Commit cd830dc7 by 杨树贤

fix åbug

parent 8e9fbb00
Showing with 9 additions and 6 deletions
......@@ -13,22 +13,25 @@ class InviteService extends BaseService
$result = json_decode($result, true);
//需要处理一下数据,因为要获得被邀请人的名称(即是公司名称),如果没有名称,那就显示手机号码
$userNames = [];
$userNames = $mobiles = [];
if (isset($result['data']) && $result['data']) {
//获取到被邀请人的信息
$ids = array_column($result['data'], 'invited_user_id');
$users = $this->getUsersFromRedis($ids);
foreach ($users as $user) {
$userNames[$user['user_id']] = isset($user['company_name']) ?: $user['mobile'];
$mobiles[$user['user_id']] = $user['mobile'];
if (isset($user['user_id'])) {
$userNames[$user['user_id']] = isset($user['company_name'])&&!empty($user['company_name']) ?
$user['company_name'] : $user['mobile'];
$mobiles[$user['user_id']] = $user['mobile'];
}
}
$result['data'] = array_map(function ($value) use ($userNames,$mobiles) {
$value['invited_user_name'] = $userNames[$value['invited_user_id']];
$value['invited_user_mobile'] = $mobiles[$value['invited_user_id']];
$value['invited_user_name'] = array_get($userNames,$value['invited_user_id']);
$value['invited_user_mobile'] = array_get($mobiles,$value['invited_user_id']);
$value['add_time'] = date('Y-m-d H:i');
return $value;
}, $result['data']);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment