新增公司成员对外接口

This commit is contained in:
weiz 2023-11-20 09:42:49 +08:00
parent e05552b206
commit 75585f8e5f
2 changed files with 55 additions and 4 deletions

View File

@ -3,9 +3,11 @@
namespace app\middleapi\controller;
use app\adminapi\logic\auth\AdminLogic;
use app\adminapi\logic\user\UserLogic;
use app\adminapi\validate\CompanyValidate;
use app\api\controller\JunziqianController;
use app\common\controller\BaseLikeAdminController;
use app\common\enum\user\UserTerminalEnum;
use app\common\logic\CompanyLogic;
use app\common\logic\contract\ContractLogic;
use app\common\logic\RedisLogic;
@ -17,6 +19,7 @@
use app\common\model\task_scheduling\TaskScheduling;
use app\common\model\user\User;
use app\common\model\CompanyDepositVoucher;
use Exception;
use think\facade\Db;
use think\facade\Log;
use think\response\Json;
@ -330,7 +333,7 @@
return $this->success('success', array_unique($data));
}
public function getDepositRechargeTransferVoucherList()
public function getDepositRechargeTransferVoucherList(): Json
{
if(!$this->request->isPost()){
return $this->fail('请求方式错误');
@ -358,7 +361,7 @@
return $this->success('请求成功',$result);
}
public function depositRechargeTransferVoucher()
public function depositRechargeTransferVoucher(): Json
{
if(!$this->request->isPost()){
return $this->fail('请求方式错误');
@ -416,7 +419,7 @@
}
public function getPartyA()
public function getPartyA(): Json
{
if(!$this->request->isPost()){
return $this->fail('请求方式错误');
@ -431,4 +434,51 @@
}
return $this->success('成功', $re);
}
//获取公司成员
public function companyUserLists(): Json
{
if(!$this->request->isPost()){
return $this->fail('请求方式错误');
}
$params = $this->request->post(['company_id','page_no','page_size']);
if(empty($params['company_id'])){
return $this->fail('参数错误');
}
$pageNo = !empty($params['page_no']) ? $params['page_no'] : 1;
$pageSize = !empty($params['page_size']) ? $params['page_size'] : 20;
$field = "id,id contract,sn,nickname,sex,avatar,account,mobile,channel,create_time,admin_id,company_id,street,street as street_name,is_contract";
$lists = User::with(['company'])
->where('company_id',$params['company_id'])
->page($pageNo, $pageSize)
->field($field)
->order('id desc')
->select()
->toArray();
foreach ($lists as &$item) {
$item['channel'] = UserTerminalEnum::getTermInalDesc($item['channel']);
}
$count = User::where('company_id',$params['company_id'])->count();
$result = [
'lists' => $lists,
'count' => $count,
'page_no' => $pageNo,
'page_size' => $pageSize
];
return $this->success('请求成功',$result);
}
//获取公司成员详情
public function companyUserDetail(): Json
{
if(!$this->request->isPost()){
return $this->fail('请求方式错误');
}
$params = $this->request->post(['user_id']);
if(empty($params['user_id'])){
return $this->fail('参数错误');
}
$detail = UserLogic::detail($params['user_id']);
return $this->success('', $detail);
}
}

View File

@ -44,7 +44,8 @@
"jpush/jpush": "^3.6",
"topthink/think-filesystem": "^2.0",
"alibabacloud/live": "^1.8",
"alibabacloud/live-20161101": "1.1.1"
"alibabacloud/live-20161101": "1.1.1",
"ext-bcmath": "*"
},
"require-dev": {
"symfony/var-dumper": "^4.2",