game-api/ff-game/src/main/java/com/ff/api/controller/ApiTenantController.java

54 lines
1.6 KiB
Java

package com.ff.api.controller;
import com.ff.annotation.CheckHeader;
import com.ff.api.response.TenantInfoResponse;
import com.ff.base.core.controller.BaseController;
import com.ff.base.core.domain.AjaxResult;
import com.ff.base.enums.QuotaType;
import com.ff.base.utils.bean.BeanUtils;
import com.ff.common.domain.TenantGameQuota;
import com.ff.base.system.domain.TenantSecretKey;
import com.ff.common.service.ITenantGameQuotaService;
import com.ff.config.KeyConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* api控制器
*
* @author shi
* @date 2025/02/10
*/
@RestController
@CheckHeader
@RequestMapping("/api/tenant")
@Slf4j
public class ApiTenantController extends BaseController {
@Resource
private ITenantGameQuotaService tenantGameQuotaService;
@Resource
private KeyConfig keyConfig;
/**
* 信息
*
* @return {@link AjaxResult }
*/
@PostMapping("/info")
public AjaxResult info() {
TenantSecretKey tenantSecretKey = keyConfig.get();
TenantGameQuota tenantGameQuota = tenantGameQuotaService.selectTenantGameQuotaByTenantKey(tenantSecretKey.getTenantKey(), QuotaType.BALANCE.getCode());
TenantInfoResponse tenantInfoResponse= new TenantInfoResponse();
BeanUtils.copyProperties(tenantGameQuota,tenantInfoResponse);
return AjaxResult.success(tenantInfoResponse);
}
}