From b430a4c162dbe4dfa67af02194f349fd06ac56b7 Mon Sep 17 00:00:00 2001 From: monanxiao Date: Thu, 23 Mar 2023 11:09:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E6=94=BE=E5=AD=97=E6=AE=B5=E9=AA=8C?= =?UTF-8?q?=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/SupplyAccount.php | 9 ++++- app/admin/controller/SupplyBrokerage.php | 30 ++++++++++++++- app/api/controller/Maintainentry.php | 10 ++--- app/api/controller/Userinfo.php | 16 +++++--- app/api/validate/UserInfo.php | 49 ++++++++++++++++++++++++ 5 files changed, 102 insertions(+), 12 deletions(-) create mode 100644 app/api/validate/UserInfo.php diff --git a/app/admin/controller/SupplyAccount.php b/app/admin/controller/SupplyAccount.php index 19fccc0..dfed6cc 100644 --- a/app/admin/controller/SupplyAccount.php +++ b/app/admin/controller/SupplyAccount.php @@ -23,7 +23,9 @@ class SupplyAccount extends BaseController * 构造函数 */ public function __construct() - { + { + $this->adminInfo = get_login_admin(); + $this->model = new SupplyAccountModel(); $this->uid = get_login_admin('id'); } @@ -37,6 +39,11 @@ class SupplyAccount extends BaseController $where = []; $rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit']; + if($this->adminInfo['group_access'] != 1){ //不是超级管理员 + + $where['fa_supply_team_id'] = $this->uid; + } + $list = SupplyAccountModel::with('team')->where($where) ->paginate($rows, false, ['query' => $param]); diff --git a/app/admin/controller/SupplyBrokerage.php b/app/admin/controller/SupplyBrokerage.php index 2a06f5d..52ce92e 100644 --- a/app/admin/controller/SupplyBrokerage.php +++ b/app/admin/controller/SupplyBrokerage.php @@ -24,6 +24,7 @@ class SupplyBrokerage extends BaseController */ public function __construct() { + $this->adminInfo = get_login_admin(); $this->model = new SupplyBrokerageModel(); $this->uid = get_login_admin('id'); } @@ -36,8 +37,35 @@ class SupplyBrokerage extends BaseController $param = get_params(); $where = []; - $list = $this->model->with(['merchant', 'supplyChain', 'level'])->order('id desc')->select(); // 只读取来源为供应链小组的订单 + if($this->adminInfo['group_access'] != 1){ // 不是超级管理员 + + $www['admin_id'] = $this->adminInfo['id']; + $user_address = Db::table('fa_szxc_information_useraddress') + ->where($www) + ->find(); + + if ($user_address){ + if($user_address['auth_range'] == 1){ + $where['village'] = $user_address['village_id']; + }elseif ($user_address['auth_range'] == 2){ + $where['township'] = $user_address['street_id']; + }elseif ($user_address['auth_range'] == 3){ + $where['county'] = $user_address['area_id']; + }else{ + $where['village'] = $user_address['village_id']; + } + + }else{ + $where['village'] = ''; + } + } + + $list = $this->model->with(['merchant', 'supplyChain', 'level']) + ->order('id desc') + ->select(); // 只读取来源为供应链小组的订单 + $total = $this->model->count(); + foreach ($list as $k =>$v){ // $list[$k]['fa_supply_chain_id'] = Db::table('fa_supply_team')->where('id',$v['fa_supply_chain_id'])->value('name'); diff --git a/app/api/controller/Maintainentry.php b/app/api/controller/Maintainentry.php index 85ac33d..92eb7a2 100644 --- a/app/api/controller/Maintainentry.php +++ b/app/api/controller/Maintainentry.php @@ -1483,11 +1483,11 @@ class Maintainentry extends BaseController public function userEntry() { $post = get_params(); -// try { -// validate('Maintainentry.myadd')->check($post); -// } catch (\Exception $e) { -// $this->apiError($e->getMessage()); -// } + try { + validate('Maintainentry.myadd')->check($post); + } catch (\Exception $e) { + $this->apiError($e->getMessage()); + } if ($post) { //// 验证验证码 diff --git a/app/api/controller/Userinfo.php b/app/api/controller/Userinfo.php index fd3b122..6fcab0a 100644 --- a/app/api/controller/Userinfo.php +++ b/app/api/controller/Userinfo.php @@ -95,11 +95,17 @@ class Userinfo extends BaseController public function Binding() { $post = get_params(); - if(!$post['idcard'] || !$post['area_id'] || !$post['street_id'] || !$post['village_id'] || !$post['name']){ - $this->apiError('缺少参数'); - } - if($post['phone'] == 'undefined'){ - $this->apiError('手机号错误'); + // if(!$post['idcard'] || !$post['area_id'] || !$post['street_id'] || !$post['village_id'] || !$post['name']){ + // $this->apiError('缺少参数'); + // } + // if($post['phone'] == 'undefined'){ + // $this->apiError('手机号错误'); + // } + + try { + validate('UserInfo.myadd')->check($post); + } catch (\Exception $e) { + $this->apiError($e->getMessage()); } // $where['id'] = $this->request->uid; // 废弃 diff --git a/app/api/validate/UserInfo.php b/app/api/validate/UserInfo.php new file mode 100644 index 0000000..da088fe --- /dev/null +++ b/app/api/validate/UserInfo.php @@ -0,0 +1,49 @@ + 'require', + 'idcard' => 'require|idCard', + 'area_id' => 'require', + 'street_id' => 'require', + 'village_id' => 'require', + ]; + + /** + * 提示消息. + */ + protected $message = [ + 'name' => '请输入姓名', + 'idcard' => '请输入身份证号', + 'idcard.idCard' => '身份证号不正确', + 'area_id' => '请选择村组信息', + 'street_id' => '请选择村组信息', + 'village_id' => '请选择村组信息', + ]; + + /** + * 字段描述. + */ + protected $field = [ + ]; + + /** + * 验证场景. + */ + protected $scene = [ + 'add' => ['name', 'area_id', 'idcard', 'street_id', 'village_id'], + ]; + + public function __construct() + { + parent::__construct(); + } +}