quanwei
2025-11-28 3ea53e61cc23fdb3ddf8b38a199ca60a6da8c407
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
 
 
namespace app\common\model\user;
 
use app\common\model\BaseModel;
 
/**
 * 平台核销员模型
 */
class Clerk extends BaseModel
{
    protected $pk = 'clerk_id';
    protected $name = 'user_clerk';
 
    /**
     * 关联用户表
     */
    public function user()
    {
        return $this->BelongsTo('app\common\model\user\User', 'user_id', 'user_id');
    }
 
    /**
     * 核销员详情
     */
    public static function detail($where, $with = ['user'])
    {
        $filter = is_array($where) ? $where : ['clerk_id' => $where];
        return (new static())->with($with)->where(array_merge(['is_delete' => 0], $filter))->find();
    }
 
    /**
     * 状态
     */
    public function getStatusAttr($value)
    {
        $status = [0 => '禁用', 1 => '启用'];
        return ['text' => $status[$value], 'value' => $value];
    }
    
}