Przeglądaj źródła

Merge branch 'raccount' of 39.97.239.116:gyfl/xyzshop into raccount

stanley-king 2 lat temu
rodzic
commit
27776724f6

+ 3 - 0
core/framework/core/base.php

@@ -283,6 +283,9 @@ final class Base
 				throw new Exception("Class Error: {$class}.isn't exists!");
 			}
 		}
+        elseif (substr($class, 0, 9) == 'phpexcel_') {
+
+        }
 		elseif (!@include_once(BASE_CORE_PATH.'/framework/libraries/'.$class.'.php'))
         {
             throw new Exception("Class Error: {$class} isn't exists!");

+ 2 - 2
docker/compose/homecuda/admin/docker-compose.yml

@@ -2,13 +2,13 @@ version: "3.7"
 
 services:
   mchsrv:
-    image: php-zts:7.3.18
+    image: php-zts-debug:7.3.18
     ports:
       - "9102:9102"
     volumes:
       - ../../../../:/var/www/html
       - ../conf/etc/localtime:/etc/localtime:ro
-      - ../conf/php/php.ini:/usr/local/etc/php/php.ini
+      - ../conf/php/php-debug.ini:/usr/local/etc/php/php.ini
       - ../conf/php/mch-spwan-start:/usr/local/bin/docker-spwan-start
       - /data/shop_share/upload:/var/www/html/data/upload
       - /mnt/shoplog:/var/www/html/data/log

+ 2 - 2
helper/task/manager.php

@@ -13,7 +13,7 @@ class manager
         $this->mHandler = new handler();
     }
 
-    public function add_task($method,$params,$is_show = 1,$del_timeout = -1,$title='')
+    public function add_task($method, $params, $is_show = 1, $del_timeout = -1, $title = '', $mchid = 0)
     {
         if(empty($method) || empty($params)) {
             return false;
@@ -46,7 +46,7 @@ class manager
         {
             $item = ['type' => $method, 'title' => $title,
                      'params' => serialize($params), 'task_hash' => $task_hash,
-                     'add_time' => time(), 'is_show' => $is_show];
+                     'add_time' => time(), 'is_show' => $is_show, 'mchid' => $mchid];
             $task_id = $mod_task->insert($item);
             $item = $mod_task->where(['task_id' => $task_id])->master(true)->find();
         }

+ 106 - 2
mchsrv/control/merchant_order.php

@@ -1,5 +1,9 @@
 <?php
+
+use task\manager;
+
 require_once(BASE_ROOT_PATH . '/mobile/control/merchantweb.php');
+require_once(BASE_HELPER_PATH . '/task/task_helper.php');
 
 class merchant_orderControl extends mbMerchantControl
 {
@@ -76,7 +80,7 @@ class merchant_orderControl extends mbMerchantControl
         }
 
         $fields = 'refill_order.*,vr_order.order_state';
-        $order_list = $model_vr_order->getMerchantOrderList($cond, $this->page, 0, $fields, 'refill_order.order_time desc');
+        $order_list = $model_vr_order->getMerchantOrderList($cond, $this->page, 5000, $fields, 'refill_order.order_time desc');
         $order_list = $this->merchant_order_format($order_list);
         $result['data'] = $order_list;
         $result['total'] = $model_vr_order->gettotalpage();
@@ -413,4 +417,104 @@ class merchant_orderControl extends mbMerchantControl
 
         return ['title' => $title , 'data' => $datas];
     }
-}
+
+    private function checkSend($start, $end)
+    {
+        $order_state_send = ORDER_STATE_SEND;
+        $order_state_queue = ORDER_STATE_QUEUE;
+        $cond['order_state'] = ['in',"{$order_state_send},{$order_state_queue}"];
+        $cond['order_time'] = [['egt', $start], ['lt', $end], 'and'];
+        return Model('refill_detail')->where($cond)->select();
+    }
+
+    private function is_timestamp($timestamp) {
+        $timestamp = intval($timestamp);
+        if(strtotime(date('Y-m-d H:i:s',$timestamp)) === $timestamp) {
+            return $timestamp;
+        } else return false;
+    }
+
+    public function create_taskOp()
+    {
+        if(empty($_GET['time_type']) || empty($_GET['start_time']) || empty($_GET['end_time'])) {
+            return self::outerr(errcode::ErrInputParam, "参数错误.");
+        }
+        if(!$this->is_timestamp($_GET['start_time']) || !$this->is_timestamp($_GET['end_time'])) {
+            return self::outerr(errcode::ErrInputParam, "时间戳类型错误.");
+        }
+
+
+        $task_title_create = function ($start, $end, $time_type){
+            $start = date('Y-m-d H:i:s', $start);
+            $end = date('Y-m-d H:i:s', $end);
+            if ($time_type === 'order_time') {
+                $task_title = "订单导出: 下单时间 {$start} - {$end}";
+            } else {
+                $task_title = "订单导出: 回调时间 {$start} - {$end}";
+            }
+            return $task_title;
+        };
+
+        $time_type = $_GET['time_type'];
+        $start = $_GET['start_time'];
+        $end = $_GET['end_time'];
+        if (!empty($this->checkSend($start, $end))) {
+            return self::outerr(errcode::ErrInputParam, "还有正在充值中的订单,请稍后再试.");
+        }
+
+        $start_date = strtotime(date('Y-m-d',$start));
+        $end_date = strtotime(date('Y-m-d',$end));
+        $today = strtotime(date('Y-m-d',time()));
+        $tomorrow = $today + 86400;
+
+        if ($time_type === 'order_time')
+        {
+            $add_end = $end_date + 86400 * 5;
+            if($add_end > $tomorrow) {
+                $add_end = $tomorrow;
+            }
+            $scope = ['order_time' => [$start, $end], 'add_time' => [$start, $add_end]];
+        } elseif ($time_type === 'notify_time') {
+            $add_begin = $start_date - 86400 * 5;
+            $scope = ['order_time' => [$add_begin, $end], 'add_time' => [$add_begin, $end], 'notify_time' => [$start, $end]];
+        } else {
+            return self::outerr(errcode::ErrInputParam, "筛选日期类型错误.");
+        }
+        $normal_cond['inner_status'] = 0;
+        $normal_cond['order_state'] = ORDER_STATE_SUCCESS;
+        $normal_cond['mchid'] = $this->mchid();
+
+        $task_title = $task_title_create($start, $end, $time_type);
+        $cond = ['normal' => $normal_cond, 'time_scope' => $scope, 'export_type' => 'merchant'];
+
+        $manager = new manager();
+        $task = $manager->add_task('refill_order_export',$cond,1,-1, $task_title, $this->mchid());
+        $file_path = '';
+        if ($task->completed() && $task->success()) {
+            $file_name = $task->result();
+            $file_path = UPLOAD_SITE_URL . '/' . ATTACH_TASK . DS . $file_name;
+        }
+        return self::outsuccess(['file_path' => $file_path]);
+    }
+
+    public function task_listOp()
+    {
+        $model = Model('task');
+        $condition['is_show'] = 1;
+        $condition['mchid'] = $this->mchid();
+        $task_list = $model->getList($condition, $this->page, '*', 'add_time desc', 20);
+
+        foreach ($task_list as $key => $value)
+        {
+            if($value['state'] == 3 && !empty($value['result']))
+            {
+                $task_list[$key]['file_path'] = UPLOAD_SITE_URL . '/' . ATTACH_TASK . DS . unserialize($value['result']);
+            }else{
+                $task_list[$key]['file_path'] = '';
+            }
+        }
+        $result['data'] = $task_list;
+        $result['total'] = $model->gettotalpage();
+        return self::outsuccess($result);
+    }
+}