Merge branch 'master' of http://47.108.67.251:8099/coupon.xp.yn.cn/coupon_backend
正在显示
1 个修改的文件
包含
23 行增加
和
5 行删除
| @@ -427,9 +427,27 @@ class Wechat extends Api | @@ -427,9 +427,27 @@ class Wechat extends Api | ||
| 427 | 427 | ||
| 428 | //发放 对应活动的礼品券 | 428 | //发放 对应活动的礼品券 |
| 429 | public function send_gift_certificate($pid,$verification_coupon_ids,$order_id,$time){ | 429 | public function send_gift_certificate($pid,$verification_coupon_ids,$order_id,$time){ |
| 430 | - $w1 = []; | ||
| 431 | - $w1['id'] = ['in',$verification_coupon_ids]; | ||
| 432 | - $coupon = Db::name('verification_coupon')->where($w1)->select(); | 430 | + $order_info = Db::name('verification_order')->where(['id'=>$order_id])->find(); |
| 431 | + $store = Db::name('verification_store')->where(['id'=>$order_info['verification_store_id']])->find(); | ||
| 432 | + //获取门店下的礼品券 | ||
| 433 | + if(empty($store['verification_coupon_id'])){ | ||
| 434 | + $coupon = Db::name('verification_coupon')->where(['id'=>$store['verification_coupon_id']])->find(); | ||
| 435 | + //发送给pid用户 | ||
| 436 | + $save = []; | ||
| 437 | + $save['verification_coupon_id'] = $store['verification_coupon_id']; | ||
| 438 | + $save['verification_store_id'] = $store['id']; | ||
| 439 | + $save['user_id'] = $pid; | ||
| 440 | + | ||
| 441 | + $save['type'] = 0;//使用情况 | ||
| 442 | + $save['closetime'] = $coupon['closetime']; | ||
| 443 | + $save['receive_no'] = $time.uniqid(); | ||
| 444 | + $res = (new \app\api\controller\v1\Index())->build($save['receive_no']); | ||
| 445 | + $save['qr_code'] = $res;//二维码 | ||
| 446 | + $save['createtime'] = $time; | ||
| 447 | + $save['verification_order_id'] = $order_id; | ||
| 448 | + $save['coupon_type'] = $coupon['type']; | ||
| 449 | + | ||
| 450 | + } | ||
| 433 | } | 451 | } |
| 434 | //发放 对应活动包含的券 | 452 | //发放 对应活动包含的券 |
| 435 | public function send_voucher($pid,$verification_coupon_ids,$order_id,$time){ | 453 | public function send_voucher($pid,$verification_coupon_ids,$order_id,$time){ |
| @@ -466,8 +484,8 @@ class Wechat extends Api | @@ -466,8 +484,8 @@ class Wechat extends Api | ||
| 466 | public function grant_red_packets($pid=0,$order_id=0){ | 484 | public function grant_red_packets($pid=0,$order_id=0){ |
| 467 | try{ | 485 | try{ |
| 468 | //测试 https://coupon.xp.yn.cn/api/v1/wechat/grant_red_packets | 486 | //测试 https://coupon.xp.yn.cn/api/v1/wechat/grant_red_packets |
| 469 | - $order_id = 58; | ||
| 470 | - $pid = 2; | 487 | + //$order_id = 58; |
| 488 | + //$pid = 2; | ||
| 471 | //测试结束 | 489 | //测试结束 |
| 472 | $send_result = 0; | 490 | $send_result = 0; |
| 473 | $verification_order = Db::name('verification_order')->where(['id'=>$order_id])->find(); | 491 | $verification_order = Db::name('verification_order')->where(['id'=>$order_id])->find(); |
-
请 注册 或 登录 后发表评论