|
@@ -88,17 +88,21 @@ class JCouponController extends AdminController
|
|
if (empty($gift)) {
|
|
if (empty($gift)) {
|
|
CommonFn::requestAjax(false,'礼包不存在');exit;
|
|
CommonFn::requestAjax(false,'礼包不存在');exit;
|
|
}
|
|
}
|
|
- $c = new EMongoCriteria();
|
|
|
|
|
|
+ if ($coding_num > 1000000) {
|
|
|
|
+ CommonFn::requestAjax(false,'起始值重复');exit;
|
|
|
|
+ }
|
|
|
|
+ /*$c = new EMongoCriteria();
|
|
$c->coding_num('==',$coding_num);
|
|
$c->coding_num('==',$coding_num);
|
|
$j = JCoupon::model()->findAll($c);
|
|
$j = JCoupon::model()->findAll($c);
|
|
if (count($j) > 0) {
|
|
if (count($j) > 0) {
|
|
CommonFn::requestAjax(false,'起始值重复');exit;
|
|
CommonFn::requestAjax(false,'起始值重复');exit;
|
|
- }
|
|
|
|
- $total = 100000;
|
|
|
|
|
|
+ }*/
|
|
|
|
+ $total = 10000;
|
|
for($i=0; $i<$num; $i++) {
|
|
for($i=0; $i<$num; $i++) {
|
|
$coupon = new JCoupon();
|
|
$coupon = new JCoupon();
|
|
$coupon->gift_id = $gift_id;
|
|
$coupon->gift_id = $gift_id;
|
|
- $coupon->coding_num = $coding_num;
|
|
|
|
|
|
+ $tmp1 = $coding_num + 1000000;
|
|
|
|
+ $coupon->coding_num = date('d').substr($tmp1,1);
|
|
|
|
|
|
$flag = true;
|
|
$flag = true;
|
|
while($flag) {
|
|
while($flag) {
|
|
@@ -110,7 +114,7 @@ class JCouponController extends AdminController
|
|
}
|
|
}
|
|
$total++;
|
|
$total++;
|
|
$coupon->pwd = $pwd;
|
|
$coupon->pwd = $pwd;
|
|
- $coupon->coupon_coding = $gift->gift_num.substr(date('Y'),2).date('m').'0'.substr($total,1);
|
|
|
|
|
|
+ $coupon->coupon_coding = $gift->gift_num.substr(date('Y'),2).date('md').substr($total,1);
|
|
$coupon->channel = $channel;
|
|
$coupon->channel = $channel;
|
|
$coupon->status = 0;
|
|
$coupon->status = 0;
|
|
$coupon->expire_time = $expire_time;
|
|
$coupon->expire_time = $expire_time;
|