|
@@ -45,6 +45,16 @@ class User extends Model
|
|
return isset($list['name']) ? $list['name'] : '';
|
|
return isset($list['name']) ? $list['name'] : '';
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public function getJobTextAttr($value, $data)
|
|
|
|
+ {
|
|
|
|
+ $value = $value ? $value : (isset($data['job_id']) ? $data['job_id'] : 0);
|
|
|
|
+ $list = [];
|
|
|
|
+ if (!empty($value)) {
|
|
|
|
+ $list = model('enumjob')->field('name')->find($value);
|
|
|
|
+ }
|
|
|
|
+ return isset($list['name']) ? $list['name'] : '';
|
|
|
|
+ }
|
|
|
|
+
|
|
public function getProvinceTextAttr($value, $data)
|
|
public function getProvinceTextAttr($value, $data)
|
|
{
|
|
{
|
|
$value = $value ? $value : (isset($data['province_id']) ? $data['province_id'] : 0);
|
|
$value = $value ? $value : (isset($data['province_id']) ? $data['province_id'] : 0);
|
|
@@ -115,7 +125,7 @@ class User extends Model
|
|
{
|
|
{
|
|
if (!$value) {
|
|
if (!$value) {
|
|
//如果不需要启用首字母头像,请使用
|
|
//如果不需要启用首字母头像,请使用
|
|
- $value = '/assets/img/avatar.png';
|
|
|
|
|
|
+ $value = '';
|
|
//$value = letter_avatar($data['nickname']);
|
|
//$value = letter_avatar($data['nickname']);
|
|
}
|
|
}
|
|
return $value;
|
|
return $value;
|
|
@@ -395,6 +405,7 @@ class User extends Model
|
|
$ageId = isset($userInfo['age_id']) ? $userInfo['age_id'] : 0;
|
|
$ageId = isset($userInfo['age_id']) ? $userInfo['age_id'] : 0;
|
|
$provinceId = isset($userInfo['province_id']) ? $userInfo['province_id'] : 0;
|
|
$provinceId = isset($userInfo['province_id']) ? $userInfo['province_id'] : 0;
|
|
$cityId = isset($userInfo['city_id']) ? $userInfo['city_id'] : 0;
|
|
$cityId = isset($userInfo['city_id']) ? $userInfo['city_id'] : 0;
|
|
|
|
+ $userInfo['job_text'] = $this->getJobTextAttr(false,['job_id' => $userInfo['job_id']]);
|
|
$userInfo['age_text'] = $this->getAgeTextAttr(false,['age_id' => $ageId]);
|
|
$userInfo['age_text'] = $this->getAgeTextAttr(false,['age_id' => $ageId]);
|
|
$areaWhere['id'] = ['in',[$provinceId,$cityId]];
|
|
$areaWhere['id'] = ['in',[$provinceId,$cityId]];
|
|
$areaData = Db::name('shopro_area')->where($areaWhere)->column('id,name');
|
|
$areaData = Db::name('shopro_area')->where($areaWhere)->column('id,name');
|
|
@@ -414,6 +425,10 @@ class User extends Model
|
|
{
|
|
{
|
|
return $this->hasOne('Constellation', 'id', 'constellation_id',[],'LEFT');
|
|
return $this->hasOne('Constellation', 'id', 'constellation_id',[],'LEFT');
|
|
}
|
|
}
|
|
|
|
+ public function job()
|
|
|
|
+ {
|
|
|
|
+ return $this->hasOne('EnumJob', 'id', 'job_id',[],'LEFT');
|
|
|
|
+ }
|
|
public function useralipay()
|
|
public function useralipay()
|
|
{
|
|
{
|
|
return $this->hasOne('UserAlipay', 'user_id', 'id',[],'LEFT');
|
|
return $this->hasOne('UserAlipay', 'user_id', 'id',[],'LEFT');
|