44323
2023-12-23 aa2c6d722ed799290285b6365f011aaa74373d73
cloud-server-other/src/main/java/com/dsh/other/controller/GameController.java
@@ -10,15 +10,13 @@
import com.dsh.other.feignclient.account.AppUserClient;
import com.dsh.other.feignclient.account.model.AppUser;
import com.dsh.other.model.QueryMySiteVo;
import com.dsh.other.service.ISiteLockService;
import com.dsh.other.service.TGameConfigService;
import com.dsh.other.service.TGameRecordService;
import com.dsh.other.service.TGameService;
import com.dsh.other.service.*;
import com.dsh.other.util.*;
import com.dsh.other.util.httpClinet.HttpResult;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import net.bytebuddy.asm.Advice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -123,8 +121,9 @@
            return ResultUtil.runErr();
        }
    }
    private String smid = "2088330203191220";//平台支付宝商户号
    @Autowired
    private ISiteService siteService;
    @ResponseBody
    @PostMapping("/payGame")
    @ApiOperation(value = "支付游戏", tags = {"用户—游戏"})
@@ -212,10 +211,21 @@
                return weixinpay;
            } else if (type == 2) {
//                Integer gameId, Integer configId,Integer type,Integer sutuId,Integer spaceId;
                String smid1="";
                String params = uid + "_" + gameId + "_" + spaceId + "_" + sutuId+"_"+code+"_"+configId;
                // 判断这个课包属于哪个门店 属于哪个运营商 根据运营商 id 获取对应的商户号
                TGame game = gameService.getById(gameId);
                String params = uid + "_" + gameId + "_" + spaceId + "_" + sutuId;
                Integer operationId = game.getOperationId();
                if (operationId==0){
                    // 是平台的
                    smid1 = smid;
                }else{
                    String smidByOperatorId = siteService.getSMIDByOperatorId(operationId);
                    smid1 = smidByOperatorId;
                }
                ResultUtil alipay = payMoneyUtil.alipay("游戏支付", "游戏支付", params, code, config.getCash().toString(), "/base/site/gameCallback");
                ResultUtil alipay = payMoneyUtil.alipay(smid1,"游戏支付", "游戏支付", params, code, config.getCash().toString(), "/base/site/gameCallback");
                if (alipay.getCode() == 200) {
                    new Thread(new Runnable() {
                        @Override
@@ -253,7 +263,6 @@
                                                coursePackagePayment.setStatus(1);
                                                coursePackagePayment.setMoney(config.getCash());
                                                coursePackagePayment.setOrderNo(tradeNo);
                                                CourseCounsum courseCounsum = new CourseCounsum();
//                                                courseCounsum.setPaymentId(paymentId);
                                                courseCounsum.setChangeType(3);
@@ -261,10 +270,21 @@
                                                courseCounsum.setReason("智慧球场;" + config.getCash());
                                                courseCounsum.setAppUserId(uid);
                                                courseRecordClient.save(courseCounsum);
                                            }
                                            gameRecordService.updateBatchById(list);
                                            Integer integer = startGame(uid, gameId, spaceId, sutuId);
                                            // 判断这个课包属于哪个门店 属于哪个运营商 根据运营商 id 获取对应的商户号
                                            TGame game = gameService.getById(gameId);
                                            String smid2="";
                                            Integer operationId = game.getOperationId();
                                            if (operationId==0){
                                                // 是平台的
                                                smid2 = smid;
                                            }else{
                                                String smidByOperatorId = siteService.getSMIDByOperatorId(operationId);
                                                smid2 = smidByOperatorId;
                                            }
                                            payMoneyUtil.confirm(smid2,code,tradeNo,config.getCash().toString());
                                            break;
                                        }
                                        if ("WAIT_BUYER_PAY".equals(s)) {
@@ -333,6 +353,7 @@
        JSONObject jsonObject = JSONObject.parseObject(s);
        Object code = jsonObject.get("code");
        if (String.valueOf(code) != null && "200".equals(String.valueOf(code))) {
            System.err.println("--------------启动了一次游戏");
            return 200;
        } else {
            return 500;