dever 6 years ago
parent
commit
7adad249cb
2 changed files with 35 additions and 3 deletions
  1. 0 1
      journal/database/order.php
  2. 35 2
      main/lib/Cron.php

+ 0 - 1
journal/database/order.php

@@ -549,7 +549,6 @@ return array
             ),
             'type' => 'all',
             'order' => array('id' => 'desc'),
-            'limit' => '0,1000',
             'col' => '*',
         ),
     ),

+ 35 - 2
main/lib/Cron.php

@@ -54,6 +54,39 @@ class Cron
         */
     }
 
+    # 去重
+    public function quchong_api()
+    {
+        # 购买小刊
+        $id = Dever::input('product_id', 28);
+        $where['product_id'] = $id;
+        $where['status'] = 2;
+        $order_id = Dever::input('order_id');
+        if ($order_id) {
+            $where['order_id'] = $order_id;
+        }
+        $uid = Dever::input('uid');
+        if ($uid) {
+            $where['uid'] = $uid;
+        }
+        $where['type'] = 2;
+        //$where['score_status'] = 1;
+        $order = Dever::db('journal/order')->getBuy($where);
+
+        print_r($order);die;
+        if($order) {
+            $user = array();
+            foreach ($order as $k => $v) {
+                $key = $v['uid'] . '_' . $v['code'];
+                if (!isset($user[$key])) {
+                    $user[$key] = $v;
+                } else {
+                    Dever::db('journal/order')->update(array('where_id' => $v['id'], 'state' => 2));
+                }
+            }
+        }
+    }
+
     # 重新计算排行榜
     public function pai3_api()
     {
@@ -71,14 +104,14 @@ class Cron
             $where['uid'] = $uid;
         }
         $where['type'] = 2;
-        $where['score_status'] = 1;
+        //$where['score_status'] = 1;
         $order = Dever::db('journal/order')->getBuy($where);
 
         $user = array();
         if ($order) {
             foreach ($order as $k1 => $v1) {
                 $this->paiOrder($v1, $user);
-                Dever::db('journal/order')->update(array('where_id' => $v1['id'], 'score_status' => 2));
+                //Dever::db('journal/order')->update(array('where_id' => $v1['id'], 'score_status' => 2));
             }
         }