新增订阅消息队列+短信发送队列
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $template_id 主键id
|
||||
* @property int $client_type 客户端类型(1:患者端 2:医师端 3:药师端)
|
||||
* @property string $wx_template_id 微信订阅模版id
|
||||
* @property string $template_title 模版标题
|
||||
* @property int $template_type 模版类型(2:长期 3:一次性)
|
||||
* @property string $template_content 模版内容
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
*/
|
||||
class SubTemplate extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'sub_template';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['template_id', 'client_type', 'wx_template_id', 'template_title', 'template_type', 'template_content', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "template_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 SubTemplate|\Hyperf\Database\Model\Model
|
||||
*/
|
||||
public static function addSubTemplate(array $data): SubTemplate|\Hyperf\Database\Model\Model
|
||||
{
|
||||
return self::create($data);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user