|
@@ -123,7 +123,7 @@ Class Cron{
|
|
|
$w['buy_uid'] = $uid;
|
|
|
$w['order_id'] = $v['id'];
|
|
|
$w['clear'] = true;
|
|
|
- $w['write_code'] = Dever::load('lib/active')->getCode();
|
|
|
+ $w['write_code'] = $this->getCode();
|
|
|
$code_id = Dever::db('active/code')->insert($w);
|
|
|
if ($code_id) {
|
|
|
$where['where_id'] = $v['id'];
|
|
@@ -152,7 +152,7 @@ Class Cron{
|
|
|
$insert['active_id'] = $order['active_id'];
|
|
|
$insert['buy_uid'] = $order['uid'];
|
|
|
$insert['order_id'] = $order['id'];
|
|
|
- $insert['write_code'] = Dever::load('lib/active')->getCode();
|
|
|
+ $insert['write_code'] = $this->getCode();
|
|
|
$insert['act_status'] = $active['act_status'];
|
|
|
$ids = Dever::db('active/code')->insert($insert);
|
|
|
if ($ids) {
|
|
@@ -166,4 +166,15 @@ Class Cron{
|
|
|
}
|
|
|
return 'ok';
|
|
|
}
|
|
|
+ #活动核销码
|
|
|
+ public function getCode()
|
|
|
+ {
|
|
|
+ $where['write_code'] = Dever::rand(6, 0);
|
|
|
+ $state = Dever::db('active/code')->one($where);
|
|
|
+ if (!$state) {
|
|
|
+ return $where['write_code'];
|
|
|
+ } else {
|
|
|
+ return $this->getCode();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|