16
This commit is contained in:
@@ -12,27 +12,48 @@ use Throwable;
|
||||
/**
|
||||
* 用户宣传
|
||||
*/
|
||||
class FriendController extends Crud
|
||||
class FriendController extends OpenimBase
|
||||
{
|
||||
|
||||
/**
|
||||
* @var \app\model\UserXuanchuan
|
||||
*/
|
||||
protected $model = null;
|
||||
protected $relationSearch = ['user'];
|
||||
protected $relationSearch = [];
|
||||
/**
|
||||
* 构造函数
|
||||
* @return void
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
$this->model = new \app\model\UserXuanchuan();
|
||||
$this->model = new User();
|
||||
$statusList = $this->model->getStatusList();
|
||||
$this->assign("statusList", $statusList);
|
||||
$this->assignconfig("statusList", $statusList);
|
||||
$typeList = $this->model->getTypeList();
|
||||
$this->assign("typeList", $typeList);
|
||||
$this->assignconfig("typeList", $typeList);
|
||||
}
|
||||
|
||||
function select(Request $request): Response
|
||||
{
|
||||
$res = $this->getSdk()->friend->getFriendList(Input('userID'), 1, 5000);
|
||||
|
||||
$userIDs = [];
|
||||
foreach ($res['friendsInfo'] as $key => $value) {
|
||||
$userIDs[] = $value['friendUser']['userID'];
|
||||
}
|
||||
//$_users = \app\model\User::whereIn('userID', $userIDs)->column('*','userID');
|
||||
|
||||
|
||||
[$where, $format, $limit, $field, $order] = $this->selectInput($request);
|
||||
$where['userId'] = ['symbol'=>'in', 'value1'=>$userIDs];
|
||||
$query = $this->doSelect($where, $field, $order);
|
||||
return $this->doFormat($query, $format, $limit);
|
||||
|
||||
$list = [];
|
||||
foreach ($res['friendsInfo'] as $key => $value) {
|
||||
$item = array_merge($value['friendUser'], $_users[$value['friendUser']['userID']] ?? [],$value['friendUser']);
|
||||
unset($item['friendUser']);
|
||||
$list[] =$item;
|
||||
}
|
||||
return json([
|
||||
"code" => 0,
|
||||
"count" => $res['total'],
|
||||
"data" => $list,
|
||||
"msg" => "ok"
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user