|
@@ -31,54 +31,53 @@ type RenewUpgrade struct {
|
|
|
//获取购买订阅相关信息
|
|
|
func (this *RenewUpgrade) GetBuyMsg() {
|
|
|
userId := qutil.ObjToString(this.GetSession("userId"))
|
|
|
- data, ok := util.MQFW.FindById("user", userId, nil)
|
|
|
- if ok && len(*data) > 0 && *data != nil {
|
|
|
- vipjy := (*data)["o_vipjy"].(map[string]interface{})
|
|
|
- area := vipjy["o_area"]
|
|
|
- buyerclass := vipjy["a_buyerclass"]
|
|
|
- // cycleunit := vipjy["i_cycleunit"] // 1-年,2-月
|
|
|
- // cyclecount := vipjy["i_cyclecount"] //数量
|
|
|
- starttime := qutil.Int64All((*data)["l_vip_starttime"])
|
|
|
- start := time.Unix(starttime, 0).Format("2006-01-02")
|
|
|
- endtime := qutil.Int64All((*data)["l_vip_endtime"])
|
|
|
- end := time.Unix(endtime, 0).Format("2006-01-02")
|
|
|
- now := time.Unix(time.Now().Unix(), 0).Format("2006-01-02")
|
|
|
- vipStatus := (*data)["i_vip_status"]
|
|
|
- buyset := vipjy["o_buyset"]
|
|
|
-
|
|
|
- orderdata := util.Mysql.FindOne("dataexport_order", map[string]interface{}{
|
|
|
- "user_id": userId,
|
|
|
- "order_status": 1,
|
|
|
- "product_type": "VIP订阅",
|
|
|
- }, "filter,order_code", "create_time desc")
|
|
|
- vmsg := entity.VipSimpleMsg{}
|
|
|
- allArea := &map[string]interface{}{}
|
|
|
- allIndustry := []string{}
|
|
|
- if len(*orderdata) > 0 && *orderdata != nil {
|
|
|
- filterStr := qutil.ObjToString((*orderdata)["filter"])
|
|
|
- if err := json.Unmarshal([]byte(filterStr), &vmsg); err != nil {
|
|
|
- log.Printf("%s vipSubscribeStruct PayCallBack Unmarshal 出错 [%s]\n", filterStr)
|
|
|
- return
|
|
|
- }
|
|
|
- allArea = vmsg.Area
|
|
|
- allIndustry = vmsg.Industry
|
|
|
+ r := func() *entity.FuncResult {
|
|
|
+ if userId == "" {
|
|
|
+ return &entity.FuncResult{false, errors.New("未登录"), nil}
|
|
|
}
|
|
|
- dataArr := map[string]interface{}{
|
|
|
- "area": area,
|
|
|
- "buyerclass": buyerclass,
|
|
|
- "starttime": starttime,
|
|
|
- "endtime": endtime,
|
|
|
- "start": start,
|
|
|
- "end": end,
|
|
|
- "now": now,
|
|
|
- "vipStatus": vipStatus,
|
|
|
- "buyset": buyset,
|
|
|
- "allarea": allArea,
|
|
|
- "allindustry": allIndustry,
|
|
|
- "orderCode": (*orderdata)["order_code"],
|
|
|
+ data, ok := util.MQFW.FindById("user", userId, nil)
|
|
|
+ if ok && len(*data) > 0 && *data != nil {
|
|
|
+ vipjy := (*data)["o_vipjy"].(map[string]interface{})
|
|
|
+ area := vipjy["o_area"]
|
|
|
+ buyerclass := vipjy["a_buyerclass"]
|
|
|
+ starttime := qutil.Int64All((*data)["l_vip_starttime"])
|
|
|
+ start := time.Unix(starttime, 0).Format("2006-01-02")
|
|
|
+ endtime := qutil.Int64All((*data)["l_vip_endtime"])
|
|
|
+ end := time.Unix(endtime, 0).Format("2006-01-02")
|
|
|
+ now := time.Unix(time.Now().Unix(), 0).Format("2006-01-02")
|
|
|
+ vipStatus := (*data)["i_vip_status"]
|
|
|
+ buyset := vipjy["o_buyset"]
|
|
|
+ //
|
|
|
+ var orderCode interface{}
|
|
|
+ orderdata := util.Mysql.FindOne("dataexport_order", map[string]interface{}{
|
|
|
+ "user_id": userId,
|
|
|
+ "order_status": 1,
|
|
|
+ "product_type": "VIP订阅",
|
|
|
+ }, "order_code", "create_time desc")
|
|
|
+ if len(*orderdata) > 0 && *orderdata != nil {
|
|
|
+ orderCode = (*orderdata)["order_code"]
|
|
|
+ }
|
|
|
+ dataArr := map[string]interface{}{
|
|
|
+ "area": area,
|
|
|
+ "buyerclass": buyerclass,
|
|
|
+ "starttime": starttime,
|
|
|
+ "endtime": endtime,
|
|
|
+ "start": start,
|
|
|
+ "end": end,
|
|
|
+ "now": now,
|
|
|
+ "vipStatus": vipStatus,
|
|
|
+ "buyset": buyset,
|
|
|
+ "orderCode": orderCode,
|
|
|
+ }
|
|
|
+ return &entity.FuncResult{true, nil, dataArr}
|
|
|
+ } else {
|
|
|
+ return &entity.FuncResult{false, errors.New("非法请求"), nil}
|
|
|
}
|
|
|
- this.ServeJson(dataArr)
|
|
|
+ }()
|
|
|
+ if r.Err != nil {
|
|
|
+ log.Printf("%s CreateOrder err:%v\n", userId, r.Err.Error())
|
|
|
}
|
|
|
+ this.ServeJson(r.Format())
|
|
|
}
|
|
|
|
|
|
//升级续费
|