Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/master'

kk 1 mese fa
parent
commit
57997c6367
18 ha cambiato i file con 1319 aggiunte e 23 eliminazioni
  1. 136 0
      game-business/src/main/java/com/game/business/controller/AppChargeChannelController.java
  2. 6 6
      game-business/src/main/java/com/game/business/controller/AppUserAgentController.java
  3. 41 4
      game-business/src/main/java/com/game/business/controller/AppUserController.java
  4. 130 0
      game-business/src/main/java/com/game/business/domain/AppChargeChannel.java
  5. 1 1
      game-business/src/main/java/com/game/business/domain/AppGameCommission.java
  6. 7 1
      game-business/src/main/java/com/game/business/dto/UserChargeDto.java
  7. 61 0
      game-business/src/main/java/com/game/business/mapper/AppChargeChannelMapper.java
  8. 61 0
      game-business/src/main/java/com/game/business/service/IAppChargeChannelService.java
  9. 95 0
      game-business/src/main/java/com/game/business/service/impl/AppChargeChannelServiceImpl.java
  10. 1 1
      game-business/src/main/java/com/game/business/service/impl/AppGameCommissionServiceImpl.java
  11. 9 1
      game-business/src/main/java/com/game/business/service/impl/AppUserAgentServiceImpl.java
  12. 1 1
      game-business/src/main/java/com/game/business/task/AppAgentGameBettingTask.java
  13. 1 1
      game-business/src/main/java/com/game/business/task/AppUserCountTask.java
  14. 133 0
      game-business/src/main/resources/mapper/business/AppChargeChannelMapper.xml
  15. 44 0
      game-ui/src/api/business/channel.js
  16. 8 0
      game-ui/src/api/business/user.js
  17. 444 0
      game-ui/src/views/business/channel/index.vue
  18. 140 7
      game-ui/src/views/business/user/index.vue

+ 136 - 0
game-business/src/main/java/com/game/business/controller/AppChargeChannelController.java

@@ -0,0 +1,136 @@
+package com.game.business.controller;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import com.game.common.core.domain.R;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.game.common.annotation.Log;
+import com.game.common.core.controller.BaseController;
+import com.game.common.core.domain.AjaxResult;
+import com.game.common.enums.BusinessType;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import com.game.business.domain.AppChargeChannel;
+import com.game.business.service.IAppChargeChannelService;
+import com.game.common.utils.poi.ExcelUtil;
+import com.game.common.core.page.TableDataInfo;
+
+/**
+ * 充值渠道Controller
+ * 
+ * @author game
+ * @date 2024-08-13
+ */
+@RestController
+@RequestMapping("/business/channel")
+@Api(value = "AppChargeChannelController", description = "充值渠道接口", tags = {"充值渠道"})
+public class AppChargeChannelController extends BaseController
+{
+    @Autowired
+    private IAppChargeChannelService appChargeChannelService;
+
+    /**
+     * 查询充值渠道列表
+     */
+    @PreAuthorize("@ss.hasPermi('business:channel:list')")
+    @GetMapping("/list")
+    @ApiOperation(value = "查询充值渠道列表", notes = "获取充值渠道列表")
+    public TableDataInfo<AppChargeChannel> list(AppChargeChannel appChargeChannel)
+    {
+        startPage();
+        List<AppChargeChannel> list = appChargeChannelService.selectAppChargeChannelList(appChargeChannel);
+        return getDataTable(list);
+    }
+
+    /**
+     * 查询充值渠道列表
+     */
+    @GetMapping("/allList")
+    @ApiOperation(value = "查询充值渠道列表", notes = "获取充值渠道列表")
+    public R<List<AppChargeChannel>> allList(AppChargeChannel appChargeChannel)
+    {
+        appChargeChannel.setStatus(1L);
+        List<AppChargeChannel> list = appChargeChannelService.selectAppChargeChannelList(appChargeChannel);
+        if(null == list){
+            list = new ArrayList<>();
+        }
+        AppChargeChannel chargeChannel = new AppChargeChannel();
+        chargeChannel.setId(-1L);
+        chargeChannel.setName("其他");
+        chargeChannel.setRate(0.00);
+        list.add(chargeChannel);
+        return R.ok(list);
+    }
+
+    /**
+     * 导出充值渠道列表
+     */
+    @PreAuthorize("@ss.hasPermi('business:channel:export')")
+    @Log(title = "充值渠道", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    @ApiOperation(value = "导出充值渠道列表", notes = "导出充值渠道列表")
+    public void export(HttpServletResponse response, AppChargeChannel appChargeChannel)
+    {
+        List<AppChargeChannel> list = appChargeChannelService.selectAppChargeChannelList(appChargeChannel);
+        ExcelUtil<AppChargeChannel> util = new ExcelUtil<AppChargeChannel>(AppChargeChannel.class);
+        util.exportExcel(response, list, "充值渠道数据");
+    }
+
+    /**
+     * 获取充值渠道详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('business:channel:query')")
+    @GetMapping(value = "/{id}")
+    @ApiOperation(value = "获取充值渠道详细信息", notes = "获取充值渠道详细信息")
+    public R<AppChargeChannel> getInfo(@PathVariable("id") Long id)
+    {
+        return R.ok(appChargeChannelService.selectAppChargeChannelById(id));
+    }
+
+    /**
+     * 新增充值渠道
+     */
+    @PreAuthorize("@ss.hasPermi('business:channel:add')")
+    @Log(title = "充值渠道", businessType = BusinessType.INSERT)
+    @ApiOperation(value = "新增充值渠道", notes = "新增充值渠道")
+    @PostMapping
+    public R add(@RequestBody AppChargeChannel appChargeChannel)
+    {
+        return R.ok(appChargeChannelService.insertAppChargeChannel(appChargeChannel));
+    }
+
+    /**
+     * 修改充值渠道
+     */
+    @PreAuthorize("@ss.hasPermi('business:channel:edit')")
+    @Log(title = "充值渠道", businessType = BusinessType.UPDATE)
+    @ApiOperation(value = "修改充值渠道", notes = "修改充值渠道")
+    @PutMapping
+    public R edit(@RequestBody AppChargeChannel appChargeChannel)
+    {
+        return R.ok(appChargeChannelService.updateAppChargeChannel(appChargeChannel));
+    }
+
+    /**
+     * 删除充值渠道
+     */
+    @PreAuthorize("@ss.hasPermi('business:channel:remove')")
+    @Log(title = "充值渠道", businessType = BusinessType.DELETE)
+    @ApiOperation(value = "删除充值渠道", notes = "删除充值渠道")
+	@DeleteMapping("/{ids}")
+    public R remove(@PathVariable Long[] ids)
+    {
+        return R.ok(appChargeChannelService.deleteAppChargeChannelByIds(ids));
+    }
+}

+ 6 - 6
game-business/src/main/java/com/game/business/controller/AppUserAgentController.java

@@ -124,14 +124,14 @@ public class AppUserAgentController extends BaseController
                 appGameCommission.setUserId(appUserAgent.getUserId());
                 appGameCommission.setPid(appUserAgent.getPid());
                 appGameCommission.setGameId(appGame.getId());
-                appGameCommission.setGameRate(0L);
+                appGameCommission.setGameRate(0.00);
 
                 if(appGameCommissionService.save(appGameCommission)){
                     AppGameCommissionVO appGameCommissionVO = new AppGameCommissionVO();
                     appGameCommissionVO.setId(appGameCommission.getId());
                     appGameCommissionVO.setPid(dbPuserAgent.getUserId());
                     appGameCommissionVO.setUserId(appUser.getUserid());
-                    appGameCommissionVO.setGameRate(0L);
+                    appGameCommissionVO.setGameRate(0.00);
 
                     appGameCommissionVO.setGameId(appGame.getId());
                     appGameCommissionVO.setGameName(appGame.getName());
@@ -244,7 +244,7 @@ public class AppUserAgentController extends BaseController
                     AppGameCommission gameCommission = idGameMap.get(appGame.getId()).get(0);
                     BeanUtils.copyProperties(gameCommission, appGameCommissionVO);
                 }else{
-                    appGameCommissionVO.setGameRate(0L);
+                    appGameCommissionVO.setGameRate(0.00);
                 }
 
                 appGameCommissionVO.setGameId(appGame.getId());
@@ -347,7 +347,7 @@ public class AppUserAgentController extends BaseController
                     AppGameCommission gameCommission = idGameMap.get(appGame.getId()).get(0);
                     BeanUtils.copyProperties(gameCommission, appGameCommissionVO);
                 }else{
-                    appGameCommissionVO.setGameRate(0L);
+                    appGameCommissionVO.setGameRate(0.00);
                 }
 
                 appGameCommissionVO.setGameId(appGame.getId());
@@ -362,7 +362,7 @@ public class AppUserAgentController extends BaseController
                     AppGameCommission gameCommission = idGamePMap.get(appGame.getId()).get(0);
                     BeanUtils.copyProperties(gameCommission, appGamePCommissionVO);
                 }else{
-                    appGamePCommissionVO.setGameRate(100L);
+                    appGamePCommissionVO.setGameRate(100.00);
                 }
                 appGamePCommissionVO.setGameId(appGame.getId());
 
@@ -416,7 +416,7 @@ public class AppUserAgentController extends BaseController
                 AppGame appGame = gameList.get(i);
 
                 AppGameCommissionVO appGameCommissionVO = new AppGameCommissionVO();
-                appGameCommissionVO.setGameRate(0L);
+                appGameCommissionVO.setGameRate(0.00);
                 appGameCommissionVO.setGameId(appGame.getId());
 
                 setGameCommissionMinRate(appGameCommissionVO, userId);

+ 41 - 4
game-business/src/main/java/com/game/business/controller/AppUserController.java

@@ -7,10 +7,12 @@ import javax.servlet.http.HttpServletResponse;
 
 import cn.hutool.core.util.IdUtil;
 import cn.hutool.core.util.RandomUtil;
+import com.game.business.domain.AppChargeChannel;
 import com.game.business.domain.AppUsersCharge;
 import com.game.business.domain.FinTranRecord;
 import com.game.business.dto.RestPwdDto;
 import com.game.business.dto.UserChargeDto;
+import com.game.business.service.IAppChargeChannelService;
 import com.game.business.service.IAppUsersChargeService;
 import com.game.business.util.Md5Utils;
 import com.game.common.constant.AppSceneType;
@@ -24,6 +26,7 @@ import com.game.common.core.redis.RedisCache;
 import com.game.common.utils.SecurityUtils;
 import lombok.extern.log4j.Log4j2;
 import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
@@ -69,6 +72,9 @@ public class AppUserController extends BaseController
     @Autowired
     private RedisCache redisCache;
 
+    @Autowired
+    private IAppChargeChannelService appChargeChannelService;
+
     /**
      * 查询app用户列表
      */
@@ -121,6 +127,18 @@ public class AppUserController extends BaseController
         if(null == appUser){
             return R.fail("充值失败,用户不存在");
         }
+        String remark = "后台充值";
+
+        if(null == userChargeDto.getChannelId() || -1 == userChargeDto.getChannelId().longValue()){
+            remark = "后台充值";
+        }else{
+            AppChargeChannel channel = appChargeChannelService.selectAppChargeChannelById(userChargeDto.getChannelId());
+            if(null == channel){
+                return R.fail("充值渠道错误");
+            }
+            userChargeDto.setRate(channel.getRate());
+            remark = "后台充值补单,渠道:".concat(channel.getName());
+        }
         //流水 余额
         FinTranAddedInfo addedInfo = FinTranAddedInfo.createTranInfo(appUser.getUserid(), 0, 0, AppSceneType.Scene_None, "");
         FinTranRecord tran = null;
@@ -133,9 +151,28 @@ public class AppUserController extends BaseController
             tran.setDiamondCoinChange(userChargeDto.getAmount());
             tran.setCurrencyType(TranCurrencyType.Balance.getType());
         }
-        tran.setRemarks("后台充值");
+        tran.setRemarks(remark);
+
         try {
             appUserService.updateUserAmount(tran);
+            BigDecimal rate = BigDecimal.ZERO;
+            if(null != userChargeDto.getRate() && userChargeDto.getRate() > 0 && userChargeDto.getAmount() > 0){
+                //扣除手续费
+                FinTranRecord rateTran = new FinTranRecord();
+                BeanUtils.copyProperties(tran,rateTran);
+                if(TranCurrencyType.Balance.getType() == rateTran.getCurrencyType()){
+                    rate = BigDecimal.valueOf(rateTran.getDiamondCoinChange() * userChargeDto.getRate()).setScale(2,BigDecimal.ROUND_HALF_UP);
+                    rateTran.setDiamondCoinChange(rate.doubleValue() * -1);
+                }else if(TranCurrencyType.Coin.getType() == rateTran.getCurrencyType()){
+                    rate = BigDecimal.valueOf(rateTran.getCoinChange() * userChargeDto.getRate()).setScale(2,BigDecimal.ROUND_HALF_UP);
+                    rateTran.setCoinChange(rate.doubleValue() * -1);
+                }
+                rateTran.setTranType3(FinTranType3.CHARGE_OUT_RATE.getType());
+                rateTran.setTranType2(FinTranType3.CHARGE_OUT_RATE.getTranType2().getType());
+                rateTran.setTranType1(userChargeDto.getType() == 1?FinTranType1.U_Outcome_Balance.getType():FinTranType1.U_Outcome_Coin.getType());
+                rateTran.setRemarks("充值手续费");
+                appUserService.updateUserAmount(rateTran);
+            }
             AppUser afterUser = appUserService.selectAppUserByUserid(userChargeDto.getUserId());
             //充值记录
             AppUsersCharge appUsersCharge = new AppUsersCharge();
@@ -143,7 +180,7 @@ public class AppUserController extends BaseController
             appUsersCharge.setTouid(appUser.getUserid());
             appUsersCharge.setUid(appUser.getUserid());
 
-            appUsersCharge.setCoin(BigDecimal.valueOf(userChargeDto.getAmount()));
+            appUsersCharge.setCoin(BigDecimal.valueOf(userChargeDto.getAmount() - rate.doubleValue()));
             appUsersCharge.setCoinType(Long.parseLong(String.valueOf(userChargeDto.getType())));
             appUsersCharge.setOrderno(IdUtil.fastUUID());
             // 充值成功
@@ -157,8 +194,8 @@ public class AppUserController extends BaseController
             // 操作类型 1:充值金币 2:扣减金币
             appUsersCharge.setOptType(userChargeDto.getAmount()<0?2L:1L);
             appUsersCharge.setAddtime(new Date());
-            appUsersCharge.setPlatformService(0.00);
-            appUsersCharge.setPlatformServiceRate(0.00);
+            appUsersCharge.setPlatformService(rate.doubleValue());
+            appUsersCharge.setPlatformServiceRate(userChargeDto.getRate());
             appUsersCharge.setCoinGive(BigDecimal.valueOf(0));
             appUsersCharge.setAfterCoin(userChargeDto.getType()==0?BigDecimal.valueOf(afterUser.getCoin()):BigDecimal.valueOf(afterUser.getDiamondCoin()));
             appUsersChargeService.insertAppUsersCharge(appUsersCharge);

+ 130 - 0
game-business/src/main/java/com/game/business/domain/AppChargeChannel.java

@@ -0,0 +1,130 @@
+package com.game.business.domain;
+
+import java.math.BigDecimal;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.game.common.annotation.Excel;
+import com.game.common.core.domain.BaseEntity;
+import io.swagger.annotations.ApiModelProperty;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+/**
+ * 充值渠道对象 app_charge_channel
+ *
+ * @author game
+ * @date 2024-08-13
+ */
+@ApiModel(value = "app_charge_channel", description = "充值渠道")
+@TableName(value= "app_charge_channel")
+@Data
+public class AppChargeChannel
+        {
+private static final long serialVersionUID=1L;
+
+    /** $column.columnComment */
+    @ApiModelProperty(value = "$column.columnComment")
+    @TableId(value = "id" , type = IdType.AUTO)
+    private Long id;
+
+    /** 名称 */
+    @ApiModelProperty(value = "名称")
+    @Excel(name = "名称")
+    @TableField(value = "name")
+    private String name;
+
+    /** 渠道key */
+    @ApiModelProperty(value = "渠道key")
+    @Excel(name = "渠道key")
+    @TableField(value = "channel_key")
+    private String channelKey;
+
+    /** 渠道费率 */
+    @ApiModelProperty(value = "渠道费率")
+    @Excel(name = "渠道费率")
+    @TableField(value = "rate")
+    private Double rate;
+
+    /** logo */
+    @ApiModelProperty(value = "logo")
+    @Excel(name = "logo")
+    @TableField(value = "logo_url")
+    private String logoUrl;
+
+    /** 付款公司名 */
+    @ApiModelProperty(value = "付款公司名")
+    @Excel(name = "付款公司名")
+    @TableField(value = "company")
+    private String company;
+
+    /** 支付id */
+    @ApiModelProperty(value = "支付id")
+    @Excel(name = "支付id")
+    @TableField(value = "app_id")
+    private String appId;
+
+    /** 支付秘钥 */
+    @ApiModelProperty(value = "支付秘钥")
+    @Excel(name = "支付秘钥")
+    @TableField(value = "app_secret")
+    private String appSecret;
+
+    /** 第三方支付url */
+    @ApiModelProperty(value = "第三方支付url")
+    @Excel(name = "第三方支付url")
+    @TableField(value = "third_url")
+    private String thirdUrl;
+
+    /** 是否开启 0:未开启  1:开启 */
+    @ApiModelProperty(value = "是否开启 0:未开启  1:开启")
+    @Excel(name = "是否开启 0:未开启  1:开启")
+    @TableField(value = "status")
+    private Long status;
+
+    /** 证书地址 */
+    @ApiModelProperty(value = "证书地址")
+    @Excel(name = "证书地址")
+    @TableField(value = "cert_path")
+    private String certPath;
+
+    /** 阿里公钥证书地址 */
+    @ApiModelProperty(value = "阿里公钥证书地址")
+    @Excel(name = "阿里公钥证书地址")
+    @TableField(value = "ali_public_cert")
+    private String aliPublicCert;
+
+    /** 阿里应用公钥证书地址 */
+    @ApiModelProperty(value = "阿里应用公钥证书地址")
+    @Excel(name = "阿里应用公钥证书地址")
+    @TableField(value = "ali_apply_cert")
+    private String aliApplyCert;
+
+    /** 阿里ca根证书地址 */
+    @ApiModelProperty(value = "阿里ca根证书地址")
+    @Excel(name = "阿里ca根证书地址")
+    @TableField(value = "ali_ca_cert")
+    private String aliCaCert;
+
+    /** 商户号 */
+    @ApiModelProperty(value = "商户号")
+    @Excel(name = "商户号")
+    @TableField(value = "merchant_no")
+    private String merchantNo;
+
+    /** api秘钥 */
+    @ApiModelProperty(value = "api秘钥")
+    @Excel(name = "api秘钥")
+    @TableField(value = "api_secret")
+    private String apiSecret;
+
+    /** 排序 */
+    @ApiModelProperty(value = "排序")
+    @Excel(name = "排序")
+    @TableField(value = "orderno")
+    private Long orderno;
+
+}

+ 1 - 1
game-business/src/main/java/com/game/business/domain/AppGameCommission.java

@@ -52,7 +52,7 @@ private static final long serialVersionUID=1L;
     @ApiModelProperty(value = "游戏返佣费率")
     @Excel(name = "游戏返佣费率")
     @TableField(value = "game_rate")
-    private Long gameRate;
+    private Double gameRate;
 
     @TableField(exist = false)
     @ApiModelProperty(value = "游戏名称")

+ 7 - 1
game-business/src/main/java/com/game/business/dto/UserChargeDto.java

@@ -6,7 +6,7 @@ import lombok.Data;
 import javax.validation.constraints.NotNull;
 import java.io.Serializable;
 
-@ApiModel("修改密码")
+@ApiModel("充值")
 @Data
 public class UserChargeDto implements Serializable {
 
@@ -19,4 +19,10 @@ public class UserChargeDto implements Serializable {
     @NotNull(message = "UID不能为空")
     private Long userId;
 
+//    @NotNull(message = "费率")
+    private Double rate = 0.00;
+
+//    @NotNull(message = "渠道id")
+    private Long channelId;
+
 }

+ 61 - 0
game-business/src/main/java/com/game/business/mapper/AppChargeChannelMapper.java

@@ -0,0 +1,61 @@
+package com.game.business.mapper;
+
+import java.util.List;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.game.business.domain.AppChargeChannel;
+
+/**
+ * 充值渠道Mapper接口
+ *
+ * @author game
+ * @date 2024-08-13
+ */
+public interface AppChargeChannelMapper extends BaseMapper<AppChargeChannel> {
+    /**
+     * 查询充值渠道
+     *
+     * @param id 充值渠道主键
+     * @return 充值渠道
+     */
+    public AppChargeChannel selectAppChargeChannelById(Long id);
+
+    /**
+     * 查询充值渠道列表
+     *
+     * @param appChargeChannel 充值渠道
+     * @return 充值渠道集合
+     */
+    public List<AppChargeChannel> selectAppChargeChannelList(AppChargeChannel appChargeChannel);
+
+    /**
+     * 新增充值渠道
+     *
+     * @param appChargeChannel 充值渠道
+     * @return 结果
+     */
+    public int insertAppChargeChannel(AppChargeChannel appChargeChannel);
+
+    /**
+     * 修改充值渠道
+     *
+     * @param appChargeChannel 充值渠道
+     * @return 结果
+     */
+    public int updateAppChargeChannel(AppChargeChannel appChargeChannel);
+
+    /**
+     * 删除充值渠道
+     *
+     * @param id 充值渠道主键
+     * @return 结果
+     */
+    public int deleteAppChargeChannelById(Long id);
+
+    /**
+     * 批量删除充值渠道
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteAppChargeChannelByIds(Long[] ids);
+}

+ 61 - 0
game-business/src/main/java/com/game/business/service/IAppChargeChannelService.java

@@ -0,0 +1,61 @@
+package com.game.business.service;
+
+import java.util.List;
+import com.game.business.domain.AppChargeChannel;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 充值渠道Service接口
+ *
+ * @author game
+ * @date 2024-08-13
+ */
+public interface IAppChargeChannelService extends IService<AppChargeChannel> {
+    /**
+     * 查询充值渠道
+     *
+     * @param id 充值渠道主键
+     * @return 充值渠道
+     */
+    public AppChargeChannel selectAppChargeChannelById(Long id);
+
+    /**
+     * 查询充值渠道列表
+     *
+     * @param appChargeChannel 充值渠道
+     * @return 充值渠道集合
+     */
+    public List<AppChargeChannel> selectAppChargeChannelList(AppChargeChannel appChargeChannel);
+
+    /**
+     * 新增充值渠道
+     *
+     * @param appChargeChannel 充值渠道
+     * @return 结果
+     */
+    public int insertAppChargeChannel(AppChargeChannel appChargeChannel);
+
+    /**
+     * 修改充值渠道
+     *
+     * @param appChargeChannel 充值渠道
+     * @return 结果
+     */
+    public int updateAppChargeChannel(AppChargeChannel appChargeChannel);
+
+    /**
+     * 批量删除充值渠道
+     *
+     * @param ids 需要删除的充值渠道主键集合
+     * @return 结果
+     */
+    public int deleteAppChargeChannelByIds(Long[] ids);
+
+    /**
+     * 删除充值渠道信息
+     *
+     * @param id 充值渠道主键
+     * @return 结果
+     */
+    public int deleteAppChargeChannelById(Long id);
+}

+ 95 - 0
game-business/src/main/java/com/game/business/service/impl/AppChargeChannelServiceImpl.java

@@ -0,0 +1,95 @@
+package com.game.business.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import java.util.List;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.game.business.mapper.AppChargeChannelMapper;
+import com.game.business.domain.AppChargeChannel;
+import com.game.business.service.IAppChargeChannelService;
+import com.game.common.annotation.DataSource;
+import com.game.common.enums.DataSourceType;
+
+/**
+ * 充值渠道Service业务层处理
+ *
+ * @author game
+ * @date 2024-08-13
+ */
+@Service
+public class AppChargeChannelServiceImpl extends ServiceImpl<AppChargeChannelMapper, AppChargeChannel> implements IAppChargeChannelService {
+    @Autowired
+    private AppChargeChannelMapper appChargeChannelMapper;
+
+    /**
+     * 查询充值渠道
+     *
+     * @param id 充值渠道主键
+     * @return 充值渠道
+     */
+    @Override
+    @DataSource(DataSourceType.SLAVE)
+    public AppChargeChannel selectAppChargeChannelById(Long id) {
+        return appChargeChannelMapper.selectAppChargeChannelById(id);
+    }
+
+    /**
+     * 查询充值渠道列表
+     *
+     * @param appChargeChannel 充值渠道
+     * @return 充值渠道
+     */
+    @Override
+    @DataSource(DataSourceType.SLAVE)
+    public List<AppChargeChannel> selectAppChargeChannelList(AppChargeChannel appChargeChannel) {
+        return appChargeChannelMapper.selectAppChargeChannelList(appChargeChannel);
+    }
+
+    /**
+     * 新增充值渠道
+     *
+     * @param appChargeChannel 充值渠道
+     * @return 结果
+     */
+    @Override
+    @DataSource(DataSourceType.SLAVE)
+    public int insertAppChargeChannel(AppChargeChannel appChargeChannel) {
+            return appChargeChannelMapper.insertAppChargeChannel(appChargeChannel);
+    }
+
+    /**
+     * 修改充值渠道
+     *
+     * @param appChargeChannel 充值渠道
+     * @return 结果
+     */
+    @Override
+    @DataSource(DataSourceType.SLAVE)
+    public int updateAppChargeChannel(AppChargeChannel appChargeChannel) {
+        return appChargeChannelMapper.updateAppChargeChannel(appChargeChannel);
+    }
+
+    /**
+     * 批量删除充值渠道
+     *
+     * @param ids 需要删除的充值渠道主键
+     * @return 结果
+     */
+    @Override
+    @DataSource(DataSourceType.SLAVE)
+    public int deleteAppChargeChannelByIds(Long[] ids) {
+        return appChargeChannelMapper.deleteAppChargeChannelByIds(ids);
+    }
+
+    /**
+     * 删除充值渠道信息
+     *
+     * @param id 充值渠道主键
+     * @return 结果
+     */
+    @Override
+    @DataSource(DataSourceType.SLAVE)
+    public int deleteAppChargeChannelById(Long id) {
+        return appChargeChannelMapper.deleteAppChargeChannelById(id);
+    }
+}

+ 1 - 1
game-business/src/main/java/com/game/business/service/impl/AppGameCommissionServiceImpl.java

@@ -125,7 +125,7 @@ public class AppGameCommissionServiceImpl extends ServiceImpl<AppGameCommissionM
                     //未设置过该游戏
                     AppGameCommission appGameCommission = new AppGameCommission();
                     appGameCommission.setGameId(game.getId());
-                    appGameCommission.setGameRate(0L);
+                    appGameCommission.setGameRate(0.00);
                     appGameCommission.setGameName(game.getName());
                     appGameCommission.setUserId(unId);
                     list.add(appGameCommission);

+ 9 - 1
game-business/src/main/java/com/game/business/service/impl/AppUserAgentServiceImpl.java

@@ -215,6 +215,14 @@ public class AppUserAgentServiceImpl extends ServiceImpl<AppUserAgentMapper, App
         }
         List<AppAgentTeamVo> list = appUserAgentMapper.teamListNew(teamDto);
         if(null != list && list.size() > 0){
+            list.forEach(e->{
+                List<AppUserAgent> appUserAgentList = appUserAgentMapper.selectAllAgentList(e.getUserId(),null,null,null);
+                if(null != appUserAgentList && appUserAgentList.size() > 0){
+                    e.setTeamNum(appUserAgentList.size());
+                }else{
+                    e.setTeamNum(0);
+                }
+            });
             List<Long> ids = list.stream().map(e->{return e.getUserId();}).collect(Collectors.toList());
             //查询游戏分红比例
             List<AppGameCommission> gameCommissionList = gameCommissionService.getByIds(ids);
@@ -238,7 +246,7 @@ public class AppUserAgentServiceImpl extends ServiceImpl<AppUserAgentMapper, App
                             gameCommission.setGameId(j.getId());
                             gameCommission.setGameName(j.getName());
                             gameCommission.setPid(e.getPid());
-                            gameCommission.setGameRate(0L);
+                            gameCommission.setGameRate(0.00);
                             return gameCommission;
                         }).collect(Collectors.toList()));
                     }

+ 1 - 1
game-business/src/main/java/com/game/business/task/AppAgentGameBettingTask.java

@@ -98,7 +98,7 @@ public class AppAgentGameBettingTask {
 
         AppGameCommission gameCommission = gameCommissions.get(0);
         if(gameCommission.getGameRate() == null){
-            gameCommission.setGameRate(0L);
+            gameCommission.setGameRate(0.00);
         }
 
         gameRateList.add(gameCommission);

+ 1 - 1
game-business/src/main/java/com/game/business/task/AppUserCountTask.java

@@ -207,7 +207,7 @@ public class AppUserCountTask {
             List<FinTranRecord> finTranRecordList = finTranRecordService.getUserRecordList(null!=userId?String.valueOf(userId):null, lastDateStr, endTimeStr);
             List<AppUserLiveDividedRecord> liveDividedRecordList = appUserLiveDividedRecordService.selectByDate(userId, lastDateStr, endTimeStr);
             if (null != list && list.size() > 0) {
-                List<AppUserCount> appUserCountList = new ArrayList<>();
+//                List<AppUserCount> appUserCountList = new ArrayList<>();
                 String finalDateTime = dateTime;
                 list.forEach(appUser -> {
                     AppUserCount appUserCount = new AppUserCount();

+ 133 - 0
game-business/src/main/resources/mapper/business/AppChargeChannelMapper.xml

@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.game.business.mapper.AppChargeChannelMapper">
+    
+    <resultMap type="com.game.business.domain.AppChargeChannel" id="AppChargeChannelResult">
+        <result property="id"    column="id"    />
+        <result property="name"    column="name"    />
+        <result property="channelKey"    column="channel_key"    />
+        <result property="rate"    column="rate"    />
+        <result property="logoUrl"    column="logo_url"    />
+        <result property="company"    column="company"    />
+        <result property="appId"    column="app_id"    />
+        <result property="appSecret"    column="app_secret"    />
+        <result property="thirdUrl"    column="third_url"    />
+        <result property="status"    column="status"    />
+        <result property="certPath"    column="cert_path"    />
+        <result property="aliPublicCert"    column="ali_public_cert"    />
+        <result property="aliApplyCert"    column="ali_apply_cert"    />
+        <result property="aliCaCert"    column="ali_ca_cert"    />
+        <result property="merchantNo"    column="merchant_no"    />
+        <result property="apiSecret"    column="api_secret"    />
+        <result property="orderno"    column="orderno"    />
+    </resultMap>
+
+    <sql id="selectAppChargeChannelVo">
+        select id, name, channel_key, rate, logo_url, company, app_id, app_secret, third_url, status, cert_path, ali_public_cert, ali_apply_cert, ali_ca_cert, merchant_no, api_secret, orderno from app_charge_channel
+    </sql>
+
+    <select id="selectAppChargeChannelList" parameterType="com.game.business.domain.AppChargeChannel" resultMap="AppChargeChannelResult">
+        <include refid="selectAppChargeChannelVo"/>
+        <where>  
+            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
+            <if test="channelKey != null  and channelKey != ''"> and channel_key = #{channelKey}</if>
+            <if test="rate != null "> and rate = #{rate}</if>
+            <if test="logoUrl != null  and logoUrl != ''"> and logo_url = #{logoUrl}</if>
+            <if test="company != null  and company != ''"> and company = #{company}</if>
+            <if test="appId != null  and appId != ''"> and app_id = #{appId}</if>
+            <if test="appSecret != null  and appSecret != ''"> and app_secret = #{appSecret}</if>
+            <if test="thirdUrl != null  and thirdUrl != ''"> and third_url = #{thirdUrl}</if>
+            <if test="status != null "> and status = #{status}</if>
+            <if test="certPath != null  and certPath != ''"> and cert_path = #{certPath}</if>
+            <if test="aliPublicCert != null  and aliPublicCert != ''"> and ali_public_cert = #{aliPublicCert}</if>
+            <if test="aliApplyCert != null  and aliApplyCert != ''"> and ali_apply_cert = #{aliApplyCert}</if>
+            <if test="aliCaCert != null  and aliCaCert != ''"> and ali_ca_cert = #{aliCaCert}</if>
+            <if test="merchantNo != null  and merchantNo != ''"> and merchant_no = #{merchantNo}</if>
+            <if test="apiSecret != null  and apiSecret != ''"> and api_secret = #{apiSecret}</if>
+            <if test="orderno != null "> and orderno = #{orderno}</if>
+        </where>
+    </select>
+    
+    <select id="selectAppChargeChannelById" parameterType="Long" resultMap="AppChargeChannelResult">
+        <include refid="selectAppChargeChannelVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertAppChargeChannel" parameterType="com.game.business.domain.AppChargeChannel">
+        insert into app_charge_channel
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">id,</if>
+            <if test="name != null">name,</if>
+            <if test="channelKey != null">channel_key,</if>
+            <if test="rate != null">rate,</if>
+            <if test="logoUrl != null">logo_url,</if>
+            <if test="company != null">company,</if>
+            <if test="appId != null">app_id,</if>
+            <if test="appSecret != null">app_secret,</if>
+            <if test="thirdUrl != null">third_url,</if>
+            <if test="status != null">status,</if>
+            <if test="certPath != null">cert_path,</if>
+            <if test="aliPublicCert != null">ali_public_cert,</if>
+            <if test="aliApplyCert != null">ali_apply_cert,</if>
+            <if test="aliCaCert != null">ali_ca_cert,</if>
+            <if test="merchantNo != null">merchant_no,</if>
+            <if test="apiSecret != null">api_secret,</if>
+            <if test="orderno != null">orderno,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">#{id},</if>
+            <if test="name != null">#{name},</if>
+            <if test="channelKey != null">#{channelKey},</if>
+            <if test="rate != null">#{rate},</if>
+            <if test="logoUrl != null">#{logoUrl},</if>
+            <if test="company != null">#{company},</if>
+            <if test="appId != null">#{appId},</if>
+            <if test="appSecret != null">#{appSecret},</if>
+            <if test="thirdUrl != null">#{thirdUrl},</if>
+            <if test="status != null">#{status},</if>
+            <if test="certPath != null">#{certPath},</if>
+            <if test="aliPublicCert != null">#{aliPublicCert},</if>
+            <if test="aliApplyCert != null">#{aliApplyCert},</if>
+            <if test="aliCaCert != null">#{aliCaCert},</if>
+            <if test="merchantNo != null">#{merchantNo},</if>
+            <if test="apiSecret != null">#{apiSecret},</if>
+            <if test="orderno != null">#{orderno},</if>
+         </trim>
+    </insert>
+
+    <update id="updateAppChargeChannel" parameterType="com.game.business.domain.AppChargeChannel">
+        update app_charge_channel
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="name != null">name = #{name},</if>
+            <if test="channelKey != null">channel_key = #{channelKey},</if>
+            <if test="rate != null">rate = #{rate},</if>
+            <if test="logoUrl != null">logo_url = #{logoUrl},</if>
+            <if test="company != null">company = #{company},</if>
+            <if test="appId != null">app_id = #{appId},</if>
+            <if test="appSecret != null">app_secret = #{appSecret},</if>
+            <if test="thirdUrl != null">third_url = #{thirdUrl},</if>
+            <if test="status != null">status = #{status},</if>
+            <if test="certPath != null">cert_path = #{certPath},</if>
+            <if test="aliPublicCert != null">ali_public_cert = #{aliPublicCert},</if>
+            <if test="aliApplyCert != null">ali_apply_cert = #{aliApplyCert},</if>
+            <if test="aliCaCert != null">ali_ca_cert = #{aliCaCert},</if>
+            <if test="merchantNo != null">merchant_no = #{merchantNo},</if>
+            <if test="apiSecret != null">api_secret = #{apiSecret},</if>
+            <if test="orderno != null">orderno = #{orderno},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteAppChargeChannelById" parameterType="Long">
+        delete from app_charge_channel where id = #{id}
+    </delete>
+
+    <delete id="deleteAppChargeChannelByIds" parameterType="String">
+        delete from app_charge_channel where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 44 - 0
game-ui/src/api/business/channel.js

@@ -0,0 +1,44 @@
+import request from '@/utils/request'
+
+// 查询充值渠道列表
+export function listChannel(query) {
+  return request({
+    url: '/business/channel/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询充值渠道详细
+export function getChannel(id) {
+  return request({
+    url: '/business/channel/' + id,
+    method: 'get'
+  })
+}
+
+// 新增充值渠道
+export function addChannel(data) {
+  return request({
+    url: '/business/channel',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改充值渠道
+export function updateChannel(data) {
+  return request({
+    url: '/business/channel',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除充值渠道
+export function delChannel(id) {
+  return request({
+    url: '/business/channel/' + id,
+    method: 'delete'
+  })
+}

+ 8 - 0
game-ui/src/api/business/user.js

@@ -16,6 +16,14 @@ export function listUser(query) {
     params: query
   })
 }
+// 查询app用户列表
+export function channelList() {
+  return request({
+    url: '/business/channel/allList',
+    method: 'get',
+    // params: query
+  })
+}
 
 // 查询app用户详细
 export function getUser(userid) {

+ 444 - 0
game-ui/src/views/business/channel/index.vue

@@ -0,0 +1,444 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="名称" prop="name">
+        <el-input
+          v-model="queryParams.name"
+          placeholder="请输入名称"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+<!--      <el-form-item label="渠道key" prop="channelKey">
+        <el-input
+          v-model="queryParams.channelKey"
+          placeholder="请输入渠道key"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="渠道费率" prop="rate">
+        <el-input
+          v-model="queryParams.rate"
+          placeholder="请输入渠道费率"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="logo" prop="logoUrl">
+        <el-input
+          v-model="queryParams.logoUrl"
+          placeholder="请输入logo"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="付款公司名" prop="company">
+        <el-input
+          v-model="queryParams.company"
+          placeholder="请输入付款公司名"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="支付id" prop="appId">
+        <el-input
+          v-model="queryParams.appId"
+          placeholder="请输入支付id"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="支付秘钥" prop="appSecret">
+        <el-input
+          v-model="queryParams.appSecret"
+          placeholder="请输入支付秘钥"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="第三方支付url" prop="thirdUrl">
+        <el-input
+          v-model="queryParams.thirdUrl"
+          placeholder="请输入第三方支付url"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="证书地址" prop="certPath">
+        <el-input
+          v-model="queryParams.certPath"
+          placeholder="请输入证书地址"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="阿里公钥证书地址" prop="aliPublicCert">
+        <el-input
+          v-model="queryParams.aliPublicCert"
+          placeholder="请输入阿里公钥证书地址"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="阿里应用公钥证书地址" prop="aliApplyCert">
+        <el-input
+          v-model="queryParams.aliApplyCert"
+          placeholder="请输入阿里应用公钥证书地址"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="阿里ca根证书地址" prop="aliCaCert">
+        <el-input
+          v-model="queryParams.aliCaCert"
+          placeholder="请输入阿里ca根证书地址"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="商户号" prop="merchantNo">
+        <el-input
+          v-model="queryParams.merchantNo"
+          placeholder="请输入商户号"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="api秘钥" prop="apiSecret">
+        <el-input
+          v-model="queryParams.apiSecret"
+          placeholder="请输入api秘钥"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="排序" prop="orderno">
+        <el-input
+          v-model="queryParams.orderno"
+          placeholder="请输入排序"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>-->
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['business:channel:add']"
+        >新增</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          plain
+          icon="el-icon-edit"
+          size="mini"
+          :disabled="single"
+          @click="handleUpdate"
+          v-hasPermi="['business:channel:edit']"
+        >修改</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="danger"
+          plain
+          icon="el-icon-delete"
+          size="mini"
+          :disabled="multiple"
+          @click="handleDelete"
+          v-hasPermi="['business:channel:remove']"
+        >删除</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          @click="handleExport"
+          v-hasPermi="['business:channel:export']"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table v-loading="loading" :data="channelList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+<!--      <el-table-column label="${comment}" align="center" prop="id" />-->
+      <el-table-column label="名称" align="center" prop="name" />
+<!--      <el-table-column label="渠道key" align="center" prop="channelKey" />-->
+      <el-table-column label="渠道费率" align="center" prop="rate" />
+<!--      <el-table-column label="logo" align="center" prop="logoUrl" />
+      <el-table-column label="付款公司名" align="center" prop="company" />
+      <el-table-column label="支付id" align="center" prop="appId" />
+      <el-table-column label="支付秘钥" align="center" prop="appSecret" />
+      <el-table-column label="第三方支付url" align="center" prop="thirdUrl" />
+      <el-table-column label="是否开启 0:未开启  1:开启" align="center" prop="status" />
+      <el-table-column label="证书地址" align="center" prop="certPath" />
+      <el-table-column label="阿里公钥证书地址" align="center" prop="aliPublicCert" />
+      <el-table-column label="阿里应用公钥证书地址" align="center" prop="aliApplyCert" />
+      <el-table-column label="阿里ca根证书地址" align="center" prop="aliCaCert" />
+      <el-table-column label="商户号" align="center" prop="merchantNo" />
+      <el-table-column label="api秘钥" align="center" prop="apiSecret" />-->
+      <el-table-column label="排序" align="center" prop="orderno" />
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['business:channel:edit']"
+          >修改</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['business:channel:remove']"
+          >删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改充值渠道对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="名称" prop="name">
+          <el-input v-model="form.name" placeholder="请输入名称" />
+        </el-form-item>
+<!--        <el-form-item label="渠道key" prop="channelKey">
+          <el-input v-model="form.channelKey" placeholder="请输入渠道key" />
+        </el-form-item>-->
+        <el-form-item label="渠道费率" prop="rate">
+          <el-input v-model="form.rate" placeholder="请输入渠道费率" />
+        </el-form-item>
+<!--        <el-form-item label="logo" prop="logoUrl">
+          <el-input v-model="form.logoUrl" placeholder="请输入logo" />
+        </el-form-item>
+        <el-form-item label="付款公司名" prop="company">
+          <el-input v-model="form.company" placeholder="请输入付款公司名" />
+        </el-form-item>
+        <el-form-item label="支付id" prop="appId">
+          <el-input v-model="form.appId" placeholder="请输入支付id" />
+        </el-form-item>
+        <el-form-item label="支付秘钥" prop="appSecret">
+          <el-input v-model="form.appSecret" placeholder="请输入支付秘钥" />
+        </el-form-item>
+        <el-form-item label="第三方支付url" prop="thirdUrl">
+          <el-input v-model="form.thirdUrl" placeholder="请输入第三方支付url" />
+        </el-form-item>
+        <el-form-item label="证书地址" prop="certPath">
+          <el-input v-model="form.certPath" placeholder="请输入证书地址" />
+        </el-form-item>
+        <el-form-item label="阿里公钥证书地址" prop="aliPublicCert">
+          <el-input v-model="form.aliPublicCert" placeholder="请输入阿里公钥证书地址" />
+        </el-form-item>
+        <el-form-item label="阿里应用公钥证书地址" prop="aliApplyCert">
+          <el-input v-model="form.aliApplyCert" placeholder="请输入阿里应用公钥证书地址" />
+        </el-form-item>
+        <el-form-item label="阿里ca根证书地址" prop="aliCaCert">
+          <el-input v-model="form.aliCaCert" placeholder="请输入阿里ca根证书地址" />
+        </el-form-item>
+        <el-form-item label="商户号" prop="merchantNo">
+          <el-input v-model="form.merchantNo" placeholder="请输入商户号" />
+        </el-form-item>
+        <el-form-item label="api秘钥" prop="apiSecret">
+          <el-input v-model="form.apiSecret" placeholder="请输入api秘钥" />
+        </el-form-item>-->
+        <el-form-item label="排序" prop="orderno">
+          <el-input v-model="form.orderno" placeholder="请输入排序" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listChannel, getChannel, delChannel, addChannel, updateChannel } from "@/api/business/channel";
+
+export default {
+  name: "Channel",
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 充值渠道表格数据
+      channelList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        name: null,
+        channelKey: null,
+        rate: null,
+        logoUrl: null,
+        company: null,
+        appId: null,
+        appSecret: null,
+        thirdUrl: null,
+        status: null,
+        certPath: null,
+        aliPublicCert: null,
+        aliApplyCert: null,
+        aliCaCert: null,
+        merchantNo: null,
+        apiSecret: null,
+        orderno: null
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+      }
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    /** 查询充值渠道列表 */
+    getList() {
+      this.loading = true;
+      listChannel(this.queryParams).then(response => {
+        this.channelList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        name: null,
+        channelKey: null,
+        rate: null,
+        logoUrl: null,
+        company: null,
+        appId: null,
+        appSecret: null,
+        thirdUrl: null,
+        status: null,
+        certPath: null,
+        aliPublicCert: null,
+        aliApplyCert: null,
+        aliCaCert: null,
+        merchantNo: null,
+        apiSecret: null,
+        orderno: null
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加充值渠道";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const id = row.id || this.ids
+      getChannel(id).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改充值渠道";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.id != null) {
+            updateChannel(this.form).then(response => {
+              this.$modal.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addChannel(this.form).then(response => {
+              this.$modal.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+      this.$modal.confirm('是否确认删除充值渠道编号为"' + ids + '"的数据项?').then(function() {
+        return delChannel(ids);
+      }).then(() => {
+        this.getList();
+        this.$modal.msgSuccess("删除成功");
+      }).catch(() => {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      this.download('business/channel/export', {
+        ...this.queryParams
+      }, `channel_${new Date().getTime()}.xlsx`)
+    }
+  }
+};
+</script>

+ 140 - 7
game-ui/src/views/business/user/index.vue

@@ -386,8 +386,8 @@
     </el-dialog>
 
     <!-- 充值对话框 -->
-    <el-dialog :title="title" :visible.sync="chargeopen" width="500px" append-to-body>
-      <el-form ref="chargeForm" :model="chargeForm" :rules="chargeRules" label-width="80px">
+    <el-dialog :title="title" :visible.sync="chargeopen" width="700px" append-to-body>
+      <el-form ref="chargeForm" :model="chargeForm" :rules="currentRules" :validate-on-rule-change=false label-width="150px">
         <el-form-item label="用户id" prop="userId">
           <el-input v-model="chargeForm.userId" disabled />
         </el-form-item>
@@ -402,8 +402,38 @@
           </el-select>
         </el-form-item>
         <el-form-item label="金额" prop="amount">
-          <el-input v-model="chargeForm.amount" placeholder="请输入密码" />
+          <el-input type="text" v-model="chargeForm.amount" placeholder="请输入金额" />
         </el-form-item>
+        <el-form-item label="是否扣除手续费" prop="isRate">
+          <el-select v-model="chargeForm.isRate" placeholder="请选择" clearable @change="isRateChange">
+            <el-option
+              v-for="dict in dict.type.app_charge_rate"
+              :key="dict.value"
+              :label="dict.label"
+              :value="dict.value"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="渠道(扣除对应渠道手续费)" prop="channelId" v-if="chargeForm.isRate==1">
+          <el-select v-model="chargeForm.channelId" placeholder="请选择" clearable @change="chargeChannel">
+            <el-option
+              v-for="dict in channelList"
+              :key="dict.value"
+              :label="dict.label"
+              :value="dict.value"
+            />
+          </el-select>
+          <span style="padding-left: 1rem;color: red;font-size: 12px" v-if="null != rate && undefined != rate">手续费:{{(rate*100) + "%"}}</span>
+        </el-form-item>
+<!--        <el-form-item label="手续费比例" prop="rate" v-show="chargeForm.isRate==1 && chargeForm.channelId == -1">
+          <el-input v-model="chargeForm.rate" placeholder="请输入手续费 (比如扣除10%,则填写0.1)" />
+        </el-form-item>-->
+        <template v-show="!isReadOnly">
+          <el-form-item label="手续费比例" prop="rate" >
+            <el-input type="number" v-model="chargeForm.rate" placeholder="请输入手续费 (比如扣除10%,则填写0.1)" :disabled="isReadOnly"/>
+          </el-form-item>
+        </template>
+
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="submitChargeForm">确 定</el-button>
@@ -414,11 +444,11 @@
 </template>
 
 <script>
-import { listUser, getUser, delUser, addUser, updateUser,resetUser,userCharge } from "@/api/business/user";
+import { listUser, getUser, delUser, addUser, updateUser,resetUser,userCharge,channelList } from "@/api/business/user";
 
 export default {
   name: "User",
-  dicts: ['is_anchor_auth', 'app_user_role', 'app_user_status', 'app_user_online_status','app_user_coin_type'],
+  dicts: ['is_anchor_auth', 'app_user_role', 'app_user_status', 'app_user_online_status','app_user_coin_type','app_charge_rate'],
   data() {
     return {
       // 遮罩层
@@ -443,6 +473,10 @@ export default {
       resetPwdopen: false,
       // 是否显示弹出层
       chargeopen: false,
+      channelList:[],
+      isReadOnly:true,
+      rate:null,
+      channelMap:{},
       // 查询参数
       queryParams: {
         pageNum: 1,
@@ -472,7 +506,7 @@ export default {
         pid: null,
         role: null,
         diamondCoin: null,
-        mobile:null
+        mobile:null,
       },
       // 表单参数
       form: {},
@@ -498,6 +532,9 @@ export default {
         type: [
           { required: true, message: "类型不能为空", trigger: "blur" }
         ],
+        isRate: [
+          { required: true, message: "请选择是否扣除手续费", trigger: "blur" }
+        ]
       },
       scrollLeft: 0
     };
@@ -505,6 +542,18 @@ export default {
   created() {
     this.getList();
   },
+  computed: {
+    currentRules:function(){
+      if(this.chargeForm.isRate == 1){
+        this.chargeRules["channelId"] = [
+          { required: true, message: "请选择充值渠道", trigger: "blur" }
+        ];
+      }else{
+        delete this.chargeRules["channelId"]
+      }
+      return this.chargeRules;
+    },
+  },
   methods: {
     /** 查询app用户列表 */
     getList() {
@@ -699,7 +748,10 @@ export default {
       this.chargeForm = {
         userId: null,
         amount: null,
-        type:null
+        type:null,
+        isRate:null,
+        rate:null,
+        channelId:null
       };
       this.resetForm("restPwdForm");
     },
@@ -748,6 +800,22 @@ export default {
     },
     /** 重置密码按钮操作 */
     handleCharge(row) {
+      var that = this;
+      that.channelList = [];
+      that.channelMap = {};
+      channelList().then(response => {
+        if(response.data){
+          for(var i in response.data){
+            var item = response.data[i];
+            that.channelMap[item.id] = item.rate;
+            that.channelList.push({
+              value:item.id,
+              label:item.name,
+              rate:item.rate
+            })
+          }
+        }
+      });
       this.resetCharge();
       const userid = row.userid;
       this.chargeForm = {
@@ -757,6 +825,21 @@ export default {
       };
       this.chargeopen = true;
       this.title = "充值";
+
+      /*this.$nextTick(()=>{
+        // 重置当前页面的所有字段值
+        this.$refs['chargeForm'].resetFields();
+
+        if (data){
+          // 模式1
+          this.form.patternType = 1;
+        }else{
+          // 模式2
+          this.form.patternType = 2;
+        }
+        // 设置校验规则
+        this.setValidRules(this.form.patternType);
+      })*/
     },
     /** 提交按钮 */
     submitForm() {
@@ -792,8 +875,17 @@ export default {
     },
     /** 充值提交按钮 */
     submitChargeForm() {
+      var that =this;
       this.$refs["chargeForm"].validate(valid => {
         if (valid) {
+          if(that.chargeForm.channelId == -1 && (undefined == that.chargeForm.rate || null == that.chargeForm.rate)){
+            this.$modal.msgError("请输入手续费比例");
+            return;
+          }
+          if(that.chargeForm.channelId == -1 &&  that.chargeForm.rate >= 1){
+            this.$modal.msgError("手续费比例超过最大值");
+            return;
+          }
           userCharge(this.chargeForm).then(response => {
             this.$modal.msgSuccess("修改成功");
             this.chargeopen = false;
@@ -821,6 +913,47 @@ export default {
     handleScroll(event) {
       // 当滚动时同步左右滚动
       this.scrollLeft = event.target.scrollLeft;
+    },
+    isRateChange(val){
+      let rule = {};
+      for(var i in this.chargeRules){
+        rule[i] = this.chargeRules[i];
+      }
+      this.chargeRules = {};
+      if(this.chargeForm.isRate == 1){
+        rule["channelId"] = [
+          { required: true, message: "请选择充值渠道", trigger: "blur" }
+        ];
+        /*rule["rate"] = [
+          { required: true, message: "请输入手续费比例", trigger: "blur" }
+        ];*/
+      }else{
+          delete rule["channelId"];
+          // delete rule["rate"];
+      }
+      this.chargeRules = rule;
+    },
+    chargeChannel(val){
+      let rule = {};
+      for(var i in this.chargeRules){
+        rule[i] = this.chargeRules[i];
+      }
+      this.chargeRules = {};
+      if(this.chargeForm.channelId == -1){
+        /*this.chargeForm.rate = null;
+        rule["rate"] = [
+          { required: true, message: "请输入手续费比例", trigger: "blur" }
+        ];*/
+        this.isReadOnly = false;
+        this.rate = null;
+      }else{
+        let rate = this.channelMap[this.chargeForm.channelId];
+        this.chargeForm.rate = rate;
+        // delete rule["rate"];
+        this.isReadOnly = true;
+        this.rate = rate;
+      }
+      // this.chargeRules = rule;
     }
   }
 };