dever 3 anos atrás
pai
commit
9b3379eca8

+ 1 - 1
app/goods/database/card.php

@@ -61,7 +61,7 @@ return array
         'type'        => array
         (
             'type'      => 'int-11',
-            'name'      => '礼品卡类型',
+            'name'      => '礼品卡类型-永久有效的时间为10年,即3650天',
             'default'   => '1',
             'desc'      => '礼品卡类型',
             'match'     => 'is_numeric',

+ 1 - 1
app/goods/database/card_code.php

@@ -128,7 +128,7 @@ return array
             'match'     => 'is_numeric',
             'default'   => '',
             'desc'      => '',
-            //'list'      => 'date("Y-m-d H:i:s", {edate})',
+            'list'      => 'date("Y-m-d H:i:s", {edate})',
         ),
 
         'state'     => array

+ 5 - 0
app/goods/lib/Manage.php

@@ -305,6 +305,11 @@ class Manage
 
         if (!$state) {
             $where['card_id'] = $info['id'];
+            if ($info['type'] == 1) {
+                $info['day'] = 3650;
+            }
+
+            $where['edate'] = time() + ($info['day']*86400);
             Dever::db('goods/card_code')->insert($where);
         } else {
             $this->createCode($info);

+ 2 - 3
app/shop/src/Buy.php

@@ -86,7 +86,7 @@ class Buy extends Core
             $state = Dever::db('shop/cart')->update($where);
         }
 
-        return $this->alert($state);
+        return $this->getCart();
     }
 
     # 清空购物车
@@ -124,7 +124,7 @@ class Buy extends Core
             }
         }
 
-        return $this->alert($state);
+        return $this->getCart();
     }
 
     # 确认订单页面
@@ -334,7 +334,6 @@ class Buy extends Core
         }
 
         $pay = Dever::load('shop/lib/sell')->action($this->data['method'], $this->data['pay_method'], $this->user, $this->shop, $this->data['name'], $this->data['num'], $this->data['list'], $this->data['price'], $address_id, $invoice_id, $info, $this->data['card'], $this->data['coupon_id'], $this->data['user_coupon_id'], $parent_uid, $cart, $refer);
-
         return $pay;
     }
 

+ 14 - 0
app/shop/src/My.php

@@ -103,6 +103,20 @@ class My extends Core
         return $this->data;
     }
 
+    # 兑换礼品卡
+    public function dh_card()
+    {
+        $where['card'] = Dever::input('card');
+        $where['pwd'] = Dever::input('pwd');
+        $info = Dever::db('goods/card_code')->find($where);
+
+        if ($info && $info['status'] == 1) {
+            # 可以兑换
+        } else {
+            return "该礼品卡过有效期\r\n无法兑换";
+        }
+    }
+
     # 我的订单列表
     public function order()
     {