|
@@ -30,6 +30,7 @@ type OrderListDetails struct {
|
|
checkMailCodeVerify xweb.Mapper `xweb:"/orderListDetails/checkMailCodeVerify"` //验证码
|
|
checkMailCodeVerify xweb.Mapper `xweb:"/orderListDetails/checkMailCodeVerify"` //验证码
|
|
emailOperation xweb.Mapper `xweb:"/orderListDetails/emailOperation"` //查看邮箱
|
|
emailOperation xweb.Mapper `xweb:"/orderListDetails/emailOperation"` //查看邮箱
|
|
isVip xweb.Mapper `xweb:"/orderListDetails/isVip"`
|
|
isVip xweb.Mapper `xweb:"/orderListDetails/isVip"`
|
|
|
|
+ getVipOrderInfo xweb.Mapper `xweb:"/orderListDetails/getVipOrderInfo"` //再次购买 回显
|
|
}
|
|
}
|
|
|
|
|
|
var (
|
|
var (
|
|
@@ -360,6 +361,62 @@ func (o *OrderListDetails) IsVip() {
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+//获取购买订阅相关信息
|
|
|
|
+func (o *OrderListDetails) GetVipOrderInfo() {
|
|
|
|
+ userId := qutil.ObjToString(o.GetSession("userId"))
|
|
|
|
+ order_code := o.GetString("orderCode")
|
|
|
|
+ queryMap := map[string]interface{}{
|
|
|
|
+ "user_id": userId,
|
|
|
|
+ "order_code": order_code,
|
|
|
|
+ }
|
|
|
|
+ inf := map[string]interface{}{}
|
|
|
|
+ company, timeSelect, year, month := 0, 0, 0, 0
|
|
|
|
+ filter := util.Mysql.FindOne(tableName_order, queryMap, "filter,vip_starttime,vip_endtime", "")
|
|
|
|
+ if filter != nil {
|
|
|
|
+ info := qutil.ObjToMap(filter)
|
|
|
|
+ inf = *qutil.ObjToMap((*info)["filter"])
|
|
|
|
+ vip_starttime := qutil.ObjToString((*info)["vip_starttime"])
|
|
|
|
+ vip_endtime := qutil.ObjToString((*info)["vip_endtime"])
|
|
|
|
+ if vip_starttime != "" && vip_endtime != "" {
|
|
|
|
+ //计算周期时间
|
|
|
|
+ vip_starttime_stamp, _ := time.ParseInLocation(qutil.Date_Full_Layout, vip_starttime, time.Local)
|
|
|
|
+ vip_endtime_stamp, _ := time.ParseInLocation(qutil.Date_Full_Layout, vip_endtime, time.Local)
|
|
|
|
+ start_year := time.Unix(qutil.Int64All(vip_starttime_stamp.Unix()), 0).Year()
|
|
|
|
+ end_year := time.Unix(qutil.Int64All(vip_endtime_stamp.Unix()), 0).Year()
|
|
|
|
+ start_month := int(time.Unix(qutil.Int64All(vip_starttime_stamp.Unix()), 0).Month())
|
|
|
|
+ end_month := int(time.Unix(qutil.Int64All(vip_endtime_stamp.Unix()), 0).Month())
|
|
|
|
+ if end_year > start_year {
|
|
|
|
+ if end_month > start_month {
|
|
|
|
+ year = end_year - start_year
|
|
|
|
+ month = end_month - start_month
|
|
|
|
+ } else {
|
|
|
|
+ year = end_year - start_year - 1
|
|
|
|
+ month = 12 + end_month - start_month
|
|
|
|
+ if month == 12 {
|
|
|
|
+ year++
|
|
|
|
+ month = 0
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else if end_year == start_year {
|
|
|
|
+ month = end_month - start_month
|
|
|
|
+ }
|
|
|
|
+ //company 1:年 2:月
|
|
|
|
+ if year == 0 && month > 0 {
|
|
|
|
+ company, timeSelect = 2, month
|
|
|
|
+ } else if year > 0 && month > 0 {
|
|
|
|
+ company, timeSelect = 2, (12*year + month)
|
|
|
|
+ } else if year > 0 && month == 0 {
|
|
|
|
+ company, timeSelect = 1, year
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ o.ServeJson(map[string]interface{}{
|
|
|
|
+ "data": inf,
|
|
|
|
+ "company": company,
|
|
|
|
+ "timeSelect": timeSelect,
|
|
|
|
+ })
|
|
|
|
+}
|
|
|
|
+
|
|
func (o *OrderListDetails) SetRes(res []map[string]interface{}, queryM map[string]interface{}) {
|
|
func (o *OrderListDetails) SetRes(res []map[string]interface{}, queryM map[string]interface{}) {
|
|
//获取最后一次购买的vip订单
|
|
//获取最后一次购买的vip订单
|
|
queryM["product_type"] = "VIP订阅"
|
|
queryM["product_type"] = "VIP订阅"
|