|
@@ -138,4 +138,32 @@ Class Cron{
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ public function bcode_api()
|
|
|
+ {
|
|
|
+ $order_id = Dever::input('order_id');
|
|
|
+ $status = 2;
|
|
|
+ $order = Dever::db('active/order')->one(array('id' => $order_id, 'clear' => true));
|
|
|
+ if ($order && $status == 2) {
|
|
|
+
|
|
|
+ $code = Dever::db('active/code')->find(array('join_uid'=>$order['uid'],'active_id'=>$order['active_id']));
|
|
|
+ if (!$code) {
|
|
|
+ $active = Dever::db('active/info')->find($order['active_id']);
|
|
|
+ $insert['join_uid'] = $order['uid'];
|
|
|
+ $insert['active_id'] = $order['active_id'];
|
|
|
+ $insert['buy_uid'] = $order['uid'];
|
|
|
+ $insert['order_id'] = $order['id'];
|
|
|
+ $insert['write_code'] = Dever::load('active/home')->getCode();
|
|
|
+ $insert['act_status'] = $active['act_status'];
|
|
|
+ $ids = Dever::db('active/code')->insert($insert);
|
|
|
+ if ($ids) {
|
|
|
+ $update['code_num'] = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $update['status'] = 2;
|
|
|
+ $update['where_id'] = $order['id'];
|
|
|
+
|
|
|
+ Dever::db('active/order')->update($update);
|
|
|
+ }
|
|
|
+ return 'ok';
|
|
|
+ }
|
|
|
}
|