Просмотр исходного кода

修改开始同步数据时间

dong025 5 дней назад
Родитель
Сommit
7d495ee0bf

+ 105 - 1
app/admin/controller/goods/ImportList.php

@@ -18,7 +18,7 @@ use app\common\model\CustomerSpec;
 use app\common\model\ProductConfig;
 use app\common\model\ImportList as ImportListModel;
 use app\common\model\ShopList as ShopListModel;
-
+use think\facade\Cache;
 #[Group("goods/import_list")]
 class ImportList extends Backend
 {
@@ -373,4 +373,108 @@ class ImportList extends Backend
         $this->callback = function ($ids) {};
         return $this->_del();
     }
+
+    /**
+     * 聚水潭同步数据设置
+     */
+    #[Route('GET,POST,JSON', 'set_jushuitan')]
+    public function set_jushuitan()
+    {
+        if (false === $this->request->isPost()) {
+            $row=[];
+            $startTime=null;
+            $jushuitan=Cache::get('jushuitan');
+            if(!empty($jushuitan)||$jushuitan!=null){
+                $startTime=$jushuitan['startTime'];
+                $startTime=date('Y-m-d H:i:s', $startTime);
+            }
+            $this->assign('row', $row);
+            $this->assign('startTime', $startTime);
+            return $this->fetch();
+        }
+
+        $params = $this->request->post("");
+        if (empty($params['startTime'])) $this->error(__('请选择开始时间'));
+
+        //时间间隔
+        $start_end_space_time=10*60;
+        //下一次时间间隔
+        $next_time_space=7*60;
+
+
+        //将查询分为,"2026-01-05 00:00:00~2026-01-05 00:05:00",查询该区间的订单,但是该时间区间单独数量可能超过50条,为了性能又不能一次性查询太多,从而进行分页查询,
+        //查询不到数据,就往下一个时间区间查询
+
+        $startTime_stamp = strtotime($params['startTime']);
+        $endTime_stamp=$startTime_stamp+$start_end_space_time;
+        $pageNum=1;
+
+        $jushuitan=[
+            'startTime'=>$startTime_stamp,
+            'endTime'=>$endTime_stamp,
+            'pageNum'=>$pageNum,
+            'next_time_space'=>$next_time_space
+        ];
+        $jushuitan=[
+            'startTime'=>$startTime_stamp,
+            'endTime'=>$endTime_stamp,
+            'pageNum'=>$pageNum,
+            'next_time_space'=>$next_time_space
+        ];
+        $result=Cache::set('jushuitan',$jushuitan);
+        if($result) return $this->jsonSuccess('设置成功');
+        return $this->jsonError('设置失败');
+    }
+   
+    /**
+     * 风速同步数据设置
+     */
+    #[Route('GET,POST,JSON', 'set_fengsu')]
+    public function set_fengsu()
+    {
+        if (false === $this->request->isPost()) {
+            $row=[];
+            $startTime=null;
+            $fengsu=Cache::get('fengsu');
+            if(!empty($fengsu)||$fengsu!=null){
+                $startTime=$fengsu['startTime'];
+                $startTime=date('Y-m-d H:i:s', $startTime);
+            }
+            $this->assign('row', $row);
+            $this->assign('startTime', $startTime);
+            return $this->fetch();
+        }
+
+        $params = $this->request->post("");
+        if (empty($params['startTime'])) $this->error(__('请选择开始时间'));
+
+        //时间间隔
+        $start_end_space_time=10*60;
+        //下一次时间间隔
+        $next_time_space=7*60;
+
+
+        //将查询分为,"2026-01-05 00:00:00~2026-01-05 00:05:00",查询该区间的订单,但是该时间区间单独数量可能超过50条,为了性能又不能一次性查询太多,从而进行分页查询,
+        //查询不到数据,就往下一个时间区间查询
+
+        $startTime_stamp = strtotime($params['startTime']);
+        $endTime_stamp=$startTime_stamp+$start_end_space_time;
+        $pageNum=1;
+
+        $fengsu=[
+            'startTime'=>$startTime_stamp,
+            'endTime'=>$endTime_stamp,
+            'pageNum'=>$pageNum,
+            'next_time_space'=>$next_time_space
+        ];
+        $fengsu=[
+            'startTime'=>$startTime_stamp,
+            'endTime'=>$endTime_stamp,
+            'pageNum'=>$pageNum,
+            'next_time_space'=>$next_time_space
+        ];
+        $result=Cache::set('fengsu',$fengsu);
+        if($result) return $this->jsonSuccess('设置成功');
+        return $this->jsonError('设置失败');
+    }
 }

+ 98 - 0
app/admin/view/goods/import_list/set_fengsu.html

@@ -0,0 +1,98 @@
+<template>
+    <el-card shadow="never" style="border: 0;">
+        <yun-form ref="yunform" :columns="columns" @submit="onSubmit">
+            <template #default>
+
+                <div class="el-form-item__label">
+                    <label for="" style="width: 140px;">请选择开始同步时间:</label>
+                    <el-date-picker v-model="startTime" type="datetime" format="YYYY-MM-DD HH:mm:ss"
+                        value-format="YYYY-MM-DD HH:mm:ss" />
+                </div>
+            </template>
+        </yun-form>
+    </el-card>
+
+</template>
+<script>
+    import form from "@components/Form.js";
+    export default {
+        components: {
+            'YunForm': form
+        },
+        data: {
+            columns: [
+
+            ],
+            startTime: Yunqi.data.startTime
+        },
+        //页面加载完成时执行
+        onLoad: function (query) {
+
+
+        },
+        //页面初始显示或在框架内显示时执行
+        onShow: function () {
+
+        },
+        //页面在框架内隐藏时执行
+        onHide: function () {
+
+        },
+        //页面在框架内关闭时执行
+        onUnload: function () {
+
+        },
+        methods: {
+
+            onSubmit: function (rows) {
+                if (this.startTime == '' || this.startTime == null) {
+                    ElementPlus.ElMessage({
+                        type: 'warning',
+                        message: '请选择开始时间',
+                    })
+                    return;
+                }
+                ElementPlus.ElMessageBox.confirm(
+                    '请确认开始同步的时间!',
+                    '提示',
+                    {
+                        confirmButtonText: '确认',
+                        cancelButtonText: '取消',
+                        type: 'warning',
+                    }
+                )
+                    .then(() => {
+                        let data = {
+                            startTime: this.startTime
+                        }
+                        Yunqi.ajax.post('goods/import_list/set_fengsu', data, false, false, true).then(res => {
+                            
+                            if (res.code == 200) {
+                                ElementPlus.ElMessage.success(res.msg)
+                            }else{
+                                ElementPlus.ElMessage.error(res.msg)
+                            }
+                            setTimeout(() => {
+                            Yunqi.api.closelayer(Yunqi.app.window.id, true);
+                            
+                        }, 1000);
+                        })
+
+                    })
+                    .catch(() => {
+
+                    })
+
+            },
+            onSuccess: function (response) {
+                //表单提交成功后执行
+                console.log(response)
+            },
+            onFail: function (err) {
+                //表单提交失败后执行
+            }
+        }
+    }
+</script>
+<style>
+</style>

+ 98 - 0
app/admin/view/goods/import_list/set_jushuitan.html

@@ -0,0 +1,98 @@
+<template>
+    <el-card shadow="never" style="border: 0;">
+        <yun-form ref="yunform" :columns="columns" @submit="onSubmit">
+            <template #default>
+
+                <div class="el-form-item__label">
+                    <label for="" style="width: 140px;">请选择开始同步时间:</label>
+                    <el-date-picker v-model="startTime" type="datetime" format="YYYY-MM-DD HH:mm:ss"
+                        value-format="YYYY-MM-DD HH:mm:ss" />
+                </div>
+            </template>
+        </yun-form>
+    </el-card>
+
+</template>
+<script>
+    import form from "@components/Form.js";
+    export default {
+        components: {
+            'YunForm': form
+        },
+        data: {
+            columns: [
+
+            ],
+            startTime: Yunqi.data.startTime
+        },
+        //页面加载完成时执行
+        onLoad: function (query) {
+
+
+        },
+        //页面初始显示或在框架内显示时执行
+        onShow: function () {
+
+        },
+        //页面在框架内隐藏时执行
+        onHide: function () {
+
+        },
+        //页面在框架内关闭时执行
+        onUnload: function () {
+
+        },
+        methods: {
+
+            onSubmit: function (rows) {
+                if (this.startTime == '' || this.startTime == null) {
+                    ElementPlus.ElMessage({
+                        type: 'warning',
+                        message: '请选择开始时间',
+                    })
+                    return;
+                }
+                ElementPlus.ElMessageBox.confirm(
+                    '请确认开始同步的时间!',
+                    '提示',
+                    {
+                        confirmButtonText: '确认',
+                        cancelButtonText: '取消',
+                        type: 'warning',
+                    }
+                )
+                    .then(() => {
+                        let data = {
+                            startTime: this.startTime
+                        }
+                        Yunqi.ajax.post('goods/import_list/set_jushuitan', data, false, false, true).then(res => {
+                          
+                            if (res.code == 200) {
+                                ElementPlus.ElMessage.success(res.msg)
+                            }else{
+                                ElementPlus.ElMessage.error(res.msg)
+                            }
+                            setTimeout(() => {
+                            Yunqi.api.closelayer(Yunqi.app.window.id, true);
+                            
+                        }, 1000);
+                        })
+
+                    })
+                    .catch(() => {
+                        
+                    })
+
+            },
+            onSuccess: function (response) {
+                //表单提交成功后执行
+                console.log(response)
+            },
+            onFail: function (err) {
+                //表单提交失败后执行
+            }
+        }
+    }
+</script>
+<style>
+</style>