فهرست منبع

发货时重新获取角色id

wufeng 2 سال پیش
والد
کامیت
ddf653f991
1فایلهای تغییر یافته به همراه4 افزوده شده و 2 حذف شده
  1. 4 2
      app/admin/controller/Sale.php

+ 4 - 2
app/admin/controller/Sale.php

@@ -3834,7 +3834,8 @@ class Sale extends Base
 
             if ($einfo['is_stock'] == 1) {
                 //如果是库存品,只能由库管和库管-张凯旋操作
-                if (!in_array($user_info['data']['roleid'], config('app.wsm_cgder_role'))) throw new \think\Exception('库存品只能由库管人员操作');
+                $own_roleid = Db::name('user_role')->where(['is_del'=>0,'uid'=>$uid,'status'=>1])->value('roleid',0);
+                if (!in_array($own_roleid, config('app.wsm_cgder_role'))) throw new \think\Exception('库存品只能由库管人员操作');
             } elseif ($einfo['is_stock'] == 1 || $einfo['order_type'] == 3) {
                 //非库存品和采返商品只能由供应商负责人操作
                 $personid = Db::name('supplier')
@@ -4558,6 +4559,7 @@ class Sale extends Base
         $user = GetUserInfo($param['token']);
         $createrid = $user['data']['id']??0;//$this->uid;
         $creater = $user['data']['nickname']??0;//$this->uname;
+        $own_roleid = Db::name('user_role')->where(['is_del'=>0,'uid'=>$createrid,'status'=>1])->value('roleid',0);
 
         //所有发货单信息
         $order_out_infos = Db::name("order_out")
@@ -4590,7 +4592,7 @@ class Sale extends Base
                 } else $temp_out_codes[$value['outCode']] = $value['outCode'];
 
                 if ($sale_infos[$order_out_infos[$value['outCode']]]['is_stock'] == 1) {
-                    if (!in_array($user['data']['roleid'], config('app.wsm_cgder_role'))) {
+                    if (!in_array($own_roleid, config('app.wsm_cgder_role'))) {
                         Db::rollback();
                         return app_show(1003, $value['outCode'] . '发货单只能由库管操作');
                     }