12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- namespace app\common\model;
- use think\model\concern\SoftDelete;
- class UserModel extends BaseModel
- {
- // 设置表名
- protected $name = '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 AUTH = [1 => '待认证', 2 => '待审核', 3 => '审核拒绝', 4 => '审核通过'];
- const STATUS_WAIT = 1;
- const STATUS_PASS = 2;
- const STATUS_FAIL = 3;
- const STATUS_DISABLE = 4;
- const GENDER_MAN = 1;
- const GENDER_WOMAN = 2;
- const AUTH_UN = 1;
- const AUTH_WAIT = 2;
- const AUTH_REJECT = 3;
- const AUTH_PASS = 4;
- //允许修改
- const MOBILE_EDIT_ALLOW = ['realname', 'idcard', 'idcard_front_pic', 'idcard_back_pic', 'is_auth']; //手机端实名认证
- public function getStatusTextAttr($value, $data)
- {
- return self::STATUS[$data['status']];
- }
- public function getGenderTextAttr($value, $data)
- {
- return self::GENDER[$data['gender']];
- }
- public function getIsAuthTextAttr($value, $data)
- {
- return self::AUTH[$data['is_auth']];
- }
- }
|