|
|
|
@ -274,8 +274,11 @@ class CouponRebateService implements CouponRebateServiceInterface |
|
|
|
->whereIn('r.system_coupon_user_id',$coupon_ids) |
|
|
|
->select('r.user_id', 'r.send_user_id') |
|
|
|
->first(); |
|
|
|
/* 如果使用的优惠券为转发活动优惠券 则给赠送者返一张优惠券*/ |
|
|
|
if ($coupon) { |
|
|
|
/* 如果使用的优惠券为转发活动优惠券 |
|
|
|
**则给赠送者返一张优惠券 |
|
|
|
* **自己给自己转发的券不给返券 |
|
|
|
*/ |
|
|
|
if ($coupon && ($coupon->user_id != $coupon->send_user_id)) { |
|
|
|
//是否已返过券
|
|
|
|
$exists_coupon_rebate = Db::table('ims_system_coupon_user_receive') |
|
|
|
->where([ |
|
|
|
@ -341,6 +344,14 @@ class CouponRebateService implements CouponRebateServiceInterface |
|
|
|
->where('id', $active['repay']) |
|
|
|
->increment('inventory_use'); |
|
|
|
|
|
|
|
//添加领取记录到ssdb
|
|
|
|
$data = [ |
|
|
|
'msg', '领券', |
|
|
|
'order_id',$order_id, |
|
|
|
'user_id' , $coupon->user_id, |
|
|
|
'send_usr_id' , $coupon->send_user_id |
|
|
|
]; |
|
|
|
$ssdb->execWithoutTask('multi_hset', SsdbKeysPrefix::COUPON_REBATE_LIST, $data); |
|
|
|
// 提交
|
|
|
|
Db::commit(); |
|
|
|
} catch (\Exception $e) { |
|
|
|
@ -348,7 +359,7 @@ class CouponRebateService implements CouponRebateServiceInterface |
|
|
|
Db::rollBack(); |
|
|
|
$log_Data = array(); |
|
|
|
$log_Data['name'] = '返券'; |
|
|
|
$log_Data['order_main_id'] = $order_id; |
|
|
|
$log_Data['order_id'] = $order_id; |
|
|
|
$log_Data['msg'] = '返券失败'; |
|
|
|
$this->log->event( |
|
|
|
LogLabel::COUPON_LOG, |
|
|
|
|