2023-02-17 17:10:16 +08:00

78 lines
3.2 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
declare(strict_types=1);
namespace App\Model;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $coupon_id 主键id
* @property string $coupon_name 优惠卷名称
* @property string $coupon_icon 优惠卷图片
* @property int $coupon_client 使用平台1:小程序)
* @property int $coupon_type 优惠卷类型1:无门槛 2:满减)
* @property int $coupon_status 状态1:正常 2:强制失效 3:结束)
* @property int $distribution_object 发放对象1:新注册用户 2:会员 3:近期消费 4:近期购药)
* @property int $application_scope 适用范围1:全部 2:快速问诊 3:专家问诊 4:公益问诊 5:问诊购药)
* @property int $is_display 是否展示0:否 1:是)
* @property int $distribution_with_day 发放关联时间(发放对象为近期消费等类型时规定天数)
* @property int $coupon_count 发放数量
* @property int $coupon_take_count 领取数量
* @property int $coupon_ used_count 使用数量
* @property string $coupon_price 优惠卷金额
* @property string $with_amount 符合满减标准金额(优惠卷类型为满减时使用)
* @property int $valid_type 有效类型1:绝对时效xxx-xxx时间段有效 2:相对时效 n天内有效
* @property int $valid_days 自领取之日起有效天数
* @property string $valid_start_time 开始使用时间
* @property string $valid_end_time 结束使用时间
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
*/
class Coupon extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'coupon';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['coupon_id', 'coupon_name', 'coupon_icon', 'coupon_client', 'coupon_type', 'coupon_status', 'distribution_object', 'application_scope', 'is_display', 'distribution_with_day', 'coupon_count', 'coupon_take_count', 'coupon_ used_count', 'coupon_price', 'with_amount', 'valid_type', 'valid_days', 'valid_start_time', 'valid_end_time', 'created_at', 'updated_at'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['coupon_id' => 'integer', 'coupon_client' => 'integer', 'coupon_type' => 'integer', 'coupon_status' => 'integer', 'distribution_object' => 'integer', 'application_scope' => 'integer', 'is_display' => 'integer', 'distribution_with_day' => 'integer', 'coupon_count' => 'integer', 'coupon_take_count' => 'integer', 'coupon_ used_count' => 'integer', 'valid_type' => 'integer', 'valid_days' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
protected string $primaryKey = "coupon_id";
/**
* 获取-单条
* @param array $params
* @param array $fields
* @return object|null
*/
public static function getOne(array $params, array $fields = ['*']): object|null
{
return self::where($params)->first($fields);
}
/**
* 获取信息-多条
* @param array $params
* @param array $fields
* @return object|null
*/
public static function getList(array $params, array $fields = ['*']): object|null
{
return self::where($params)->get($fields);
}
}