|
|
@@ -8,6 +8,7 @@ import com.bizzan.bitrade.service.CoinNetworkService;
|
|
|
import com.bizzan.bitrade.service.CoinService;
|
|
|
import com.bizzan.bitrade.util.MessageResult;
|
|
|
import com.bizzan.bitrade.vo.CoinChildWithNetworkVO;
|
|
|
+import com.bizzan.bitrade.vo.CoinRechargeConfigVO;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
|
@@ -146,6 +147,52 @@ public class CoinNetworkController extends BaseController {
|
|
|
@ApiImplicitParams({
|
|
|
@ApiImplicitParam(name = "coinName", value = "顶级币种名称,如 USDT", required = true, dataType = "string", paramType = "query")
|
|
|
})
|
|
|
+ /**
|
|
|
+ * 充值:查询顶级币种下已在 coin_network_config 配置的可选主网
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "充值可选主网", notes = "按 coin_network_config + coin 表查询,返回该顶级币种下已配置且可充值的主网")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "coinName", value = "顶级币种名称,如 USDT", required = true, dataType = "string", paramType = "query")
|
|
|
+ })
|
|
|
+ @GetMapping("recharge-networks")
|
|
|
+ public MessageResult listRechargeNetworks(@RequestParam("coinName") String coinName) {
|
|
|
+ if (StringUtils.isBlank(coinName)) {
|
|
|
+ return error("币种名称不能为空");
|
|
|
+ }
|
|
|
+ Coin parent = coinService.findOne(coinName);
|
|
|
+ if (parent == null) {
|
|
|
+ return error("币种不存在:" + coinName);
|
|
|
+ }
|
|
|
+ return success(coinNetworkConfigService.findRechargeNetworksByParent(coinName));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 充值:按主网 ID 从 coin_network_config 查询子币种列表
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "充值可选子币种", notes = "按 networkId 查询 coin_network_config,仅返回 parentCoinName=coinName 的可充值子币")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "coinName", value = "顶级币种名称,如 USDT", required = true, dataType = "string", paramType = "query"),
|
|
|
+ @ApiImplicitParam(name = "networkId", value = "主网ID coin_network.id", required = true, dataType = "long", paramType = "query")
|
|
|
+ })
|
|
|
+ @GetMapping("recharge-configs")
|
|
|
+ public MessageResult listRechargeConfigs(@RequestParam("coinName") String coinName,
|
|
|
+ @RequestParam("networkId") Long networkId) {
|
|
|
+ if (StringUtils.isBlank(coinName) || networkId == null) {
|
|
|
+ return error("参数不能为空");
|
|
|
+ }
|
|
|
+ Coin parent = coinService.findOne(coinName);
|
|
|
+ if (parent == null) {
|
|
|
+ return error("币种不存在:" + coinName);
|
|
|
+ }
|
|
|
+ CoinNetwork network = coinNetworkService.findById(networkId);
|
|
|
+ if (network == null) {
|
|
|
+ return error("主网不存在");
|
|
|
+ }
|
|
|
+ List<CoinRechargeConfigVO> configs =
|
|
|
+ coinNetworkConfigService.findRechargeConfigsByParentAndNetwork(coinName, networkId);
|
|
|
+ return success(configs);
|
|
|
+ }
|
|
|
+
|
|
|
@GetMapping("children-with-network")
|
|
|
public MessageResult listChildrenWithNetwork(@RequestParam("coinName") String coinName) {
|
|
|
if (StringUtils.isBlank(coinName)) {
|