Commit 542e0f5b by wang

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

parent 3b6ac6e0
......@@ -41,20 +41,20 @@ type LySkuEntity struct {
}
//将 LySkuEntity 的值赋值到 SkuRedisInfo(两个结构字段和类型不一样不会赋值)
func (LS *LySkuEntity) ToRedisSku() model.SkuRedisInfo{
skuRedisInfo:=model.SkuRedisInfo{}
func (LS *LySkuEntity) ToRedisSku() model.LySkuRedisInfo{
skuRedisInfo:=model.LySkuRedisInfo{}
common.CopyStruct(LS,&skuRedisInfo)
return skuRedisInfo
}
//将 LySkuEntity 的值赋值到 model.SkuMongo(两个结构字段和类型不一样不会赋值)
func (LS *LySkuEntity) ToMongoSku() model.SkuMongo{
skuMongo:=model.SkuMongo{}
common.CopyStruct(LS,&skuMongo)
skuMongo.SpuId=gconv.Int64(LS.SpuId)//spuID在mangoDB是int64位
skuMongo.GoodsId=gconv.Int64(LS.GoodsId)//spuID在mangoDB是int64位
return skuMongo
//将 LySkuEntity 的值赋值到 model.LySkuMongo(两个结构字段和类型不一样不会赋值)
func (LS *LySkuEntity) ToMongoSku() model.LySkuMongo{
LySkuMongo:=model.LySkuMongo{}
common.CopyStruct(LS,&LySkuMongo)
LySkuMongo.SpuId=gconv.Int64(LS.SpuId)//spuID在mangoDB是int64位
LySkuMongo.GoodsId=gconv.Int64(LS.GoodsId)//spuID在mangoDB是int64位
return LySkuMongo
}
......
package model
//对应mongo SKU
type SkuMongo struct {
type LySkuMongo struct {
SpuId int64 `bson:"spu_id"`
GoodsId int64 `json:"goods_id" bson:"goods_id"`
......
......@@ -5,7 +5,7 @@ package model
联营 redis hash sku 结构,主要是用作新增插入用
poolSkuSave 插入redis就是这些字段
*/
type SkuRedisInfo struct {
type LySkuRedisInfo struct {
SpuId string `json:"spu_id"`
Encoded int `json:"encoded"`//供应商编码
......
......@@ -347,7 +347,7 @@ func (S *LySaveService) saveRedisSkuInfo(isAdd bool,skuId string,lySkuEntity sav
/**
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返回
GetValue:= func(fieldValue reflect.Value) interface{}{
......
......@@ -16,9 +16,9 @@ type SkuCacheService struct {
/**
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")
defer func() {
mongodb.Close()
......@@ -43,7 +43,7 @@ func (spuCacheService *SkuCacheService) MongoGetOnlySkuInfo(spuId string,supplie
/**
mongo 插入sku
*/
func (spuCacheService *SkuCacheService) MongoInsertOnlySkuInfo(onlySkuInfo model.SkuMongo)(error){
func (spuCacheService *SkuCacheService) MongoInsertOnlySkuInfo(onlySkuInfo model.LySkuMongo)(error){
mongoConn := mongo.Conn("default");
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