Files
hospital-applets-api/app/Model/UserPharmacist.php
T
2023-03-16 10:17:44 +08:00

67 lines
1.9 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $pharmacist_id 主键id
* @property int $user_id 用户id
* @property string $user_name 用户名称
* @property string $open_id 微信open_id
* @property string $union_id 微信开放平台唯一标识
* @property string $wx_session_key 微信会话密钥
* @property int $status 状态(0:禁用 1:正常 2:删除)
* @property int $is_online 是否在线(0:不在线 1:在线)
* @property string $avatar 头像
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
*/
class UserPharmacist extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'user_pharmacist';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['pharmacist_id', 'user_id', 'user_name', 'open_id', 'union_id', 'wx_session_key', 'status', 'is_online', 'avatar', 'created_at', 'updated_at'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['pharmacist_id' => 'integer', 'user_id' => 'integer', 'status' => 'integer', 'sex' => 'integer', 'age' => 'integer', 'is_online' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
protected string $primaryKey = "pharmacist_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 $data
* @return int
*/
public static function editUserPharmacist(array $params = [], array $data = []) : int
{
return self::where($params)->update($data);
}
}