Browse Source

Merge branch 'master-new-dev-wf' of wugg/phpstock into master-new

wufeng 2 năm trước cách đây
mục cha
commit
b4c489c5e1

+ 1 - 1
app/admin/controller/Base.php

@@ -43,7 +43,7 @@ class Base extends \app\BaseController
         }
         }
         $this->uid=$effetc['data']['id']??"";
         $this->uid=$effetc['data']['id']??"";
         $this->uname=$effetc['data']['nickname']??"";
         $this->uname=$effetc['data']['nickname']??"";
-        $this->level=$effetc['data']['level'];
+        request()->level = $this->level = $effetc['data']['level'];//request()->level主要是为了部分未继承Base控制器的方法使用,例如Model/ProcessOrder::adddProcess
         $where=[];
         $where=[];
         if($companyNo!=""){
         if($companyNo!=""){
             $where=["companyNo"=>$companyNo];
             $where=["companyNo"=>$companyNo];

+ 9 - 3
app/admin/controller/Process.php

@@ -63,7 +63,10 @@ class Process extends Base
     {
     {
         $param = $this->request->filter('trim')->only(['type', 'orderCode'], 'post');
         $param = $this->request->filter('trim')->only(['type', 'orderCode'], 'post');
 
 
-        $val = Validate::rule([]);
+        $val = Validate::rule([
+            'type'=>'require',
+            'orderCode'=>'require',
+        ]);
         if (!$val->check($param)) return error_show(1004, $val->getError());
         if (!$val->check($param)) return error_show(1004, $val->getError());
 //        $process_type = isset($this->post['type']) && $this->post['type'] != "" ? $this->post['type'] : "";
 //        $process_type = isset($this->post['type']) && $this->post['type'] != "" ? $this->post['type'] : "";
 //        if ($process_type == "") {
 //        if ($process_type == "") {
@@ -86,7 +89,7 @@ class Process extends Base
             ->leftJoin('action_process b', 'b.order_type=a.order_type AND b.order_process=a.action_process')
             ->leftJoin('action_process b', 'b.order_type=a.order_type AND b.order_process=a.action_process')
             ->where(["a.order_type" => $param['type']])
             ->where(["a.order_type" => $param['type']])
             ->order('a.id', 'asc')
             ->order('a.id', 'asc')
-            ->field('a.id,a.action_uid,a.action_name,a.addtime,a.action_process,a.order_type,a.source,a.action_process,b.status_name');
+            ->field('a.id,a.action_uid,a.action_name,a.addtime,a.action_process,a.order_type,a.source,a.level,a.action_process,b.status_name');
         if (is_numeric($param['orderCode'])) $rs->where('a.order_id', $param['orderCode']);
         if (is_numeric($param['orderCode'])) $rs->where('a.order_id', $param['orderCode']);
         else $rs->where('a.order_code', $param['orderCode']);
         else $rs->where('a.order_code', $param['orderCode']);
 
 
@@ -95,7 +98,9 @@ class Process extends Base
             ->toArray();
             ->toArray();
 
 
         $i = 0;
         $i = 0;
-        $data = [['status_name' => '创建', 'order_process' => -1]];
+        if($param['type']=='FHGD') $data = [['status_name' => '创建-待发货', 'order_process' => -1]];//针对发货工单流程特殊处理
+        else $data = [['status_name' => '创建', 'order_process' => -1]];
+
         foreach ($node as $value) {
         foreach ($node as $value) {
 
 
             $data[$i] = array_merge($data[$i], [
             $data[$i] = array_merge($data[$i], [
@@ -103,6 +108,7 @@ class Process extends Base
                 'action_name' => $value['action_name'],
                 'action_name' => $value['action_name'],
                 'addtime' => $value['addtime'],
                 'addtime' => $value['addtime'],
                 'source' => $value['source'],
                 'source' => $value['source'],
+                'level' => $value['level'],
             ]);
             ]);
 
 
             $data[$i + 1] = [
             $data[$i + 1] = [

+ 3 - 0
app/admin/model/ProcessOrder.php

@@ -49,6 +49,9 @@ class ProcessOrder extends \think\Model
         //如果是【供应商】应用,即abutment,增加字段source==2(操作来源为供应商)
         //如果是【供应商】应用,即abutment,增加字段source==2(操作来源为供应商)
         if (strtolower(app('http')->getName()) == 'abutment') $insert['source'] = 2;
         if (strtolower(app('http')->getName()) == 'abutment') $insert['source'] = 2;
 
 
+        //区分操作账号等级
+        $insert['level'] = request()->level;
+
         if (self::insert($insert)) {
         if (self::insert($insert)) {
             Workflow::SaveFlow($data);
             Workflow::SaveFlow($data);
         };
         };

+ 3 - 3
app/youzan/logic/Goodup.php

@@ -505,7 +505,7 @@ class Goodup
         $data = Db::name('platform_youzan')
         $data = Db::name('platform_youzan')
             ->where('id', $param['platform_youzan_id'])
             ->where('id', $param['platform_youzan_id'])
             ->whereOr('skuCode', $param['skuCode'])
             ->whereOr('skuCode', $param['skuCode'])
-            ->find();
+            ->findOrEmpty();
 
 
         if (empty($data)) return error_show(1005, '查询不到该记录');
         if (empty($data)) return error_show(1005, '查询不到该记录');
 
 
@@ -513,8 +513,8 @@ class Goodup
         $good_data = Db::name("good_basic")
         $good_data = Db::name("good_basic")
             ->withoutField('createrid,creater,is_del,addtime,updatetime')
             ->withoutField('createrid,creater,is_del,addtime,updatetime')
             ->where(["is_del" => 0, "spuCode" => $data['spuCode']])
             ->where(["is_del" => 0, "spuCode" => $data['spuCode']])
-            ->find();
-        if ($good_data == false) return error_show(1004, "未找到商品数据");
+            ->findOrEmpty();
+        if (empty($good_data)) return error_show(1004, "未找到商品数据");
 
 
         $data = array_merge($data, $good_data);
         $data = array_merge($data, $good_data);