|
@@ -413,4 +413,58 @@ class merchant_orderControl extends mbMerchantControl
|
|
|
|
|
|
return ['title' => $title , 'data' => $datas];
|
|
|
}
|
|
|
+
|
|
|
+ public function create_taskOp()
|
|
|
+ {
|
|
|
+ if(empty($_GET['time_type']) || empty($_GET['start_time']) || empty($_GET['end_time'])) {
|
|
|
+ return self::outerr(errcode::ErrInputParam, "参数错误.");
|
|
|
+ }
|
|
|
+ $normal_cond['inner_status'] = 0;
|
|
|
+ $normal_cond['order_state'] = ORDER_STATE_SUCCESS;
|
|
|
+ $time_type = $_GET['time_type'];
|
|
|
+ $start = $_GET['start_time'];
|
|
|
+ $end = $_GET['end_time'];
|
|
|
+ $title = $_GET['task_title'] ?? '';
|
|
|
+
|
|
|
+ $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, "筛选日期类型错误.");
|
|
|
+ }
|
|
|
+ $manager = new task\manager();
|
|
|
+
|
|
|
+ $cond = ['normal' => $normal_cond, 'time_scope' => $scope, 'export_type' => 'merchant'];
|
|
|
+
|
|
|
+ $task = $manager->add_task('refill_order_export',$cond,1,-1, $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);
|
|
|
+ $result['data'] = $task_list;
|
|
|
+ $result['total'] = $model->gettotalpage();
|
|
|
+ return self::outsuccess($result);
|
|
|
+ }
|
|
|
}
|