...
|
...
|
@@ -53,7 +53,6 @@ class IndexController extends WeChatBaseController |
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
$user_id = cmf_get_current_user_id();
|
...
|
...
|
@@ -118,8 +117,11 @@ class IndexController extends WeChatBaseController |
|
|
/*if(empty($fangcong)){
|
|
|
|
|
|
}*/
|
|
|
$fangcong = Db::name('coupons_user') -> where("uid=".$guanxi['uid']." and cid=".$guanxi['cid']) -> find();
|
|
|
if(empty($fangcong)){
|
|
|
Db::name('coupons_user') -> insert($guanxi);
|
|
|
}
|
|
|
|
|
|
Db::name('coupons_user') -> insert($guanxi);
|
|
|
|
|
|
//生日优惠券
|
|
|
$bir = Db::name('coupons') -> where('type',2) -> find();
|
...
|
...
|
@@ -127,7 +129,11 @@ class IndexController extends WeChatBaseController |
|
|
$guanxi2['cid'] = $bir['id'];
|
|
|
$guanxi2['state'] = 0;
|
|
|
$guanxi2['code'] = date('md').substr(implode(NULL, array_map('ord', str_split(substr(uniqid(), 7, 13), 1))), 0, 8);
|
|
|
Db::name('coupons_user') -> insert($guanxi2);
|
|
|
$fangcongs = Db::name('coupons_user') -> where("uid=".$guanxi2['uid']." and cid=".$guanxi2['cid']) -> find();
|
|
|
if(empty($fangcongs)){
|
|
|
Db::name('coupons_user') -> insert($guanxi2);
|
|
|
}
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
...
|
...
|
|