作者 chencheng

kq-0621-20

@@ -497,9 +497,9 @@ truncate cv_verification_receive; @@ -497,9 +497,9 @@ truncate cv_verification_receive;
497 public function send_gift_certificate_url($pid,$order_id,$time){ 497 public function send_gift_certificate_url($pid,$order_id,$time){
498 $order_info = Db::name('verification_order')->where(['id'=>$order_id])->find(); 498 $order_info = Db::name('verification_order')->where(['id'=>$order_id])->find();
499 $store = Db::name('verification_store')->where(['id'=>$order_info['verification_store_id']])->find(); 499 $store = Db::name('verification_store')->where(['id'=>$order_info['verification_store_id']])->find();
500 - $activity = Db::name('verification_activity')->where(['id'=>$order_info['verification_activity_id']])->find();  
501 - //获取门店下的礼品券  
502 - if(!empty($activity['verification_coupon_ids'])){ 500 +
  501 +
  502 +
503 503
504 //判断当前父级的所有下级的订单数,是否满足 send_rule_limit 的规则 504 //判断当前父级的所有下级的订单数,是否满足 send_rule_limit 的规则
505 $subIds = Db::name('user')->where(['pid'=>$pid])->column('id'); 505 $subIds = Db::name('user')->where(['pid'=>$pid])->column('id');
@@ -507,7 +507,8 @@ truncate cv_verification_receive; @@ -507,7 +507,8 @@ truncate cv_verification_receive;
507 507
508 //获取卡券 508 //获取卡券
509 //当前活动对应的所有券 509 //当前活动对应的所有券
510 - $coupon = Db::name('verification_coupon')->where(['id'=>['in',$activity['verification_coupon_ids']],'type'=>1,'send_rule_limit'=>$subOrderCount])->find(); 510 + $wc = ['verification_store_id'=>$order_info['verification_store_id'],'type'=>1,'send_rule_limit'=>$subOrderCount];
  511 + $coupon = Db::name('verification_coupon')->where($wc)->find();
511 512
512 if(!empty($coupon)){ 513 if(!empty($coupon)){
513 //发送给pid用户 514 //发送给pid用户
@@ -526,12 +527,12 @@ truncate cv_verification_receive; @@ -526,12 +527,12 @@ truncate cv_verification_receive;
526 $save['coupon_type'] = $coupon['type']; 527 $save['coupon_type'] = $coupon['type'];
527 Db::name('verification_receive')->insert($save); 528 Db::name('verification_receive')->insert($save);
528 } 529 }
529 - } 530 +
530 } 531 }
531 532
532 public function test_rule(){ 533 public function test_rule(){
533 - $pid = 23;  
534 - $order_id = '223'; 534 + $pid = 1;
  535 + $order_id = '2';
535 $time = time(); 536 $time = time();
536 $this->send_gift_certificate_url($pid,$order_id,$time); 537 $this->send_gift_certificate_url($pid,$order_id,$time);
537 } 538 }