...
|
...
|
@@ -427,9 +427,27 @@ class Wechat extends Api |
|
|
|
|
|
//发放 对应活动的礼品券
|
|
|
public function send_gift_certificate($pid,$verification_coupon_ids,$order_id,$time){
|
|
|
$w1 = [];
|
|
|
$w1['id'] = ['in',$verification_coupon_ids];
|
|
|
$coupon = Db::name('verification_coupon')->where($w1)->select();
|
|
|
$order_info = Db::name('verification_order')->where(['id'=>$order_id])->find();
|
|
|
$store = Db::name('verification_store')->where(['id'=>$order_info['verification_store_id']])->find();
|
|
|
//获取门店下的礼品券
|
|
|
if(empty($store['verification_coupon_id'])){
|
|
|
$coupon = Db::name('verification_coupon')->where(['id'=>$store['verification_coupon_id']])->find();
|
|
|
//发送给pid用户
|
|
|
$save = [];
|
|
|
$save['verification_coupon_id'] = $store['verification_coupon_id'];
|
|
|
$save['verification_store_id'] = $store['id'];
|
|
|
$save['user_id'] = $pid;
|
|
|
|
|
|
$save['type'] = 0;//使用情况
|
|
|
$save['closetime'] = $coupon['closetime'];
|
|
|
$save['receive_no'] = $time.uniqid();
|
|
|
$res = (new \app\api\controller\v1\Index())->build($save['receive_no']);
|
|
|
$save['qr_code'] = $res;//二维码
|
|
|
$save['createtime'] = $time;
|
|
|
$save['verification_order_id'] = $order_id;
|
|
|
$save['coupon_type'] = $coupon['type'];
|
|
|
|
|
|
}
|
|
|
}
|
|
|
//发放 对应活动包含的券
|
|
|
public function send_voucher($pid,$verification_coupon_ids,$order_id,$time){
|
...
|
...
|
@@ -466,8 +484,8 @@ class Wechat extends Api |
|
|
public function grant_red_packets($pid=0,$order_id=0){
|
|
|
try{
|
|
|
//测试 https://coupon.xp.yn.cn/api/v1/wechat/grant_red_packets
|
|
|
$order_id = 58;
|
|
|
$pid = 2;
|
|
|
//$order_id = 58;
|
|
|
//$pid = 2;
|
|
|
//测试结束
|
|
|
$send_result = 0;
|
|
|
$verification_order = Db::name('verification_order')->where(['id'=>$order_id])->find();
|
...
|
...
|
|