正在显示
1 个修改的文件
包含
21 行增加
和
20 行删除
@@ -387,31 +387,32 @@ class Wechat extends Api | @@ -387,31 +387,32 @@ class Wechat extends Api | ||
387 | //发放代金券 | 387 | //发放代金券 |
388 | public function send_voucher($pid,$verification_store_id,$order_id,$time){ | 388 | public function send_voucher($pid,$verification_store_id,$order_id,$time){ |
389 | $w1['verification_store_id'] = $verification_store_id; | 389 | $w1['verification_store_id'] = $verification_store_id; |
390 | - $w1['closetime'] = ['<',$time]; | ||
391 | - $coupon = Db::name('verification_coupon')->where($w1)->select(); | ||
392 | - if(!empty($coupon)){ | ||
393 | - foreach($coupon as $k=>$v){ | ||
394 | - $save = []; | ||
395 | - $save['verification_coupon_id'] = $v['id']; | ||
396 | - $save['verification_store_id'] = $v['verification_store_id']; | ||
397 | - $save['user_id'] = $pid; | ||
398 | - //用户是否已经领取该门店的券 | ||
399 | - $r = Db::name('verification_receive')->where($save)->find(); | ||
400 | - if(empty($r)){ | ||
401 | - $save['type'] = 0; | ||
402 | - $save['closetime'] = $v['closetime']; | ||
403 | - $save['receive_no'] = $time.uniqid(); | ||
404 | - $res = (new \app\api\controller\v1\Index())->build($save['receive_no']); | ||
405 | - $save['qr_code'] = $res;//二维码 | ||
406 | - $save['createtime'] = $time; | ||
407 | - $save['verification_order_id'] = $order_id; | ||
408 | - Db::name('verification_receive')->insert($save); | ||
409 | - } | 390 | + $w1['closetime'] = ['<',$time]; |
391 | + $coupon = Db::name('verification_coupon')->where($w1)->select(); | ||
392 | + if(!empty($coupon)){ | ||
393 | + foreach($coupon as $k=>$v){ | ||
394 | + $save = []; | ||
395 | + $save['verification_coupon_id'] = $v['id']; | ||
396 | + $save['verification_store_id'] = $v['verification_store_id']; | ||
397 | + $save['user_id'] = $pid; | ||
398 | + //用户是否已经领取该门店的券 | ||
399 | + $r = Db::name('verification_receive')->where($save)->find(); | ||
400 | + if(empty($r)){ | ||
401 | + $save['type'] = 0; | ||
402 | + $save['closetime'] = $v['closetime']; | ||
403 | + $save['receive_no'] = $time.uniqid(); | ||
404 | + $res = (new \app\api\controller\v1\Index())->build($save['receive_no']); | ||
405 | + $save['qr_code'] = $res;//二维码 | ||
406 | + $save['createtime'] = $time; | ||
407 | + $save['verification_order_id'] = $order_id; | ||
408 | + Db::name('verification_receive')->insert($save); | ||
410 | } | 409 | } |
411 | } | 410 | } |
411 | + } | ||
412 | } | 412 | } |
413 | // 发放佣金 | 413 | // 发放佣金 |
414 | public function grant_commission($pid=0,$order_id=0){ | 414 | public function grant_commission($pid=0,$order_id=0){ |
415 | + | ||
415 | try{ | 416 | try{ |
416 | $verification_order = Db::name('verification_order')->where(['id'=>$order_id])->find(); | 417 | $verification_order = Db::name('verification_order')->where(['id'=>$order_id])->find(); |
417 | $app = WehcatModule::getInstance()->initWechatPay(); | 418 | $app = WehcatModule::getInstance()->initWechatPay(); |
-
请 注册 或 登录 后发表评论