瀏覽代碼

feature/EK-3320

ryan 1 月之前
父節點
當前提交
a51f8d7790

+ 2 - 0
backendApi/config/params.php

@@ -27,6 +27,7 @@ return [
         'v1/shop/order-invoice-remark',
         'v1/shop/order-invoice-method',
         'v1/shop/order-invoice-export',
+        'v1/shop/order-invoice-export-file',
 //        'v1/site/countries'
     ],
     'noCheckPermissionActions' => [
@@ -97,5 +98,6 @@ return [
         'shop/order-invoice-remark',
         'shop/order-invoice-method',
         'shop/order-invoice-export',
+        'shop/order-invoice-export-file',
     ],
 ];

+ 1 - 0
backendApi/config/urlManagerRules.php

@@ -59,6 +59,7 @@ return [
             'GET order-invoice-method' => 'order-invoice-method',
             'POST order-invoice-remark' => 'order-invoice-remark',
             'GET order-invoice-export/<orderSn>' => 'order-invoice-export',
+            'GET order-invoice-export-file/<orderSn>' => 'order-invoice-export-file',
             'GET order-list-export' => 'order-list-export',
             'POST order-delivery' => 'order-delivery',
             'POST order-refund' => 'order-refund',

+ 10 - 1
backendApi/modules/v1/controllers/ShopController.php

@@ -865,13 +865,22 @@ class ShopController extends BaseController {
         if (!$result) {
             return static::notice(Form::formatErrorsForApi($form->getErrors()), 400);
         }
+        return static::notice(\Yii::t('ctx', 'startExporting')); // 导出开始,请到文件管理-导出文件查看
+    }
+
+    public function actionOrderInvoiceExportFile()
+    {
+        $orderSn = \Yii::$app->request->get('orderSn');
 
         //查找最新的导出文件
         $data = Export::findOneAsArray('REMARK=:REMARK', ['REMARK'=>$orderSn], [
             'useSlaves' => true,
             'orderBy' => 'CREATED_AT DESC',
         ]);
-        return static::notice($data); // 导出开始,请到文件管理-导出文件查看
+        if (!$data || $data['IS_EXPORTING']) {
+            return static::notice('导出进行中', 400);
+        }
+        return static::notice($data);
     }
 
     /**