You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
595 B
29 lines
595 B
10 months ago
|
<?php
|
||
|
|
||
|
namespace app\api\model\user;
|
||
|
|
||
|
use app\api\service\User as UserService;
|
||
|
use cores\BaseModel;
|
||
|
|
||
|
/**
|
||
|
* 用户优惠券模型
|
||
|
* Class UserCoupon
|
||
|
* @package app\api\model\user
|
||
|
*/
|
||
|
class UserCoupon extends BaseModel
|
||
|
{
|
||
|
// 定义表名
|
||
|
protected $name = 'user_coupon';
|
||
|
|
||
|
// 定义主键
|
||
|
protected $pk = 'id';
|
||
|
|
||
|
public static function getCount(): int
|
||
|
{
|
||
|
$user_id = UserService::getCurrentLoginUserId();
|
||
|
return self::where('user_id', '=', $user_id)
|
||
|
->where('is_use', '=', 0)
|
||
|
->where('is_expire', '=', 0)
|
||
|
->count();
|
||
|
}
|
||
|
}
|