Commit d0625c27 by 杨树贤

添加用户名称返回

parent 9310d100
......@@ -37,6 +37,8 @@ class InvitesController extends Controller
if (!$invitedUserId) {
return $this->Export(self::INVALID_PARAMETER);
}
//注意invited_user_id指的是点击邀请好友链接的用户id
$map = [
'user_id' => $userId,
'invited_user_id' => $invitedUserId,
......
......@@ -4,13 +4,28 @@
namespace App\Services;
class AssistService
class AssistService extends BaseService
{
public function getAssistList($map = [])
{
$url = config('website.BaseUrl') . '/assists/list';
$result = reportCurl($url, $map, true);
$result = json_decode($result, true);
$userNames = [];
if (isset($result['data']) && $result['data']) {
//获取到被邀请人的信息
$ids = array_column($result['data'], 'assist_user_id');
$users = $this->getUsersFromRedis($ids);
foreach ($users as $user) {
$userNames[$user['user_id']] = isset($user['company_name']) ?: $user['mobile'];
}
$result['data'] = array_map(function ($value) use ($userNames) {
$value['assist_user_name'] = $userNames[$value['assist_user_id']];
return $value;
}, $result['data']);
}
return $result;
}
......
......@@ -22,7 +22,7 @@ class InviteService extends BaseService
$userNames[$user['user_id']] = isset($user['company_name']) ?: $user['mobile'];
}
$result['data'] = array_map(function ($value) use ($userNames) {
$value['invited_user_mobile'] = $userNames[$value['invited_user_id']];
$value['invited_user_name'] = $userNames[$value['invited_user_id']];
return $value;
......
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