...
|
...
|
@@ -60,10 +60,11 @@ class Pay extends Api |
|
|
$update['transaction_id'] = $notify->transaction_id;
|
|
|
//判断用户是否有邀请人
|
|
|
$invite = Db::name('user')->where('id',$order['user_id'])->find();
|
|
|
//没有邀请人
|
|
|
if(empty($invite['invite_id'])){
|
|
|
// 用户是否支付成功
|
|
|
if ($successful) {
|
|
|
if(empty($order['coupon_id'])){
|
|
|
if(!empty($order['coupon_id'])){
|
|
|
//修改优惠劵为已使用
|
|
|
Db::name('coupon')->where('id',$order['coupon_id'])->update(['is_use'=>1]);
|
|
|
}
|
...
|
...
|
@@ -74,6 +75,8 @@ class Pay extends Api |
|
|
$update['expirationtime'] = $update['paytime'] + 86400*7;
|
|
|
$update['finish_status'] = 1;
|
|
|
Db::name('teacher')->where('id',$order['teacher_id'])->setInc('help_num');
|
|
|
Db::name('teacher')->where('id',$order['teacher_id'])->setInc('count');
|
|
|
Db::name('territory')->where('id',$order['territory_id'])->setInc('buynum');
|
|
|
// 创建融云用户、群组
|
|
|
$teacher_id = Db::name('teacher')->where('id',$order['teacher_id'])->value('user_id');
|
|
|
$rongyun_chat = $this->rongyun_handle($order['user_id'].','.$teacher_id,$order['id']);
|
...
|
...
|
@@ -88,6 +91,7 @@ class Pay extends Api |
|
|
Db::commit();
|
|
|
return true; // 返回处理完成
|
|
|
}else{
|
|
|
//有邀请人
|
|
|
//判断邀请的用户是否第一次购买
|
|
|
$is_one = Db::name('order')->where('user_id',$order['user_id'])->where('status',2)->find();
|
|
|
|
...
|
...
|
@@ -111,6 +115,8 @@ class Pay extends Api |
|
|
$coupon['expirationtime'] = $coupon['createtime']+7*86400;
|
|
|
Db::name('coupon')->insertGetId($coupon);
|
|
|
Db::name('teacher')->where('id',$order['teacher_id'])->setInc('help_num');
|
|
|
Db::name('teacher')->where('id',$order['teacher_id'])->setInc('count');
|
|
|
Db::name('territory')->where('id',$order['territory_id'])->setInc('buynum');
|
|
|
// 创建融云用户、群组
|
|
|
$teacher_id = Db::name('teacher')->where('id',$order['teacher_id'])->value('user_id');
|
|
|
$rongyun_chat = $this->rongyun_handle($order['user_id'].','.$teacher_id,$order['id']);
|
...
|
...
|
@@ -138,6 +144,8 @@ class Pay extends Api |
|
|
$update['expirationtime'] = $update['paytime'] + 86400*7;
|
|
|
$update['finish_status'] = 1;
|
|
|
Db::name('teacher')->where('id',$order['teacher_id'])->setInc('help_num');
|
|
|
Db::name('teacher')->where('id',$order['teacher_id'])->setInc('count');
|
|
|
Db::name('territory')->where('id',$order['territory_id'])->setInc('buynum');
|
|
|
// 创建融云用户、群组
|
|
|
$teacher_id = Db::name('teacher')->where('id',$order['teacher_id'])->value('user_id');
|
|
|
|
...
|
...
|
@@ -179,7 +187,7 @@ class Pay extends Api |
|
|
}
|
|
|
// 用户是否支付成功
|
|
|
if ($successful) {
|
|
|
if(empty($order['coupon_id'])){
|
|
|
if(!empty($order['coupon_id'])){
|
|
|
//修改优惠劵为已使用
|
|
|
Db::name('coupon')->where('id',$order['coupon_id'])->update(['is_use'=>1]);
|
|
|
}
|
...
|
...
|
@@ -203,6 +211,8 @@ class Pay extends Api |
|
|
->where('id',$order['order_id'])
|
|
|
->update(['expirationtime'=>$update['paytime'] + 86400*7,'finish_status'=>1]);
|
|
|
}
|
|
|
Db::name('teacher')->where('id',$info['teacher_id'])->setInc('count');
|
|
|
Db::name('territory')->where('id',$info['territory_id'])->setInc('buynum');
|
|
|
} else { // 用户支付失败
|
|
|
$update['status']=1;
|
|
|
}
|
...
|
...
|
|