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
bf64c6d9
authored
Dec 03, 2020
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修复bug
parent
9f05fc4e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
10 deletions
controller/sku_controller.go
model/ly_sku.go
service/service_ly.go
service/service_ly_common.go
controller/sku_controller.go
View file @
bf64c6d9
...
...
@@ -108,7 +108,6 @@ func Synchronization(ctx *gin.Context) {
logger
.
Log
(
"协程超时"
,
"sku"
,
1
)
}
}
common
.
Output
(
ctx
,
0
,
"success"
,
temp
)
}
...
...
model/ly_sku.go
View file @
bf64c6d9
...
...
@@ -6,7 +6,7 @@ import (
//联营sku结构体
type
LySku
struct
{
SpuId
string
`json:"spu_id"`
SpuId
string
`json:"spu_id"`
OldGoodsId
int64
`json:"old_goods_id"`
UpdateTime
int64
`json:"update_time"`
CpTime
int64
`json:"cp_time"`
...
...
@@ -34,14 +34,14 @@ type LySku struct {
AllowCoupon
int
`json:"allow_coupon"`
BrandId
int64
`json:"brand_id"`
//系数相关
Coefficient
interface
{}
`json:"coefficient,omitempty"`
Original
[]
LadderPrice
`json:"original_price"`
SuppExtendFee
interface
{}
`json:"supp_extend_fee"`
IsBuy
int
`json:"is_buy"`
Coefficient
interface
{}
`json:"coefficient,omitempty"`
Original
interface
{}
`json:"original_price"`
SuppExtendFee
interface
{}
`json:"supp_extend_fee"`
IsBuy
int
`json:"is_buy"`
//spu信息
ClassID1
int
`json:"class_id1"`
ClassID2
int
`json:"class_id2"`
ClassID3
int
`json:"class_id3
,omitempty
"`
ClassID3
int
`json:"class_id3"`
SpuName
string
`json:"spu_name"`
Status
int
`json:"status"`
ImagesL
string
`json:"images_l"`
...
...
@@ -124,6 +124,7 @@ func InitSkuData(sku string) (data LySku) {
LadderPriceStr
:=
gjson
.
Get
(
sku
,
"ladder_price"
)
.
String
()
data
.
LadderPrice
=
getLadderPrice
(
LadderPriceStr
)
data
.
Original
=
getOriginPrice
(
LadderPriceStr
)
return
}
...
...
@@ -146,3 +147,22 @@ func getLadderPrice(ladderPriceStr string) (ladderPrice []LadderPrice) {
}
return
}
//获取原始价格
func
getOriginPrice
(
ladderPriceStr
string
)
(
ladderPrice
[]
OriginPrice
)
{
ladderPriceArr
:=
gjson
.
Parse
(
ladderPriceStr
)
.
Array
()
for
_
,
price
:=
range
ladderPriceArr
{
ladderPrice
=
append
(
ladderPrice
,
OriginPrice
{
Purchases
:
price
.
Get
(
"purchases"
)
.
Int
(),
PriceUs
:
price
.
Get
(
"price_us"
)
.
Float
(),
PriceCn
:
price
.
Get
(
"price_cn"
)
.
Float
(),
PriceAc
:
price
.
Get
(
"price_ac"
)
.
Float
(),
CostPrice
:
price
.
Get
(
"cost_price"
)
.
Float
(),
})
}
if
len
(
ladderPrice
)
==
0
{
ladderPrice
=
[]
OriginPrice
{}
return
}
return
}
service/service_ly.go
View file @
bf64c6d9
...
...
@@ -120,7 +120,6 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan
//判断是否有新客价权利
if
isNewCustomer
==
"true"
{
//获取新客价
//todo test
sku
=
ls
.
GetActivityPrice
(
sku
,
"_NewCustomer"
,
power
)
if
sku
.
AcType
>
0
{
hasActivity
=
true
...
...
service/service_ly_common.go
View file @
bf64c6d9
...
...
@@ -166,6 +166,9 @@ func (ls *LyService) GetExtendFee(supplierId int64, canal string) interface{} {
if
supplierId
==
17
{
//为什么专卖的redis键会不一样,专卖的附加费管理在供应商系统,其它的在基石
value
,
_
:=
redis
.
String
(
redisCon
.
Do
(
"HGET"
,
"supp_extend_fee"
,
"17."
+
canal
))
if
value
==
""
{
return
false
}
//专卖的存了两种形式的数据,真是搞人心态
if
strings
.
Contains
(
value
,
"cn"
)
{
var
extendFee
ExtendFee
...
...
@@ -178,6 +181,9 @@ func (ls *LyService) GetExtendFee(supplierId int64, canal string) interface{} {
}
}
else
{
value
,
_
:=
redis
.
String
(
redisCon
.
Do
(
"HGET"
,
"supp_extend_fee"
,
supplierId
))
if
value
==
""
{
return
false
}
var
extendFee
ExtendFee
json
.
Unmarshal
([]
byte
(
value
),
&
extendFee
)
return
extendFee
...
...
@@ -191,7 +197,6 @@ func (ls *LyService) GetCoefficient(sku model.LySku) model.LySku {
}
flag
:=
0
//专卖
originalLadderPrice
:=
sku
.
LadderPrice
if
sku
.
SupplierId
==
17
{
ladderPrice
:=
sku
.
LadderPrice
for
key
,
price
:=
range
ladderPrice
{
...
...
@@ -333,7 +338,6 @@ func (ls *LyService) GetCoefficient(sku model.LySku) model.LySku {
coefficient
.
Tax
=
tax
sku
.
Coefficient
=
coefficient
}
sku
.
Original
=
originalLadderPrice
return
sku
}
...
...
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