dever 6 年之前
父節點
當前提交
d8110eaee2
共有 1 個文件被更改,包括 51 次插入0 次删除
  1. 51 0
      main/src/Content.php

+ 51 - 0
main/src/Content.php

@@ -23,6 +23,57 @@ class Content extends Core
     }
     */
 
+    public function score_code_actact()
+    {
+        $where['status'] = 2;
+        $where['product_id'] = 15;
+        $where['type'] = 3;
+        $where['buy_id'] = Dever::input('buy_id', 48);
+        $uid = Dever::input('uid');
+        $test = Dever::input('test');
+        if ($uid > 0) {
+            $where['uid'] = $uid;
+        }
+        $id = array
+        (
+            48 => 10,
+            49 => 100,
+            50 => 300,
+            51 => 600
+        );
+        $buy = Dever::db('journal/buy_num')->one($where['buy_id']);
+        $info = Dever::db('journal/info')->one($where['product_id']);
+        $data = Dever::db('journal/order')->state($where);
+        $time = Dever::maketime('2019-01-29 14:44:30');
+        if ($data) {
+            if ($test == 1) {
+                print_r($data);die;
+            }
+            foreach ($data as $k => $v) {
+                if ($v['cdate'] < $time && isset($id[$v['buy_id']]) && $id[$v['buy_id']]) {
+                    if ($v['type'] == 3) {
+
+                        $w['code'] = $v['code'];
+                        $o = Dever::db('code/info')->one($w);
+                        print_r($buy);
+                        print_r($v);
+                        print_r($o);die;
+                        if ($o) {
+                            $up['product_num'] = $buy['num'];
+                            $up['where_id'] = $o['id'];
+                            Dever::db('code/info')->update($up);
+                        }
+
+                        print_r($o);
+                        print_r($v);
+                    }
+
+
+                }
+            }
+        }
+    }
+
     # 跑积分
     public function score_actact()
     {