coupon-admin/app/model/CouponType.php

42 lines
939 B
PHP
Raw Normal View History

2021-11-18 09:57:04 +00:00
<?php
namespace app\model;
2022-01-14 10:21:18 +00:00
use app\repository\CouponRepository;
2021-11-18 09:57:04 +00:00
use think\Collection;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
/**
2022-03-31 06:42:56 +00:00
* 签到券类型
2021-11-18 09:57:04 +00:00
* Class CouponType
* @package app\model
*/
class CouponType extends Base
{
2022-01-14 10:21:18 +00:00
/**
* 获取全部列表
*
* @return Collection
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public static function getList()
{
return self::field('id,name')->order('id', 'desc')->select();
}
2021-11-18 09:57:04 +00:00
2022-01-14 10:21:18 +00:00
/**
* 检查类型
* */
public static function checkType($valueData){
$type = CouponRepository::getInstance()->getCouponTypeAll();
$type = array_column($type->toArray(), null, "id");
if (!isset($type[$valueData])) {
return false;
}
return true;
}
2021-11-18 09:57:04 +00:00
}