puzhibing
2024-03-06 a2ca8c0889a39ebd83195d5d2ebe8e2ed20b16d5
cloud-server-other/src/main/java/com/dsh/other/controller/GameController.java
@@ -18,10 +18,7 @@
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.math.BigDecimal;
@@ -165,7 +162,9 @@
    private String smid = "2088330203191220";//平台支付宝商户号
    @Autowired
    private ISiteService siteService;
@@ -263,8 +262,21 @@
                }
                return weixinpay;
            } else if (type == 2) {
                String params = uid + "_" + gameId + "_" + spaceId + "_" + sutuId + "_" + code + "_" + configId;
                ResultUtil alipay = payMoneyUtil.alipay("游戏支付", "游戏支付", params, code, config.getCash().toString(), "/base/site/gameCallback");
                String smid1="";
                String params = uid + "_" + gameId + "_" + spaceId + "_" + sutuId+"_"+code+"_"+configId;
                // 判断这个课包属于哪个门店 属于哪个运营商 根据运营商 id 获取对应的商户号
                TGame game = gameService.getById(gameId);
                Integer operationId = game.getOperationId();
                if (operationId==0){
                    // 是平台的
                    smid1 = smid;
                }else{
                    String smidByOperatorId = siteService.getSMIDByOperatorId(operationId);
                    smid1 = smidByOperatorId;
                }
                ResultUtil alipay = payMoneyUtil.alipay(smid1,"游戏支付", "游戏支付", params, code, config.getCash().toString(), "/base/site/gameCallback");
                if (alipay.getCode() == 200) {
                    new Thread(new Runnable() {
                        @Override
@@ -310,6 +322,18 @@
                                            }
                                            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)) {
@@ -384,4 +408,15 @@
    }
    /**
     * 根据sutuid获取游戏数据
     * @param sutuId
     * @return
     */
    @ResponseBody
    @PostMapping("/getTGameBySutuId")
    public TGame getTGameBySutuId(@RequestBody String sutuId){
        return gameService.getOne(new QueryWrapper<TGame>().eq("blue", sutuId).or()
                .eq("red", sutuId).eq("state", 0));
    }
}