|
@@ -245,8 +245,8 @@ func (o *OrderListDetails) SetEmail() {
|
|
|
var email_used = true
|
|
|
if email != o.GetSession("EmailBindingVerifyEmail") {
|
|
|
//user表里校验邮箱是否被使用 字段待定
|
|
|
- res, _ := util.MQFW.FindOne("user", bson.M{"email": email})
|
|
|
- if res != nil && qutil.ObjToString((*res)["email"]) != "" {
|
|
|
+ res, _ := util.MQFW.FindOne("user", bson.M{"s_myemail": email})
|
|
|
+ if res != nil && qutil.ObjToString((*res)["s_myemail"]) != "" {
|
|
|
email_used = false
|
|
|
o.T["success"] = false
|
|
|
o.T["errCode"] = 4
|
|
@@ -354,6 +354,25 @@ func (o *OrderListDetails) SetRes(res []map[string]interface{}, queryM map[strin
|
|
|
}
|
|
|
delete(queryM, "product_type")
|
|
|
for _, v := range res {
|
|
|
+ //获取单号 如果是vip 48小时取消
|
|
|
+ //order_code := qutil.ObjToString(v["order_code"])
|
|
|
+ //go FortyEightHoursCancel(order_code)
|
|
|
+
|
|
|
+ create_time_str := qutil.ObjToString(v["create_time"])
|
|
|
+ //创建时间戳
|
|
|
+ create_time, _ := time.ParseInLocation(qutil.Date_Full_Layout, create_time_str, time.Local)
|
|
|
+ //48小时后的时间戳
|
|
|
+ create_time_stamp := create_time.AddDate(0, 0, 2).Unix()
|
|
|
+ //当前时间时间戳
|
|
|
+ now_time_stamp := time.Now().Unix()
|
|
|
+ if create_time_stamp < now_time_stamp && qutil.ObjToString(v["product_type"]) == "VIP订阅" {
|
|
|
+ if v["order_status"] != nil {
|
|
|
+ order_status := qutil.Int64All(v["order_status"])
|
|
|
+ if order_status == 0 {
|
|
|
+ v["order_status"] = orderStatus_cancel
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
if v["filter_publishtime"] != nil {
|
|
|
filter_publishtime := v["filter_publishtime"]
|
|
|
if filter_publishtime != nil {
|
|
@@ -436,3 +455,40 @@ func getPayTransactionId(payWay, tradeNo string) (transaction_id string) {
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+//检查vip订单是否到期,如果到期 订单取消48h
|
|
|
+func FortyEightHoursCancel(order string) {
|
|
|
+ //查询vip订单条件
|
|
|
+ queryM := map[string]interface{}{
|
|
|
+ "order_code": order,
|
|
|
+ "product_type": "VIP订阅",
|
|
|
+ }
|
|
|
+ flag := false
|
|
|
+ //order := util.Mysql.FindOne(tableName_order, queryMap, "pay_way,out_trade_no,prepay_time,order_status", "")
|
|
|
+ res := util.Mysql.FindOne(tableName_order, queryM, "id,order_code,create_time,pay_way,out_trade_no,prepay_time,order_status,user_id", "")
|
|
|
+ if res != nil {
|
|
|
+ id := qutil.Int64All((*res)["id"])
|
|
|
+ queryMap := map[string]interface{}{
|
|
|
+ "id": id,
|
|
|
+ "user_id": qutil.ObjToString((*res)["user_id"]),
|
|
|
+ }
|
|
|
+ create_time_str := qutil.ObjToString((*res)["create_time"])
|
|
|
+ //创建时间戳
|
|
|
+ create_time, _ := time.ParseInLocation(qutil.Date_Full_Layout, create_time_str, time.Local)
|
|
|
+ //48小时后的时间戳
|
|
|
+ create_time_stamp := create_time.AddDate(0, 0, 2).Unix()
|
|
|
+ //当前时间时间戳
|
|
|
+ now_time_stamp := time.Now().Unix()
|
|
|
+ //如果超过48小时 取消订单
|
|
|
+ if create_time_stamp < now_time_stamp {
|
|
|
+ if qutil.IntAll((*res)["order_status"]) == 0 { //未支付状态下 删除订单需要先关闭订单
|
|
|
+ flag = pay.CloseDataExportOrder(qutil.ObjToString((*res)["pay_way"]), qutil.ObjToString((*res)["out_trade_no"]), qutil.ObjToString((*res)["prepay_time"]))
|
|
|
+ } else {
|
|
|
+ flag = true
|
|
|
+ }
|
|
|
+ if flag {
|
|
|
+ flag = util.Mysql.Update(tableName_order, queryMap, map[string]interface{}{"order_status": -2})
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|