Commit 542e0f5b by wang

更改结构名称和文件名称区,为了分自营联营sku

parent 3b6ac6e0
...@@ -41,20 +41,20 @@ type LySkuEntity struct { ...@@ -41,20 +41,20 @@ type LySkuEntity struct {
} }
//将 LySkuEntity 的值赋值到 SkuRedisInfo(两个结构字段和类型不一样不会赋值) //将 LySkuEntity 的值赋值到 SkuRedisInfo(两个结构字段和类型不一样不会赋值)
func (LS *LySkuEntity) ToRedisSku() model.SkuRedisInfo{ func (LS *LySkuEntity) ToRedisSku() model.LySkuRedisInfo{
skuRedisInfo:=model.SkuRedisInfo{} skuRedisInfo:=model.LySkuRedisInfo{}
common.CopyStruct(LS,&skuRedisInfo) common.CopyStruct(LS,&skuRedisInfo)
return skuRedisInfo return skuRedisInfo
} }
//将 LySkuEntity 的值赋值到 model.SkuMongo(两个结构字段和类型不一样不会赋值) //将 LySkuEntity 的值赋值到 model.LySkuMongo(两个结构字段和类型不一样不会赋值)
func (LS *LySkuEntity) ToMongoSku() model.SkuMongo{ func (LS *LySkuEntity) ToMongoSku() model.LySkuMongo{
skuMongo:=model.SkuMongo{} LySkuMongo:=model.LySkuMongo{}
common.CopyStruct(LS,&skuMongo) common.CopyStruct(LS,&LySkuMongo)
skuMongo.SpuId=gconv.Int64(LS.SpuId)//spuID在mangoDB是int64位 LySkuMongo.SpuId=gconv.Int64(LS.SpuId)//spuID在mangoDB是int64位
skuMongo.GoodsId=gconv.Int64(LS.GoodsId)//spuID在mangoDB是int64位 LySkuMongo.GoodsId=gconv.Int64(LS.GoodsId)//spuID在mangoDB是int64位
return skuMongo return LySkuMongo
} }
......
package model package model
//对应mongo SKU //对应mongo SKU
type SkuMongo struct { type LySkuMongo struct {
SpuId int64 `bson:"spu_id"` SpuId int64 `bson:"spu_id"`
GoodsId int64 `json:"goods_id" bson:"goods_id"` GoodsId int64 `json:"goods_id" bson:"goods_id"`
......
...@@ -5,7 +5,7 @@ package model ...@@ -5,7 +5,7 @@ package model
联营 redis hash sku 结构,主要是用作新增插入用 联营 redis hash sku 结构,主要是用作新增插入用
poolSkuSave 插入redis就是这些字段 poolSkuSave 插入redis就是这些字段
*/ */
type SkuRedisInfo struct { type LySkuRedisInfo struct {
SpuId string `json:"spu_id"` SpuId string `json:"spu_id"`
Encoded int `json:"encoded"`//供应商编码 Encoded int `json:"encoded"`//供应商编码
......
...@@ -347,7 +347,7 @@ func (S *LySaveService) saveRedisSkuInfo(isAdd bool,skuId string,lySkuEntity sav ...@@ -347,7 +347,7 @@ func (S *LySaveService) saveRedisSkuInfo(isAdd bool,skuId string,lySkuEntity sav
/** /**
struct 跟map Map合并,返回一个新的map(后续可以整理成公共函数) struct 跟map Map合并,返回一个新的map(后续可以整理成公共函数)
*/ */
func (S *LySaveService) structMerageMap(redisSkuInfo model.SkuRedisInfo,oldSkuInfoMap map[string]interface{})(error,map[string]interface{}) { func (S *LySaveService) structMerageMap(redisSkuInfo model.LySkuRedisInfo,oldSkuInfoMap map[string]interface{})(error,map[string]interface{}) {
//将新的redisSku数据struct 和 老的redis的数据map 合并成map并转换成json返回 //将新的redisSku数据struct 和 老的redis的数据map 合并成map并转换成json返回
GetValue:= func(fieldValue reflect.Value) interface{}{ GetValue:= func(fieldValue reflect.Value) interface{}{
......
...@@ -16,9 +16,9 @@ type SkuCacheService struct { ...@@ -16,9 +16,9 @@ type SkuCacheService struct {
/** /**
mongoDB 根据 spuId supplierId moq encoded canal 获取sku信息 mongoDB 根据 spuId supplierId moq encoded canal 获取sku信息
*/ */
func (spuCacheService *SkuCacheService) MongoGetOnlySkuInfo(spuId string,supplierId int,moq int,encoded int,canal string)(error, model.SkuMongo){ func (spuCacheService *SkuCacheService) MongoGetOnlySkuInfo(spuId string,supplierId int,moq int,encoded int,canal string)(error, model.LySkuMongo){
var skuMongo model.SkuMongo var skuMongo model.LySkuMongo
mongodb := mongo.Conn("default") mongodb := mongo.Conn("default")
defer func() { defer func() {
mongodb.Close() mongodb.Close()
...@@ -43,7 +43,7 @@ func (spuCacheService *SkuCacheService) MongoGetOnlySkuInfo(spuId string,supplie ...@@ -43,7 +43,7 @@ func (spuCacheService *SkuCacheService) MongoGetOnlySkuInfo(spuId string,supplie
/** /**
mongo 插入sku mongo 插入sku
*/ */
func (spuCacheService *SkuCacheService) MongoInsertOnlySkuInfo(onlySkuInfo model.SkuMongo)(error){ func (spuCacheService *SkuCacheService) MongoInsertOnlySkuInfo(onlySkuInfo model.LySkuMongo)(error){
mongoConn := mongo.Conn("default"); mongoConn := mongo.Conn("default");
defer mongoConn.Close() defer mongoConn.Close()
......
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