Merge branch 'develop' of https://gitee.com/fusenpack/fusenapi into develop

This commit is contained in:
eson 2023-10-26 10:21:56 +08:00
commit 99aa49ece5
4 changed files with 18 additions and 6 deletions

View File

@ -89,8 +89,12 @@ func (p *FsProductModel) GetRandomProductList(ctx context.Context, limit int) (r
return resp, err return resp, err
} }
func (p *FsProductModel) GetIgnoreRandomProductList(ctx context.Context, limit int, notInProductIds []int64) (resp []FsProduct, err error) { func (p *FsProductModel) GetIgnoreRandomProductList(ctx context.Context, limit int, notInProductIds []int64) (resp []FsProduct, err error) {
err = p.db.WithContext(ctx).Model(&FsProduct{}). db := p.db.WithContext(ctx).Model(&FsProduct{}).
Where("`is_del` =? and `is_shelf` = ? and `id` not in(?)", 0, 1, notInProductIds).Order("RAND()").Limit(limit).Find(&resp).Error Where("`is_del` =? and `is_shelf` = ? ", 0, 1)
if len(notInProductIds) > 0 {
db = db.Where("`id` not in(?)", notInProductIds)
}
err = db.Order("RAND()").Limit(limit).Find(&resp).Error
return resp, err return resp, err
} }
func (p *FsProductModel) FindAllOnlyByIds(ctx context.Context, ids []int64) (resp []FsProduct, err error) { func (p *FsProductModel) FindAllOnlyByIds(ctx context.Context, ids []int64) (resp []FsProduct, err error) {

View File

@ -3,6 +3,7 @@ package logic
import ( import (
"encoding/json" "encoding/json"
"errors" "errors"
"fmt"
"fusenapi/constants" "fusenapi/constants"
"fusenapi/model/gmodel" "fusenapi/model/gmodel"
"fusenapi/utils/auth" "fusenapi/utils/auth"
@ -64,6 +65,7 @@ func (l *GetRecommendProductListLogic) GetRecommendProductList(req *types.GetRec
recommendProductList = recommendProductList[:req.Num] recommendProductList = recommendProductList[:req.Num]
} }
} }
fmt.Println(recommendProductList)
//资源id集合 //资源id集合
resourceIds := make([]string, 0, 50) resourceIds := make([]string, 0, 50)
//需要填充时需要忽略的id //需要填充时需要忽略的id

View File

@ -81,7 +81,13 @@ func (l *UploadFileBackendLogic) UploadFileBackend(req *types.UploadFileBackendR
MysqlConn: l.svcCtx.MysqlConn, MysqlConn: l.svcCtx.MysqlConn,
AwsSession: l.svcCtx.AwsSession, AwsSession: l.svcCtx.AwsSession,
} }
var resourceId string = hash.JsonHashKey(req.FileKey) var resourceId string
if len(req.FileKey) == 64 {
resourceId = req.FileKey
} else {
resourceId = hash.JsonHashKey(req.FileKey)
}
uploadRes, err := upload.UploadFileByByte(&file.UploadBaseReq{ uploadRes, err := upload.UploadFileByByte(&file.UploadBaseReq{
FileHash: resourceId, FileHash: resourceId,
FileByte: ioData, FileByte: ioData,

View File

@ -136,9 +136,9 @@ func (d *defaultShoppingCart) CaculateStepPrice(purchaseQuantity int64, stepPric
//遍历查询合适的价格 //遍历查询合适的价格
for k, v := range stepPrice.PriceRange { for k, v := range stepPrice.PriceRange {
//购买数量>起点 //购买数量>起点
if purchaseQuantity > v.StartQuantity { if purchaseQuantity >= v.StartQuantity {
//最后一个 || 小于等于终点 //最后一个 || 小于终点
if k == l-1 || purchaseQuantity <= v.EndQuantity { if k == l-1 || purchaseQuantity < v.EndQuantity {
itemPrice = v.Price + fittingPrice itemPrice = v.Price + fittingPrice
return itemPrice * purchaseQuantity, itemPrice, nil return itemPrice * purchaseQuantity, itemPrice, nil
} }