Commit 08a4df8b by mushishixian

fix

parent 8176893b
......@@ -3,6 +3,7 @@ package main
import (
"encoding/json"
"flag"
"fmt"
_ "github.com/go-sql-driver/mysql"
"github.com/gohouse/gorose/v2"
"github.com/ichunt2019/logger"
......@@ -201,7 +202,9 @@ func main() {
logger.Error(err.Error())
}
}
items, err := db.Reset().Fields("*,count(amount) as total_amount").Table("lie_order_activity_count").
items, err := db.Reset().
Fields("activity_id,order_id,lie_user_main.user_id,mobile,create_device,sum(lie_order_activity_count.amount) as total_amount").
Table("lie_order_activity_count").
LeftJoin("lie_user_main on lie_order_activity_count.user_id = lie_user_main.user_id").
Where("lie_order_activity_count.activity_id", activity.Id).
GroupBy("order_id").Get()
......@@ -222,6 +225,7 @@ func main() {
}
//存在跳过,不存在才插入
if priceActivityMongo.OrderId == 0 {
fmt.Println(result)
priceActivityMongo.ActivityId = gjson.Get(result, "activity_id").Int()
priceActivityMongo.OrderId = gjson.Get(result, "order_id").Int()
priceActivityMongo.UserId = gjson.Get(result, "user_id").Int()
......
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