add getAreaManager method
This commit is contained in:
parent
97fb87d461
commit
5f6318bfa9
@ -4,7 +4,6 @@ namespace app\common\controller;
|
|||||||
|
|
||||||
use alioss\alioss;
|
use alioss\alioss;
|
||||||
use app\common\model\auth\Admin;
|
use app\common\model\auth\Admin;
|
||||||
use app\common\model\auth\AdminRole;
|
|
||||||
use app\common\model\Company;
|
use app\common\model\Company;
|
||||||
use app\common\model\im\UserImMessage;
|
use app\common\model\im\UserImMessage;
|
||||||
use app\common\model\user\User;
|
use app\common\model\user\User;
|
||||||
@ -115,7 +114,7 @@ class ImController extends BaseLikeAdminController
|
|||||||
'to_user_id' => $params['to_user_id'],
|
'to_user_id' => $params['to_user_id'],
|
||||||
'content' => $params['content'],
|
'content' => $params['content'],
|
||||||
'type' => $params['type'],
|
'type' => $params['type'],
|
||||||
'is_read' => 0,
|
'is_read' => 1,
|
||||||
'is_undo' => 0,
|
'is_undo' => 0,
|
||||||
'is_delete' => 0,
|
'is_delete' => 0,
|
||||||
'create_time' => time(),
|
'create_time' => time(),
|
||||||
@ -209,7 +208,7 @@ class ImController extends BaseLikeAdminController
|
|||||||
'to_user_id' => $params['to_user_id'],
|
'to_user_id' => $params['to_user_id'],
|
||||||
'content' => $result['data'],
|
'content' => $result['data'],
|
||||||
'type' => $params['type'],
|
'type' => $params['type'],
|
||||||
'is_read' => 0,
|
'is_read' => 1,
|
||||||
'is_undo' => 0,
|
'is_undo' => 0,
|
||||||
'is_delete' => 0,
|
'is_delete' => 0,
|
||||||
'create_time' => time(),
|
'create_time' => time(),
|
||||||
@ -336,4 +335,32 @@ class ImController extends BaseLikeAdminController
|
|||||||
//返回数据
|
//返回数据
|
||||||
return $this->success('请求成功',$users);
|
return $this->success('请求成功',$users);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getAreaManager(): Json
|
||||||
|
{
|
||||||
|
//验证请求方式
|
||||||
|
if(!$this->request->isPost()){
|
||||||
|
return $this->fail('请求方式错误');
|
||||||
|
}
|
||||||
|
//获取请求参数
|
||||||
|
$params = $this->request->post(['user_id']);
|
||||||
|
if(empty($params['user_id'])){
|
||||||
|
return $this->fail('参数错误');
|
||||||
|
}
|
||||||
|
//获取其用户的公司id
|
||||||
|
$userInfo = User::field('id,company_id')->where('id',$params['user_id'])->findOrEmpty();
|
||||||
|
if(empty($userInfo)){
|
||||||
|
return $this->fail('未获取到用户信息');
|
||||||
|
}
|
||||||
|
//获取公司信息
|
||||||
|
$companyInfo = Company::field('area_manager')->where('id',$userInfo['company_id'])->findOrEmpty();
|
||||||
|
if(empty($companyInfo)){
|
||||||
|
return $this->fail('用户信息错误');
|
||||||
|
}
|
||||||
|
if($params['user_id'] == $companyInfo['area_manager']){
|
||||||
|
return $this->fail('用户身份错误错误');
|
||||||
|
}
|
||||||
|
//返回
|
||||||
|
return $this->success('请求成功',['to_user_id'=>$companyInfo['area_manager']]);
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user