dever 6 سال پیش
والد
کامیت
d7606f11b2
1فایلهای تغییر یافته به همراه26 افزوده شده و 6 حذف شده
  1. 26 6
      buy/src/Buy.php

+ 26 - 6
buy/src/Buy.php

@@ -5,13 +5,13 @@ use Dever;
 # 必须登录才能购买小刊
 class Buy extends Base
 {
-	public function __construct()
+    public function __construct()
     {
-    	parent::__construct();
+        parent::__construct();
 
-    	if (!$this->user) {
-    		//return $this->location('home');
-    	}
+        if (!$this->user) {
+            //return $this->location('home');
+        }
     }
     
     # 列表页
@@ -57,6 +57,26 @@ class Buy extends Base
 
     # 列表页 我已购买的兑换码
     public function lists_code()
+    {
+        $where['cate_id'] = $this->cate;
+        $where['create_uid'] = $this->user['id'];
+        //$where['type'] = 3;
+        $where['type'] = 4;
+        $data = Dever::db('code/info')->getAll($where);
+
+        if ($data) {
+            foreach ($data as $k => $v) {
+                $data[$k]['cdate'] = date('Y年m月d日 H:i', $v['cdate']);
+                $data[$k]['link'] = '';
+                $data[$k]['desc'] = $v['buy_num'] . '本 ¥' . number_format($v['cash'], 2);
+            }
+        }
+
+        return $data;
+    }
+
+    # 列表页 我已购买的兑换码
+    public function code_detail()
     {
         $where['cate_id'] = $this->cate;
         $where['create_uid'] = $this->user['id'];
@@ -285,7 +305,7 @@ class Buy extends Base
 
         $order_data['system'] = 2;
         if ($this->source) {
-        	$order_data['source'] = $this->source;
+            $order_data['source'] = $this->source;
         }
 
         if ($this->seller) {