فهرست منبع

Merge branch 'dev_wf' of wugg/phpstock into version1.5

wufeng 2 سال پیش
والد
کامیت
8644a129d0
3فایلهای تغییر یافته به همراه66 افزوده شده و 2 حذف شده
  1. 1 1
      app/admin/controller/Resign.php
  2. 6 1
      app/admin/model/ProcessWait.php
  3. 59 0
      app/command/UpdateYzHistoryData.php

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

@@ -204,7 +204,7 @@ class Resign extends Base
         ];
         $in = Db::name("purchease")->insert($info,true);
         if($in>0){
-            $order=["order_type"=>'BHD',"order_code"=>$bk_code,"order_id"=>$in,"order_status"=>1,"before_status"=>1, 'holder_id' => $info['apply_id']];
+            $order=["order_type"=>'BHD',"order_code"=>$bk_code,"order_id"=>$in,"order_status"=>1,"before_status"=>1, 'holder_id' => $info['cgderid']];
             ProcessOrder::AddProcess($token,$order);
             $ste = ["order_code"=>$bk_code,"status"=>0,"action_remark"=>'',"action_type"=>"create"];
             ActionLog::logAdd($token,$ste,"BHD",1,$info);

+ 6 - 1
app/admin/model/ProcessWait.php

@@ -35,10 +35,15 @@ class ProcessWait extends Model
 //            "addtime"=>'',
 //        ];
 
+        //修改各个节点的最终节点
+        Db::name('process_wait')
+            ->where(['order_type' => $data['order_type'], 'order_code' => $data['order_code'], 'order_id' => $data['order_id']])
+            ->update(['order_process_finally' => $data['action_process']]);
+
         //把上一个节点改成已完成
         Db::name('process_wait')
             ->where(['order_type' => $data['order_type'], 'order_process' => $data['action_status'], 'order_code' => $data['order_code'], 'order_id' => $data['order_id'], 'status' => self::$status_wait])
-            ->update(['status' => self::$status_finish, 'order_process_finally' => $data['action_process'], 'updatetime' => date('Y-m-d H:i:s')]);
+            ->update(['status' => self::$status_finish, 'updatetime' => date('Y-m-d H:i:s')]);
 
         //查询流程下该节点值的id
         $info = Db::name('process')

+ 59 - 0
app/command/UpdateYzHistoryData.php

@@ -0,0 +1,59 @@
+<?php
+declare (strict_types=1);
+
+namespace app\command;
+
+use think\console\Command;
+use think\console\Input;
+use think\console\input\Argument;
+use think\console\input\Option;
+use think\console\Output;
+use think\Exception;
+use think\facade\Db;
+
+class UpdateYzHistoryData extends Command
+{
+    protected function configure()
+    {
+        // 指令配置
+        $this->setName('UpdateYzHistoryData')
+            ->setDescription('更新有赞的历史数据');
+    }
+
+    protected function execute(Input $input, Output $output)
+    {
+
+        $data = Db::name('order_out')
+            ->alias('a')
+            ->field('a.orderCode,a.outCode,a.post_name,a.post_code')
+            ->leftJoin('sale b', 'b.orderCode=a.orderCode')
+            ->where('a.addtime', '>=', date('Y-m-d H:i:s', time() - 72 * 3600))
+            ->where([
+                'a.is_del' => 0,
+                'a.status' => 2,
+                'b.order_source' => 5
+            ])
+            ->limit(1)->select()->toArray();
+//            ->cursor();
+
+        $url = config('app.yz_domain') . 'api/yz_out_send';
+
+        foreach ($data as $value) {
+            $res = curl_request($url, [
+                'orderCode' => $value['orderCode'],
+                'out_stype' => $value['post_name'],
+                'post_code' => $value['post_code'],
+                'uid' => 96,
+                'uname' => '武锋(历史数据处理)',
+                'order_out' => $value['outCode'],
+            ]);
+
+            $res = json_decode($res, true);
+            if ($res['code'] != 0) $output->writeln('handle fail,' . json_encode($value, JSON_UNESCAPED_UNICODE) . ':' . $res['message']);
+        }
+
+
+    }
+
+
+}