feat: 增加宠物蛋结果计算和金币检查逻辑
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
xinian
2026-03-18 11:14:55 +08:00
committed by cnb
parent e7098e3777
commit e2ac5a6325
4 changed files with 14 additions and 4 deletions

View File

@@ -3,10 +3,12 @@ package admin
import (
"blazing/common/data"
"blazing/cool"
base "blazing/modules/base/service"
config "blazing/modules/config/service"
"blazing/modules/player/model"
"blazing/modules/player/service"
"context"
"fmt"
"github.com/gogf/gf/v2/frame/g"
)
@@ -98,6 +100,14 @@ func (c *PetBagController) ModPrise(ctx context.Context, req *PriseReq) (res *co
if req.Price < 5 {
req.Price = 5
}
if req.IsSale == 1 {
if base.NewBaseSysUserService().GetFreeGold(admin.UserId) < 0 {
err = fmt.Errorf("金币不足")
return
}
}
err = service.NewPetService(uint32(admin.UserId)).UPdatePrice(req.Ctime, req.Price, req.IsSale)
return