feat: 增加宠物蛋结果计算和金币检查逻辑
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user