You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
199 lines
3.5 KiB
199 lines
3.5 KiB
<?php
|
|
namespace app\mobilenode\controller;
|
|
use app\admin\model\User;
|
|
use app\AdminRest;
|
|
use app\mobilenode\info\PermissionMobilenode;
|
|
use app\mobilenode\model\RoleAdmin;
|
|
use think\App;
|
|
|
|
|
|
|
|
class AdminUser extends AdminRest
|
|
{
|
|
|
|
public function __construct(App $app) {
|
|
|
|
parent::__construct($app);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2022-01-04 14:41
|
|
* @功能说明:账号列表
|
|
*/
|
|
public function adminList(){
|
|
|
|
$input = $this->_param;
|
|
|
|
$admin_model = new RoleAdmin();
|
|
|
|
$dis[] = ['uniacid','=',$this->_uniacid];
|
|
|
|
$dis[] = ['status','>',-1];
|
|
|
|
if($this->_user['is_admin']==0){
|
|
|
|
$dis[] = ['admin_id','=',$this->_user['id']];
|
|
}else{
|
|
|
|
$dis[] = ['admin_id','=',0];
|
|
|
|
}
|
|
|
|
$data = $admin_model->dataList($dis,$input['limit']);
|
|
|
|
if(!empty($data['data'])){
|
|
|
|
$user_model = new \app\massage\model\User();
|
|
|
|
foreach ($data['data'] as &$v){
|
|
|
|
$v['phone'] = $user_model->where(['id'=>$v['user_id']])->value('phone');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2022-01-04 14:47
|
|
* @功能说明:添加账号
|
|
*/
|
|
public function adminAdd(){
|
|
|
|
$input = $this->_input;
|
|
|
|
$admin_model = new RoleAdmin();
|
|
|
|
$check = $admin_model->checkDatas($this->_uniacid,$input['user_id'],$this->_user);
|
|
|
|
if(!empty($check['code'])){
|
|
|
|
$this->errorMsg($check['msg']);
|
|
}
|
|
|
|
$insert = [
|
|
|
|
'uniacid' => $this->_uniacid,
|
|
|
|
'user_id' => $input['user_id'],
|
|
|
|
'node' => implode(',',$input['node'])
|
|
];
|
|
|
|
if($this->_user['is_admin']==0){
|
|
|
|
$insert['admin_id'] = $this->_user['id'];
|
|
}
|
|
|
|
$res = $admin_model->dataAdd($insert);
|
|
|
|
return $this->success($res);
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2023-04-21 14:43
|
|
* @功能说明:删除上下架
|
|
*/
|
|
public function adminStatusUpdate(){
|
|
|
|
$input = $this->_input;
|
|
|
|
$dis = [
|
|
|
|
'id' => $input['id']
|
|
];
|
|
|
|
$admin_model = new RoleAdmin();
|
|
|
|
$res = $admin_model->dataUpdate($dis,$input);
|
|
|
|
return $this->success($res);
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2022-01-04 14:47
|
|
* @功能说明:添加账号
|
|
*/
|
|
public function adminUpdate(){
|
|
|
|
$input = $this->_input;
|
|
|
|
$admin_model = new RoleAdmin();
|
|
|
|
$dis = [
|
|
|
|
'uniacid' => $this->_uniacid,
|
|
|
|
'user_id' => $input['user_id'],
|
|
];
|
|
|
|
$find = $admin_model->where($dis)->where('id','<>',$input['id'])->where('status','>',-1)->find();
|
|
|
|
if(!empty($find)){
|
|
|
|
$this->errorMsg('已经绑定过该用户');
|
|
|
|
}
|
|
|
|
$insert = [
|
|
|
|
'uniacid' => $this->_uniacid,
|
|
|
|
'user_id' => $input['user_id'],
|
|
|
|
'node' => implode(',',$input['node'])
|
|
];
|
|
|
|
$res = $admin_model->dataUpdate(['id'=>$input['id']],$insert);
|
|
|
|
return $this->success($res);
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2023-04-20 11:23
|
|
* @功能说明:详情
|
|
*/
|
|
public function adminInfo(){
|
|
|
|
$input = $this->_param;
|
|
|
|
$admin_model = new RoleAdmin();
|
|
|
|
$dis = [
|
|
|
|
'id' => $input['id']
|
|
];
|
|
|
|
$data = $admin_model->dataInfo($dis);
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|