Browse Source

shop cardkey_list add assigned_time

ayHaru 4 years ago
parent
commit
a7b56b0567
2 changed files with 31 additions and 1 deletions
  1. 11 0
      shop/control/card_keylist.php
  2. 20 1
      shop/templates/default/seller/card_key.stats.php

+ 11 - 0
shop/control/card_keylist.php

@@ -42,7 +42,18 @@ class card_keylistcontrol extends BaseSellerControl
     public function statsOp()
     {
         $condition = ['card_id' => ['gt', 0]];
+        $start_unixtime = intval(strtotime($_GET['query_start_time']));
+        $end_unixtime   = intval(strtotime($_GET['query_end_time']));
 
+        if ($start_unixtime > 0 && $end_unixtime > $start_unixtime) {
+            $condition['assigned_time'] = [ ['egt', $start_unixtime] , ['lt', $end_unixtime] , 'and'];
+        }
+        elseif ($start_unixtime > 0) {
+            $condition['assigned_time'] = ['egt', $start_unixtime];
+        }
+        elseif ($end_unixtime > 0) {
+            $condition['assigned_time'] = ['lt', $end_unixtime];
+        }
         $items = Model('')->table('card_key')
             ->field('card_type, amount, card_state, count(*) as card_count, sum(amount) as card_amounts')
             ->where($condition)

+ 20 - 1
shop/templates/default/seller/card_key.stats.php

@@ -25,7 +25,14 @@
         <input type="hidden" name="op" value="stats"/>
         <tr>
             <td class="count">共<?php echo $output['card_count']?>张&nbsp;</td>
-
+            <th style="width: 100px;">卡密使用时间</th>
+            <td class="w400">
+                <input class="txt date" type="text" value="<?php echo $_GET['query_start_time']; ?>"
+                       id="startTime" name="query_start_time" autocomplete="off" style="width:120px" />
+                <label for="query_start_time">~</label>
+                <input class="txt date" type="text" value="<?php echo $_GET['query_end_time']; ?>"
+                       id="endTime" name="query_end_time" autocomplete="off" style="width:120px" />
+            </td>
             <td class="w70 tc"><label class="submit-border">
                     <input type="submit" class="submit" value="搜索"/>
                 </label></td>
@@ -104,5 +111,17 @@
 </table>
 <script src="<?php echo RESOURCE_SITE_URL; ?>/js/jquery.poshytip.min.js"></script>
 <script src="<?php echo SHOP_RESOURCE_SITE_URL; ?>/js/store_goods_list.js"></script>
+<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/laydate/laydate.js"></script>
 <script>
+    $(function(){
+        // 日期选择器
+        laydate.render({
+            elem: '#startTime',
+            type: 'datetime'
+        });
+        laydate.render({
+            elem: '#endTime',
+            type: 'datetime'
+        });
+    });
 </script>