Browse Source

fix: 贷款列表翻页

master
liyang 3 months ago
parent
commit
818023ed2c
  1. 180
      app/admin/service/UserService.php

180
app/admin/service/UserService.php

@ -62,11 +62,11 @@ class UserService extends AdminBaseService
$where = []; $where = [];
// 角色数据权限过滤: 管理员登录可查看所有用户数据;代理登录查看代理下用户数据;客服登录查看客服关联用户的数据 // 角色数据权限过滤: 管理员登录可查看所有用户数据;代理登录查看代理下用户数据;客服登录查看客服关联用户的数据
$account = AdminModel::where(['id'=>$adminId])->find(); $account = AdminModel::where(['id' => $adminId])->find();
if (empty($account)) { if (empty($account)) {
return $this->toData('500', '当前账号数据为空'); return $this->toData('500', '当前账号数据为空');
} }
$role = AuthRoleModel::where(['id'=>$account->role_id])->find(); $role = AuthRoleModel::where(['id' => $account->role_id])->find();
if (empty($role)) { if (empty($role)) {
return $this->toData('500', '当前账号分配的角色为空'); return $this->toData('500', '当前账号分配的角色为空');
} }
@ -315,7 +315,7 @@ class UserService extends AdminBaseService
$sellerIds = array_keys($sellerList); $sellerIds = array_keys($sellerList);
} }
// 合并account账号,一次性查出account信息 // 合并account账号,一次性查出account信息
$accountIds = array_merge($customerIds,$groupLeaderIds,$sellerIds); $accountIds = array_merge($customerIds, $groupLeaderIds, $sellerIds);
$accountList = AdminModel::where('id', 'in', $accountIds)->column('user_name', 'id'); $accountList = AdminModel::where('id', 'in', $accountIds)->column('user_name', 'id');
// 查询用户充值、提款冻结状态 // 查询用户充值、提款冻结状态
@ -330,7 +330,7 @@ class UserService extends AdminBaseService
// 获取国家 // 获取国家
$countryIds = array_column($realNameTranslation, 'country'); $countryIds = array_column($realNameTranslation, 'country');
$countryArr = CountryModel::where('id', 'in', $countryIds)->column('name_cn', 'id'); $countryArr = CountryModel::where('id', 'in', $countryIds)->column('name_cn', 'id');
foreach ($realNameTranslation as $k=>$v) { foreach ($realNameTranslation as $k => $v) {
if (!empty($v['front_img'])) { if (!empty($v['front_img'])) {
$realNameTranslation[$k]['front_img'] = $imgArr[$v['front_img']] ?? ''; $realNameTranslation[$k]['front_img'] = $imgArr[$v['front_img']] ?? '';
} }
@ -379,7 +379,7 @@ class UserService extends AdminBaseService
$vipExpire = $vipInfo[$item['user_id']]['expire']; $vipExpire = $vipInfo[$item['user_id']]['expire'];
} }
// 话务数据 // 话务数据
$business = BusinessLogModel::where(['uid'=>$item['user_id']])->order('id', 'desc')->find(); $business = BusinessLogModel::where(['uid' => $item['user_id']])->order('id', 'desc')->find();
if (!empty($business)) { if (!empty($business)) {
$business = $business->toArray(); $business = $business->toArray();
} else { } else {
@ -424,7 +424,7 @@ class UserService extends AdminBaseService
'stock' => $userStockList[$item['user_id']]['usable_num'] ?? '0', 'stock' => $userStockList[$item['user_id']]['usable_num'] ?? '0',
'contract' => $userContractList[$item['user_id']]['usable_num'] ?? '0', 'contract' => $userContractList[$item['user_id']]['usable_num'] ?? '0',
'contract_sec' => $userContractSecList[$item['user_id']]['usable_num'] ?? '0', 'contract_sec' => $userContractSecList[$item['user_id']]['usable_num'] ?? '0',
'forex' => $userForexList[$item['user_id']]['usable_num'] ?? '0',//外汇 'forex' => $userForexList[$item['user_id']]['usable_num'] ?? '0', //外汇
'stock_idn' => $userStockIdrList[$item['user_id']]['usable_num'] ?? '0', // 印尼股票余额 'stock_idn' => $userStockIdrList[$item['user_id']]['usable_num'] ?? '0', // 印尼股票余额
'stock_tha' => $userStockThaList[$item['user_id']]['usable_num'] ?? '0', // 泰股资产 'stock_tha' => $userStockThaList[$item['user_id']]['usable_num'] ?? '0', // 泰股资产
'stock_mys' => $userStockMysList[$item['user_id']]['usable_num'] ?? '0', // 马股资产 'stock_mys' => $userStockMysList[$item['user_id']]['usable_num'] ?? '0', // 马股资产
@ -749,14 +749,14 @@ class UserService extends AdminBaseService
return $this->toData('0', 'SUCCESS', ['total' => 0, 'list' => []]); return $this->toData('0', 'SUCCESS', ['total' => 0, 'list' => []]);
} }
// // 查询列表数据 // // 查询列表数据
// $userList = UserModel::where('FIND_IN_SET(:id,parent_ids)', ['id' => $userId]) // $userList = UserModel::where('FIND_IN_SET(:id,parent_ids)', ['id' => $userId])
// ->order('user_id', 'desc') // ->order('user_id', 'desc')
// ->page($param['page'], $param['limit']) // ->page($param['page'], $param['limit'])
// ->select(); // ->select();
// // 查询总数 // // 查询总数
// $total = UserModel::where('FIND_IN_SET(:id,parent_ids)', ['id' => $userId]) // $total = UserModel::where('FIND_IN_SET(:id,parent_ids)', ['id' => $userId])
// ->count(); // ->count();
// 查询列表数据 // 查询列表数据
$userList = UserModel::where($whereU) $userList = UserModel::where($whereU)
@ -862,7 +862,6 @@ class UserService extends AdminBaseService
} catch (\Exception $exception) { } catch (\Exception $exception) {
return $this->toData('1', '系统异常 请稍后重试', [$exception->getMessage(), $exception->getTrace()]); return $this->toData('1', '系统异常 请稍后重试', [$exception->getMessage(), $exception->getTrace()]);
} }
} }
public function reg_email($param, $adminId) public function reg_email($param, $adminId)
@ -878,7 +877,7 @@ class UserService extends AdminBaseService
if ($emailExists) { if ($emailExists) {
return $this->toData('100300', 'The email has already been registered.', []); return $this->toData('100300', 'The email has already been registered.', []);
} }
// 获取代理id // 获取代理id
$isAgent = AdminModel::checkUserIsAgent($adminId); $isAgent = AdminModel::checkUserIsAgent($adminId);
if ($isAgent) { if ($isAgent) {
@ -904,12 +903,12 @@ class UserService extends AdminBaseService
} }
$customerId = $customer->id; $customerId = $customer->id;
// 查询客服的chat信息 // 查询客服的chat信息
$customerChatInfo = UserChatLinkModel::where(['user_id'=>$customerId, 'user_type'=>UserChatLinkModel::USER_CHAT_LINK_USER_TYPE_ADMIN])->find(); $customerChatInfo = UserChatLinkModel::where(['user_id' => $customerId, 'user_type' => UserChatLinkModel::USER_CHAT_LINK_USER_TYPE_ADMIN])->find();
if (empty($customerChatInfo)) { if (empty($customerChatInfo)) {
return $this->toData('500', '客服账号缺少chat信息'); return $this->toData('500', '客服账号缺少chat信息');
} }
// 查询代理创建的chat群聊信息 // 查询代理创建的chat群聊信息
$agentGroup = UserChatGroupModel::where(['user_id'=>$agentId,'remark'=>UserChatGroupModel::USER_CHAT_GROUP_REMARK_ADMIN_INIT])->find(); $agentGroup = UserChatGroupModel::where(['user_id' => $agentId, 'remark' => UserChatGroupModel::USER_CHAT_GROUP_REMARK_ADMIN_INIT])->find();
if (empty($agentGroup)) { if (empty($agentGroup)) {
return $this->toData('500', '当前代理还未创建chat群聊'); return $this->toData('500', '当前代理还未创建chat群聊');
} }
@ -921,7 +920,7 @@ class UserService extends AdminBaseService
$chatData = [ $chatData = [
'Username' => $userNo, 'Username' => $userNo,
'Password' => '123456', 'Password' => '123456',
'Nickname' => 'user_'.explode('@', $param['email'])[0], 'Nickname' => 'user_' . explode('@', $param['email'])[0],
'Email' => $param['email'], 'Email' => $param['email'],
]; ];
$chatUrl = env('CHAT_SERVER.BASE_URL') . '/api/user/register'; $chatUrl = env('CHAT_SERVER.BASE_URL') . '/api/user/register';
@ -953,11 +952,11 @@ class UserService extends AdminBaseService
]; ];
$chatFriendsUrl = env('CHAT_SERVER.BASE_URL') . '/api/eachOtherFriends'; $chatFriendsUrl = env('CHAT_SERVER.BASE_URL') . '/api/eachOtherFriends';
$chatFriendsRes = (new \app\utility\RequestChatServer())->ReqChatServer($chatFriendsUrl, $chatFriendsData); $chatFriendsRes = (new \app\utility\RequestChatServer())->ReqChatServer($chatFriendsUrl, $chatFriendsData);
Log::info("admin创建用户 - 用户与客服chat_id加好友结果:".json_encode($chatFriendsRes)); Log::info("admin创建用户 - 用户与客服chat_id加好友结果:" . json_encode($chatFriendsRes));
// 将当前用户加入到代理创建的群聊中 // 将当前用户加入到代理创建的群聊中
$joinChatGroupUrl = env('CHAT_SERVER.BASE_URL') . '/api/group/join/'.$chatRes['data']['uuid'].'/'.$agentGroup->group_uuid; $joinChatGroupUrl = env('CHAT_SERVER.BASE_URL') . '/api/group/join/' . $chatRes['data']['uuid'] . '/' . $agentGroup->group_uuid;
$joinChatGroupRes = (new \app\utility\RequestChatServer())->ReqChatServer($joinChatGroupUrl, []); $joinChatGroupRes = (new \app\utility\RequestChatServer())->ReqChatServer($joinChatGroupUrl, []);
Log::info("admin创建用户 - 用户的chat_id加入群聊结果:".json_encode($joinChatGroupRes)); Log::info("admin创建用户 - 用户的chat_id加入群聊结果:" . json_encode($joinChatGroupRes));
(new \app\home\service\UserService())->doRegInitUserInfo($userId, $parentUserId); (new \app\home\service\UserService())->doRegInitUserInfo($userId, $parentUserId);
return $this->toData('0', 'SUCCESS'); return $this->toData('0', 'SUCCESS');
@ -968,7 +967,6 @@ class UserService extends AdminBaseService
} catch (\Exception $exception) { } catch (\Exception $exception) {
return $this->toData('1', '系统异常 请稍后重试', [$exception->getMessage(), $exception->getTrace()]); return $this->toData('1', '系统异常 请稍后重试', [$exception->getMessage(), $exception->getTrace()]);
} }
} }
// 实名认证操作 // 实名认证操作
@ -985,16 +983,15 @@ class UserService extends AdminBaseService
return $this->toData('0', 'success', []); return $this->toData('0', 'success', []);
} }
// $front = FileModel::where('id', $log->front_img)->value('path'); // $front = FileModel::where('id', $log->front_img)->value('path');
// $back = FileModel::where('id', $log->back_img)->value('path'); // $back = FileModel::where('id', $log->back_img)->value('path');
if ($log->front_img) { if ($log->front_img) {
$front = AwsS3Model::where('id', $log->front_img)->value('s3_url'); $front = AwsS3Model::where('id', $log->front_img)->value('s3_url');
} }
// if ($log->back_img) { // if ($log->back_img) {
// $back = AwsS3Model::where('id', $log->back_img)->value('s3_url'); // $back = AwsS3Model::where('id', $log->back_img)->value('s3_url');
// } // }
$country = CountryModel::where('id', $log->country)->find(); $country = CountryModel::where('id', $log->country)->find();
@ -1079,7 +1076,7 @@ class UserService extends AdminBaseService
} }
} }
public function getUserLoan($param,$adminId) public function getUserLoan($param, $adminId)
{ {
try { try {
$where = []; $where = [];
@ -1096,30 +1093,30 @@ class UserService extends AdminBaseService
// 判断是否是代理 如果是代理 只能看他自己管理的用户 // 判断是否是代理 如果是代理 只能看他自己管理的用户
$where = $this->getWhereByIsAgentAndUserId($adminId, $where, $userId); $where = $this->getWhereByIsAgentAndUserId($adminId, $where, $userId);
if(isset($param['status'])){ if (isset($param['status'])) {
$where['status']=intval($param['status']); $where['status'] = intval($param['status']);
} }
$data['where']=$where; $data['where'] = $where;
$data['page']=isset($param['page']) ? intval($param['page']) : 1; $data['page'] = isset($param['page']) ? intval($param['page']) : 1;
$data['size']=isset($param['size']) ? intval($param['size']) : 10; $data['size'] = isset($param['limit']) ? intval($param['limit']) : 10;
$list = UserLoanModel::getUserLoanList($data); $list = UserLoanModel::getUserLoanList($data);
if(!empty($list['list'])){ if (!empty($list['list'])) {
foreach ($list['list'] as $key=>$item){ foreach ($list['list'] as $key => $item) {
$user= UserModel::where('user_id', $item['user_id'])->find(); $user = UserModel::where('user_id', $item['user_id'])->find();
$list['list'][$key]['nick_name']=$user->nick_name; $list['list'][$key]['nick_name'] = $user->nick_name;
} }
} }
return $this->toData('0', 'SUCCESS', $list); return $this->toData('0', 'SUCCESS', $list);
} catch (\Exception $exception) { } catch (\Exception $exception) {
return $this->toData('1', '系统繁忙', [$exception->getMessage(),$exception->getTrace()]); return $this->toData('1', '系统繁忙', [$exception->getMessage(), $exception->getTrace()]);
} }
} }
public function dealUserLoan($param,$adminId) public function dealUserLoan($param, $adminId)
{ {
try { try {
$where = []; $where = [];
@ -1136,19 +1133,19 @@ class UserService extends AdminBaseService
// 判断是否是代理 如果是代理 只能看他自己管理的用户 // 判断是否是代理 如果是代理 只能看他自己管理的用户
$where = $this->getWhereByIsAgentAndUserId($adminId, $where, $userId); $where = $this->getWhereByIsAgentAndUserId($adminId, $where, $userId);
$where['id']=intval($param['id']); $where['id'] = intval($param['id']);
$info=UserLoanModel::where($where)->find(); $info = UserLoanModel::where($where)->find();
if(empty($info)){ if (empty($info)) {
return $this->toData('1', '数据不存在'); return $this->toData('1', '数据不存在');
} }
if($info['status']!=0){ if ($info['status'] != 0) {
return $this->toData('1', '数据已审核'); return $this->toData('1', '数据已审核');
} }
UserLoanModel::where($where)->update([ UserLoanModel::where($where)->update([
'status'=>intval($param['status']), 'status' => intval($param['status']),
'update_time'=>date('Y-m-d H:i:s') 'update_time' => date('Y-m-d H:i:s')
]); ]);
return $this->toData('0', 'SUCCESS', []); return $this->toData('0', 'SUCCESS', []);
@ -1178,9 +1175,9 @@ class UserService extends AdminBaseService
switch ($param['code_type']) { switch ($param['code_type']) {
case 6: case 6:
if ($param['business'] == 1) { if ($param['business'] == 1) {
$key = 'USER:sendEmailLoginNoTrade:'.$param['search']; $key = 'USER:sendEmailLoginNoTrade:' . $param['search'];
} elseif ($param['business'] == 3) { } elseif ($param['business'] == 3) {
$key = 'USER:sendEmailLoginTrade:'.$param['search']; $key = 'USER:sendEmailLoginTrade:' . $param['search'];
} }
break; break;
case 9: case 9:
@ -1196,23 +1193,23 @@ class UserService extends AdminBaseService
$getCode = Cache::store('redis')->get($key); $getCode = Cache::store('redis')->get($key);
return $this->toData('0', 'success', ['extend' => $extend, 'get_code' => 1, 'code' => $getCode]); return $this->toData('0', 'success', ['extend' => $extend, 'get_code' => 1, 'code' => $getCode]);
// //
// $key_12 = "DB:USER:UNLOGIN:SMS_CODE:" . $param['search']; // $key_12 = "DB:USER:UNLOGIN:SMS_CODE:" . $param['search'];
// $key_9 = "DB:USER:UNLOGIN:EMAIL_CODE:" . $param['search']; // $key_9 = "DB:USER:UNLOGIN:EMAIL_CODE:" . $param['search'];
// $key_7 = "USER:sendEmailLoginNoTrade:" . $param['search']; // $key_7 = "USER:sendEmailLoginNoTrade:" . $param['search'];
// $key_10 = "USER:sendSmsLoginNoTrade:" . $param['search']; // $key_10 = "USER:sendSmsLoginNoTrade:" . $param['search'];
// //
// $key = "key_" . ($param['business'] + $param['code_type']); // $key = "key_" . ($param['business'] + $param['code_type']);
// if (!isset($$key)) { // if (!isset($$key)) {
// return $this->toData('0', 'success', ['extend' => $extend, 'get_code' => 0, 'code' => '']); // return $this->toData('0', 'success', ['extend' => $extend, 'get_code' => 0, 'code' => '']);
// } // }
// //
// $redis = $this->getRedis(); // $redis = $this->getRedis();
// $code = $redis->get($$key); // $code = $redis->get($$key);
// if ($code) { // if ($code) {
// return $this->toData('0', 'success', ['extend' => $extend, 'get_code' => 1, 'code' => $code]); // return $this->toData('0', 'success', ['extend' => $extend, 'get_code' => 1, 'code' => $code]);
// } // }
// return $this->toData('0', 'success', ['extend' => $extend, 'get_code' => 0, 'code' => '']); // return $this->toData('0', 'success', ['extend' => $extend, 'get_code' => 0, 'code' => '']);
} catch (\Exception $exception) { } catch (\Exception $exception) {
return $this->toData('1', '系统异常 请稍后重试', [$exception->getMessage(), $exception->getTrace()]); return $this->toData('1', '系统异常 请稍后重试', [$exception->getMessage(), $exception->getTrace()]);
} }
@ -1242,7 +1239,7 @@ class UserService extends AdminBaseService
if (empty($userId) || !is_numeric($userId)) { if (empty($userId) || !is_numeric($userId)) {
return $this->toData('400', 'Param error user_id', [$userId]); return $this->toData('400', 'Param error user_id', [$userId]);
} }
$list = UserBankModel::where(['user_id'=>$param['user_id']])->select()->toArray(); $list = UserBankModel::where(['user_id' => $param['user_id']])->select()->toArray();
return $this->toData('0', 'success', $list); return $this->toData('0', 'success', $list);
} catch (\Exception $e) { } catch (\Exception $e) {
return $this->toData('1', '系统异常 请稍后重试', [$e->getMessage(), $e->getTrace()]); return $this->toData('1', '系统异常 请稍后重试', [$e->getMessage(), $e->getTrace()]);
@ -1312,11 +1309,11 @@ class UserService extends AdminBaseService
} }
$updateArr = []; $updateArr = [];
// $bool = 0; // $bool = 0;
if (!empty($param['login_password'])) $updateArr['login_password'] = (new UnqId())->encryptPassword($param['login_password'], $user->salt); if (!empty($param['login_password'])) $updateArr['login_password'] = (new UnqId())->encryptPassword($param['login_password'], $user->salt);
if (!empty($param['trade_password'])) $updateArr['trade_password'] = (new UnqId())->encryptPassword($param['trade_password'], $user->salt); if (!empty($param['trade_password'])) $updateArr['trade_password'] = (new UnqId())->encryptPassword($param['trade_password'], $user->salt);
if (!empty($updateArr)) UserModel::where('user_id', $param['id'])->update($updateArr); if (!empty($updateArr)) UserModel::where('user_id', $param['id'])->update($updateArr);
// if (empty($bool)) return $this->toData('1', '系统异常 请稍后重试', []); // if (empty($bool)) return $this->toData('1', '系统异常 请稍后重试', []);
return $this->toData('0', 'SUCCESS', []); return $this->toData('0', 'SUCCESS', []);
} catch (\Exception $exception) { } catch (\Exception $exception) {
return $this->toData('1', '系统异常 请稍后重试', [$exception->getMessage(), $exception->getTrace()]); return $this->toData('1', '系统异常 请稍后重试', [$exception->getMessage(), $exception->getTrace()]);
@ -1395,7 +1392,7 @@ class UserService extends AdminBaseService
if (empty($param['user_id']) || !is_numeric($param['user_id']) || empty($param['remark'])) { if (empty($param['user_id']) || !is_numeric($param['user_id']) || empty($param['remark'])) {
return $this->toData('400', 'Missing parameter user_id'); return $this->toData('400', 'Missing parameter user_id');
} }
$user = UserModel::where(['user_id'=>$param['user_id']])->find(); $user = UserModel::where(['user_id' => $param['user_id']])->find();
if (empty($user)) { if (empty($user)) {
return $this->toData('500', '操作的用户数据错误'); return $this->toData('500', '操作的用户数据错误');
} }
@ -1414,7 +1411,7 @@ class UserService extends AdminBaseService
if (empty($param['user_id']) || !is_numeric($param['user_id']) || empty($param['label'])) { if (empty($param['user_id']) || !is_numeric($param['user_id']) || empty($param['label'])) {
return $this->toData('400', 'Missing parameter user_id'); return $this->toData('400', 'Missing parameter user_id');
} }
$user = UserModel::where(['user_id'=>$param['user_id']])->find(); $user = UserModel::where(['user_id' => $param['user_id']])->find();
if (empty($user)) { if (empty($user)) {
return $this->toData('500', '操作的用户数据错误'); return $this->toData('500', '操作的用户数据错误');
} }
@ -1422,7 +1419,7 @@ class UserService extends AdminBaseService
$user->save(); $user->save();
// 同步更新chat服务 // 同步更新chat服务
$userChatInfo = UserChatLinkModel::where(['user_id'=>$user->user_id, 'user_type'=>UserChatLinkModel::USER_CHAT_LINK_USER_TYPE_PC])->find(); $userChatInfo = UserChatLinkModel::where(['user_id' => $user->user_id, 'user_type' => UserChatLinkModel::USER_CHAT_LINK_USER_TYPE_PC])->find();
if (empty($userChatInfo)) { if (empty($userChatInfo)) {
return $this->toData('500', '该用户的聊天信息错误'); return $this->toData('500', '该用户的聊天信息错误');
} }
@ -1433,7 +1430,7 @@ class UserService extends AdminBaseService
$chatFriendsUrl = env('CHAT_SERVER.BASE_URL') . '/api/user'; $chatFriendsUrl = env('CHAT_SERVER.BASE_URL') . '/api/user';
$chatFriendsRes = (new \app\utility\RequestChatServer())->ReqChatServer($chatFriendsUrl, $upChaData, 'PUT'); $chatFriendsRes = (new \app\utility\RequestChatServer())->ReqChatServer($chatFriendsUrl, $upChaData, 'PUT');
if (!isset($chatFriendsRes['code']) || !$chatFriendsRes['code'] == 0) { if (!isset($chatFriendsRes['code']) || !$chatFriendsRes['code'] == 0) {
return $this->toData('500', 'chat服务错误:'.$chatFriendsRes['msg']); return $this->toData('500', 'chat服务错误:' . $chatFriendsRes['msg']);
} }
return $this->toData('0', 'SUCCESS'); return $this->toData('0', 'SUCCESS');
} catch (\Exception $exception) { } catch (\Exception $exception) {
@ -1447,7 +1444,7 @@ class UserService extends AdminBaseService
if (empty($param['user_id']) || !is_numeric($param['user_id']) || empty($param['base_label'])) { if (empty($param['user_id']) || !is_numeric($param['user_id']) || empty($param['base_label'])) {
return $this->toData('400', 'Missing parameter user_id'); return $this->toData('400', 'Missing parameter user_id');
} }
$user = UserModel::where(['user_id'=>$param['user_id']])->find(); $user = UserModel::where(['user_id' => $param['user_id']])->find();
if (empty($user)) { if (empty($user)) {
return $this->toData('500', '操作的用户数据错误'); return $this->toData('500', '操作的用户数据错误');
} }
@ -1478,10 +1475,10 @@ class UserService extends AdminBaseService
$accountFrozen = AccountFrozenModel::where('user_id', $userId)->find(); $accountFrozen = AccountFrozenModel::where('user_id', $userId)->find();
if (empty($accountFrozen)) { if (empty($accountFrozen)) {
if (isset($param['frozen_recharge'])) { if (isset($param['frozen_recharge'])) {
AccountFrozenModel::create(['user_id'=>$userId, 'frozen_recharge' => $param['frozen_recharge']]); AccountFrozenModel::create(['user_id' => $userId, 'frozen_recharge' => $param['frozen_recharge']]);
} }
if (isset($param['frozen_withdraw'])) { if (isset($param['frozen_withdraw'])) {
AccountFrozenModel::create(['user_id'=>$userId, 'frozen_withdraw' => $param['frozen_withdraw']]); AccountFrozenModel::create(['user_id' => $userId, 'frozen_withdraw' => $param['frozen_withdraw']]);
} }
} else { } else {
if (isset($param['frozen_recharge'])) { if (isset($param['frozen_recharge'])) {
@ -1513,7 +1510,7 @@ class UserService extends AdminBaseService
return $this->toData('1', '用户不存在'); return $this->toData('1', '用户不存在');
} }
// 检测用户阶段数据 // 检测用户阶段数据
$userStageState = UserStageStateModel::where(['user_id'=>$user['user_id']])->find(); $userStageState = UserStageStateModel::where(['user_id' => $user['user_id']])->find();
if (empty($userStageState)) { if (empty($userStageState)) {
UserStageStateModel::create([ UserStageStateModel::create([
'user_id' => $user['user_id'], 'user_id' => $user['user_id'],
@ -1525,14 +1522,14 @@ class UserService extends AdminBaseService
'third_stage_state' => $param['third_stage_state'] ?? 0, 'third_stage_state' => $param['third_stage_state'] ?? 0,
]); ]);
} else { } else {
if (isset($param['first_stage'])) { if (isset($param['first_stage'])) {
$userStageState->first_stage = $param['first_stage']; $userStageState->first_stage = $param['first_stage'];
$userStageState->first_stage_state = $param['first_stage_state'] ?? 0; $userStageState->first_stage_state = $param['first_stage_state'] ?? 0;
} }
if (isset($param['second_stage'])) { if (isset($param['second_stage'])) {
$userStageState->second_stage = $param['second_stage']; $userStageState->second_stage = $param['second_stage'];
$userStageState->second_stage_state = $param['second_stage_state'] ?? 0; $userStageState->second_stage_state = $param['second_stage_state'] ?? 0;
} }
if (isset($param['third_stage'])) { if (isset($param['third_stage'])) {
$userStageState->third_stage = $param['third_stage']; $userStageState->third_stage = $param['third_stage'];
$userStageState->third_stage_state = $param['third_stage_state'] ?? 0; $userStageState->third_stage_state = $param['third_stage_state'] ?? 0;
@ -1607,7 +1604,7 @@ class UserService extends AdminBaseService
if (empty($param['business_id']) || empty($param['reply_content'])) { if (empty($param['business_id']) || empty($param['reply_content'])) {
return $this->toData('400', '参错错误'); return $this->toData('400', '参错错误');
} }
$info = BusinessLogModel::where(['id'=>$param['business_id']])->find(); $info = BusinessLogModel::where(['id' => $param['business_id']])->find();
if (empty($info)) { if (empty($info)) {
return $this->toData('500', '数据不存在'); return $this->toData('500', '数据不存在');
} }
@ -1639,11 +1636,11 @@ class UserService extends AdminBaseService
return $this->toData('400', '缺少uid'); return $this->toData('400', '缺少uid');
} }
// 获取用户信息 // 获取用户信息
$userInfo = UserModel::where(['user_id'=>$param['user_id']])->find(); $userInfo = UserModel::where(['user_id' => $param['user_id']])->find();
if (empty($userInfo)) { if (empty($userInfo)) {
return $this->toData('500', '用户信息错误'); return $this->toData('500', '用户信息错误');
} }
$where = ['uid'=>$param['user_id']]; $where = ['uid' => $param['user_id']];
if (!empty($param['is_reply']) && $param['is_reply'] < 2) { if (!empty($param['is_reply']) && $param['is_reply'] < 2) {
$where['is_reply'] = $param['is_reply']; // 根据回复状态过滤:0-未回复的; 1-已经回复的; 2-全部 $where['is_reply'] = $param['is_reply']; // 根据回复状态过滤:0-未回复的; 1-已经回复的; 2-全部
} }
@ -1686,10 +1683,10 @@ class UserService extends AdminBaseService
if (!empty($list->items())) { if (!empty($list->items())) {
foreach ($list->items() as $v) { foreach ($list->items() as $v) {
$tmp = $v; $tmp = $v;
$userInfo = UserModel::where(['user_id'=>$v['user_id']])->find(); $userInfo = UserModel::where(['user_id' => $v['user_id']])->find();
if (!empty($userInfo)) { if (!empty($userInfo)) {
$tmp['user_info'] = $userInfo->toArray(); $tmp['user_info'] = $userInfo->toArray();
} else{ } else {
$tmp['user_info'] = []; $tmp['user_info'] = [];
} }
$data[] = $tmp; $data[] = $tmp;
@ -1706,7 +1703,4 @@ class UserService extends AdminBaseService
return $this->toData('500', '系统异常 请稍后重试', [$e->getMessage(), $e->getTrace()]); return $this->toData('500', '系统异常 请稍后重试', [$e->getMessage(), $e->getTrace()]);
} }
} }
} }

Loading…
Cancel
Save