dever 6 years ago
parent
commit
897f87f71f
1 changed files with 15 additions and 2 deletions
  1. 15 2
      main/lib/Cron.php

+ 15 - 2
main/lib/Cron.php

@@ -24,14 +24,27 @@ class Cron
         */
         */
 
 
         # 购买小刊
         # 购买小刊
+        $where['product_id'] = Dever::input('journal_id', 28);
         $where['type'] = 1;
         $where['type'] = 1;
+        $where['status'] = 2;
         $data = Dever::db('journal/order')->state($where);
         $data = Dever::db('journal/order')->state($where);
+        $score = 20;
         if ($data) {
         if ($data) {
-            
+            foreach ($data as $k => $v) {
+                # 计算该订单能加的积分数
+                if ($v['buy_id'] && $v['buy_id'] > 0) {
+                    $buy = Dever::db('journal/buy_num')->one($data['buy_id']);
+                    if ($buy && $buy['num'] > 0) {
+                        $update_score = $score*$buy['num'];
+                    }
+                }
+            }
         }
         }
 
 
         # 兑换小刊
         # 兑换小刊
+        $where['product_id'] = Dever::input('journal_id', 28);
         $where['type'] = 2;
         $where['type'] = 2;
+        $where['status'] = 2;
         $data = Dever::db('journal/order')->state($where);
         $data = Dever::db('journal/order')->state($where);
     }
     }
 
 
@@ -64,7 +77,7 @@ class Cron
     {
     {
         # 获取该订单所能拥有的兑换码数
         # 获取该订单所能拥有的兑换码数
         $code_num = 1;
         $code_num = 1;
-        $uid = $order['uid'];
+        $uid = $data['uid'];
         if ($data['buy_id'] > 0) {
         if ($data['buy_id'] > 0) {
             $buy = Dever::db('journal/buy_num')->one($data['buy_id']);
             $buy = Dever::db('journal/buy_num')->one($data['buy_id']);
             $code_num = $buy['code'];
             $code_num = $buy['code'];