91 lines
2.1 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\model\activity\lottery;
use crmeb\basic\BaseModel;
use crmeb\traits\ModelTrait;
use think\Model;
/**
*
* Class LuckPrizeDao
* @package app\model\activity\lottery
*/
class LuckPrize extends BaseModel
{
use ModelTrait;
/**
* 数据表主键
* @var string
*/
protected $pk = 'id';
/**
* 模型名称
* @var string
*/
protected $name = 'luck_prize';
/**
* 关联抽奖
* @return \think\model\relation\HasOne
*/
public function lottery()
{
return $this->hasOne(LuckLottery::class, 'id', 'lottery_id');
}
/**
* 抽奖id搜索器
* @param $query Model
* @param $value
*/
public function searchLotteryIdAttr($query, $value)
{
if ($value) $query->where('lottery_id', $value);
}
/**
* 奖品类型搜索器
* @param $query Model
* @param $value
*/
public function searchTypeAttr($query, $value)
{
if ($value) $query->where('type', $value);
}
/**
* 状态搜索器
* @param $query Model
* @param $value
*/
public function searchStatusAttr($query, $value)
{
if ($value !== '') $query->where('status', $value);
}
/**
* 是否删除搜索器
* @param $query Model
* @param $value
*/
public function searchIsDelAttr($query, $value)
{
if ($value !== '') $query->where('is_del', $value);
}
}