|
@@ -3,7 +3,9 @@ package service
|
|
|
import (
|
|
|
"encoding/json"
|
|
|
"fmt"
|
|
|
+ "github.com/gogf/gf/v2/util/gconv"
|
|
|
"log"
|
|
|
+ "math"
|
|
|
"strconv"
|
|
|
"strings"
|
|
|
"time"
|
|
@@ -221,7 +223,7 @@ func BuyProductList(this *entmanageapplication.BuyProductListReq) *entmanageappl
|
|
|
func addPower(waitEmpowerId int64, identity *usercenter.Identity) {
|
|
|
data := JyMysql.FindOne(EntnicheOrder, map[string]interface{}{"wait_empower_id": waitEmpowerId}, "", "")
|
|
|
if data != nil && len(*data) > 0 {
|
|
|
- orderId := common.Int64All((*data)["product_id"])
|
|
|
+ orderId := common.Int64All((*data)["order_detail_id"])
|
|
|
orderData := JyMysql.FindOne(JyOrderDetail, map[string]interface{}{"id": orderId}, "", "")
|
|
|
if orderData != nil && len(*orderData) > 0 {
|
|
|
productType := common.ObjToString((*orderData)["product_type"])
|
|
@@ -385,11 +387,18 @@ func vipSetMap(orderData map[string]interface{}) (set map[string]interface{}, se
|
|
|
setEntUser["i_vip_status"] = common.If(isTrial, -2, 2) //1试用 2正式 -2 试用到期
|
|
|
vms := VipSimpleMsg{}
|
|
|
json.Unmarshal([]byte(common.ObjToString(orderData["filter"])), &vms)
|
|
|
-
|
|
|
+ if vms.NewBuyset == nil { //704改版后新订单不包含此类信息
|
|
|
+ newVms := VipCycleFilter{}
|
|
|
+ json.Unmarshal([]byte(common.ObjToString(orderData["filter"])), &newVms)
|
|
|
+ vms.NewBuyset = &SubvipBuySet{
|
|
|
+ Upgrade: 1,
|
|
|
+ AreaCount: newVms.FinalAreaCount,
|
|
|
+ }
|
|
|
+ }
|
|
|
set = map[string]interface{}{
|
|
|
"o_entniche": map[string]interface{}{
|
|
|
- "i_trial": -1, //已激活试用
|
|
|
- "o_area": *vms.Area, //设置地区
|
|
|
+ "i_trial": -1, //已激活试用
|
|
|
+ //"o_area": *vms.Area, //设置地区
|
|
|
"o_buyset": *vms.NewBuyset, //购买内容 城市、省份、行业数量
|
|
|
"a_buyerclass": []interface{}{}, //设置行业
|
|
|
},
|
|
@@ -399,12 +408,29 @@ func vipSetMap(orderData map[string]interface{}) (set map[string]interface{}, se
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+func month(num, ty int) int {
|
|
|
+ //BuyType int `json:"buy_type"` //购买周期 类型 1天 2月 3年 4季度
|
|
|
+ switch ty {
|
|
|
+ case 2:
|
|
|
+ return num
|
|
|
+ case 1:
|
|
|
+ return gconv.Int(math.Ceil(float64(num) / 30))
|
|
|
+ case 3:
|
|
|
+ return num * 12
|
|
|
+ case 4:
|
|
|
+ return num * 3
|
|
|
+ }
|
|
|
+ return 0
|
|
|
+}
|
|
|
+
|
|
|
func memberSetMap(userId, waitEmpowerId int64, orderData map[string]interface{}) (set map[string]interface{}, setEntUser map[string]interface{}) {
|
|
|
set, setEntUser = map[string]interface{}{}, map[string]interface{}{}
|
|
|
filterMap := common.ObjToMap(orderData["filter"])
|
|
|
- level := common.IntAll((*filterMap)["level"])
|
|
|
comboId := common.IntAll((*filterMap)["comboId"])
|
|
|
- payCycle := common.IntAll((*filterMap)["cycle"])
|
|
|
+ level := common.If(comboId == 0, 5, comboId).(int)
|
|
|
+ payCycle := month(common.IntAll((*filterMap)["buy_cycle"]), common.IntAll((*filterMap)["buy_type"])) + month(common.IntAll((*filterMap)["give_cycle"]), common.IntAll((*filterMap)["give_type"]))
|
|
|
+
|
|
|
+ //payCycle := common.IntAll((*filterMap)["cycle"])
|
|
|
serversId := common.ObjToString((*filterMap)["serversId"])
|
|
|
startTime := common.ObjToString(orderData["service_starttime"])
|
|
|
endTime := common.ObjToString(orderData["service_endtime"])
|