Your Name 2 years ago
parent
commit
b4c384f6a0
1 changed files with 19 additions and 0 deletions
  1. 19 0
      learn/active/lib/Cron.php

+ 19 - 0
learn/active/lib/Cron.php

@@ -177,4 +177,23 @@ Class Cron{
             return $this->getCode();
         }
     }
+    #更改订单状态
+    public function update_order_api()
+    {
+        $data = Dever::db('active/order')->state();
+        foreach ($data as $k => $v) {
+            if ($v['num'] == $v['refund_num']) {
+                $where['where_id'] = $v['id'];
+                $where['status'] = 6; 
+            }
+            if ($v['refund_num'] >0 && $v['refund_num'] != $v['num']) {
+                $where['where_id'] = $v['id'];
+                $where['status'] = 7;
+            }
+            if (isset($where) && $where) {
+                Dever::db('active/order')->update($where);
+            }
+        }
+        return 'ok';
+    }
 }