hospital-applets-api/app/Model/UserPharmacist.php
2023-02-17 17:10:16 +08:00

70 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
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 string $mobile 电话
* @property int $sex 性别0:未知 1:男 2:女)
* @property int $age 年龄
* @property string $avatar 头像
* @property int $is_online 是否在线0:不在线 1:在线)
* @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', 'mobile', 'sex', 'age', 'avatar', 'is_online', '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);
}
}