| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 | <?phpnamespace app\admin\model;use support\Db;use support\Model;/** * 医疗服务-预约服务业务员模型 * Class Users * @package app\admin\model */class Notice extends Model{    const STATUS_DEL_NO = '0';    const STATUS_DEL_YES = '1';    const STATUS_DEL = [        self::STATUS_DEL_NO => '正常',        self::STATUS_DEL_YES => '删除'    ];    /**     * The table associated with the model.     *     * @var string     */    protected $table = 'medical_care_notice';    public $timestamps = false;    /**     * Notes:获取菜单列表     * @param string $keywords     * @param int $page     * @param int $limit     * @return array     * User: ZQ     * Date: 2022/9/14     */    public static function getNoticeList(int $page, int $limit, string $keywords)    {        $list = static::select('*')->where(['notice_del'=>static::STATUS_DEL_NO])            ->when($keywords != '', function ($query) use ($keywords){                $query->where('notice_name', 'like', '%' . $keywords . '%');            })            ->forPage($page,$limit)            ->orderBy('notice_sort','DESC')            ->orderBy('notice_create_time','DESC')            ->get();        $count = static::where(['notice_del'=>static::STATUS_DEL_NO])            ->when($keywords != '', function ($query) use ($keywords){                $query->where('notice_name', 'like', '%' . $keywords . '%');            })            ->count();        return [$list,$count];    }    /**     * Notes:查询指定条件下的某个字段内容     * @param int $notice_id     * @param string $field     * User: ZQ     * Date: 2022/9/27     */    public static function getValue(int $notice_id, string $field)    {        return static::where(['notice_id' => $notice_id])->value($field);    }}
 |