Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
黄成意
/
go_sku_server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
542e0f5b
authored
Dec 22, 2020
by
wang
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
更改结构名称和文件名称区,为了分自营联营sku
parent
3b6ac6e0
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
15 additions
and
15 deletions
model/saveModel/edit_request.go → model/saveModel/ly_edit_request.go
model/saveModel/save_request.go → model/saveModel/ly_save_request.go
model/saveModel/save_response.go → model/saveModel/ly_save_response.go
model/saveModel/ly_sku_entity.go
model/sku_mongo.go
model/sku_redis.go
service/service_ly_save.go
service/sku_cache.go
model/saveModel/edit_request.go
→
model/saveModel/
ly_
edit_request.go
View file @
542e0f5b
File moved
model/saveModel/save_request.go
→
model/saveModel/
ly_
save_request.go
View file @
542e0f5b
File moved
model/saveModel/save_response.go
→
model/saveModel/
ly_
save_response.go
View file @
542e0f5b
File moved
model/saveModel/ly_sku_entity.go
View file @
542e0f5b
...
@@ -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
.
Ly
SkuRedisInfo
{
skuRedisInfo
:=
model
.
SkuRedisInfo
{}
skuRedisInfo
:=
model
.
Ly
SkuRedisInfo
{}
common
.
CopyStruct
(
LS
,
&
skuRedisInfo
)
common
.
CopyStruct
(
LS
,
&
skuRedisInfo
)
return
skuRedisInfo
return
skuRedisInfo
}
}
//将 LySkuEntity 的值赋值到 model.SkuMongo(两个结构字段和类型不一样不会赋值)
//将 LySkuEntity 的值赋值到 model.
Ly
SkuMongo(两个结构字段和类型不一样不会赋值)
func
(
LS
*
LySkuEntity
)
ToMongoSku
()
model
.
SkuMongo
{
func
(
LS
*
LySkuEntity
)
ToMongoSku
()
model
.
Ly
SkuMongo
{
skuMongo
:=
model
.
SkuMongo
{}
LySkuMongo
:=
model
.
Ly
SkuMongo
{}
common
.
CopyStruct
(
LS
,
&
s
kuMongo
)
common
.
CopyStruct
(
LS
,
&
LyS
kuMongo
)
s
kuMongo
.
SpuId
=
gconv
.
Int64
(
LS
.
SpuId
)
//spuID在mangoDB是int64位
LyS
kuMongo
.
SpuId
=
gconv
.
Int64
(
LS
.
SpuId
)
//spuID在mangoDB是int64位
s
kuMongo
.
GoodsId
=
gconv
.
Int64
(
LS
.
GoodsId
)
//spuID在mangoDB是int64位
LyS
kuMongo
.
GoodsId
=
gconv
.
Int64
(
LS
.
GoodsId
)
//spuID在mangoDB是int64位
return
s
kuMongo
return
LyS
kuMongo
}
}
...
...
model/sku_mongo.go
View file @
542e0f5b
package
model
package
model
//对应mongo SKU
//对应mongo SKU
type
SkuMongo
struct
{
type
Ly
SkuMongo
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"`
...
...
model/sku_redis.go
View file @
542e0f5b
...
@@ -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
Ly
SkuRedisInfo
struct
{
SpuId
string
`json:"spu_id"`
SpuId
string
`json:"spu_id"`
Encoded
int
`json:"encoded"`
//供应商编码
Encoded
int
`json:"encoded"`
//供应商编码
...
...
service/service_ly_save.go
View file @
542e0f5b
...
@@ -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
.
Ly
SkuRedisInfo
,
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
{}{
...
...
service/sku_cache.go
View file @
542e0f5b
...
@@ -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
.
Ly
SkuMongo
){
var
skuMongo
model
.
SkuMongo
var
skuMongo
model
.
Ly
SkuMongo
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
.
Ly
SkuMongo
)(
error
){
mongoConn
:=
mongo
.
Conn
(
"default"
);
mongoConn
:=
mongo
.
Conn
(
"default"
);
defer
mongoConn
.
Close
()
defer
mongoConn
.
Close
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment