|
@@ -564,6 +564,21 @@ class ServiceOrderLogic extends BaseLogic
|
|
|
public static function orderPayInfo($params)
|
|
public static function orderPayInfo($params)
|
|
|
{
|
|
{
|
|
|
try {
|
|
try {
|
|
|
|
|
+
|
|
|
|
|
+ //判断是否存在优惠券
|
|
|
|
|
+ $is_coupon_used = \app\common\model\recharge\RechargeOrder::where([
|
|
|
|
|
+ 'order_type' => 0,
|
|
|
|
|
+ 'user_id' => $params['user_id'],
|
|
|
|
|
+ 'sn'=>$params['sn']
|
|
|
|
|
+ ])->findOrEmpty();
|
|
|
|
|
+ if(!empty($is_coupon_used['coupon_id']) && $is_coupon_used['pay_status'] == 0){
|
|
|
|
|
+ $user_coupon = UserCoupon::where(['user_id'=>$is_coupon_used->user_id,'id'=>$is_coupon_used->coupon_id])->findOrEmpty();
|
|
|
|
|
+ $user_coupon->voucher_status = 0;
|
|
|
|
|
+ $user_coupon->voucher_count = $user_coupon->voucher_count+1;
|
|
|
|
|
+ $user_coupon->save();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
$order_info = \app\common\model\recharge\RechargeOrder::with(['order_goods'=>function ($query) {
|
|
$order_info = \app\common\model\recharge\RechargeOrder::with(['order_goods'=>function ($query) {
|
|
|
$query->visible(['goods_payment_type','goods_category_id']);
|
|
$query->visible(['goods_payment_type','goods_category_id']);
|
|
|
},'service_work'=>function ($query) {
|
|
},'service_work'=>function ($query) {
|