85 lines
2.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\Database\Model\Collection;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $popup_id 主键id
* @property int $user_id 用户id
* @property int $app_type 应用程序类型1:小程序 2:app
* @property int $client_type 客户端类型1:患者端 2:医生端 3:药师端)
* @property int $status 状态0:未弹 1:已弹)
* @property int $popup_type 弹窗类型1:结算费用)
* @property string $popup_title 标题
* @property string $popup_content 内容
* @property string $popup_img 封面图片
* @property string $popup_link 跳转地址
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
*/
class Popup extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'popup';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['popup_id', 'user_id', 'app_type', 'client_type', 'status', 'popup_type', 'popup_title', 'popup_content', 'popup_img', 'popup_link', 'created_at', 'updated_at'];
protected string $primaryKey = "popup_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 Collection|array
*/
public static function getList(array $params = [], array $fields = ['*']): Collection|array
{
return self::where($params)->get($fields);
}
/**
* 新增
* @param array $data
* @return \Hyperf\Database\Model\Model|Popup
*/
public static function addPopup(array $data): \Hyperf\Database\Model\Model|Popup
{
return self::create($data);
}
/**
* 修改
* @param array $params
* @param array $data
* @return int
*/
public static function edit(array $params = [], array $data = []): int
{
return self::where($params)->update($data);
}
}