11
This commit is contained in:
parent
7fa7b868ca
commit
e042cf209d
|
@ -13,6 +13,7 @@ import (
|
|||
"fusenapi/utils/file"
|
||||
"fusenapi/utils/hash"
|
||||
"gorm.io/gorm"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
|
@ -53,9 +54,9 @@ func (l *AddToCartLogic) AddToCart(req *types.AddToCartReq, userinfo *auth.UserI
|
|||
if cartCount >= 100 {
|
||||
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "sorry,the count of your carts can`t greater than 100")
|
||||
}
|
||||
if req.RenderImage != "" {
|
||||
//不是传路径则就是传base64
|
||||
if !strings.Contains(req.RenderImage, "https://") {
|
||||
//上传base64文件
|
||||
// 上传文件
|
||||
var upload = file.Upload{
|
||||
Ctx: l.ctx,
|
||||
MysqlConn: l.svcCtx.MysqlConn,
|
||||
|
@ -270,6 +271,10 @@ func (l *AddToCartLogic) AddToCartParamVerify(req *types.AddToCartReq) error {
|
|||
if req.PurchaseQuantity <= 0 {
|
||||
return errors.New("purchase quantity can not less than 0 or equal 0")
|
||||
}
|
||||
req.RenderImage = strings.Trim(req.RenderImage, " ")
|
||||
if req.RenderImage == "" {
|
||||
return errors.New("render image is required")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user