dever 4 سال پیش
والد
کامیت
d0b8e29785
3فایلهای تغییر یافته به همراه20 افزوده شده و 0 حذف شده
  1. 3 0
      app/collection/src/Api.php
  2. 13 0
      app/user/database/ticket.php
  3. 4 0
      app/user/lib/Ticket.php

+ 3 - 0
app/collection/src/Api.php

@@ -225,6 +225,9 @@ class Api extends Core
 
         
         $data['func'] = $this->getFunc();
+
+        # 更新阅读数
+        Dever::db('collection/info')->addView(array('where_id' => $this->id));
         
         return $data;
     }

+ 13 - 0
app/user/database/ticket.php

@@ -128,5 +128,18 @@ return array
                 'num' => array('yes', '-='),
             ),
         ),
+
+        # 查看数量
+        'total' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'info_id' => 'yes',
+                //'state' => 1,
+            ),
+            'type' => 'one',
+            'col' => 'sum(total) as  total',
+        ),
     ),
 );

+ 4 - 0
app/user/lib/Ticket.php

@@ -142,6 +142,10 @@ class Ticket
                     Dever::load('collection/lib/ranking')->up($order['uid'], $order['info_id'], 1, $order['buy_num']);
                 }
 
+                # 更新购买数
+                $total = Dever::db('user/ticket')->total(array('info_id' => $order['info_id']));
+                Dever::db('collection/info')->update(array('num_buy' => $total['total'], 'where_id' => $order['info_id']));
+
                 # 增加积分
                 if ($order['parent_uid'] > 0) {
                     $uid = $order['parent_uid'] . '_' . $order['uid'];