123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php
- namespace app\common\model;
- use think\model\concern\SoftDelete;
- class UserModel extends BaseModel
- {
- // 设置表名
- protected $table = 'user';
- // 设置字段自动转换类型
- protected $type = [
- 'last_login_time' => 'timestamp:Y-m-d H:i:s',
- ];
- // 软删除
- use SoftDelete;
- protected $deleteTime = 'delete_time';
- protected $defaultSoftDelete = 0;
- // 常量
- const STATUS = [1 => '待审核', 2 => '已通过', 3 => '未通过', 4 => '禁用'];
- const GENDER = ['保密', '男', '女'];
- const STATUS_WAIT = 1;
- const STATUS_PASS = 2;
- const STATUS_FAIL = 3;
- const STATUS_DISABLE = 4;
- const GENDER_MAN = 1;
- const GENDER_WOMAN = 2;
- public function getStatusTextAttr($value, $data)
- {
- return self::STATUS[$data['status']];
- }
- public function getGenderTextAttr($value, $data)
- {
- return self::GENDER[$data['gender']];
- }
- }
|