Commit d9fc7c18 by huangchengyi

1.0

parent 1fe10cbe
Showing with 11 additions and 10 deletions
...@@ -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;
} }
......
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