...
|
...
|
@@ -497,9 +497,9 @@ truncate cv_verification_receive; |
|
|
public function send_gift_certificate_url($pid,$order_id,$time){
|
|
|
$order_info = Db::name('verification_order')->where(['id'=>$order_id])->find();
|
|
|
$store = Db::name('verification_store')->where(['id'=>$order_info['verification_store_id']])->find();
|
|
|
$activity = Db::name('verification_activity')->where(['id'=>$order_info['verification_activity_id']])->find();
|
|
|
//获取门店下的礼品券
|
|
|
if(!empty($activity['verification_coupon_ids'])){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//判断当前父级的所有下级的订单数,是否满足 send_rule_limit 的规则
|
|
|
$subIds = Db::name('user')->where(['pid'=>$pid])->column('id');
|
...
|
...
|
@@ -507,7 +507,8 @@ truncate cv_verification_receive; |
|
|
|
|
|
//获取卡券
|
|
|
//当前活动对应的所有券
|
|
|
$coupon = Db::name('verification_coupon')->where(['id'=>['in',$activity['verification_coupon_ids']],'type'=>1,'send_rule_limit'=>$subOrderCount])->find();
|
|
|
$wc = ['verification_store_id'=>$order_info['verification_store_id'],'type'=>1,'send_rule_limit'=>$subOrderCount];
|
|
|
$coupon = Db::name('verification_coupon')->where($wc)->find();
|
|
|
|
|
|
if(!empty($coupon)){
|
|
|
//发送给pid用户
|
...
|
...
|
@@ -526,12 +527,12 @@ truncate cv_verification_receive; |
|
|
$save['coupon_type'] = $coupon['type'];
|
|
|
Db::name('verification_receive')->insert($save);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
public function test_rule(){
|
|
|
$pid = 23;
|
|
|
$order_id = '223';
|
|
|
$pid = 1;
|
|
|
$order_id = '2';
|
|
|
$time = time();
|
|
|
$this->send_gift_certificate_url($pid,$order_id,$time);
|
|
|
}
|
...
|
...
|
|