2 Commits

Author SHA1 Message Date
  Your Name c451914c81 修改后台-合并冲突 1 week ago
  Your Name 94706a798a 修改后台 1 week ago

+ 10
- 1
app/shop/controller/order/OrderRenew.php View File

@@ -25,6 +25,11 @@ class OrderRenew extends ShopBase
25 25
             return JsonServer::success('', OrderRenewLogic::lists($get));
26 26
         }
27 27
 
28
+        //自动取消订单
29
+        $shop_id = $this->shop_id;
30
+        OrderRenewLogic::cancelOrder($shop_id);
31
+
32
+
28 33
         return view('');
29 34
     }
30 35
 
@@ -111,7 +116,11 @@ class OrderRenew extends ShopBase
111 116
         $get['shop_id'] = $this->shop_id;
112 117
         $data = OrderRenewLogic::payPage($get);
113 118
 
114
-        return view('', ['detail' => $data]);
119
+        if($data[0] === 1){
120
+            return JsonServer::error($data[1]);
121
+        }
122
+
123
+        return view('', ['detail' => $data[1]]);
115 124
     }
116 125
 
117 126
     public function payWay()

+ 55
- 5
app/shop/logic/order/OrderRenewLogic.php View File

@@ -94,7 +94,25 @@ class OrderRenewLogic extends Logic
94 94
         return $info->toArray();
95 95
     }
96 96
 
97
-
97
+    public static function cancelOrder($shop_id)
98
+    {
99
+        //dump("dffd");
100
+        //查找未付款 待支付
101
+        //获取1个小时前的时间戳
102
+        $oneHourAgo = strtotime("-1 hour", time());
103
+        $where = [
104
+            ['shop_id','=',$shop_id],
105
+            ['del', '=', 0],
106
+            ['pay_status', '=', 0],
107
+            ['order_status', '=', 0],
108
+            ['create_time', '<', $oneHourAgo]
109
+        ];
110
+        OrderRenew::where($where)->update([
111
+                'order_status' => 4,
112
+                'cancel_time' => time(),
113
+                'update_time' => time(),
114
+            ]);
115
+    }
98 116
     public static function cancel($post)
99 117
     {
100 118
         try {
@@ -164,12 +182,28 @@ class OrderRenewLogic extends Logic
164 182
         ];
165 183
 
166 184
         $info = OrderRenew::where($where)->find();
185
+
186
+        //dump($info->toArray());
187
+        $good = ShopGoodsRenew::where([
188
+                ['id', '=', $info['renew_id']],
189
+            ])->find();
190
+
191
+        if(empty($good)){
192
+            $msg = '商品已删除';
193
+            return [1,$msg];
194
+        }
195
+
196
+        if((int)$good['status'] === 0){
197
+            $msg = '商品已下架';
198
+            return [1,$msg];
199
+        }
200
+
167 201
         if (!$info) {
168
-            static::$error = '数据不存在';
169
-            return false;
202
+            $msg = '数据不存在';
203
+            return [1,$msg];
170 204
         }
171 205
 
172
-        return $info->toArray();
206
+        return [0,$info->toArray()];
173 207
     }
174 208
 
175 209
     private static function aliPay($info, $time_expire)
@@ -225,6 +259,18 @@ class OrderRenewLogic extends Logic
225 259
             return false;
226 260
         }
227 261
 
262
+        //计算是否已过期
263
+        $oneHourAgo = strtotime("-1 hour", time());
264
+        if(strtotime($info->create_time) < $oneHourAgo){
265
+            //已过期
266
+            $info->order_status = 4;
267
+            $info->cancel_time = time();
268
+            $info->update_time = time();
269
+            $info->save();
270
+            self::$error = '订单已过期';
271
+            return false;
272
+        }
273
+
228 274
         $time_expire = time() + 3600 * 2;
229 275
 
230 276
         $info->pay_way = $post['pay_way'];
@@ -241,6 +287,7 @@ class OrderRenewLogic extends Logic
241 287
 
242 288
     private static function changeHkCount($info, $time)
243 289
     {
290
+        // 添加用户套餐时间或者数量
244 291
         // 操作数量
245 292
         $op_count = $info['renew_op_count'] * $info['total_num'];
246 293
         $shop = Shop::find($info['shop_id']);
@@ -273,7 +320,10 @@ class OrderRenewLogic extends Logic
273 320
             // 按量付费
274 321
             // 添加数量记录
275 322
             $old_hksy_count = $shop->hksy_count;
276
-
323
+            //$hk = new ShopHkLog();
324
+            //$hk->shop_id = $shop['id'];
325
+            //$hk->source_id = $info->id;
326
+            //$hk->change_count = $op_count;
277 327
             $hk->left_count = $op_count + $old_hksy_count;
278 328
             $hk->remark = '[' . $info->renew_name . '],订单号:' . $info->order_sn . ',增加总数:' . $op_count;
279 329
             $hk->save();

+ 3
- 3
app/shop/view/content/closure/edit/04.html View File

@@ -15,11 +15,11 @@
15 15
         </span>
16 16
 
17 17
         <span class="ks">
18
-        评论数:<input type="text" name="c1_1[]" id="" autocomplete="off" class="layui-input w100" value="{$extend.c1_1[1]??'default'}">
18
+        评论数:<input type="text" name="c1_1[]" id="" autocomplete="off" class="layui-input w100" value="{if !isset($extend.c1_1[1]) || empty($extend.c1_1[1])}5-9{/if}">
19 19
         观看
20
-        <input type="number" name="c1_2[]" id="" autocomplete="off" class="layui-input w30" value="{$extend.c1_2[1]??'5'}">
20
+        <input type="number" name="c1_2[]" id="" autocomplete="off" class="layui-input w30" value="{if !isset($extend.c1_2[1]) || empty($extend.c1_2[1])}5{/if}">
21 21
         秒到
22
-        <input type="number" name="c1_3[]" id="" autocomplete="off" class="layui-input w30" value="{$extend.c1_3[1]??'9'}">
22
+        <input type="number" name="c1_3[]" id="" autocomplete="off" class="layui-input w30" value="{if !isset($extend.c1_3[1]) || empty($extend.c1_3[1])}9{/if}">
23 23
24 24
         </span>
25 25
 

+ 4
- 3
app/shop/view/content/closure/edit/05.html View File

@@ -12,11 +12,12 @@
12 12
13 13
         </span>
14 14
         <span class="ks">
15
-        评论数:<input type="text" name="d1_1[]" id="" autocomplete="off" class="layui-input w100" value="{$extend.d1_1[1]??'default'}">
15
+
16
+        评论数:<input type="text" name="d1_1[]" id="" autocomplete="off" class="layui-input w100" value="{if !isset($extend.d1_1[1]) || empty($extend.d1_1[1])}5-9{/if}">
16 17
         观看
17
-        <input type="number" name="d1_2[]" id="" autocomplete="off" class="layui-input w30" value="{$extend.d1_2[1]??'5'}">
18
+        <input type="number" name="d1_2[]" id="" autocomplete="off" class="layui-input w30" value="{if !isset($extend.d1_2[1]) || empty($extend.d1_2[1])}5{/if}">
18 19
         秒到
19
-        <input type="number" name="d1_3[]" id="" autocomplete="off" class="layui-input w30" value="{$extend.d1_3[1]??'9'}">
20
+        <input type="number" name="d1_3[]" id="" autocomplete="off" class="layui-input w30" value="{if !isset($extend.d1_3[1]) || empty($extend.d1_3[1])}9{/if}">
20 21
21 22
         </span>
22 23
 

+ 1
- 0
app/shop/view/content/equi_category/add.html View File

@@ -4,6 +4,7 @@
4 4
 <style>
5 5
   html,body{
6 6
     height: 100% !important;
7
+
7 8
   }
8 9
   .layui-form-label {
9 10
     color: #6a6f6c;

+ 4
- 3
app/shop/view/content/equi_category/edit.html View File

@@ -2,6 +2,7 @@
2 2
 <style>
3 3
   html,body{
4 4
     height: 100% !important;
5
+    background: #fff;
5 6
   }
6 7
   .layui-form-label {
7 8
     color: #6a6f6c;
@@ -26,7 +27,7 @@
26 27
 
27 28
   <div class="layui-form-item">
28 29
     <label class="layui-form-label"></label>
29
-    <span style="color: #a3a3a3;font-size: 9px">与影刀手机管理器 自定义名称 一致 (英文字母+数字)</span>
30
+    <span style="color: #a3a3a3;font-size: 12px">与影刀手机管理器 自定义名称 一致 (英文字母+数字)</span>
30 31
   </div>
31 32
 
32 33
   <div class="layui-form-item">
@@ -157,7 +158,7 @@
157 158
   </div>
158 159
   <div class="layui-form-item">
159 160
     <label class="layui-form-label"></label>
160
-    <span style="color: #a3a3a3;font-size: 9px">根据教程: 复制到目标机器指定的文件内容即可;</span>
161
+    <span style="color: #a3a3a3;font-size: 12px">根据教程: 复制到目标机器指定的文件内容即可;</span>
161 162
   </div>
162 163
   <div class="layui-form-item">
163 164
     <label class="layui-form-label">机器码:</label>
@@ -175,7 +176,7 @@
175 176
 
176 177
   <div class="layui-form-item">
177 178
     <label class="layui-form-label"></label>
178
-    <span style="color: #a3a3a3;font-size: 9px">如需更换机器,这里清空绑定的机器码后保存即可;</span>
179
+    <span style="color: #a3a3a3;font-size: 12px">如需更换机器,这里清空绑定的机器码后保存即可;</span>
179 180
   </div>
180 181
   {/if}
181 182
 

+ 14
- 3
app/shop/view/content/equi_category/lists.html View File

@@ -22,11 +22,22 @@
22 22
           <div class="layui-colla-content layui-show">
23 23
             <p>
24 24
 
25
-              <b>套餐包含:</b> 电脑{$server_info.pc_num}台,每台电脑可添加手机{$server_info.mobile_num}台,可同时运行手机{$server_info.run_num}台.
25
+{php}
26
+$date1 = time();
27
+$date2 = strtotime($end_time);
28
+
29
+// 将时间戳转换为天数
30
+$days = abs($date2 - $date1) / (60 * 60 * 24);
31
+              $days = intval($days);
32
+
33
+//echo "相差天数:".intval($days); // 输出相差天数,使用intval确保得到整数结果
34
+{/php}
35
+
36
+              <b>套餐包含:</b> 电脑{$server_info.pc_num}台,每台电脑可添加手机{$server_info.mobile_num}台,可同时运行手机{$server_info.run_num}台。
26 37
               <br/>
27
-              总电脑数量: {$edui_info[0][0]??"0"}台 &nbsp;&nbsp;&nbsp;&nbsp;<b>服务到期时间:</b>  {$end_time} &nbsp;&nbsp;&nbsp;&nbsp;<b>评论剩余数量:</b>  {$hksy_count}<br/>
38
+              总电脑数量{$edui_info[0][0]??"0"}台 &nbsp;&nbsp;&nbsp;&nbsp;<b style="color:red;">服务到期时间:</b>  <span style="color:red;">{$end_time} (剩余{$days}天)</span> &nbsp;&nbsp;&nbsp;&nbsp;<b style="color:red;">评论次数剩余数量:</b>  <span style="color:red;">{$hksy_count}</span> <br/>
28 39
               {volist name="edui_info" id="vo"}
29
-              第{$vo[1]}台电脑,总共{$vo[2]}台手机设备,已启用{$vo[3]}台手机设备,未启用{$vo[4]}台手机设备,可同时运行手机{$server_info.run_num}台. <br/>
40
+              第{$vo[1]}台电脑,总共{$vo[2]}台手机设备,已启用{$vo[3]}台手机设备,未启用{$vo[4]}台手机设备,可同时运行手机{$server_info.run_num}台。 <br/>
30 41
               {/volist}
31 42
 
32 43
             </p>

+ 28
- 6
app/shop/view/order/order_renew/lists.html View File

@@ -49,7 +49,29 @@
49 49
                 <b style="color:red;">¥{{ d.renew_price }}</b>
50 50
             </script>
51 51
 
52
+            <script type="text/html" id="table-order">
52 53
 
54
+                {{#  if(d.order_status_str == "待支付"){ }}
55
+                <b style="color:red;">{{ d.order_status_str }}</b>
56
+                {{#  } }}
57
+                {{#  if(d.order_status_str == "已完成"){ }}
58
+                <b style="color:blue;">{{ d.order_status_str }}</b>
59
+                {{#  } }}
60
+                {{#  if(d.order_status_str == "已关闭"){ }}
61
+                <b style="color:#000;">{{ d.order_status_str }}</b>
62
+                {{#  } }}
63
+
64
+            </script>
65
+
66
+            <script type="text/html" id="table-pay">
67
+                {{#  if(d.pay_status_str == "待支付"){ }}
68
+                <b style="color:red;">{{ d.pay_status_str }}</b>
69
+                {{#  } }}
70
+
71
+                {{#  if(d.pay_status_str == "已支付"){ }}
72
+                <b style="color:blue;">{{ d.pay_status_str }}</b>
73
+                {{#  } }}
74
+            </script>
53 75
         </div>
54 76
 
55 77
     </div>
@@ -65,16 +87,16 @@
65 87
             { field: "id", width: 80, title: "ID" }
66 88
             , { field: "order_sn", width: 200, align: "center", title: "订单编号" }
67 89
             , { field: "renew_name", width: 180, align: "center", title: "商品名称" }
68
-            , { field: "renew_price", width: 100, align: "center", title: "套餐总价", templet: "#table-price"  }
69
-            , { field: "total_num", width: 100, align: "center", title: "套餐数量" }
70
-            , { field: "order_status_str", width: 100, align: "center", title: "订单状态" , templet: "#table-pay" }
71
-            , { field: "pay_status_str", width: 100, align: "center", title: "支付状态" }
90
+            , { field: "total_num", width: 100, align: "center", title: "商品数量" }
91
+            , { field: "renew_price", width: 100, align: "center", title: "订单总价", templet: "#table-price"  }
92
+            , { field: "order_status_str", width: 100, align: "center", title: "订单状态" , templet: "#table-order" }
72 93
             , { field: "pay_way_str", width: 100, align: "center", title: "支付方式" }
94
+            , { field: "pay_status_str", width: 100, align: "center", title: "支付状态"  , templet: "#table-pay"}
73 95
             , { field: "pay_time_str", width: 200, align: "center", title: "支付时间" }
74
-            , { title: "操作", width: 300, align: "center", fixed: "right", toolbar: "#table-operation" }
96
+            , { field: "trade_no", width: 250, align: "center", title: "支付流水号" }
97
+            , { title: "操作", width: 100, align: "center", fixed: "right", toolbar: "#table-operation" }
75 98
         ]);
76 99
 
77
-
78 100
         var active = {
79 101
             pay: function (obj) {
80 102
                 window.open("{:url('order.OrderRenew/payPage')}?id=" + obj.data.id);

Loading…
Cancel
Save