|
@@ -26,15 +26,30 @@ type (
|
|
|
SupServiceIds []string `json:"supServiceIds"`
|
|
|
FinalAccountCount int `json:"finalAccountCount"` //当前套餐最终
|
|
|
FinalAreaCount int `json:"finalAreaCount"`
|
|
|
+
|
|
|
+ DataPackNum int `json:"dataPackNum"` //赠送的数据流量包
|
|
|
}
|
|
|
)
|
|
|
|
|
|
-func GetBigFilter(data map[string]interface{}) (g.Map, string, error) {
|
|
|
+func GetBigFilter(data map[string]interface{}) (g.Map, string, int, error) {
|
|
|
var (
|
|
|
- bigFilter g.Map
|
|
|
- bigCode string
|
|
|
+ bigFilter = make(g.Map)
|
|
|
+ bigCode string
|
|
|
+ recordPayType int
|
|
|
)
|
|
|
filter := gconv.Map(data["filter"])
|
|
|
+ if vs, ok := filter["recordPayType"]; ok && vs != nil {
|
|
|
+ recordPayType = gconv.Int(filter["recordPayType"])
|
|
|
+ } else {
|
|
|
+ if gconv.Int(filter["createType"]) == 2 {
|
|
|
+ recordPayType = 3
|
|
|
+ } else if gconv.Int(filter["createType"]) == 3 {
|
|
|
+ recordPayType = 1
|
|
|
+ } else {
|
|
|
+ recordPayType = gconv.Int(filter["createType"])
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if filter["comboId"] != nil {
|
|
|
bigFilter["comboId"] = gconv.Int(filter["comboId"])
|
|
|
} else {
|
|
@@ -48,16 +63,17 @@ func GetBigFilter(data map[string]interface{}) (g.Map, string, error) {
|
|
|
bigCode = "dyh002"
|
|
|
case 7:
|
|
|
bigCode = "dyh003"
|
|
|
- case 30190:
|
|
|
- bigCode = "dyh004"
|
|
|
}
|
|
|
-
|
|
|
+ bigFilter["dataPackNum"] = gconv.Int(filter["dataPackNum"])
|
|
|
ctx := context.Background()
|
|
|
bigFilter["finalAreaCount"] = -1
|
|
|
if gconv.Int(filter["areaCount"]) > 0 {
|
|
|
bigFilter["finalAreaCount"] = gconv.Int(filter["areaCount"])
|
|
|
}
|
|
|
-
|
|
|
+ if gconv.Int(filter["areaCount"]) == 1 && gconv.Int(filter["comboId"]) == 6 {
|
|
|
+ bigCode = "dyh004"
|
|
|
+ }
|
|
|
+ bigFilter["serviceIds"] = strings.Split(gconv.String(filter["serversId"]), ",")
|
|
|
switch gconv.String(data["product_type"]) {
|
|
|
case "大会员", "大会员-子账号":
|
|
|
bigFilter["buy_cycle"] = gconv.Int(filter["cycle"])
|
|
@@ -82,7 +98,7 @@ func GetBigFilter(data map[string]interface{}) (g.Map, string, error) {
|
|
|
bigFilter["serviceIds"] = strings.Split(gconv.String(filter["serversId"]), ",")
|
|
|
} else {
|
|
|
bigFilter["supServiceIds"] = strings.Split(gconv.String(filter["serversId"]), ",")
|
|
|
- ids, _ := g.DB().Ctx(ctx).GetOne(ctx, fmt.Sprintf(`SELECT ROUP_CONCAT(DISTINCT s_serviceid ORDER BY s_serviceid SEPARATOR ',') AS concatenated_ids FROM bigmember_service_user WHERE s_userid ='%s'`, gconv.String(data["user_id"])))
|
|
|
+ ids, _ := g.DB().Ctx(ctx).GetOne(ctx, fmt.Sprintf(`SELECT GROUP_CONCAT(DISTINCT s_serviceid SEPARATOR ',') AS concatenated_ids FROM bigmember_service_user WHERE s_userid ='%s'`, gconv.String(data["user_id"])))
|
|
|
if !ids.IsEmpty() {
|
|
|
bigFilter["serviceIds"] = strings.Split(gconv.String(ids.Map()["concatenated_ids"]), ",")
|
|
|
}
|
|
@@ -98,5 +114,42 @@ func GetBigFilter(data map[string]interface{}) (g.Map, string, error) {
|
|
|
}
|
|
|
bigFilter["supServiceIds"] = supIds
|
|
|
}
|
|
|
- return bigFilter, bigCode, nil
|
|
|
+ return bigFilter, bigCode, recordPayType, nil
|
|
|
+}
|
|
|
+
|
|
|
+func OrderSeal() error {
|
|
|
+ res, err := g.DB().Query(context.Background(), `SELECT * FROM order_seal `)
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ for _, i2 := range res.List() {
|
|
|
+ var (
|
|
|
+ applicant_id []string
|
|
|
+ salesman_id string
|
|
|
+ )
|
|
|
+ res1, _ := g.DB().Query(context.Background(), fmt.Sprintf(`SELECT phone FROM cadmin.admin_user where id in (%s) `, gconv.String(i2["applicant_id"])))
|
|
|
+ if !res1.IsEmpty() {
|
|
|
+ for _, m := range res1.List() {
|
|
|
+ res11, _ := g.DB().GetOne(context.Background(), `SELECT id FROM entniche_user where ent_id=25917 and phone =? `, m["phone"])
|
|
|
+ if !res11.IsEmpty() {
|
|
|
+ applicant_id = append(applicant_id, gconv.String(res11.Map()["id"]))
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ res2, _ := g.DB().GetOne(context.Background(), `SELECT phone FROM cadmin.admin_user where id =? `, i2["salesman_id"])
|
|
|
+ if !res1.IsEmpty() {
|
|
|
+ res22, _ := g.DB().GetOne(context.Background(), `SELECT id FROM entniche_user where ent_id=25917 and phone =? `, res2.Map()["phone"])
|
|
|
+ if !res22.IsEmpty() {
|
|
|
+ salesman_id = gconv.String(res22.Map()["id"])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ g.DB().Update(context.Background(), "order_seal", map[string]interface{}{
|
|
|
+ "applicant_id": strings.Join(applicant_id, ","),
|
|
|
+ "salesman_id": salesman_id,
|
|
|
+ }, map[string]interface{}{
|
|
|
+ "id": i2["id"],
|
|
|
+ })
|
|
|
+ }
|
|
|
+ return nil
|
|
|
}
|