16
This commit is contained in:
@@ -66,7 +66,6 @@ class FilesController extends Crud
|
||||
$data = $this->base($request, $savePath);
|
||||
}catch(\Exception $e){
|
||||
return $this->fail( $e->getMessage());
|
||||
log_alert($e->getMessage());
|
||||
}
|
||||
return $this->success( '上传成功', $data);
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace plugin\admin\app\controller;
|
||||
|
||||
use app\model\User;
|
||||
use plugin\admin\app\controller\Crud;
|
||||
use support\exception\BusinessException;
|
||||
use support\Request;
|
||||
use support\Response;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* OpenimBase
|
||||
*/
|
||||
class OpenimBase extends Crud
|
||||
{
|
||||
|
||||
/**
|
||||
* @var \support\OpenImSdk\Client
|
||||
*/
|
||||
protected $sdk = null;
|
||||
protected function getSdk(){
|
||||
if($this->sdk){
|
||||
return $this->sdk;
|
||||
}
|
||||
$this->sdk = new \support\OpenImSdk\Client([
|
||||
'host' => 'http://127.0.0.1:10002', // OpenIM API地址
|
||||
'secret' => 'n1e5a6s6m7', // OpenIM密钥
|
||||
]);
|
||||
return $this->sdk;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -58,10 +58,8 @@ class QuestionnaireController extends Crud
|
||||
if($showField && input($showField)){
|
||||
$query = $query->whereLike($showField,'%'.input($showField).'%');
|
||||
}
|
||||
//log_alert($ids,'cansnow');
|
||||
$query = $query->whereNotIn('id',$ids);
|
||||
$list = $query->field([$showField,$keyField])->paginate($limit);
|
||||
//log_alert($query->getLastSql(),'cansnow');
|
||||
|
||||
return $this->success('ok',$list);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ class TeamController extends Crud
|
||||
public function select(Request $request): Response
|
||||
{
|
||||
[$where, $format, $limit, $field, $order] = $this->selectInput($request);
|
||||
//log_alert($where);
|
||||
$user_id = 0;
|
||||
if($where['user_id']['value1']){
|
||||
$user_id = $where['user_id']['value1'];
|
||||
|
||||
Reference in New Issue
Block a user