- 新增可提现余额和不可提现余额字段,完善账户余额结构 - 添加充值接口支持微信和支付宝支付方式 - 实现token消费转换扣费功能,支持AI模型调用计费 - 增加管理员赠送金额接口,仅管理员可调用 - 完善交易记录查询功能,支持用户查看历史交易明细 - 集成模型价格服务,实现token费用自动计算 - 重构余额增加逻辑,区分可提现和不可提现金额 - 优化账户实体类初始化逻辑,确保余额字段正确设置 - 更新交易记录实体类,新增token相关和收支类型字段 - 修改支付配置,更新微信和支付宝回调地址为生产环境域名
114 lines
3.7 KiB
Java
114 lines
3.7 KiB
Java
package com.kexue.skills.controller;
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.kexue.skills.entity.ModelPrice;
|
|
import com.kexue.skills.entity.dto.ModelPriceDto;
|
|
import com.kexue.skills.service.ModelPriceService;
|
|
import com.kexue.skills.common.CommonResult;
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import javax.annotation.Resource;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* (ModelPrice)表控制层
|
|
* 大模型Token价格表
|
|
*
|
|
* @author 王志维
|
|
* @since 2026-03-26 10:15:00
|
|
*/
|
|
@RestController
|
|
@RequestMapping("/api/modelPrice")
|
|
@Tag(name = "大模型Token价格表管理", description = "大模型Token价格表管理接口")
|
|
public class ModelPriceController {
|
|
@Resource
|
|
private ModelPriceService modelPriceService;
|
|
|
|
/**
|
|
* 分页查询
|
|
*
|
|
* @param queryDto 筛选条件
|
|
* @return 查询结果
|
|
*/
|
|
@Operation(summary = "分页查询", description = "分页查询大模型Token价格表")
|
|
@PostMapping("/getPageList")
|
|
public CommonResult<PageInfo<ModelPrice>> getPageList(@RequestBody ModelPriceDto queryDto) {
|
|
return CommonResult.success(this.modelPriceService.getPageList(queryDto));
|
|
}
|
|
|
|
/**
|
|
* 查询列表
|
|
*
|
|
* @param queryDto 筛选条件
|
|
* @return 查询结果
|
|
*/
|
|
@Operation(summary = "查询列表", description = "查询大模型Token价格表列表")
|
|
@PostMapping("/getList")
|
|
public CommonResult<List<ModelPrice>> getList(@RequestBody ModelPriceDto queryDto) {
|
|
return CommonResult.success(this.modelPriceService.getList(queryDto));
|
|
}
|
|
|
|
/**
|
|
* 通过主键查询单条数据
|
|
*
|
|
* @param id 主键
|
|
* @return 实例对象
|
|
*/
|
|
@Operation(summary = "通过主键查询", description = "通过主键查询大模型Token价格表")
|
|
@GetMapping("/queryById/{id}")
|
|
public CommonResult<ModelPrice> queryById(@PathVariable("id") Long id) {
|
|
return CommonResult.success(this.modelPriceService.queryById(id));
|
|
}
|
|
|
|
/**
|
|
* 通过模型名称查询数据
|
|
*
|
|
* @param modelName 模型名称
|
|
* @return 实例对象
|
|
*/
|
|
@Operation(summary = "通过模型名称查询", description = "通过模型名称查询大模型Token价格表")
|
|
@GetMapping("/queryByModelName/{modelName}")
|
|
public CommonResult<ModelPrice> queryByModelName(@PathVariable("modelName") String modelName) {
|
|
return CommonResult.success(this.modelPriceService.queryByModelName(modelName));
|
|
}
|
|
|
|
/**
|
|
* 新增数据
|
|
*
|
|
* @param modelPrice 实例对象
|
|
* @return 实例对象
|
|
*/
|
|
@Operation(summary = "新增数据", description = "新增大模型Token价格表")
|
|
@PostMapping("/insert")
|
|
public CommonResult<ModelPrice> insert(@RequestBody ModelPrice modelPrice) {
|
|
return CommonResult.success(this.modelPriceService.insert(modelPrice));
|
|
}
|
|
|
|
/**
|
|
* 更新数据
|
|
*
|
|
* @param modelPrice 实例对象
|
|
* @return 实例对象
|
|
*/
|
|
@Operation(summary = "更新数据", description = "更新大模型Token价格表")
|
|
@PostMapping("/update")
|
|
public CommonResult<ModelPrice> update(@RequestBody ModelPrice modelPrice) {
|
|
return CommonResult.success(this.modelPriceService.update(modelPrice));
|
|
}
|
|
|
|
/**
|
|
* 通过主键删除数据
|
|
*
|
|
* @param id 主键
|
|
* @return 影响行数
|
|
*/
|
|
@Operation(summary = "通过主键删除", description = "通过主键删除大模型Token价格表")
|
|
@PostMapping("/deleteById/{id}")
|
|
public CommonResult<Integer> deleteById(@PathVariable("id") Long id) {
|
|
return CommonResult.success(this.modelPriceService.deleteById(id));
|
|
}
|
|
|
|
}
|