Commit 3d349088 by 杨树贤

Merge branch 'ysx-寄售需求-20250710' into dev

parents b2fe0668 9e8faaa4
/go.sum
/.idea/
gowatch.yml
*.exe
*.exe~
cmd.exe~
/cmd/logs/
/cmd/*.exe~
/cmd/logs
/bat/logs/
/conf/prod/*.ini
/go.mod
/logs
/mylogs
/doc/test
/vm.sh
/cmd/http
/doc/spuTest
/doc/test3
/.history
/.vscode
...@@ -2,15 +2,16 @@ package controller ...@@ -2,15 +2,16 @@ package controller
import ( import (
"encoding/json" "encoding/json"
"github.com/gin-gonic/gin"
"github.com/gogf/gf/util/gconv"
"github.com/syyongx/php2go"
"go_sku_server/pkg/common" "go_sku_server/pkg/common"
"go_sku_server/pkg/gredis" "go_sku_server/pkg/gredis"
"go_sku_server/pkg/logger" "go_sku_server/pkg/logger"
"go_sku_server/service" "go_sku_server/service"
"sync" "sync"
"time" "time"
"github.com/gin-gonic/gin"
"github.com/gogf/gf/util/gconv"
"github.com/syyongx/php2go"
) )
const goodsSliceCount = 10 //每多少个型号id开启一个协程 const goodsSliceCount = 10 //每多少个型号id开启一个协程
...@@ -52,11 +53,16 @@ func CommonController(ctx *gin.Context) map[string]interface{} { ...@@ -52,11 +53,16 @@ func CommonController(ctx *gin.Context) map[string]interface{} {
return nil return nil
} }
ch := make(chan sync.Map) //管道 var wg sync.WaitGroup
p := 0 //总共协程 ch := make(chan sync.Map, 50) //管道
zyGoodsId := make([]string, 0)
lyGoodsId := make([]string, 0) zyGoodsId := make([]string, 0, goodsSliceCount)
lyGoodsId := make([]string, 0, goodsSliceCount)
for _, goodsId := range goodsIdArr { for _, goodsId := range goodsIdArr {
//if len(goodsIdArr) > 100 {
// common.Output(ctx, 1001, "查询型号ID不得超过100个", "")
// return nil
//}
if goodsId == "" { if goodsId == "" {
continue continue
} }
...@@ -65,20 +71,32 @@ func CommonController(ctx *gin.Context) map[string]interface{} { ...@@ -65,20 +71,32 @@ func CommonController(ctx *gin.Context) map[string]interface{} {
if len(zyGoodsId) >= goodsSliceCount { if len(zyGoodsId) >= goodsSliceCount {
common.PrintDebugHtml(ctx, "zy增加协程1001:") common.PrintDebugHtml(ctx, "zy增加协程1001:")
common.PrintDebugHtml(ctx, zyGoodsId) common.PrintDebugHtml(ctx, zyGoodsId)
//wg.Add(1) //协程计数一 wg.Add(1) //协程计数一
go zyService.ZyGoodsDetail(ctx, zyGoodsId, ch)
zyGoodsId = zyGoodsId[:0:0] idsToProcess := make([]string, len(zyGoodsId))
p++ copy(idsToProcess, zyGoodsId)
go func(ctx_in *gin.Context, goodsIds_in []string, chs_in chan sync.Map) {
defer wg.Done()
zyService.ZyGoodsDetail(ctx_in, goodsIds_in, chs_in)
}(ctx, idsToProcess, ch)
zyGoodsId = zyGoodsId[:0]
} }
} else { //联营 } else { //联营
lyGoodsId = append(lyGoodsId, goodsId) lyGoodsId = append(lyGoodsId, goodsId)
if len(lyGoodsId) >= goodsSliceCount { if len(lyGoodsId) >= goodsSliceCount {
common.PrintDebugHtml(ctx, "ly增加协程1002:") common.PrintDebugHtml(ctx, "ly增加协程1002:")
common.PrintDebugHtml(ctx, lyGoodsId) common.PrintDebugHtml(ctx, lyGoodsId)
//wg.Add(1) wg.Add(1)
go lyService.LyGoodsDetail(ctx, lyGoodsId, ch)
lyGoodsId = lyGoodsId[:0:0] idsToProcess := make([]string, len(lyGoodsId))
p++ copy(idsToProcess, lyGoodsId)
go func(ctx_in *gin.Context, goodsIds_in []string, chs_in chan sync.Map) {
defer wg.Done()
lyService.LyGoodsDetail(ctx_in, goodsIds_in, chs_in)
}(ctx, idsToProcess, ch)
lyGoodsId = lyGoodsId[:0]
} }
} }
} }
...@@ -86,35 +104,55 @@ func CommonController(ctx *gin.Context) map[string]interface{} { ...@@ -86,35 +104,55 @@ func CommonController(ctx *gin.Context) map[string]interface{} {
if len(zyGoodsId) > 0 { if len(zyGoodsId) > 0 {
common.PrintDebugHtml(ctx, "zy增加协程1003:") common.PrintDebugHtml(ctx, "zy增加协程1003:")
common.PrintDebugHtml(ctx, zyGoodsId) common.PrintDebugHtml(ctx, zyGoodsId)
//wg.Add(1) //协程计数一 wg.Add(1) //协程计数一
go zyService.ZyGoodsDetail(ctx, zyGoodsId, ch)
p++ idsToProcess := make([]string, len(zyGoodsId))
copy(idsToProcess, zyGoodsId)
go func(ctx_in *gin.Context, goodsIds_in []string, chs_in chan sync.Map) {
defer wg.Done()
zyService.ZyGoodsDetail(ctx_in, goodsIds_in, chs_in)
}(ctx, zyGoodsId, ch)
} }
if len(lyGoodsId) > 0 { if len(lyGoodsId) > 0 {
common.PrintDebugHtml(ctx, "ly增加协程1004:") common.PrintDebugHtml(ctx, "ly增加协程1004:")
common.PrintDebugHtml(ctx, zyGoodsId) common.PrintDebugHtml(ctx, lyGoodsId)
go lyService.LyGoodsDetail(ctx, lyGoodsId, ch) wg.Add(1)
p++
idsToProcess := make([]string, len(lyGoodsId))
copy(idsToProcess, lyGoodsId)
go func(ctx_in *gin.Context, goodsIds_in []string, chs_in chan sync.Map) {
defer wg.Done()
lyService.LyGoodsDetail(ctx_in, goodsIds_in, chs_in)
}(ctx, idsToProcess, ch)
} }
// 开启一个协程,等待所有任务完成,然后关闭channel
go func() {
wg.Wait()
close(ch)
}()
//异步map最后转成map //异步map最后转成map
temp := make(map[string]interface{}) temp := make(map[string]interface{})
for i := 0; i < p; i++ { timeout := time.After(time.Second * 20)
for {
select { select {
case GoodsRes := <-ch: case GoodsRes, ok := <-ch:
if !ok { // channel被关闭,说明所有协程都已执行完毕
return temp
}
GoodsRes.Range(func(k, v interface{}) bool { GoodsRes.Range(func(k, v interface{}) bool {
s, _ := k.(string) s, _ := k.(string)
temp[s] = v temp[s] = v
return true return true
}) })
case <-time.After(time.Second * 20): case <-timeout:
logger.Log("协程超时", "sku", 1) logger.Log("协程整体处理超时", "sku", 1)
return temp // 超时,返回已经收到的部分数据
} }
} }
return temp
} }
func Synchronization(ctx *gin.Context) { func Synchronization(ctx *gin.Context) {
...@@ -130,7 +168,7 @@ func Hbsdata(ctx *gin.Context) { ...@@ -130,7 +168,7 @@ func Hbsdata(ctx *gin.Context) {
} }
/* /*
测试redis 测试redis
*/ */
func Testr(ctx *gin.Context) { func Testr(ctx *gin.Context) {
......
package config package config
type RedisDatabase struct { type RedisDatabase struct {
Password string Password string
Host string Host string
Database string Database string
MaxIdle int MaxIdle int
MaxActive int MaxActive int
IdleTimeout int
MaxAIdleTimeoutctive string MaxAIdleTimeoutctive string
Prefix string Prefix string
} }
//多数据库配置 // 多数据库配置
func BuildRedisConfigs() (RedisDatabaseMap map[string]RedisDatabase) { func BuildRedisConfigs() (RedisDatabaseMap map[string]RedisDatabase) {
redisReadMaxIdle,_ := Get("default_redis_read.max_idle").Int() redisReadMaxIdle, _ := Get("default_redis_read.max_idle").Int()
redisReadMaxActive,_ := Get("default_redis_read.max_active").Int() redisReadMaxActive, _ := Get("default_redis_read.max_active").Int()
redisWriteMaxIdle,_ := Get("default_redis_write.max_idle").Int() redisWriteMaxIdle, _ := Get("default_redis_write.max_idle").Int()
redisWriteMaxActive,_ := Get("default_redis_write.max_active").Int() redisWriteMaxActive, _ := Get("default_redis_write.max_active").Int()
redisSpuMaxIdle,_ := Get("default_redis_spu.max_idle").Int() redisSpuMaxIdle, _ := Get("default_redis_spu.max_idle").Int()
redisSpuMaxActive,_ := Get("default_redis_spu.max_active").Int() redisSpuMaxActive, _ := Get("default_redis_spu.max_active").Int()
redisIdleTimeout, _ := Get("default_redis_read.idle_timeout").Int()
return map[string]RedisDatabase{ return map[string]RedisDatabase{
"search_r": { "search_r": {
Host: Get("default_redis_read.host").String(), Host: Get("default_redis_read.host").String(),
Password: Get("default_redis_read.password").String(), Password: Get("default_redis_read.password").String(),
MaxIdle: redisReadMaxIdle, MaxIdle: redisReadMaxIdle,
MaxActive: redisReadMaxActive, MaxActive: redisReadMaxActive,
IdleTimeout: redisIdleTimeout,
}, },
"default_r": { "default_r": {
Host: Get("default_redis_read.host").String(), Host: Get("default_redis_read.host").String(),
Password: Get("default_redis_read.password").String(), Password: Get("default_redis_read.password").String(),
MaxIdle: redisReadMaxIdle, MaxIdle: redisReadMaxIdle,
MaxActive: redisReadMaxActive, MaxActive: redisReadMaxActive,
IdleTimeout: redisIdleTimeout,
}, },
"search_w": { "search_w": {
Host: Get("default_redis_write.host").String(), Host: Get("default_redis_write.host").String(),
Password: Get("default_redis_write.password").String(), Password: Get("default_redis_write.password").String(),
MaxIdle: redisWriteMaxIdle, MaxIdle: redisWriteMaxIdle,
MaxActive: redisWriteMaxActive, MaxActive: redisWriteMaxActive,
IdleTimeout: redisIdleTimeout,
}, },
"spu": { "spu": {
Host: Get("default_redis_spu.host").String(), Host: Get("default_redis_spu.host").String(),
Password: Get("default_redis_spu.password").String(), Password: Get("default_redis_spu.password").String(),
MaxIdle: redisSpuMaxIdle, MaxIdle: redisSpuMaxIdle,
MaxActive: redisSpuMaxActive, MaxActive: redisSpuMaxActive,
IdleTimeout: redisIdleTimeout,
}, },
} }
} }
...@@ -2,9 +2,10 @@ package gredis ...@@ -2,9 +2,10 @@ package gredis
import ( import (
"fmt" "fmt"
"github.com/gomodule/redigo/redis"
"go_sku_server/pkg/config" "go_sku_server/pkg/config"
"time" "time"
"github.com/gomodule/redigo/redis"
) )
type ichuntRedis struct { type ichuntRedis struct {
...@@ -32,7 +33,7 @@ func Setup() (err error) { ...@@ -32,7 +33,7 @@ func Setup() (err error) {
return nil return nil
} }
//格式化成字符串 // 格式化成字符串
func String(a interface{}, err error) (string, error) { func String(a interface{}, err error) (string, error) {
return redis.String(a, err) return redis.String(a, err)
} }
...@@ -41,10 +42,15 @@ func getConn(writeHost, password string, maxIdle, maxActive int) (pool *redis.Po ...@@ -41,10 +42,15 @@ func getConn(writeHost, password string, maxIdle, maxActive int) (pool *redis.Po
//maxIdle, _ := config.Get("redis.max_idle").Int() //maxIdle, _ := config.Get("redis.max_idle").Int()
//maxActive, _ := config.Get("redis.max_active").Int() //maxActive, _ := config.Get("redis.max_active").Int()
pool = &redis.Pool{ pool = &redis.Pool{
MaxIdle: maxIdle, MaxIdle: maxIdle,
MaxActive: maxActive, MaxActive: maxActive,
IdleTimeout: 240 * time.Second,
Dial: func() (redis.Conn, error) { Dial: func() (redis.Conn, error) {
c, err := redis.Dial("tcp", writeHost) c, err := redis.Dial("tcp", writeHost,
redis.DialConnectTimeout(2*time.Second),
redis.DialReadTimeout(2*time.Second),
redis.DialWriteTimeout(2*time.Second),
)
if err != nil { if err != nil {
return nil, err return nil, err
} }
...@@ -70,8 +76,9 @@ func getConn(writeHost, password string, maxIdle, maxActive int) (pool *redis.Po ...@@ -70,8 +76,9 @@ func getConn(writeHost, password string, maxIdle, maxActive int) (pool *redis.Po
@param hkey string 集合键值,如sku @param hkey string 集合键值,如sku
@param targetIds string 查询的id 切片 @param targetIds string 查询的id 切片
eg: eg:
redisConn := gredis.Conn("search_r")
skuArr := gredis.HgetPi(&redisConn,"Self_SelfGoods",[]string{"1001","10005"}) redisConn := gredis.Conn("search_r")
skuArr := gredis.HgetPi(&redisConn,"Self_SelfGoods",[]string{"1001","10005"})
*/ */
func Hmget(redisCon string, hkey string, targetIds []string) map[string]string { func Hmget(redisCon string, hkey string, targetIds []string) map[string]string {
if len(targetIds) == 0 { if len(targetIds) == 0 {
...@@ -86,7 +93,8 @@ func Hmget(redisCon string, hkey string, targetIds []string) map[string]string { ...@@ -86,7 +93,8 @@ func Hmget(redisCon string, hkey string, targetIds []string) map[string]string {
goods_id := targetIds[0] goods_id := targetIds[0]
info, err := String(redisConn.Do("HGET", hkey, goods_id)) info, err := String(redisConn.Do("HGET", hkey, goods_id))
if err != nil && err != redis.ErrNil { if err != nil && err != redis.ErrNil {
fmt.Print("连接redis错误991:", err) fmt.Printf("redis HGET error for key %s, field %s: %v\n", hkey, goods_id, err)
return nil
} }
if info == "" { if info == "" {
skuArr[goods_id] = "" skuArr[goods_id] = ""
...@@ -102,9 +110,14 @@ func Hmget(redisCon string, hkey string, targetIds []string) map[string]string { ...@@ -102,9 +110,14 @@ func Hmget(redisCon string, hkey string, targetIds []string) map[string]string {
} }
res1, err1 := redisConn.Do("hmget", param...) res1, err1 := redisConn.Do("hmget", param...)
reply, _ := redis.Strings(res1, err1)
if err1 != nil { if err1 != nil {
fmt.Println(err1) fmt.Printf("redis HMGET error for key %s: %v\n", hkey, err1)
return nil
}
reply, err := redis.Strings(res1, err1)
if err != nil {
fmt.Printf("redis Strings conversion error after HMGET for key %s: %v\n", hkey, err)
return nil
} }
for k, goodsInfo := range reply { for k, goodsInfo := range reply {
...@@ -120,8 +133,9 @@ func Hmget(redisCon string, hkey string, targetIds []string) map[string]string { ...@@ -120,8 +133,9 @@ func Hmget(redisCon string, hkey string, targetIds []string) map[string]string {
@param hkey string 集合键值,如sku @param hkey string 集合键值,如sku
@param targetIds string 查询的id 切片 @param targetIds string 查询的id 切片
eg: eg:
redisConn := gredis.Conn("search_r")
skuArr := gredis.HgetPi(&redisConn,"Self_SelfGoods",[]string{"1001","10005"}) redisConn := gredis.Conn("search_r")
skuArr := gredis.HgetPi(&redisConn,"Self_SelfGoods",[]string{"1001","10005"})
*/ */
func HgetPi(redisCon string, hkey string, targetIds []string) map[string]string { func HgetPi(redisCon string, hkey string, targetIds []string) map[string]string {
redisConn := Conn(redisCon) redisConn := Conn(redisCon)
...@@ -131,8 +145,9 @@ func HgetPi(redisCon string, hkey string, targetIds []string) map[string]string ...@@ -131,8 +145,9 @@ func HgetPi(redisCon string, hkey string, targetIds []string) map[string]string
if len(targetIds) == 1 { if len(targetIds) == 1 {
oneId := targetIds[0] oneId := targetIds[0]
info, err := String(redisConn.Do("HGET", hkey, oneId)) info, err := String(redisConn.Do("HGET", hkey, oneId))
if err != nil { if err != nil && err != redis.ErrNil {
fmt.Print(err) fmt.Printf("redis HGET error for key %s, field %s: %v\n", hkey, oneId, err)
return nil
} }
if info == "" { if info == "" {
skuArr[oneId] = "" skuArr[oneId] = ""
...@@ -148,7 +163,11 @@ func HgetPi(redisCon string, hkey string, targetIds []string) map[string]string ...@@ -148,7 +163,11 @@ func HgetPi(redisCon string, hkey string, targetIds []string) map[string]string
redisConn.Flush() redisConn.Flush()
for _, goods_id := range targetIds { for _, goods_id := range targetIds {
info, _ := redisConn.Receive() info, err := redisConn.Receive()
if err != nil {
fmt.Printf("redis Receive error for key %s: %v\n", hkey, err)
return nil
}
if info == nil { if info == nil {
skuArr[goods_id] = "" skuArr[goods_id] = ""
continue continue
...@@ -164,8 +183,9 @@ func HgetPi(redisCon string, hkey string, targetIds []string) map[string]string ...@@ -164,8 +183,9 @@ func HgetPi(redisCon string, hkey string, targetIds []string) map[string]string
@param hkey string 集合键值,如sku @param hkey string 集合键值,如sku
@param targetIds string 查询的id 切片 @param targetIds string 查询的id 切片
eg: eg:
redisConn := gredis.Conn("search_r")
skuArr := gredis.HgetPi(&redisConn,"Self_SelfGoods",[]string{"1001","10005"}) redisConn := gredis.Conn("search_r")
skuArr := gredis.HgetPi(&redisConn,"Self_SelfGoods",[]string{"1001","10005"})
*/ */
func HgetPi2(redisCon string, hkey string, targetIds []string) map[string]string { func HgetPi2(redisCon string, hkey string, targetIds []string) map[string]string {
redisConn := Conn(redisCon) redisConn := Conn(redisCon)
...@@ -174,8 +194,9 @@ func HgetPi2(redisCon string, hkey string, targetIds []string) map[string]string ...@@ -174,8 +194,9 @@ func HgetPi2(redisCon string, hkey string, targetIds []string) map[string]string
skuArr := make(map[string]string, 0) skuArr := make(map[string]string, 0)
for _, goods_id := range targetIds { for _, goods_id := range targetIds {
info, err := String(redisConn.Do("HGET", hkey, goods_id)) info, err := String(redisConn.Do("HGET", hkey, goods_id))
if err != nil { if err != nil && err != redis.ErrNil {
fmt.Print("连接redis错误991:", err) fmt.Printf("redis HGET error in HgetPi2 for key %s, field %s: %v\n", hkey, goods_id, err)
return nil
} }
if info == "" { if info == "" {
skuArr[goods_id] = "" skuArr[goods_id] = ""
......
...@@ -182,16 +182,13 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan ...@@ -182,16 +182,13 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan
//case为0是为了兼容价格体系之前的价格 //case为0是为了兼容价格体系之前的价格
case 0: case 0:
case 1: case 1:
//如果是寄售的,也不走价格体系 //这里猎芯和寄售都是走同一套的价格体系了
if sku.Source != 12 { //获取系数和价格
//这里猎芯和华云都是走同一套的价格体系了 sku = ls.GetCoefficientAndPrice(sku)
//获取系数和价格 //获取自定义价格后的阶梯价
sku = ls.GetCoefficientAndPrice(sku) customPriceService := CustomPrice{}
//获取自定义价格后的阶梯价 sku.CustomPriceList, _ = customPriceService.getCustomPriceList(sku)
customPriceService := CustomPrice{} sku = priceService.GetActivityPrice(sku)
sku.CustomPriceList, _ = customPriceService.getCustomPriceList(sku)
sku = priceService.GetActivityPrice(sku)
}
case 3: case 3:
//如果是寄售的,不走价格体系 //如果是寄售的,不走价格体系
if sku.Source == 12 { if sku.Source == 12 {
...@@ -240,6 +237,11 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan ...@@ -240,6 +237,11 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan
sku.HkDeliveryTime = delivery["hk_delivery"] sku.HkDeliveryTime = delivery["hk_delivery"]
} }
//只要是寄售的,大陆交期都是0.5工作日
if sku.Source == 12 {
sku.CnDeliveryTime = "0.5工作日"
}
} }
//处理是否可以购买 //处理是否可以购买
...@@ -255,8 +257,8 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan ...@@ -255,8 +257,8 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan
//判断是否可以购买 //判断是否可以购买
sku.IsBuy = ls.GetIsBuy(sku) sku.IsBuy = ls.GetIsBuy(sku)
if sku.IsBuy ==0 && sku.OrgId != 1 { if sku.IsBuy == 0 && sku.OrgId != 1 {
sku.AcType = 0; sku.AcType = 0
} }
sku.Stock = ls.GetStock(sku) sku.Stock = ls.GetStock(sku)
......
package service package service
import ( import (
"github.com/gomodule/redigo/redis"
"github.com/syyongx/php2go"
"github.com/tidwall/gjson"
"go_sku_server/model" "go_sku_server/model"
"go_sku_server/pkg/gredis" "go_sku_server/pkg/gredis"
"go_sku_server/pkg/vars" "go_sku_server/pkg/vars"
"github.com/gomodule/redigo/redis"
"github.com/syyongx/php2go"
"github.com/tidwall/gjson"
) )
//标签相关服务,包括goods_label //标签相关服务,包括goods_label
...@@ -14,10 +15,10 @@ import ( ...@@ -14,10 +15,10 @@ import (
type TagsService struct { type TagsService struct {
} }
//当天发货标签 // 当天发货标签
const TagZiyingSku = 4 const TagZiyingSku = 4
//获取Spu的属性 // 获取Spu的属性
func (ts *TagsService) GetTags(skuId string, selfSupplierType int64) (goodsTags model.GoodsTag) { func (ts *TagsService) GetTags(skuId string, selfSupplierType int64) (goodsTags model.GoodsTag) {
redisCon := gredis.Conn("default_r") redisCon := gredis.Conn("default_r")
defer redisCon.Close() defer redisCon.Close()
...@@ -52,13 +53,13 @@ func (ts *TagsService) GetTags(skuId string, selfSupplierType int64) (goodsTags ...@@ -52,13 +53,13 @@ func (ts *TagsService) GetTags(skuId string, selfSupplierType int64) (goodsTags
goodsTags.GoodsLabelName = vars.GoodsTags[TagZiyingSku] goodsTags.GoodsLabelName = vars.GoodsTags[TagZiyingSku]
} }
} }
goodsTags.GoodsTagNames = tagNames goodsTags.GoodsTagNames = tagNames
goodsTags.GoodsTag = tags goodsTags.GoodsTag = tags
return goodsTags return goodsTags
} }
// 获取联营tags
//获取联营tags
func (ts *TagsService) GetLyTags(sku model.LySku) (goodsTags model.GoodsTag) { func (ts *TagsService) GetLyTags(sku model.LySku) (goodsTags model.GoodsTag) {
skuId := sku.GoodsId skuId := sku.GoodsId
redisCon := gredis.Conn("default_r") redisCon := gredis.Conn("default_r")
...@@ -83,13 +84,20 @@ func (ts *TagsService) GetLyTags(sku model.LySku) (goodsTags model.GoodsTag) { ...@@ -83,13 +84,20 @@ func (ts *TagsService) GetLyTags(sku model.LySku) (goodsTags model.GoodsTag) {
for _, cname := range customerTagArr { for _, cname := range customerTagArr {
//如果是爱智的话,去掉可议价标签 //如果是爱智的话,去掉可议价标签
if sku.OrgId ==3 && cname == "可议价" { if sku.OrgId == 3 && cname == "可议价" {
continue continue
} }
tagNames = append(tagNames, cname) tagNames = append(tagNames, cname)
} }
} }
} }
if sku.Source == 12 {
if !php2go.InArray("当天发货", tagNames) {
tagNames = append(tagNames, "当天发货")
}
}
goodsTags.GoodsTagNames = tagNames goodsTags.GoodsTagNames = tagNames
goodsTags.GoodsTag = tags goodsTags.GoodsTag = tags
return goodsTags return goodsTags
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment