This commit is contained in:
laodaming 2023-06-27 14:28:52 +08:00
parent c5bcf9d676
commit 3a2fb3bc5d
2 changed files with 5 additions and 3 deletions

View File

@ -1,6 +1,9 @@
package config
import "github.com/zeromicro/go-zero/rest"
import (
"fusenapi/server/inventory/internal/types"
"github.com/zeromicro/go-zero/rest"
)
type Config struct {
rest.RestConf

View File

@ -11,7 +11,6 @@ import (
"fusenapi/utils/auth"
"fusenapi/utils/basic"
"fusenapi/utils/snow_id_generator"
"github.com/bwmarrin/snowflake"
"gorm.io/gorm"
"time"
@ -88,7 +87,7 @@ func (l *TakeLogic) Take(req *types.TakeReq, userinfo *auth.UserInfo) (resp *bas
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, fmt.Sprintf("row %d inventory data`s take num can`be less than 0", k+1))
}
//获取库存信息(枷锁)
stockInfo, err := l.svcCtx.AllModels.FsUserStock.FindOne(l.ctx, v.Id, userinfo.UserId, true)
stockInfo, err := l.svcCtx.AllModels.FsUserStock.FindOne(l.ctx, formItem.Id, userinfo.UserId, true)
if err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
return resp.SetStatusWithMessage(basic.CodeDbRecordNotFoundErr, fmt.Sprintf("row %d inventory data is not availabled for you", k+1))