@@ -0,0 +1,75 @@
package com.czg.controller ;
import com.czg.resp.CzgResult ;
import com.czg.sa.StpKit ;
import com.czg.service.order.dto.VipPayParamDTO ;
import com.czg.service.order.service.PayService ;
import com.czg.utils.ServletUtil ;
import jakarta.annotation.Resource ;
import jakarta.servlet.http.HttpServletRequest ;
import org.springframework.validation.annotation.Validated ;
import org.springframework.web.bind.annotation.PostMapping ;
import org.springframework.web.bind.annotation.RequestBody ;
import org.springframework.web.bind.annotation.RequestMapping ;
import org.springframework.web.bind.annotation.RestController ;
import java.util.Map ;
/**
* 会员 支付
*
* @author ww
* @description
*/
@RestController
@RequestMapping ( " /pay " )
public class VipPayController {
@Resource
private PayService payService ;
/**
* js支付
* payType 必填 支付方式, aliPay 支付宝, wechatPay 微信
* openId 必填
*/
@PostMapping ( " jsPayVip " )
public CzgResult < Map < String , Object > > jsPayVip ( HttpServletRequest request , @Validated @RequestBody VipPayParamDTO payParam ) {
payParam . setUserId ( StpKit . USER . getLoginIdAsLong ( ) ) ;
payParam . setPlatformType ( ServletUtil . getHeaderIgnoreCase ( ServletUtil . getRequest ( ) , " platformType " ) ) ;
return payService . jsPayVip ( ServletUtil . getClientIPByHeader ( request ) , payParam ) ;
}
/**
* 小程序支付
* payType 必填 支付方式, aliPay 支付宝, wechatPay 微信
* openId 必填
*/
@PostMapping ( " ltPayVip " )
public CzgResult < Map < String , Object > > ltPayVip ( HttpServletRequest request , @Validated @RequestBody VipPayParamDTO payParam ) {
payParam . setUserId ( StpKit . USER . getLoginIdAsLong ( ) ) ;
payParam . setPlatformType ( ServletUtil . getHeaderIgnoreCase ( ServletUtil . getRequest ( ) , " platformType " ) ) ;
return payService . ltPayVip ( ServletUtil . getClientIPByHeader ( request ) , payParam ) ;
}
/**
* 正扫
*/
@PostMapping ( " scanPayVip " )
public CzgResult < Map < String , Object > > scanPayVip ( HttpServletRequest request , @Validated @RequestBody VipPayParamDTO payParam ) {
payParam . setUserId ( StpKit . USER . getLoginIdAsLong ( ) ) ;
payParam . setPlatformType ( ServletUtil . getHeaderIgnoreCase ( ServletUtil . getRequest ( ) , " platformType " ) ) ;
return payService . scanPayVip ( ServletUtil . getClientIPByHeader ( request ) , payParam ) ;
}
/**
* 反扫
* authCode 必填 扫描码
*/
@PostMapping ( " microPayVip " )
public CzgResult < Map < String , Object > > microPayVip ( @Validated @RequestBody VipPayParamDTO payParam ) {
payParam . setUserId ( StpKit . USER . getLoginIdAsLong ( ) ) ;
payParam . setPlatformType ( ServletUtil . getHeaderIgnoreCase ( ServletUtil . getRequest ( ) , " platformType " ) ) ;
return payService . microPayVip ( payParam ) ;
}
}