add 后台创建账户新增押金,押金缴纳日期,管理户数字段。前台获取用户信息,返回新增的三个字段

This commit is contained in:
chenbo 2023-12-29 17:43:07 +08:00
parent 1b4822e8c7
commit 9360e66dc2
2 changed files with 16 additions and 8 deletions

View File

@ -132,12 +132,12 @@ class UserLogic extends BaseLogic
self::setError('手机号已被注册');
return false;
}
$count = User::where('company_id', $params['company_id'])->count();
$value = DictData::where('id', 28)->value('value');
if ($count >= $value) {
self::setError('你创建的账号已达上限');
return false;
}
// $count = User::where('company_id', $params['company_id'])->count();
// $value = DictData::where('id', 28)->value('value');
// if ($count >= $value) {
// self::setError('你创建的账号已达上限');
// return false;
// }
$group_id = $params['group_id'];
// 每个公司市场部长只有1个
if($group_id == 16) {
@ -186,6 +186,9 @@ class UserLogic extends BaseLogic
'qualification' => json_encode($params['qualification']),
'company_id' => $params['company_id'],
'group_id' => $group_id,
'deposit' => $params['deposit'],
'deposit_date' => strtotime($params['deposit_date']),
'user_information_count' => $params['user_information_count'],
]);
return true;
}

View File

@ -21,6 +21,7 @@ use app\common\{enum\notice\NoticeEnum,
model\Company,
model\user\User,
model\user\UserAuth,
model\user\UserRole,
model\user\Withdraw,
service\ConfigService,
service\sms\SmsDriver,
@ -76,8 +77,12 @@ class UserLogic extends BaseLogic
*/
public static function info(int $userId)
{
$user = User::where(['id' => $userId])->with(['company'])
->field('id,sn,sex,is_new_user,account,nickname,real_name,avatar,mobile,create_time,user_money,deposit,income,admin_id,company_id,is_captain,province,province province_name,city,city city_name,area,area area_name,street,street street_name,village,village village_name,brigade,brigade brigade_name, group_id')
$user = User::where(['id' => $userId])->with(['company'])->append(['user_role_name'])
->withAttr('user_role_name', function ($value, $data) {
$userRole = UserRole::where(['id' => $data['group_id']])->find();
return $userRole ? $userRole['name'] : '普通用户';
})
->field('id,sn,sex,is_new_user,account,nickname,real_name,avatar,mobile,create_time,user_money,deposit,income,admin_id,company_id,is_captain,province,province province_name,city,city city_name,area,area area_name,street,street street_name,village,village village_name,brigade,brigade brigade_name, group_id, deposit, deposit_date, user_information_count')
->findOrEmpty();
// $user['avatar'] = $user['avatar'] ? Request()->host() . $user['avatar'] : $user['avatar'];
$user['day_money_count']=UserAccountLog::where(['user_id'=>$userId,'action'=>1])->whereDay('create_time')->sum('change_amount');