Merge branch 'yaooo' into dev

This commit is contained in:
yaooo 2023-11-16 10:01:31 +08:00
commit d6284a9f79
5 changed files with 13 additions and 13 deletions

View File

@ -13,14 +13,14 @@ class UserLists extends BaseAdminDataLists implements ListsSearchInterface
{ {
return [ return [
'=' => ['status','province','city','area','street','village','brigade'], '=' => ['status','province','city','area','street','village','brigade'],
'%like%' => ['nick_name','real_name','phone'], '%like%' => ['nickname','realname','phone'],
]; ];
} }
// 获取用户列表 // 获取用户列表
public function lists(): array public function lists(): array
{ {
$field = "id,phone,avatar,nick_name,real_name,id_card,gender,age,total_balance,total_integral,province,city,area,street,village,brigade,address,status,create_time"; $field = "id,phone,avatar,nickname,realname,id_card,gender,age,total_balance,total_integral,province,city,area,street,village,brigade,address,status,create_time";
return User::field($field)->where('status','<>',2)->where($this->searchWhere) return User::field($field)->where('status','<>',2)->where($this->searchWhere)
->limit($this->limitOffset, $this->limitLength)->order('id desc') ->limit($this->limitOffset, $this->limitLength)->order('id desc')
->select()->each(function($item){ ->select()->each(function($item){

View File

@ -14,7 +14,7 @@ class UserLogic extends BaseLogic
public static function detail(int $userId): array public static function detail(int $userId): array
{ {
//获取用户信息 //获取用户信息
$field = ['id','phone','avatar','nick_name','real_name','id_card','gender','age','total_balance','total_integral','province','city','area','street','village','brigade','address','status','last_login_time','last_login_ip','create_time']; $field = ['id','phone','avatar','nickname','realname','id_card','gender','age','total_balance','total_integral','province','city','area','street','village','brigade','address','status','last_login_time','last_login_ip','create_time'];
$user = User::field($field)->where(['id' => $userId])->findOrEmpty(); $user = User::field($field)->where(['id' => $userId])->findOrEmpty();
$user['address'] = $user->province_text.$user->city_text.$user->area_text.$user->street_text.$user->village_text.$user->brigade_text.$user->address; $user['address'] = $user->province_text.$user->city_text.$user->area_text.$user->street_text.$user->village_text.$user->brigade_text.$user->address;
$user['gender_text'] = $user->gender_text; $user['gender_text'] = $user->gender_text;

View File

@ -33,12 +33,12 @@ class LoginLogic extends BaseLogic
$user = User::create([ $user = User::create([
'admin_id' => 0, 'admin_id' => 0,
'phone' => $params['phone'], 'phone' => $params['phone'],
'nick_name' => '用户'.$params['phone'], 'nickname' => '用户'.$params['phone'],
'password' => $userPassword, 'password' => $userPassword,
'avatar' => empty($params['avatar']) ? $avatar : $params['avatar'], 'avatar' => empty($params['avatar']) ? $avatar : $params['avatar'],
'age' => empty($params['age']) ? 0 : $params['age'], 'age' => empty($params['age']) ? 0 : $params['age'],
'gender' => empty($params['gender']) ? 0 : $params['gender'], 'gender' => empty($params['gender']) ? 0 : $params['gender'],
'real_name' => empty($params['real_name']) ? '' : $params['real_name'], 'realname' => empty($params['realname']) ? '' : $params['realname'],
'id_card' => empty($params['id_card']) ? '' : $params['id_card'], 'id_card' => empty($params['id_card']) ? '' : $params['id_card'],
'province' => empty($params['province']) ? 0 : $params['province'], 'province' => empty($params['province']) ? 0 : $params['province'],
'city' => empty($params['city']) ? 0 : $params['city'], 'city' => empty($params['city']) ? 0 : $params['city'],
@ -93,7 +93,7 @@ class LoginLogic extends BaseLogic
{ {
try { try {
$where = ['phone' => $params['account']]; $where = ['phone' => $params['account']];
$user = User::field(['id', 'phone', 'avatar', 'nick_name'])->where($where)->findOrEmpty(); $user = User::field(['id', 'phone', 'avatar', 'nickname'])->where($where)->findOrEmpty();
//更新登录信息 //更新登录信息
$user->last_login_time = time(); $user->last_login_time = time();
$user->last_login_ip = request()->ip(); $user->last_login_ip = request()->ip();

View File

@ -24,7 +24,7 @@ class RegisterValidate extends BaseValidate
'password' => 'require|length:6,20', 'password' => 'require|length:6,20',
'age' => 'number|gt:0', 'age' => 'number|gt:0',
'gender' => 'in:0,1,2', 'gender' => 'in:0,1,2',
'real_name' => 'chs|length:2,25', 'realname' => 'chs|length:2,25',
'id_card' => 'idCard', 'id_card' => 'idCard',
'province' => 'number', 'province' => 'number',
'city' => 'number', 'city' => 'number',
@ -44,8 +44,8 @@ class RegisterValidate extends BaseValidate
'age.number' => '年龄必须是数字', 'age.number' => '年龄必须是数字',
'age.gt' => '年龄必须大于0', 'age.gt' => '年龄必须大于0',
'gender.in' => '用户性别值错误', 'gender.in' => '用户性别值错误',
'real_name.chs' => '真实姓名必须是汉字', 'realname.chs' => '真实姓名必须是汉字',
'real_name.length' => '真实姓名长度必须大于2个汉字且不得超过25个汉字', 'realname.length' => '真实姓名长度必须大于2个汉字且不得超过25个汉字',
'id_card.idCard' => '身份证号码不正确', 'id_card.idCard' => '身份证号码不正确',
'province.number' => '省份编码值错误', 'province.number' => '省份编码值错误',
'city.number' => '城市编码值错误', 'city.number' => '城市编码值错误',

View File

@ -14,7 +14,7 @@ class UserValidate extends BaseValidate
'code' => 'require', 'code' => 'require',
'age' => 'number|gt:0', 'age' => 'number|gt:0',
'gender' => 'in:0,1,2', 'gender' => 'in:0,1,2',
'real_name' => 'chs|length:2,25', 'realname' => 'chs|length:2,25',
'id_card' => 'idCard', 'id_card' => 'idCard',
'province' => 'number', 'province' => 'number',
'city' => 'number', 'city' => 'number',
@ -33,8 +33,8 @@ class UserValidate extends BaseValidate
'age.number' => '年龄必须是数字', 'age.number' => '年龄必须是数字',
'age.gt' => '年龄必须大于0', 'age.gt' => '年龄必须大于0',
'gender.in' => '用户性别值错误', 'gender.in' => '用户性别值错误',
'real_name.chs' => '真实姓名必须是汉字', 'realname.chs' => '真实姓名必须是汉字',
'real_name.length' => '真实姓名长度必须大于2个汉字且不得超过25个汉字', 'realname.length' => '真实姓名长度必须大于2个汉字且不得超过25个汉字',
'id_card.idCard' => '身份证号码不正确', 'id_card.idCard' => '身份证号码不正确',
'province.number' => '省份编码值错误', 'province.number' => '省份编码值错误',
'city.number' => '城市编码值错误', 'city.number' => '城市编码值错误',
@ -56,6 +56,6 @@ class UserValidate extends BaseValidate
public function sceneEdit(): UserValidate public function sceneEdit(): UserValidate
{ {
return $this->only(['age','gender','real_name','id_card','province','city','area','street','village','brigade','address']); return $this->only(['age','gender','realname','id_card','province','city','area','street','village','brigade','address']);
} }
} }