coupon-admin/app/model/CouponType.php

42 lines
939 B
PHP

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