123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- <?php
- namespace app\common\model;
- use think\Model;
- use think\model\concern\SoftDelete;
- class User extends Model
- {
- use SoftDelete;
- protected $deleteTime = 'deletetime';
- protected $defaultSoftDelete = 0;
- // 设置字段信息
- protected $schema = [
- 'id' => 'int',
- 'groupsid' => 'int',
- 'brokerid' => 'int',
- 'nickname' => 'string',
- 'avatar' => 'string',
- 'realname' => 'string',
- 'mobile' => 'string',
- 'integral' => 'int',
- 'inttotal' => 'int',
- 'status' => 'tinyint',
- 'isvip' => 'tinyint',
- 'authstatus' => 'int',
- 'authremark' => 'string',
- 'idcardzpic' => 'string',
- 'idcardfpic' => 'string',
- 'idcard' => 'string',
- 'gender' => 'tinyint',
- 'birthday' => 'string',
- 'address' => 'string',
- 'education' => 'string',
- 'createtime' => 'int',
- 'jobintention' => 'string',
- 'workexperience' => 'string',
- 'eduexperience' => 'string',
- 'followstatus' => 'tinyint',
- 'wxampcode' => 'string',
- 'bankcard' => 'string',
- 'emp_time' => 'string',
- 'com_cate' => 'string',
- 'is_public' => 'int',
- 'volume' => 'int',
- 'deletetime' => 'int',
- 'third_id' => 'int',
- ];
- // 设置字段自动转换类型
- protected $type = [
- 'bankcard' => 'json',
- 'createtime' => 'timestamp:Y-m-d H:i:s',
- 'emp_time' => 'json',
- 'com_cate' => 'json',
- ];
- protected $jsonAssoc = true;
- public function getStatusTextAttr($value, $data)
- {
- $status = [1 => '待审核', 2 => '已通过', 3 => '未通过'];
- return $status[$data['status']];
- }
- public function getIsvipTextAttr($value, $data)
- {
- $isvip = [1 => '否', 2 => '是'];
- return $isvip[$data['isvip']];
- }
- public function getAuthstatusTextAttr($value, $data)
- {
- $authstatus = [1 => '待认证', 2 => '待审核', 3 => '已认证'];
- return $authstatus[$data['authstatus']];
- }
- public function getFollowstatusTextAttr($value, $data)
- {
- $followstatus = [1 => '未跟进', 2 => '未面试', 3 => '面试通过', 4 => '面试未通过', 5 => '用户放弃', 6 => '已入职', 7 => '已离职'];
- return $followstatus[$data['followstatus']];
- }
- public function getEducationTextAttr($value, $data)
- {
- $education = ['' => '', 1 => '初中', 2 => '高中', 3 => '中技', 4 => '中专', 5 => '大专', 6 => '本科', 7 => '硕士', 8 => '博士'];
- return $education[$data['education']];
- }
- public function getWorkerTextAttr($value, $data)
- {
- $experience = ['' => '', 1 => '无经验', 2 => '一年以下', 3 => '1-3年', 4 => '3-5年', 5 => '5-10年', 6 => '10年以上'];
- return $experience[$data['workexperience']];
- }
- public function getJobintentionTextAttr($value, $data)
- {
- $title = '';
- if ($data['jobintention']) {
- $title = UserWill::where('id', $data['jobintention'])->value('title');
- }
- return $title;
- }
- // 关联UserGroups
- public function userGroups()
- {
- return $this->hasOne(UserGroups::class, "id", "groupsid");
- }
- // 关联Broker
- public function broker()
- {
- return $this->hasOne(Broker::class, "id", "brokerid");
- }
- // 关联UserPart
- public function userPart()
- {
- return $this->hasMany(UserPart::class, "puserid", "id");
- }
- // 关联UserAuths
- public function userAuths()
- {
- return $this->hasMany(UserAuths::class, "userid", "id");
- }
- // 关联UserFollow
- public function userFollow()
- {
- return $this->hasMany(UserFollow::class, "userid", "id")->order('id', 'desc');
- }
- }
|