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
d9fc7c18
authored
Dec 02, 2020
by
huangchengyi
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
1.0
parent
1fe10cbe
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
10 deletions
service/service_zy_cron.go
service/service_zy_cron.go
View file @
d9fc7c18
...
@@ -53,10 +53,11 @@ func (a *ZyCronService) ZyDiscount(checkGoodsId string) {
...
@@ -53,10 +53,11 @@ func (a *ZyCronService) ZyDiscount(checkGoodsId string) {
if
checkGoodsId
!=
""
{
if
checkGoodsId
!=
""
{
sql
=
"select goods_id,class_id2,brand_id,cost,ladder_price from lie_goods where goods_id="
+
checkGoodsId
;
sql
=
"select goods_id,class_id2,brand_id,cost,ladder_price from lie_goods where goods_id="
+
checkGoodsId
;
}
}
fmt
.
Println
(
sql
)
//fmt.Println(sql)
goodsInfos
,
err
:=
dbSpu
.
QueryString
(
sql
)
goodsInfos
,
err
:=
dbSpu
.
QueryString
(
sql
)
if
err
!=
nil
||
len
(
goodsInfos
)
==
0
{
if
err
!=
nil
||
len
(
goodsInfos
)
==
0
{
fmt
.
Print
(
"查询没有数据"
,
err
)
//
fmt.Print("查询没有数据",err)
break
;
break
;
}
}
for
_
,
a
:=
range
goodsInfos
{
for
_
,
a
:=
range
goodsInfos
{
...
@@ -64,7 +65,7 @@ func (a *ZyCronService) ZyDiscount(checkGoodsId string) {
...
@@ -64,7 +65,7 @@ func (a *ZyCronService) ZyDiscount(checkGoodsId string) {
now_class_id
:=
a
[
"class_id2"
]
now_class_id
:=
a
[
"class_id2"
]
now_brand_id
:=
a
[
"brand_id"
]
now_brand_id
:=
a
[
"brand_id"
]
/********开始计算系数******/
/********开始计算系数******/
fmt
.
Println
(
"开始计算系数"
+
now_goods_id
)
//
fmt.Println("开始计算系数"+now_goods_id)
goodsBatch
,
_
:=
gredis
.
String
(
redisConn
.
Do
(
"HGET"
,
"Self_goods_batch"
,
now_goods_id
))
//获取商品批次信息
goodsBatch
,
_
:=
gredis
.
String
(
redisConn
.
Do
(
"HGET"
,
"Self_goods_batch"
,
now_goods_id
))
//获取商品批次信息
apiGoodsList
:=
gjson
.
Parse
(
goodsBatch
)
.
Array
()
apiGoodsList
:=
gjson
.
Parse
(
goodsBatch
)
.
Array
()
...
@@ -82,7 +83,7 @@ func (a *ZyCronService) ZyDiscount(checkGoodsId string) {
...
@@ -82,7 +83,7 @@ func (a *ZyCronService) ZyDiscount(checkGoodsId string) {
}
}
if
EarlyBatchTime
==
0
{
if
EarlyBatchTime
==
0
{
fmt
.
Println
(
"没有批次信息,goods_id :"
+
now_goods_id
)
//
fmt.Println("没有批次信息,goods_id :"+now_goods_id)
continue
;
continue
;
}
}
//查询所有的系数列表
//查询所有的系数列表
...
@@ -124,21 +125,21 @@ func (a *ZyCronService) ZyDiscount(checkGoodsId string) {
...
@@ -124,21 +125,21 @@ func (a *ZyCronService) ZyDiscount(checkGoodsId string) {
//不参与系数的商品
//不参与系数的商品
if
info
[
"goods_id"
]
!=
""
{
if
info
[
"goods_id"
]
!=
""
{
if
php2go
.
Stripos
(
info
[
"goods_id"
],
","
+
now_goods_id
+
","
,
0
)
>
-
1
{
if
php2go
.
Stripos
(
info
[
"goods_id"
],
","
+
now_goods_id
+
","
,
0
)
>
-
1
{
fmt
.
Println
(
"1001 本商品不参与系数"
+
now_goods_id
)
//
fmt.Println("1001 本商品不参与系数"+now_goods_id)
continue
;
continue
;
}
}
}
}
//不参与分类的商品
//不参与分类的商品
if
info
[
"class_id"
]
!=
""
{
if
info
[
"class_id"
]
!=
""
{
if
php2go
.
Stripos
(
info
[
"class_id"
],
","
+
now_class_id
+
","
,
0
)
==
-
1
{
if
php2go
.
Stripos
(
info
[
"class_id"
],
","
+
now_class_id
+
","
,
0
)
==
-
1
{
fmt
.
Println
(
"1002 不参与分类的商品"
+
now_goods_id
)
//
fmt.Println("1002 不参与分类的商品"+now_goods_id)
continue
;
continue
;
}
}
}
}
//不参与分类的商品
//不参与分类的商品
if
info
[
"brand_id"
]
!=
""
{
if
info
[
"brand_id"
]
!=
""
{
if
php2go
.
Stripos
(
info
[
"brand_id"
],
","
+
now_brand_id
+
","
,
0
)
==
-
1
{
if
php2go
.
Stripos
(
info
[
"brand_id"
],
","
+
now_brand_id
+
","
,
0
)
==
-
1
{
fmt
.
Println
(
"1003 不参与分类的商品"
+
now_goods_id
)
//
fmt.Println("1003 不参与分类的商品"+now_goods_id)
continue
;
continue
;
}
}
}
}
...
@@ -168,7 +169,7 @@ func (a *ZyCronService) ZyDiscount(checkGoodsId string) {
...
@@ -168,7 +169,7 @@ func (a *ZyCronService) ZyDiscount(checkGoodsId string) {
//fmt.Println(twoYearsAgotime)
//fmt.Println(twoYearsAgotime)
if
isExpire
==
false
{
if
isExpire
==
false
{
fmt
.
Println
(
"1001 本商品不存在过期"
+
now_goods_id
)
//
fmt.Println("1001 本商品不存在过期"+now_goods_id)
continue
;
continue
;
}
}
//处理清库存系数,几个系数符合,往下面算
//处理清库存系数,几个系数符合,往下面算
...
@@ -180,7 +181,7 @@ func (a *ZyCronService) ZyDiscount(checkGoodsId string) {
...
@@ -180,7 +181,7 @@ func (a *ZyCronService) ZyDiscount(checkGoodsId string) {
if
szlcPriceStr
!=
""
{
//有立创的价格
if
szlcPriceStr
!=
""
{
//有立创的价格
nowLadder
:=
gjson
.
Parse
(
a
[
"ladder_price"
])
.
Array
()
nowLadder
:=
gjson
.
Parse
(
a
[
"ladder_price"
])
.
Array
()
endnowLadder
:=
nowLadder
[
len
(
nowLadder
)
-
1
]
.
Get
(
"purchases"
)
.
Int
()
//最后一个梯度
endnowLadder
:=
nowLadder
[
len
(
nowLadder
)
-
1
]
.
Get
(
"purchases"
)
.
Int
()
//最后一个梯度
fmt
.
Println
(
endnowLadder
)
//
fmt.Println(endnowLadder)
//获取立创对应的梯度价格
//获取立创对应的梯度价格
szlcPriceArr
:=
gjson
.
Parse
(
szlcPriceStr
)
.
Array
()
szlcPriceArr
:=
gjson
.
Parse
(
szlcPriceStr
)
.
Array
()
var
szlcPrice
float64
=
0
//找到立创对应的梯度价格
var
szlcPrice
float64
=
0
//找到立创对应的梯度价格
...
@@ -223,7 +224,7 @@ func (a *ZyCronService) ZyDiscount(checkGoodsId string) {
...
@@ -223,7 +224,7 @@ func (a *ZyCronService) ZyDiscount(checkGoodsId string) {
}
}
//最后写日志
//最后写日志
logger
.
Log
(
"计算阶梯价成功 goods_id: "
+
now_goods_id
+
" 原始梯度价:"
+
a
[
"ladder_price"
]
+
" 立创梯度价: "
+
szlcPriceStr
+
" 结果:"
+
string
(
ratioRes
),
"ratio_sku_"
,
1
)
logger
.
Log
(
"计算阶梯价成功 goods_id: "
+
now_goods_id
+
" 原始梯度价:"
+
a
[
"ladder_price"
]
+
" 立创梯度价: "
+
szlcPriceStr
+
" 结果:"
+
string
(
ratioRes
),
"ratio_sku_"
,
2
)
break
OuterLoop2
;
break
OuterLoop2
;
}
}
...
...
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