package org.jeecg.modules.adweb.quota.controller;

import lombok.extern.slf4j.Slf4j;

import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.adweb.quota.service.IResourceQuotaService;
import org.jeecg.modules.adweb.quota.vo.ResourceQuotaVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 用户资源额度 - 临时站数量、AI算力、外贸大数据等
 *
 * @author wfansh
 */
@RestController
@RequestMapping("/resourceQuota")
@Slf4j
public class ResourceQuotaController {

    @Autowired private IResourceQuotaService resourceQuotaService;

    @GetMapping("/getByUid")
    @ResponseBody
    public Result<ResourceQuotaVO> getByUid(@RequestParam String uid) {
        return Result.OK(resourceQuotaService.getResourceQuotaByUid(uid));
    }

    @PostMapping("/update")
    public Result<Boolean> update(@RequestBody ResourceQuotaVO resourceQuotaVO) {
        return Result.OK(resourceQuotaService.updateResourceQuota(resourceQuotaVO));
    }
}
