Răsfoiți Sursa

fix:时间格式修改

duxin 6 luni în urmă
părinte
comite
30324e7130
1 a modificat fișierele cu 803 adăugiri și 803 ștergeri
  1. 803 803
      src/jfw/modules/subscribepay/src/service/commonAction.go

+ 803 - 803
src/jfw/modules/subscribepay/src/service/commonAction.go

@@ -1,188 +1,188 @@
 package service
 
 import (
-	"database/sql"
-	"encoding/base64"
-	"encoding/json"
-	"errors"
-	"fmt"
-	"jy/src/jfw/modules/subscribepay/src/config"
-	"jy/src/jfw/modules/subscribepay/src/entity"
-	"jy/src/jfw/modules/subscribepay/src/pay"
-	"jy/src/jfw/modules/subscribepay/src/util"
-	"log"
-	"math"
-	"net/rpc"
-	"regexp"
-	"strconv"
-	"strings"
-	"time"
-
-	. "app.yhyue.com/moapp/jybase/api"
-	. "app.yhyue.com/moapp/jybase/date"
-	"app.yhyue.com/moapp/jypkg/public"
-	"github.com/gogf/gf/v2/util/gconv"
-	"github.com/google/uuid"
-
-	"github.com/gogf/gf/v2/os/gctx"
-
-	qutil "app.yhyue.com/moapp/jybase/common"
-	"app.yhyue.com/moapp/jybase/encrypt"
-	elastic "app.yhyue.com/moapp/jybase/es"
-	"app.yhyue.com/moapp/jybase/go-xweb/xweb"
-	"app.yhyue.com/moapp/jybase/redis"
-	"github.com/SKatiyar/qr"
-	"github.com/gogf/gf/v2/frame/g"
+    "database/sql"
+    "encoding/base64"
+    "encoding/json"
+    "errors"
+    "fmt"
+    "jy/src/jfw/modules/subscribepay/src/config"
+    "jy/src/jfw/modules/subscribepay/src/entity"
+    "jy/src/jfw/modules/subscribepay/src/pay"
+    "jy/src/jfw/modules/subscribepay/src/util"
+    "log"
+    "math"
+    "net/rpc"
+    "regexp"
+    "strconv"
+    "strings"
+    "time"
+
+    . "app.yhyue.com/moapp/jybase/api"
+    . "app.yhyue.com/moapp/jybase/date"
+    "app.yhyue.com/moapp/jypkg/public"
+    "github.com/gogf/gf/v2/util/gconv"
+    "github.com/google/uuid"
+
+    "github.com/gogf/gf/v2/os/gctx"
+
+    qutil "app.yhyue.com/moapp/jybase/common"
+    "app.yhyue.com/moapp/jybase/encrypt"
+    elastic "app.yhyue.com/moapp/jybase/es"
+    "app.yhyue.com/moapp/jybase/go-xweb/xweb"
+    "app.yhyue.com/moapp/jybase/redis"
+    "github.com/SKatiyar/qr"
+    "github.com/gogf/gf/v2/frame/g"
 )
 
 // 付费公用方法
 type CommonAction struct {
-	*xweb.Action
-	getwxSdkSign         xweb.Mapper `xweb:"/wx/getwxSdkSign"`                 //微信js参数
-	getDomain            xweb.Mapper `xweb:"/getDomain"`                       //微信js参数
-	getCommonOrderPrice  xweb.Mapper `xweb:"/common/getOrderPrice"`            //获取订单价格
-	getCommonPayParam    xweb.Mapper `xweb:"/common/getPayParam"`              //公共获取支付方法
-	saveTransferAccounts xweb.Mapper `xweb:"/common/saveTransferAccounts"`     //公共对公转账接口
-	isPaySuccess         xweb.Mapper `xweb:"/isPaySuccess"`                    //是否支付成功
-	deleteOrder          xweb.Mapper `xweb:"/deleteOrder"`                     //删除订单
-	applyInvoice         xweb.Mapper `xweb:"/applyInvoice"`                    //申请发票
-	sendMailNote         xweb.Mapper `xweb:"/sendMailNote/(.*)"`               //发送附件邮件通知
-	createorder          xweb.Mapper `xweb:"/common/createorder"`              //创建订单公共方法
-	getWxReturnPayParam  xweb.Mapper `xweb:"/free/common/getWxReturnPayParam"` //获取微信回款支付参数
-	getReturnResult      xweb.Mapper `xweb:"/free/common/getReturnResult"`     //获取微信回款结果
+    *xweb.Action
+    getwxSdkSign         xweb.Mapper `xweb:"/wx/getwxSdkSign"`                 //微信js参数
+    getDomain            xweb.Mapper `xweb:"/getDomain"`                       //微信js参数
+    getCommonOrderPrice  xweb.Mapper `xweb:"/common/getOrderPrice"`            //获取订单价格
+    getCommonPayParam    xweb.Mapper `xweb:"/common/getPayParam"`              //公共获取支付方法
+    saveTransferAccounts xweb.Mapper `xweb:"/common/saveTransferAccounts"`     //公共对公转账接口
+    isPaySuccess         xweb.Mapper `xweb:"/isPaySuccess"`                    //是否支付成功
+    deleteOrder          xweb.Mapper `xweb:"/deleteOrder"`                     //删除订单
+    applyInvoice         xweb.Mapper `xweb:"/applyInvoice"`                    //申请发票
+    sendMailNote         xweb.Mapper `xweb:"/sendMailNote/(.*)"`               //发送附件邮件通知
+    createorder          xweb.Mapper `xweb:"/common/createorder"`              //创建订单公共方法
+    getWxReturnPayParam  xweb.Mapper `xweb:"/free/common/getWxReturnPayParam"` //获取微信回款支付参数
+    getReturnResult      xweb.Mapper `xweb:"/free/common/getReturnResult"`     //获取微信回款结果
 }
 
 var pdfNameReg = regexp.MustCompilePOSIX(`[^//]*\.pdf`)
 
 func (this *CommonAction) GetDomain() {
-	this.ServeJson(NewResult(map[string]interface{}{
-		"web": config.Config.WebDomain,
-		"app": config.Config.AppDomain,
-		"wx":  config.Config.WxDomain,
-	}, nil))
+    this.ServeJson(NewResult(map[string]interface{}{
+        "web": config.Config.WebDomain,
+        "app": config.Config.AppDomain,
+        "wx":  config.Config.WxDomain,
+    }, nil))
 }
 
 func (this *CommonAction) SendMailNote(mailType string) {
-	userId, _ := this.GetSession("userId").(string)
-	rData, errMsg := func() (interface{}, error) {
-		downurl := this.GetString("downurl")
-		userMail := this.GetString("email")
-		if downurl == "" || userMail == "" {
-			return nil, fmt.Errorf("缺少字段")
-		}
-		//mailShowName := "附件"
-		detail := "您好,您的附件已发送到您的邮箱,请查收!"
-		mail_title := "剑鱼标讯"
-		switch mailType {
-		case "projectPdfFile":
-			mail_title = "项目报告"
-			detail = "您好,您的“%s”项目报告已发送到您的邮箱,请查收!"
-			projectName, pid := "", ""
-			strArr := pdfNameReg.FindStringSubmatch(downurl)
-			if len(strArr) != 1 {
-				return nil, fmt.Errorf("发送异常")
-			}
-			if arr := strings.Split(strings.ReplaceAll(strArr[0], ".pdf", ""), "_"); len(arr) != 0 {
-				pid = arr[0]
-			}
-
-			if pid != "" {
-				res := elastic.Get("projectset", "projectset", fmt.Sprintf(`{"query": {"bool": {"must": [{"term": {"_id": "%s"}}]}},"_source":["projectname"],"from": 0,"size": 1}`, pid))
-				if res != nil && len(*res) == 1 {
-					projectName, _ = (*res)[0]["projectname"].(string)
-				}
-			}
-			detail = fmt.Sprintf("您好,您的“%s”项目报告已发送到您的邮箱,请查收!", projectName)
-		}
-		if !(strings.HasPrefix(downurl, "https://") || strings.HasPrefix(downurl, "http://")) {
-			downurl = config.Config.WebDomain + downurl
-		}
-		mailContent := fmt.Sprintf(config.ExConf.Mail_attach_common_attachment, detail, downurl)
-		//用户发送邮件
-		sendOk := false
-		if userMail != "" {
-			if sendOk = util.SendRetryMail(config.ExConf.Mail_retry, userMail, mail_title, mailContent, "", nil, config.GmailAuth); sendOk {
-				log.Printf("DataExportPack SendMailNote 地址%s:邮箱%s邮件发送成功!", downurl, userMail)
-			} else {
-				sendErr := fmt.Sprintf("DataExportPack SendMailNote%s:邮箱%s邮件发送失败", downurl, userMail)
-				log.Printf("%s DataExportPack SendMailNote 发送邮件失败 %v\n", userId, sendErr)
-			}
-		}
-		return sendOk, nil
-	}()
-	if errMsg != nil {
-		log.Printf("%s DataExportPack SendExportMail 异常:%s\n", userId, errMsg.Error())
-	}
-	this.ServeJson(NewResult(rData, errMsg))
+    userId, _ := this.GetSession("userId").(string)
+    rData, errMsg := func() (interface{}, error) {
+        downurl := this.GetString("downurl")
+        userMail := this.GetString("email")
+        if downurl == "" || userMail == "" {
+            return nil, fmt.Errorf("缺少字段")
+        }
+        //mailShowName := "附件"
+        detail := "您好,您的附件已发送到您的邮箱,请查收!"
+        mail_title := "剑鱼标讯"
+        switch mailType {
+        case "projectPdfFile":
+            mail_title = "项目报告"
+            detail = "您好,您的“%s”项目报告已发送到您的邮箱,请查收!"
+            projectName, pid := "", ""
+            strArr := pdfNameReg.FindStringSubmatch(downurl)
+            if len(strArr) != 1 {
+                return nil, fmt.Errorf("发送异常")
+            }
+            if arr := strings.Split(strings.ReplaceAll(strArr[0], ".pdf", ""), "_"); len(arr) != 0 {
+                pid = arr[0]
+            }
+
+            if pid != "" {
+                res := elastic.Get("projectset", "projectset", fmt.Sprintf(`{"query": {"bool": {"must": [{"term": {"_id": "%s"}}]}},"_source":["projectname"],"from": 0,"size": 1}`, pid))
+                if res != nil && len(*res) == 1 {
+                    projectName, _ = (*res)[0]["projectname"].(string)
+                }
+            }
+            detail = fmt.Sprintf("您好,您的“%s”项目报告已发送到您的邮箱,请查收!", projectName)
+        }
+        if !(strings.HasPrefix(downurl, "https://") || strings.HasPrefix(downurl, "http://")) {
+            downurl = config.Config.WebDomain + downurl
+        }
+        mailContent := fmt.Sprintf(config.ExConf.Mail_attach_common_attachment, detail, downurl)
+        //用户发送邮件
+        sendOk := false
+        if userMail != "" {
+            if sendOk = util.SendRetryMail(config.ExConf.Mail_retry, userMail, mail_title, mailContent, "", nil, config.GmailAuth); sendOk {
+                log.Printf("DataExportPack SendMailNote 地址%s:邮箱%s邮件发送成功!", downurl, userMail)
+            } else {
+                sendErr := fmt.Sprintf("DataExportPack SendMailNote%s:邮箱%s邮件发送失败", downurl, userMail)
+                log.Printf("%s DataExportPack SendMailNote 发送邮件失败 %v\n", userId, sendErr)
+            }
+        }
+        return sendOk, nil
+    }()
+    if errMsg != nil {
+        log.Printf("%s DataExportPack SendExportMail 异常:%s\n", userId, errMsg.Error())
+    }
+    this.ServeJson(NewResult(rData, errMsg))
 }
 
 // ----------------------------申请发票------------------------------------
 func (d *CommonAction) ApplyInvoice() error {
-	var applyBill_status int
-	var order_code, applyBill_company, applyBill_taxnum, applyBill_type string
-	var updateBl bool = false
-	order_code = d.GetString("order_code")
-	//获取数据
-	applyBill_type = d.GetString("demo-radio") //个人 单位
-	queryMap := map[string]interface{}{
-		"order_code": order_code,
-	}
-	my_email, product := "", ""
-	product_type := util.Mysql.FindOne("dataexport_order", queryMap, "product_type", "")
-	if product_type != nil {
-		product = qutil.ObjToString((*product_type)["product_type"])
-	}
-	if product == "VIP订阅" {
-		//获取开发票时 用户所绑定的邮箱 user--s_myemail
-		d.GetSession("userId")
-		email := util.Compatible.Select(qutil.ObjToString(d.GetSession("userId")), `{"s_myemail":1}`)
-		if len(*email) > 0 {
-			my_email = qutil.ObjToString((*email)["s_myemail"])
-		}
-	}
-	if applyBill_type == "个人" {
-		applyBill_status = 1
-		if product == "VIP订阅" && my_email != "" {
-			updateBl = util.Mysql.Update("dataexport_order", queryMap, map[string]interface{}{"applyBill_status": applyBill_status, "user_mail": my_email})
-		} else {
-			updateBl = util.Mysql.Update("dataexport_order", queryMap, map[string]interface{}{"applyBill_status": applyBill_status})
-		}
-	} else if applyBill_type == "单位" {
-		applyBill_status = 1                                 //状态
-		applyBill_company = d.GetString("applyBill_company") //公司名
-		applyBill_taxnum = d.GetString("applyBill_taxnum")   //纳税人识别号
-		if product == "VIP订阅" && my_email != "" {
-			updateBl = util.Mysql.Update("dataexport_order", queryMap, map[string]interface{}{
-				"applyBill_company": applyBill_company,
-				"applyBill_taxnum":  applyBill_taxnum,
-				"applyBill_status":  applyBill_status,
-				"applyBill_type":    1,
-				"user_mail":         my_email,
-			}) //修改操作
-		} else {
-			updateBl = util.Mysql.Update("dataexport_order", queryMap, map[string]interface{}{
-				"applyBill_company": applyBill_company,
-				"applyBill_taxnum":  applyBill_taxnum,
-				"applyBill_status":  applyBill_status,
-				"applyBill_type":    1,
-			}) //修改操作
-		}
-	}
-	//判断条件
-	if updateBl {
-		go func() {
-			orderdata := util.Mysql.FindOne("dataexport_order", map[string]interface{}{
-				"order_code": order_code,
-			}, "id,filter,user_mail,user_phone,product_type,data_spec,filter_id,order_code,data_count,order_status,order_money,out_trade_no,applybill_type,applybill_company,applybill_taxnum,user_openid,create_time,pay_time,pay_way,pay_money,vip_starttime,vip_endtime,user_id,vip_type", "")
-			tt := time.Now()
-			pay_time := FormatDate(&tt, Date_Full_Layout)
-			entity.SendMailToBJFinance(orderdata, pay_time, "", 2, config.GmailAuth)
-		}()
-	}
-	d.ServeJson(map[string]interface{}{
-		"flag": updateBl,
-	})
-	return nil
+    var applyBill_status int
+    var order_code, applyBill_company, applyBill_taxnum, applyBill_type string
+    var updateBl bool = false
+    order_code = d.GetString("order_code")
+    //获取数据
+    applyBill_type = d.GetString("demo-radio") //个人 单位
+    queryMap := map[string]interface{}{
+        "order_code": order_code,
+    }
+    my_email, product := "", ""
+    product_type := util.Mysql.FindOne("dataexport_order", queryMap, "product_type", "")
+    if product_type != nil {
+        product = qutil.ObjToString((*product_type)["product_type"])
+    }
+    if product == "VIP订阅" {
+        //获取开发票时 用户所绑定的邮箱 user--s_myemail
+        d.GetSession("userId")
+        email := util.Compatible.Select(qutil.ObjToString(d.GetSession("userId")), `{"s_myemail":1}`)
+        if len(*email) > 0 {
+            my_email = qutil.ObjToString((*email)["s_myemail"])
+        }
+    }
+    if applyBill_type == "个人" {
+        applyBill_status = 1
+        if product == "VIP订阅" && my_email != "" {
+            updateBl = util.Mysql.Update("dataexport_order", queryMap, map[string]interface{}{"applyBill_status": applyBill_status, "user_mail": my_email})
+        } else {
+            updateBl = util.Mysql.Update("dataexport_order", queryMap, map[string]interface{}{"applyBill_status": applyBill_status})
+        }
+    } else if applyBill_type == "单位" {
+        applyBill_status = 1                                 //状态
+        applyBill_company = d.GetString("applyBill_company") //公司名
+        applyBill_taxnum = d.GetString("applyBill_taxnum")   //纳税人识别号
+        if product == "VIP订阅" && my_email != "" {
+            updateBl = util.Mysql.Update("dataexport_order", queryMap, map[string]interface{}{
+                "applyBill_company": applyBill_company,
+                "applyBill_taxnum":  applyBill_taxnum,
+                "applyBill_status":  applyBill_status,
+                "applyBill_type":    1,
+                "user_mail":         my_email,
+            }) //修改操作
+        } else {
+            updateBl = util.Mysql.Update("dataexport_order", queryMap, map[string]interface{}{
+                "applyBill_company": applyBill_company,
+                "applyBill_taxnum":  applyBill_taxnum,
+                "applyBill_status":  applyBill_status,
+                "applyBill_type":    1,
+            }) //修改操作
+        }
+    }
+    //判断条件
+    if updateBl {
+        go func() {
+            orderdata := util.Mysql.FindOne("dataexport_order", map[string]interface{}{
+                "order_code": order_code,
+            }, "id,filter,user_mail,user_phone,product_type,data_spec,filter_id,order_code,data_count,order_status,order_money,out_trade_no,applybill_type,applybill_company,applybill_taxnum,user_openid,create_time,pay_time,pay_way,pay_money,vip_starttime,vip_endtime,user_id,vip_type", "")
+            tt := time.Now()
+            pay_time := FormatDate(&tt, Date_Full_Layout)
+            entity.SendMailToBJFinance(orderdata, pay_time, "", 2, config.GmailAuth)
+        }()
+    }
+    d.ServeJson(map[string]interface{}{
+        "flag": updateBl,
+    })
+    return nil
 }
 
 /*
@@ -191,136 +191,136 @@ func (d *CommonAction) ApplyInvoice() error {
 根据 id+openid 删除
 */
 func (d *CommonAction) DeleteOrder() error {
-	if userId := d.GetSession("userId"); userId != nil {
-		queryMap := map[string]interface{}{
-			"id":      d.GetString("id"),
-			"user_id": userId.(string),
-		}
-		flag := false
-		order := util.Mysql.FindOne(tableName_order, queryMap, "filter,product_type,pay_way,out_trade_no,prepay_time,order_status,order_code,discount_price,d_relation_id,user_id", "")
-		if order != nil {
-			if qutil.IntAll((*order)["order_status"]) == 0 && qutil.ObjToString((*order)["pay_way"]) != "transferAccounts" { //未支付状态下 删除订单需要先关闭订单
-				flag = pay.CloseDataExportOrder(qutil.ObjToString((*order)["pay_way"]), qutil.ObjToString((*order)["out_trade_no"]), qutil.ObjToString((*order)["prepay_time"]))
-				//未支付 非对公转账
-				//卡卷取消绑定
-				userLotteryId := qutil.ObjToString((*order)["d_relation_id"])
-				if userLotteryId != "" {
-					productType := 0 //商品类型0普通的1线上课程
-					if product_type := qutil.ObjToString((*order)["product_type"]); product_type == "中标必听课" {
-						productType = 1
-					}
-					discountId := ""
-					var filter map[string]interface{}
-					//关闭未支付订单
-					if err := json.Unmarshal([]byte(qutil.ObjToString((*order)["filter"])), &filter); err != nil {
-						log.Println("filter.json.Unmarshal出错", err)
-					} else {
-						if filter["discountId"] != nil {
-							discountId = strconv.Itoa(qutil.IntAll(filter["discountId"]))
-						}
-					}
-					order_code := qutil.ObjToString((*order)["order_code"])
-					user_id := qutil.ObjToString((*order)["user_id"])
-					go func(userId, userLotteryId, order_code string) {
-						if !util.UpdateCouponState(userId, userLotteryId, qutil.ObjToString(d.GetSession("s_nickname")), qutil.ObjToString(d.GetSession("phone")), order_code, qutil.ObjToString((*order)["product_type"]), discountId, 0, productType) {
-							log.Println(fmt.Sprintf("单号%s-解绑失败-卡卷%s", order_code, userLotteryId))
-						}
-					}(user_id, userLotteryId, order_code)
-				}
-			} else {
-				flag = true
-			}
-		}
-		if flag {
-			now := time.Now()
-			flag = util.Mysql.Update(tableName_order, queryMap, map[string]interface{}{"del_status": 1, "del_time": FormatDate(&now, Date_Full_Layout)})
-		}
-		d.ServeJson(map[string]interface{}{"success": flag})
-	}
-	return nil
+    if userId := d.GetSession("userId"); userId != nil {
+        queryMap := map[string]interface{}{
+            "id":      d.GetString("id"),
+            "user_id": userId.(string),
+        }
+        flag := false
+        order := util.Mysql.FindOne(tableName_order, queryMap, "filter,product_type,pay_way,out_trade_no,prepay_time,order_status,order_code,discount_price,d_relation_id,user_id", "")
+        if order != nil {
+            if qutil.IntAll((*order)["order_status"]) == 0 && qutil.ObjToString((*order)["pay_way"]) != "transferAccounts" { //未支付状态下 删除订单需要先关闭订单
+                flag = pay.CloseDataExportOrder(qutil.ObjToString((*order)["pay_way"]), qutil.ObjToString((*order)["out_trade_no"]), qutil.ObjToString((*order)["prepay_time"]))
+                //未支付 非对公转账
+                //卡卷取消绑定
+                userLotteryId := qutil.ObjToString((*order)["d_relation_id"])
+                if userLotteryId != "" {
+                    productType := 0 //商品类型0普通的1线上课程
+                    if product_type := qutil.ObjToString((*order)["product_type"]); product_type == "中标必听课" {
+                        productType = 1
+                    }
+                    discountId := ""
+                    var filter map[string]interface{}
+                    //关闭未支付订单
+                    if err := json.Unmarshal([]byte(qutil.ObjToString((*order)["filter"])), &filter); err != nil {
+                        log.Println("filter.json.Unmarshal出错", err)
+                    } else {
+                        if filter["discountId"] != nil {
+                            discountId = strconv.Itoa(qutil.IntAll(filter["discountId"]))
+                        }
+                    }
+                    order_code := qutil.ObjToString((*order)["order_code"])
+                    user_id := qutil.ObjToString((*order)["user_id"])
+                    go func(userId, userLotteryId, order_code string) {
+                        if !util.UpdateCouponState(userId, userLotteryId, qutil.ObjToString(d.GetSession("s_nickname")), qutil.ObjToString(d.GetSession("phone")), order_code, qutil.ObjToString((*order)["product_type"]), discountId, 0, productType) {
+                            log.Println(fmt.Sprintf("单号%s-解绑失败-卡卷%s", order_code, userLotteryId))
+                        }
+                    }(user_id, userLotteryId, order_code)
+                }
+            } else {
+                flag = true
+            }
+        }
+        if flag {
+            now := time.Now()
+            flag = util.Mysql.Update(tableName_order, queryMap, map[string]interface{}{"del_status": 1, "del_time": FormatDate(&now, Date_Full_Layout)})
+        }
+        d.ServeJson(map[string]interface{}{"success": flag})
+    }
+    return nil
 }
 
 func (p *CommonAction) IsPaySuccess() {
-	defer qutil.Catch()
-	code := p.GetString("code")
-	var paramStruct struct {
-		Code string
-	}
-	json.Unmarshal(p.Body(), &paramStruct)
-	if code == "" {
-		code = paramStruct.Code
-	}
-	userId, _ := p.GetSession("userId").(string)
-	if code != "" || userId != "" {
-		data := util.Mysql.FindOne("dataexport_order", map[string]interface{}{
-			"order_code": code,
-			"user_id":    userId,
-		}, "order_status,pay_time,user_mail,pay_way,pay_money,filter", "")
-		if data != nil && qutil.IntAll((*data)["order_status"]) == 1 {
-			t, _ := time.ParseInLocation(Date_Full_Layout, qutil.ObjToString((*data)["pay_time"]), time.Local)
-			p.ServeJson(map[string]interface{}{
-				"success":   true,
-				"email":     qutil.ObjToString((*data)["user_mail"]),
-				"payTime":   t.Unix(),
-				"pay_way":   (*data)["pay_way"],
-				"price":     (*data)["pay_money"],
-				"filter":    (*data)["filter"],
-				"orderCode": code,
-			})
-		}
-	}
-	p.ServeJson(map[string]interface{}{
-		"success": false,
-	})
+    defer qutil.Catch()
+    code := p.GetString("code")
+    var paramStruct struct {
+        Code string
+    }
+    json.Unmarshal(p.Body(), &paramStruct)
+    if code == "" {
+        code = paramStruct.Code
+    }
+    userId, _ := p.GetSession("userId").(string)
+    if code != "" || userId != "" {
+        data := util.Mysql.FindOne("dataexport_order", map[string]interface{}{
+            "order_code": code,
+            "user_id":    userId,
+        }, "order_status,pay_time,user_mail,pay_way,pay_money,filter", "")
+        if data != nil && qutil.IntAll((*data)["order_status"]) == 1 {
+            t, _ := time.ParseInLocation(Date_Full_Layout, qutil.ObjToString((*data)["pay_time"]), time.Local)
+            p.ServeJson(map[string]interface{}{
+                "success":   true,
+                "email":     qutil.ObjToString((*data)["user_mail"]),
+                "payTime":   t.Unix(),
+                "pay_way":   (*data)["pay_way"],
+                "price":     (*data)["pay_money"],
+                "filter":    (*data)["filter"],
+                "orderCode": code,
+            })
+        }
+    }
+    p.ServeJson(map[string]interface{}{
+        "success": false,
+    })
 }
 
 func (d *CommonAction) GetwxSdkSign() {
-	var sign []string
-	url := d.GetString("url")
-	if url != "" {
-		sign = SignJSSDK(url)
-	}
-	nickname, _ := d.Session().Get("s_nickname").(string)
-	avatar, _ := d.Session().Get("s_avatar").(string)
-	openid := encrypt.SE.EncodeString(qutil.ObjToString(d.GetSession("s_m_openid")))
-	d.ServeJson(map[string]interface{}{
-		"wxsdk":    sign,
-		"wxDomain": config.Config.WxDomain,
-		"nickname": nickname,
-		"avatar":   avatar,
-		"openid":   openid,
-	})
+    var sign []string
+    url := d.GetString("url")
+    if url != "" {
+        sign = SignJSSDK(url)
+    }
+    nickname, _ := d.Session().Get("s_nickname").(string)
+    avatar, _ := d.Session().Get("s_avatar").(string)
+    openid := encrypt.SE.EncodeString(qutil.ObjToString(d.GetSession("s_m_openid")))
+    d.ServeJson(map[string]interface{}{
+        "wxsdk":    sign,
+        "wxDomain": config.Config.WxDomain,
+        "nickname": nickname,
+        "avatar":   avatar,
+        "openid":   openid,
+    })
 }
 
 func SignJSSDK(url string) []string {
-	qutil.Catch()
-	var signature []string
-	var key = "wxsignature_" + url
-	if ret := redis.Get("other", key); ret != nil {
-		if d, err := json.Marshal(ret); err == nil {
-			json.Unmarshal(d, &signature)
-		}
-	}
-	if signature == nil || len(signature) == 0 {
-		qutil.Try(func() {
-			client, err := rpc.DialHTTP("tcp", config.Config.Weixinrpc)
-			defer client.Close()
-			if err != nil {
-				log.Println(err.Error())
-				return
-			}
-			err = client.Call("WeiXinRpc.GetJSInterfaceParam", url, &signature)
-			if err != nil {
-				log.Println(err.Error())
-			}
-		}, func(e interface{}) {})
-		if signature == nil || len(signature) != 4 || signature[3] == "" {
-			signature = []string{"", "", "", ""}
-		} else {
-			redis.Put("other", key, signature, 90*60)
-		}
-	}
-	return signature
+    qutil.Catch()
+    var signature []string
+    var key = "wxsignature_" + url
+    if ret := redis.Get("other", key); ret != nil {
+        if d, err := json.Marshal(ret); err == nil {
+            json.Unmarshal(d, &signature)
+        }
+    }
+    if signature == nil || len(signature) == 0 {
+        qutil.Try(func() {
+            client, err := rpc.DialHTTP("tcp", config.Config.Weixinrpc)
+            defer client.Close()
+            if err != nil {
+                log.Println(err.Error())
+                return
+            }
+            err = client.Call("WeiXinRpc.GetJSInterfaceParam", url, &signature)
+            if err != nil {
+                log.Println(err.Error())
+            }
+        }, func(e interface{}) {})
+        if signature == nil || len(signature) != 4 || signature[3] == "" {
+            signature = []string{"", "", "", ""}
+        } else {
+            redis.Put("other", key, signature, 90*60)
+        }
+    }
+    return signature
 }
 
 /*
@@ -329,25 +329,25 @@ param
 orderCode 订单号
 */
 func (this *CommonAction) GetCommonOrderPrice() {
-	orderCode := this.GetString("orderCode")
-	userId := qutil.ObjToString(this.GetSession("userId"))
-	r := func() *entity.FuncResult {
-		query := map[string]interface{}{
-			"user_id":    userId,
-			"order_code": orderCode,
-		}
-		oData := util.Mysql.FindOne("dataexport_order", query, "order_money", "")
-		if oData == nil || len(*oData) == 0 {
-			return &entity.FuncResult{false, errors.New("未知订单"), nil}
-		}
-		return &entity.FuncResult{true, nil, map[string]interface{}{
-			"price": (*oData)["order_money"],
-		}}
-	}()
-	if r.Err != nil {
-		log.Printf("%s GetCommonOrderPrice err:%v\n", userId, r.Err.Error())
-	}
-	this.ServeJson(r.Format())
+    orderCode := this.GetString("orderCode")
+    userId := qutil.ObjToString(this.GetSession("userId"))
+    r := func() *entity.FuncResult {
+        query := map[string]interface{}{
+            "user_id":    userId,
+            "order_code": orderCode,
+        }
+        oData := util.Mysql.FindOne("dataexport_order", query, "order_money", "")
+        if oData == nil || len(*oData) == 0 {
+            return &entity.FuncResult{false, errors.New("未知订单"), nil}
+        }
+        return &entity.FuncResult{true, nil, map[string]interface{}{
+            "price": (*oData)["order_money"],
+        }}
+    }()
+    if r.Err != nil {
+        log.Printf("%s GetCommonOrderPrice err:%v\n", userId, r.Err.Error())
+    }
+    this.ServeJson(r.Format())
 }
 
 /*
@@ -358,110 +358,110 @@ payway 支付方式
 dotype 产品类型
 */
 func (this *CommonAction) GetCommonPayParam() {
-	orderCode := this.GetString("orderCode")
-	payway_req := this.GetString("payway")
-	var paramStruct struct {
-		OrderCode string
-		Payway    string
-	}
-	json.Unmarshal(this.Body(), &paramStruct)
-	if orderCode == "" {
-		orderCode = paramStruct.OrderCode
-	}
-	if payway_req == "" {
-		payway_req = paramStruct.Payway
-	}
-	userId := qutil.ObjToString(this.GetSession("userId"))
-	miniprogramCode := this.Header("MiniprogramCode")
-	r := func() *entity.FuncResult {
-		query := map[string]interface{}{
-			"user_id":      userId,
-			"order_code":   orderCode,
-			"order_status": 0,
-		}
-		oData := util.Mysql.FindOne("dataexport_order", query, "id,code_url,prepay_time,pay_way,order_money,product_type,out_trade_no,course_status", "")
-		if oData == nil || len(*oData) == 0 {
-			return &entity.FuncResult{false, errors.New("未知订单"), nil}
-		}
-		//对公转账审核中
-		if qutil.IntAll((*oData)["course_status"]) == 2 || qutil.IntAll((*oData)["course_status"]) == 4 {
-			return &entity.FuncResult{false, errors.New("转账审核中,请勿重复支付"), nil}
-		}
-		payParam := qutil.ObjToString((*oData)["code_url"])
-		payway := qutil.ObjToString((*oData)["pay_way"])
-		totalfee := qutil.IntAll((*oData)["order_money"])
-		var product_type = qutil.ObjToString((*oData)["product_type"])
-		appid := ""
-		if miniprogramCode == "" {
-			//上次订单支付串是否可用
-			if prepayTime, err := time.ParseInLocation(Date_Full_Layout, qutil.ObjToString((*oData)["prepay_time"]), time.Local); err == nil && payParam != "" {
-				if time.Now().Before(prepayTime.Add(time.Hour * 2)) { //支付串未过期
-					if payway == payway_req {
-						if payParam != "" {
-							return &entity.FuncResult{true, nil, map[string]interface{}{
-								"orderCode": orderCode,
-								"res":       payParam,
-								"price":     totalfee,
-								"timeout":   prepayTime.Unix() + 2*60*60 - time.Now().Unix(),
-								"payWay":    payway}}
-						}
-					} else {
-						//关闭之前支付串(防止重复支付)
-						if !pay.CloseOrder(qutil.ObjToString((*oData)["out_trade_no"]), payway) {
-							log.Printf("GetCommonPayParam 关闭订单%s出错\n", orderCode)
-							return &entity.FuncResult{false, errors.New("支付方式切换异常"), nil}
-						}
-					}
-				}
-			}
-		} else {
-			payway_req = "wx_js"
-			appid = g.Cfg().MustGet(gctx.New(), "miniprogram."+miniprogramCode+".appid").String()
-			if appid == "" {
-				return &entity.FuncResult{false, errors.New(fmt.Sprint("没有找到该小程序%s的appid", miniprogramCode)), nil}
-			}
-		}
-		//重新生成支付串
-		productFlag, ok := pay.PayWayAndSign[product_type][payway_req]
-		if !ok {
-			return &entity.FuncResult{false, errors.New("未知支付类型:" + payway_req), nil}
-		}
-		//tradeno, prepayid, payParam, err := pay.CreateOrderPay(totalfee, productFlag, this.IP(), qutil.ObjToString(this.GetSession("s_m_openid")), appid, payway_req, orderCode, product_type)
-		tradeno, prepayid, payParam, err := pay.CreateOrderPay(totalfee, productFlag, this.IP(), qutil.ObjToString(this.GetSession("s_m_openid")), appid, payway_req, orderCode, 0, product_type)
-		if err != nil {
-			return &entity.FuncResult{false, errors.New(fmt.Sprintf("创建支付失败[%v]", err)), nil}
-		}
-		//更新订单表
-		now := time.Now()
-		update := map[string]interface{}{
-			"prepay_time":  FormatDate(&now, Date_Full_Layout),
-			"out_trade_no": tradeno,
-			"prepay_id":    prepayid,
-			"pay_way":      payway_req,
-		}
-		if miniprogramCode == "" {
-			update["code_url"] = payParam
-		}
-		ok = util.Mysql.Update("dataexport_order", query, update)
-		if !ok {
-			return &entity.FuncResult{false, errors.New("数据库操作异常"), nil}
-		}
-		return &entity.FuncResult{true, nil, map[string]interface{}{
-			"orderCode": orderCode,
-			"res":       payParam,
-			"price":     totalfee,
-			"timeout":   2 * 60 * 60,
-			"payWay":    payway_req}}
-	}()
-	if r.Err != nil {
-		log.Printf("%s GetCommonPayParam err:%v\n", userId, r.Err.Error())
-	}
-	if payway_req == "wx_pc" && r.Data["res"] != nil {
-		rEncode, _ := qr.Encode(qutil.ObjToString(r.Data["res"]), qr.M)
-		pngdat := rEncode.PNG()
-		r.Data["res"] = base64.StdEncoding.EncodeToString(pngdat)
-	}
-	this.ServeJson(r.Format())
+    orderCode := this.GetString("orderCode")
+    payway_req := this.GetString("payway")
+    var paramStruct struct {
+        OrderCode string
+        Payway    string
+    }
+    json.Unmarshal(this.Body(), &paramStruct)
+    if orderCode == "" {
+        orderCode = paramStruct.OrderCode
+    }
+    if payway_req == "" {
+        payway_req = paramStruct.Payway
+    }
+    userId := qutil.ObjToString(this.GetSession("userId"))
+    miniprogramCode := this.Header("MiniprogramCode")
+    r := func() *entity.FuncResult {
+        query := map[string]interface{}{
+            "user_id":      userId,
+            "order_code":   orderCode,
+            "order_status": 0,
+        }
+        oData := util.Mysql.FindOne("dataexport_order", query, "id,code_url,prepay_time,pay_way,order_money,product_type,out_trade_no,course_status", "")
+        if oData == nil || len(*oData) == 0 {
+            return &entity.FuncResult{false, errors.New("未知订单"), nil}
+        }
+        //对公转账审核中
+        if qutil.IntAll((*oData)["course_status"]) == 2 || qutil.IntAll((*oData)["course_status"]) == 4 {
+            return &entity.FuncResult{false, errors.New("转账审核中,请勿重复支付"), nil}
+        }
+        payParam := qutil.ObjToString((*oData)["code_url"])
+        payway := qutil.ObjToString((*oData)["pay_way"])
+        totalfee := qutil.IntAll((*oData)["order_money"])
+        var product_type = qutil.ObjToString((*oData)["product_type"])
+        appid := ""
+        if miniprogramCode == "" {
+            //上次订单支付串是否可用
+            if prepayTime, err := time.ParseInLocation(Date_Full_Layout, qutil.ObjToString((*oData)["prepay_time"]), time.Local); err == nil && payParam != "" {
+                if time.Now().Before(prepayTime.Add(time.Hour * 2)) { //支付串未过期
+                    if payway == payway_req {
+                        if payParam != "" {
+                            return &entity.FuncResult{true, nil, map[string]interface{}{
+                                "orderCode": orderCode,
+                                "res":       payParam,
+                                "price":     totalfee,
+                                "timeout":   prepayTime.Unix() + 2*60*60 - time.Now().Unix(),
+                                "payWay":    payway}}
+                        }
+                    } else {
+                        //关闭之前支付串(防止重复支付)
+                        if !pay.CloseOrder(qutil.ObjToString((*oData)["out_trade_no"]), payway) {
+                            log.Printf("GetCommonPayParam 关闭订单%s出错\n", orderCode)
+                            return &entity.FuncResult{false, errors.New("支付方式切换异常"), nil}
+                        }
+                    }
+                }
+            }
+        } else {
+            payway_req = "wx_js"
+            appid = g.Cfg().MustGet(gctx.New(), "miniprogram."+miniprogramCode+".appid").String()
+            if appid == "" {
+                return &entity.FuncResult{false, errors.New(fmt.Sprint("没有找到该小程序%s的appid", miniprogramCode)), nil}
+            }
+        }
+        //重新生成支付串
+        productFlag, ok := pay.PayWayAndSign[product_type][payway_req]
+        if !ok {
+            return &entity.FuncResult{false, errors.New("未知支付类型:" + payway_req), nil}
+        }
+        //tradeno, prepayid, payParam, err := pay.CreateOrderPay(totalfee, productFlag, this.IP(), qutil.ObjToString(this.GetSession("s_m_openid")), appid, payway_req, orderCode, product_type)
+        tradeno, prepayid, payParam, err := pay.CreateOrderPay(totalfee, productFlag, this.IP(), qutil.ObjToString(this.GetSession("s_m_openid")), appid, payway_req, orderCode, 0, product_type)
+        if err != nil {
+            return &entity.FuncResult{false, errors.New(fmt.Sprintf("创建支付失败[%v]", err)), nil}
+        }
+        //更新订单表
+        now := time.Now()
+        update := map[string]interface{}{
+            "prepay_time":  FormatDate(&now, Date_Full_Layout),
+            "out_trade_no": tradeno,
+            "prepay_id":    prepayid,
+            "pay_way":      payway_req,
+        }
+        if miniprogramCode == "" {
+            update["code_url"] = payParam
+        }
+        ok = util.Mysql.Update("dataexport_order", query, update)
+        if !ok {
+            return &entity.FuncResult{false, errors.New("数据库操作异常"), nil}
+        }
+        return &entity.FuncResult{true, nil, map[string]interface{}{
+            "orderCode": orderCode,
+            "res":       payParam,
+            "price":     totalfee,
+            "timeout":   2 * 60 * 60,
+            "payWay":    payway_req}}
+    }()
+    if r.Err != nil {
+        log.Printf("%s GetCommonPayParam err:%v\n", userId, r.Err.Error())
+    }
+    if payway_req == "wx_pc" && r.Data["res"] != nil {
+        rEncode, _ := qr.Encode(qutil.ObjToString(r.Data["res"]), qr.M)
+        pngdat := rEncode.PNG()
+        r.Data["res"] = base64.StdEncoding.EncodeToString(pngdat)
+    }
+    this.ServeJson(r.Format())
 }
 
 /*
@@ -474,406 +474,406 @@ dotype 产品类型
 var imgReg = regexp.MustCompile(".*.(gif|jpeg|png|jpg)$")
 
 func (this *CommonAction) SaveTransferAccounts() {
-	orderCode := this.GetString("orderCode")
-	transferV := this.GetString("transferV")
-	userId := qutil.ObjToString(this.GetSession("userId"))
-	productType := ""
-	r := func() *entity.FuncResult {
-		if !imgReg.MatchString(transferV) {
-			return &entity.FuncResult{false, errors.New("上传图片异常"), nil}
-		}
-		query := map[string]interface{}{"order_code": orderCode, "user_id": userId}
-		rSearch := util.Mysql.FindOne("dataexport_order", query, "order_channel,order_status,product_type,filter,course_status,out_trade_no,pay_way,create_time,order_code,user_phone,order_money", "")
-		if rSearch == nil || len(*rSearch) == 0 {
-			return &entity.FuncResult{false, errors.New("未查到订单数据"), nil}
-		}
-		if !(qutil.IntAll((*rSearch)["order_status"]) == 0 && (qutil.IntAll((*rSearch)["course_status"]) == 0 || qutil.IntAll((*rSearch)["course_status"]) == 1 || qutil.IntAll((*rSearch)["course_status"]) == 3)) {
-			return &entity.FuncResult{false, errors.New("操作异常"), nil}
-		}
-		productType = qutil.ObjToString((*rSearch)["product_type"])
-		if !(productType == "招投标课程" || productType == "大会员" || productType == "VIP订阅") {
-			return &entity.FuncResult{false, errors.New("非法请求"), nil}
-		}
-		//保存更新filter
-		filterStr := qutil.ObjToString((*rSearch)["filter"])
-		mapTmp := map[string]interface{}{}
-		if json.Unmarshal([]byte(filterStr), &mapTmp) != nil || len(mapTmp) == 0 {
-			return &entity.FuncResult{false, errors.New("存储失败"), nil}
-		}
-		mapTmp["transferV"] = transferV
-		mapTmp["transferVTime"] = time.Now().Format(Date_Full_Layout)
-		mapTmp["originalAmount"] = (*rSearch)["order_money"]
-		finalStr, err := json.Marshal(mapTmp)
-		if err != nil || string(filterStr) == "" {
-			return &entity.FuncResult{false, errors.New("存储失败"), nil}
-		}
-		//保存更新filter--end
-		saveFlag := util.Mysql.Update("dataexport_order", query, map[string]interface{}{
-			"course_status":    2, //公对公转账审核中----
-			"pay_way":          "transferAccounts",
-			"procedures_money": math.Round(qutil.Float64All((*rSearch)["order_money"]) * config.Config.CorporateProceduresMoney / 100),
-			"filter":           string(finalStr),
-		})
-
-		if !saveFlag {
-			return &entity.FuncResult{false, errors.New("保存失败"), nil}
-		}
-		go func() {
-			//entity.SendMailToOperation(1, orderCode, productType, config.GmailAuth)
-			//关闭之前支付串(防止重复支付)
-			if qutil.ObjToString((*rSearch)["pay_way"]) != "" {
-				if !pay.CloseOrder(qutil.ObjToString((*rSearch)["out_trade_no"]), qutil.ObjToString((*rSearch)["pay_way"])) {
-					log.Printf("SaveTransferAccounts 关闭订单%s出错\n", orderCode)
-				}
-			}
-			//发送对公转账审核提醒邮件
-			if err = util.OrderSendMail(*rSearch); err != nil {
-				log.Printf("对公转账邮件发送错误:order:%s,err:%v", orderCode, err.Error())
-			}
-		}()
-		return &entity.FuncResult{true, nil, nil}
-	}()
-	if r.Err != nil {
-		log.Printf("%s SaveTransferAccounts [%s ,%s] err:%v\n", userId, orderCode, transferV, r.Err.Error())
-	}
-	this.ServeJson(r.Format())
+    orderCode := this.GetString("orderCode")
+    transferV := this.GetString("transferV")
+    userId := qutil.ObjToString(this.GetSession("userId"))
+    productType := ""
+    r := func() *entity.FuncResult {
+        if !imgReg.MatchString(transferV) {
+            return &entity.FuncResult{false, errors.New("上传图片异常"), nil}
+        }
+        query := map[string]interface{}{"order_code": orderCode, "user_id": userId}
+        rSearch := util.Mysql.FindOne("dataexport_order", query, "order_channel,order_status,product_type,filter,course_status,out_trade_no,pay_way,create_time,order_code,user_phone,order_money", "")
+        if rSearch == nil || len(*rSearch) == 0 {
+            return &entity.FuncResult{false, errors.New("未查到订单数据"), nil}
+        }
+        if !(qutil.IntAll((*rSearch)["order_status"]) == 0 && (qutil.IntAll((*rSearch)["course_status"]) == 0 || qutil.IntAll((*rSearch)["course_status"]) == 1 || qutil.IntAll((*rSearch)["course_status"]) == 3)) {
+            return &entity.FuncResult{false, errors.New("操作异常"), nil}
+        }
+        productType = qutil.ObjToString((*rSearch)["product_type"])
+        if !(productType == "招投标课程" || productType == "大会员" || productType == "VIP订阅") {
+            return &entity.FuncResult{false, errors.New("非法请求"), nil}
+        }
+        //保存更新filter
+        filterStr := qutil.ObjToString((*rSearch)["filter"])
+        mapTmp := map[string]interface{}{}
+        if json.Unmarshal([]byte(filterStr), &mapTmp) != nil || len(mapTmp) == 0 {
+            return &entity.FuncResult{false, errors.New("存储失败"), nil}
+        }
+        mapTmp["transferV"] = transferV
+        mapTmp["transferVTime"] = time.Now().Format(Date_Full_Layout)
+        mapTmp["originalAmount"] = (*rSearch)["order_money"]
+        finalStr, err := json.Marshal(mapTmp)
+        if err != nil || string(filterStr) == "" {
+            return &entity.FuncResult{false, errors.New("存储失败"), nil}
+        }
+        //保存更新filter--end
+        saveFlag := util.Mysql.Update("dataexport_order", query, map[string]interface{}{
+            "course_status":    2, //公对公转账审核中----
+            "pay_way":          "transferAccounts",
+            "procedures_money": math.Round(qutil.Float64All((*rSearch)["order_money"]) * config.Config.CorporateProceduresMoney / 100),
+            "filter":           string(finalStr),
+        })
+
+        if !saveFlag {
+            return &entity.FuncResult{false, errors.New("保存失败"), nil}
+        }
+        go func() {
+            //entity.SendMailToOperation(1, orderCode, productType, config.GmailAuth)
+            //关闭之前支付串(防止重复支付)
+            if qutil.ObjToString((*rSearch)["pay_way"]) != "" {
+                if !pay.CloseOrder(qutil.ObjToString((*rSearch)["out_trade_no"]), qutil.ObjToString((*rSearch)["pay_way"])) {
+                    log.Printf("SaveTransferAccounts 关闭订单%s出错\n", orderCode)
+                }
+            }
+            //发送对公转账审核提醒邮件
+            if err = util.OrderSendMail(*rSearch); err != nil {
+                log.Printf("对公转账邮件发送错误:order:%s,err:%v", orderCode, err.Error())
+            }
+        }()
+        return &entity.FuncResult{true, nil, nil}
+    }()
+    if r.Err != nil {
+        log.Printf("%s SaveTransferAccounts [%s ,%s] err:%v\n", userId, orderCode, transferV, r.Err.Error())
+    }
+    this.ServeJson(r.Format())
 }
 
 func (this *CommonAction) Createorder() {
-	sessVal := this.Session().GetMultiple()
-	userid, _ := sessVal["userId"].(string)
-	phone := qutil.ObjToString(sessVal["phone"])
-	positionId := qutil.IntAll(sessVal["positionId"])
-	mgoId := qutil.ObjToString(sessVal["mgoUserId"])
-	rData, errMsg := func() (interface{}, error) {
-		//参数接收
-		infoMap := map[string]interface{}{}
-		if string(this.Body()) == "" {
-			return nil, fmt.Errorf("无效参数")
-		}
-		body := xweb.FilterXSS(string(this.Body()))
-		//接收参数
-		_ = json.Unmarshal([]byte(body), &infoMap)
-		if len(infoMap) == 0 {
-			return nil, fmt.Errorf("无效参数")
-		}
-		//产品类型
-		product, _ := infoMap["product"].(string)
-		if !config.Config.Product[product] {
-			return nil, fmt.Errorf("请求产品类型有误")
-		}
-		productId := strconv.Itoa(qutil.IntAll(infoMap["productId"]))
-		data, _ := infoMap["data"].(map[string]interface{})
-		if len(data) <= 0 {
-			return nil, fmt.Errorf("无效参数")
-		}
-		log.Println(infoMap)
-
-		//校验
-		if err := entity.JyCommonOrderStruct.RequestCheck(product, data, this.Session()); err != "" {
-			return nil, fmt.Errorf(err)
-		}
-
-		//获取卡券相关 活动需要字段从data字段中提取出来
-		lotteryId := qutil.IntAll(infoMap["lotteryId"]) //卡卷信息的id
-		lotteryIdStr := strconv.Itoa(lotteryId)
-		i_discountId := qutil.IntAll(infoMap["discountId"])   //赠品相关
-		activityType := qutil.IntAll(infoMap["activityType"]) //活动类型
-		discountId := strconv.Itoa(i_discountId)
-
-		inserMap, msg := entity.JyCommonOrderStruct.InserMap(product, productId, userid, lotteryIdStr, discountId, data, this.Session(), activityType)
-		//错误信息
-		if msg != "" {
-			return nil, fmt.Errorf(msg)
-		}
-		now := time.Now()
-		distributionChannel, orderChannel := util.GetJyOrderChannel(inserMap.DisWord, this.Header("User-Agent"))
-		if inserMap.OrderMoney == 0 { //0元订单 新增类型
-			filterMap := make(map[string]interface{})
-			err := json.Unmarshal([]byte(inserMap.Filter), &filterMap)
-			if err == nil {
-				filterMap["zeroOrderType"] = "赠送"
-				filter, err1 := json.Marshal(filterMap)
-				if err1 == nil {
-					inserMap.Filter = string(filter)
-				}
-			}
-		}
-		insertM := map[string]interface{}{
-			"order_money":          inserMap.OrderMoney,
-			"order_status":         inserMap.OrderStatus,
-			"service_status":       inserMap.ServiceStatus,
-			"user_phone":           inserMap.UserPhone,
-			"order_code":           inserMap.OrderCode,
-			"product_type":         product,
-			"create_time":          FormatDate(&now, Date_Full_Layout),
-			"original_price":       inserMap.OriginalPrice,
-			"user_id":              userid,
-			"filter":               inserMap.Filter,
-			"discount_price":       inserMap.DiscountPrice,
-			"d_relation_id":        inserMap.DrelationId,
-			"data_spec":            inserMap.DataSpec,
-			"user_mail":            inserMap.UserMail,
-			"data_count":           inserMap.DataCount,
-			"filter_publishtime":   inserMap.FilterPublishtime,
-			"filter_keys":          inserMap.FilterKeys,
-			"download_url":         inserMap.DownloadUrl,
-			"dis_word":             inserMap.DisWord,
-			"distribution_channel": distributionChannel, //销售渠道
-			"order_channel":        orderChannel,        //下单渠道
-			"audit_status":         3,                   //默认审核通过
-		}
-
-		if openId := qutil.ObjToString(sessVal["s_m_openid"]); openId != "" {
-			insertM["user_openid"] = openId
-		}
-
-		if nickname := qutil.ObjToString(sessVal["s_nickname"]); nickname != "" {
-			insertM["user_nickname"] = nickname
-		}
-
-		if inserMap.VipStartTime != "" && inserMap.VipEndTime != "" {
-			insertM["vip_starttime"] = inserMap.VipStartTime
-			insertM["vip_endtime"] = inserMap.VipEndTime
-		}
-		if inserMap.PrepayTime != "" {
-			insertM["prepay_time"] = inserMap.PrepayTime
-		}
-		if inserMap.OutTradeNo != "" {
-			insertM["out_trade_no"] = inserMap.OutTradeNo
-		}
-		if inserMap.PayWay != "" {
-			insertM["pay_way"] = inserMap.PayWay
-		}
-		if inserMap.PrepayId != "" {
-			insertM["prepay_id"] = inserMap.PrepayId
-		}
-		if inserMap.CodeUrl != "" {
-			insertM["code_url"] = inserMap.CodeUrl
-		}
-		if inserMap.FilterId != "" {
-			insertM["filter_id"] = inserMap.FilterId
-		}
-		//if inserMap.VipType != 0 {
-		insertM["vip_type"] = inserMap.VipType
-		//}
-		if inserMap.ExpirationTime != "" {
-			insertM["expiration_time"] = inserMap.ExpirationTime
-		}
-		if qutil.IntAll(sessVal["positionType"]) == 1 {
-			insertM["buy_subject"] = 2
-			insertM["buy_count"] = 1
-		}
-		var orderid int64
-		ok := util.Mysql.ExecTx("创建订单公共方法", func(tx *sql.Tx) bool {
-			orderid = util.Mysql.InsertByTx(tx, "dataexport_order", insertM)
-			if orderid <= 0 {
-				return false
-			}
-			//销售业绩
-			if util.Mysql.InsertByTx(tx, "order_sale_record", map[string]interface{}{
-				"state":                2,
-				"ordercode":            inserMap.OrderCode,
-				"saler_dept":           "运营部",
-				"saler_dept_id":        27103,
-				"saler_name":           "-",
-				"saler_Id":             -1,
-				"change_value":         inserMap.OrderMoney,
-				"money":                inserMap.OrderMoney,
-				"group_uuid":           uuid.New().String(),
-				"operator":             "系统自动",
-				"distribution_channel": distributionChannel,
-				"create_time":          FormatDate(&now, Date_Full_Layout),
-			}) <= 0 {
-				return false
-			}
-			if util.Mysql.InsertByTx(tx, "audit_records", map[string]interface{}{
-				"operator":      "-",
-				"create_time":   NowFormat(Date_Full_Layout),
-				"operator_type": 1,
-				"audit_status":  3,
-				"order_code":    inserMap.OrderCode,
-				"audit_type":    2,
-			}) <= 0 {
-				return false
-			}
-			return true
-		})
-		if !ok {
-			return nil, fmt.Errorf("创建订单异常")
-		}
-
-		var (
-			cacheKey = ""
-		)
-		if product == "VIP订阅" {
-			orderKey := fmt.Sprintf("order_%s", inserMap.OrderCode)
-			uInfo := map[string]interface{}{
-				"mgoId":      mgoId,
-				"positionId": positionId,
-				"phone":      phone,
-			}
-			redis.Put("other", orderKey, uInfo, 60*60*24*3)
-			//P506
-			cacheKey = fmt.Sprintf("key_phrases_v_%s", mgoId)
-		} else if product == "大会员" {
-			// p527
-			orderKey := fmt.Sprintf("order_%s", inserMap.OrderCode)
-			uInfo := map[string]interface{}{
-				"mgoId":      mgoId,
-				"positionId": positionId,
-				"phone":      phone,
-			}
-			redis.Put("other", orderKey, uInfo, 60*60*24*3)
-			//P506
-			cacheKey = fmt.Sprintf("key_phrases_m_%s", mgoId)
-		}
-		//P506  关键词组  订单信息绑定
-		if cacheKey != "" {
-			go func(cacheKey, mgoId, orderCode string) {
-				if code := redis.GetStr("limitation", cacheKey); code != "" {
-					if util.Mysql.ExecTx("关键词组订单关联表保存", func(tx *sql.Tx) bool {
-						var oCount int64
-						kpSql := `SELECT id FROM base_service.key_phrases WHERE  FIND_IN_SET(?,er_code)  ORDER BY update_time DESC`
-						kps := util.BaseMysql.SelectBySql(kpSql, code)
-						if kps != nil && len(*kps) > 0 {
-							kp := (*kps)[0]
-							id := qutil.Int64All(kp["id"])
-							oCount = util.BaseMysql.InsertByTx(tx, "base_service.key_phrases_order", map[string]interface{}{
-								"kp_id":       id,
-								"er_code":     code,
-								"order_code":  orderCode,
-								"create_time": time.Now().Format(Date_Full_Layout),
-							})
-						}
-						return oCount > 0
-					}) {
-						redis.Del("limitation", cacheKey)
-					} else {
-						log.Println("关键词组订单关联表 错误:", mgoId, "-订单号:", orderCode)
-					}
-				}
-			}(cacheKey, mgoId, inserMap.OrderCode)
-		}
-		if activityType >= 2 {
-			util.FindUserLotteryId(userid, orderid, i_discountId)
-		}
-		rdata := map[string]interface{}{"order_code": inserMap.OrderCode, "needPay": !inserMap.UnNeedPay}
-		return rdata, nil
-	}()
-	if errMsg != nil {
-		log.Printf("%s CreateOrder 异常:%s\n", userid, errMsg.Error())
-	}
-	//创建完订单后更新卡券信息
-	this.ServeJson(NewResult(rData, errMsg))
+    sessVal := this.Session().GetMultiple()
+    userid, _ := sessVal["userId"].(string)
+    phone := qutil.ObjToString(sessVal["phone"])
+    positionId := qutil.IntAll(sessVal["positionId"])
+    mgoId := qutil.ObjToString(sessVal["mgoUserId"])
+    rData, errMsg := func() (interface{}, error) {
+        //参数接收
+        infoMap := map[string]interface{}{}
+        if string(this.Body()) == "" {
+            return nil, fmt.Errorf("无效参数")
+        }
+        body := xweb.FilterXSS(string(this.Body()))
+        //接收参数
+        _ = json.Unmarshal([]byte(body), &infoMap)
+        if len(infoMap) == 0 {
+            return nil, fmt.Errorf("无效参数")
+        }
+        //产品类型
+        product, _ := infoMap["product"].(string)
+        if !config.Config.Product[product] {
+            return nil, fmt.Errorf("请求产品类型有误")
+        }
+        productId := strconv.Itoa(qutil.IntAll(infoMap["productId"]))
+        data, _ := infoMap["data"].(map[string]interface{})
+        if len(data) <= 0 {
+            return nil, fmt.Errorf("无效参数")
+        }
+        log.Println(infoMap)
+
+        //校验
+        if err := entity.JyCommonOrderStruct.RequestCheck(product, data, this.Session()); err != "" {
+            return nil, fmt.Errorf(err)
+        }
+
+        //获取卡券相关 活动需要字段从data字段中提取出来
+        lotteryId := qutil.IntAll(infoMap["lotteryId"]) //卡卷信息的id
+        lotteryIdStr := strconv.Itoa(lotteryId)
+        i_discountId := qutil.IntAll(infoMap["discountId"])   //赠品相关
+        activityType := qutil.IntAll(infoMap["activityType"]) //活动类型
+        discountId := strconv.Itoa(i_discountId)
+
+        inserMap, msg := entity.JyCommonOrderStruct.InserMap(product, productId, userid, lotteryIdStr, discountId, data, this.Session(), activityType)
+        //错误信息
+        if msg != "" {
+            return nil, fmt.Errorf(msg)
+        }
+        now := time.Now()
+        distributionChannel, orderChannel := util.GetJyOrderChannel(inserMap.DisWord, this.Header("User-Agent"))
+        if inserMap.OrderMoney == 0 { //0元订单 新增类型
+            filterMap := make(map[string]interface{})
+            err := json.Unmarshal([]byte(inserMap.Filter), &filterMap)
+            if err == nil {
+                filterMap["zeroOrderType"] = "赠送"
+                filter, err1 := json.Marshal(filterMap)
+                if err1 == nil {
+                    inserMap.Filter = string(filter)
+                }
+            }
+        }
+        insertM := map[string]interface{}{
+            "order_money":          inserMap.OrderMoney,
+            "order_status":         inserMap.OrderStatus,
+            "service_status":       inserMap.ServiceStatus,
+            "user_phone":           inserMap.UserPhone,
+            "order_code":           inserMap.OrderCode,
+            "product_type":         product,
+            "create_time":          FormatDate(&now, Date_Full_Layout),
+            "original_price":       inserMap.OriginalPrice,
+            "user_id":              userid,
+            "filter":               inserMap.Filter,
+            "discount_price":       inserMap.DiscountPrice,
+            "d_relation_id":        inserMap.DrelationId,
+            "data_spec":            inserMap.DataSpec,
+            "user_mail":            inserMap.UserMail,
+            "data_count":           inserMap.DataCount,
+            "filter_publishtime":   inserMap.FilterPublishtime,
+            "filter_keys":          inserMap.FilterKeys,
+            "download_url":         inserMap.DownloadUrl,
+            "dis_word":             inserMap.DisWord,
+            "distribution_channel": distributionChannel, //销售渠道
+            "order_channel":        orderChannel,        //下单渠道
+            "audit_status":         3,                   //默认审核通过
+        }
+
+        if openId := qutil.ObjToString(sessVal["s_m_openid"]); openId != "" {
+            insertM["user_openid"] = openId
+        }
+
+        if nickname := qutil.ObjToString(sessVal["s_nickname"]); nickname != "" {
+            insertM["user_nickname"] = nickname
+        }
+
+        if inserMap.VipStartTime != "" && inserMap.VipEndTime != "" {
+            insertM["vip_starttime"] = inserMap.VipStartTime
+            insertM["vip_endtime"] = inserMap.VipEndTime
+        }
+        if inserMap.PrepayTime != "" {
+            insertM["prepay_time"] = inserMap.PrepayTime
+        }
+        if inserMap.OutTradeNo != "" {
+            insertM["out_trade_no"] = inserMap.OutTradeNo
+        }
+        if inserMap.PayWay != "" {
+            insertM["pay_way"] = inserMap.PayWay
+        }
+        if inserMap.PrepayId != "" {
+            insertM["prepay_id"] = inserMap.PrepayId
+        }
+        if inserMap.CodeUrl != "" {
+            insertM["code_url"] = inserMap.CodeUrl
+        }
+        if inserMap.FilterId != "" {
+            insertM["filter_id"] = inserMap.FilterId
+        }
+        //if inserMap.VipType != 0 {
+        insertM["vip_type"] = inserMap.VipType
+        //}
+        if inserMap.ExpirationTime != "" {
+            insertM["expiration_time"] = inserMap.ExpirationTime
+        }
+        if qutil.IntAll(sessVal["positionType"]) == 1 {
+            insertM["buy_subject"] = 2
+            insertM["buy_count"] = 1
+        }
+        var orderid int64
+        ok := util.Mysql.ExecTx("创建订单公共方法", func(tx *sql.Tx) bool {
+            orderid = util.Mysql.InsertByTx(tx, "dataexport_order", insertM)
+            if orderid <= 0 {
+                return false
+            }
+            //销售业绩
+            if util.Mysql.InsertByTx(tx, "order_sale_record", map[string]interface{}{
+                "state":                2,
+                "ordercode":            inserMap.OrderCode,
+                "saler_dept":           "运营部",
+                "saler_dept_id":        27103,
+                "saler_name":           "-",
+                "saler_Id":             -1,
+                "change_value":         inserMap.OrderMoney,
+                "money":                inserMap.OrderMoney,
+                "group_uuid":           uuid.New().String(),
+                "operator":             "系统自动",
+                "distribution_channel": distributionChannel,
+                "create_time":          FormatDate(&now, Date_Full_Layout),
+            }) <= 0 {
+                return false
+            }
+            if util.Mysql.InsertByTx(tx, "audit_records", map[string]interface{}{
+                "operator":      "-",
+                "create_time":   NowFormat(Date_Full_Layout),
+                "operator_type": 1,
+                "audit_status":  3,
+                "order_code":    inserMap.OrderCode,
+                "audit_type":    2,
+            }) <= 0 {
+                return false
+            }
+            return true
+        })
+        if !ok {
+            return nil, fmt.Errorf("创建订单异常")
+        }
+
+        var (
+            cacheKey = ""
+        )
+        if product == "VIP订阅" {
+            orderKey := fmt.Sprintf("order_%s", inserMap.OrderCode)
+            uInfo := map[string]interface{}{
+                "mgoId":      mgoId,
+                "positionId": positionId,
+                "phone":      phone,
+            }
+            redis.Put("other", orderKey, uInfo, 60*60*24*3)
+            //P506
+            cacheKey = fmt.Sprintf("key_phrases_v_%s", mgoId)
+        } else if product == "大会员" {
+            // p527
+            orderKey := fmt.Sprintf("order_%s", inserMap.OrderCode)
+            uInfo := map[string]interface{}{
+                "mgoId":      mgoId,
+                "positionId": positionId,
+                "phone":      phone,
+            }
+            redis.Put("other", orderKey, uInfo, 60*60*24*3)
+            //P506
+            cacheKey = fmt.Sprintf("key_phrases_m_%s", mgoId)
+        }
+        //P506  关键词组  订单信息绑定
+        if cacheKey != "" {
+            go func(cacheKey, mgoId, orderCode string) {
+                if code := redis.GetStr("limitation", cacheKey); code != "" {
+                    if util.Mysql.ExecTx("关键词组订单关联表保存", func(tx *sql.Tx) bool {
+                        var oCount int64
+                        kpSql := `SELECT id FROM base_service.key_phrases WHERE  FIND_IN_SET(?,er_code)  ORDER BY update_time DESC`
+                        kps := util.BaseMysql.SelectBySql(kpSql, code)
+                        if kps != nil && len(*kps) > 0 {
+                            kp := (*kps)[0]
+                            id := qutil.Int64All(kp["id"])
+                            oCount = util.BaseMysql.InsertByTx(tx, "base_service.key_phrases_order", map[string]interface{}{
+                                "kp_id":       id,
+                                "er_code":     code,
+                                "order_code":  orderCode,
+                                "create_time": time.Now().Format(Date_Full_Layout),
+                            })
+                        }
+                        return oCount > 0
+                    }) {
+                        redis.Del("limitation", cacheKey)
+                    } else {
+                        log.Println("关键词组订单关联表 错误:", mgoId, "-订单号:", orderCode)
+                    }
+                }
+            }(cacheKey, mgoId, inserMap.OrderCode)
+        }
+        if activityType >= 2 {
+            util.FindUserLotteryId(userid, orderid, i_discountId)
+        }
+        rdata := map[string]interface{}{"order_code": inserMap.OrderCode, "needPay": !inserMap.UnNeedPay}
+        return rdata, nil
+    }()
+    if errMsg != nil {
+        log.Printf("%s CreateOrder 异常:%s\n", userid, errMsg.Error())
+    }
+    //创建完订单后更新卡券信息
+    this.ServeJson(NewResult(rData, errMsg))
 }
 
 func (this *CommonAction) GetWxReturnPayParam() {
-	var (
-		token     = this.GetString("token")
-		payWayReq = this.GetString("pay_way")
-	)
-	rData, errMsg := func() (interface{}, error) {
-		if !(payWayReq == "wx_js" || payWayReq == "ali_pc") {
-			return nil, fmt.Errorf("未知支付方式")
-		}
-		rList := util.Mysql.SelectBySql("SELECT id,return_money,expire_time,return_money,order_code FROM return_money_online r WHERE r.status=0 and r.token=? ", token)
-		if rList == nil || len(*rList) == 0 {
-			return nil, fmt.Errorf("未知回款单")
-		}
-		var (
-			rMap        = (*rList)[0]
-			expireTime  = gconv.String(rMap["expire_time"])
-			returnMoney = gconv.Int(rMap["return_money"])
-			OrderCode   = gconv.String(rMap["order_code"])
-			returnId    = gconv.Int(rMap["id"])
-		)
-		var (
-			tradeno, payParam string
-			err               error
-			openId            string
-		)
-		expire, dateErr := time.ParseInLocation("time.DateTime", expireTime, time.Local)
-		if dateErr == nil {
-
-		}
-		if time.Now().After(expire) {
-			go public.Mysql.Update("return_money_online", map[string]interface{}{"token": token, "status": 0}, map[string]interface{}{"status": -1})
-			return nil, fmt.Errorf("回款单已过期,请重新联系销售")
-		}
-
-		switch payWayReq {
-		case "wx_js":
-			var (
-				sessVal = this.Session().GetMultiple()
-			)
-			if openId = qutil.ObjToString(sessVal["s_m_openid"]); openId == "" {
-				openId = qutil.ObjToString(sessVal["openid_returnMoney"])
-			}
-			if openId == "" {
-				return nil, fmt.Errorf("创建微信支付参数异常")
-			}
-			tradeno, _, payParam, err = pay.CreateOrderPay(returnMoney, pay.WX_RETURN_NATIVE, "", openId, "", payWayReq, OrderCode, expire.Unix())
-			if err != nil {
-				return nil, fmt.Errorf("创建微信支付异常")
-			}
-		case "ali_pc":
-			tradeno, _, payParam, err = pay.CreateOrderPay(returnMoney, pay.ALI_RETURN_NATIVE, "", "", "", payWayReq, OrderCode, expire.Unix())
-			if err != nil {
-				return nil, fmt.Errorf("创建支付宝支付异常")
-			}
-		}
-		//更新支付串
-		now := time.Now()
-		if util.Mysql.Insert("return_money_online_pay", map[string]interface{}{
-			"return_id":    returnId,
-			"pay_param":    payParam,
-			"s_openid":     openId,
-			"out_trade_no": tradeno,
-			"order_code":   OrderCode,
-			"pay_way":      payWayReq,
-			"creat_time":   FormatDate(&now, Date_Full_Layout),
-		}) <= 0 {
-			return nil, fmt.Errorf("数据保存异常")
-		}
-		return payParam, nil
-	}()
-	if errMsg != nil {
-		log.Printf("GetWxReturnPayParam %s获取回款支付参数异常%v", token, errMsg)
-	}
-	this.ServeJson(NewResult(rData, errMsg))
+    var (
+        token     = this.GetString("token")
+        payWayReq = this.GetString("pay_way")
+    )
+    rData, errMsg := func() (interface{}, error) {
+        if !(payWayReq == "wx_js" || payWayReq == "ali_pc") {
+            return nil, fmt.Errorf("未知支付方式")
+        }
+        rList := util.Mysql.SelectBySql("SELECT id,return_money,expire_time,return_money,order_code FROM return_money_online r WHERE r.status=0 and r.token=? ", token)
+        if rList == nil || len(*rList) == 0 {
+            return nil, fmt.Errorf("未知回款单")
+        }
+        var (
+            rMap        = (*rList)[0]
+            expireTime  = gconv.String(rMap["expire_time"])
+            returnMoney = gconv.Int(rMap["return_money"])
+            OrderCode   = gconv.String(rMap["order_code"])
+            returnId    = gconv.Int(rMap["id"])
+        )
+        var (
+            tradeno, payParam string
+            err               error
+            openId            string
+        )
+        expire, dateErr := time.ParseInLocation(time.DateTime, expireTime, time.Local)
+        if dateErr == nil {
+
+        }
+        if time.Now().After(expire) {
+            go public.Mysql.Update("return_money_online", map[string]interface{}{"token": token, "status": 0}, map[string]interface{}{"status": -1})
+            return nil, fmt.Errorf("回款单已过期,请重新联系销售")
+        }
+
+        switch payWayReq {
+        case "wx_js":
+            var (
+                sessVal = this.Session().GetMultiple()
+            )
+            if openId = qutil.ObjToString(sessVal["s_m_openid"]); openId == "" {
+                openId = qutil.ObjToString(sessVal["openid_returnMoney"])
+            }
+            if openId == "" {
+                return nil, fmt.Errorf("创建微信支付参数异常")
+            }
+            tradeno, _, payParam, err = pay.CreateOrderPay(returnMoney, pay.WX_RETURN_NATIVE, "", openId, "", payWayReq, OrderCode, expire.Unix())
+            if err != nil {
+                return nil, fmt.Errorf("创建微信支付异常")
+            }
+        case "ali_pc":
+            tradeno, _, payParam, err = pay.CreateOrderPay(returnMoney, pay.ALI_RETURN_NATIVE, "", "", "", payWayReq, OrderCode, expire.Unix())
+            if err != nil {
+                return nil, fmt.Errorf("创建支付宝支付异常")
+            }
+        }
+        //更新支付串
+        now := time.Now()
+        if util.Mysql.Insert("return_money_online_pay", map[string]interface{}{
+            "return_id":    returnId,
+            "pay_param":    payParam,
+            "s_openid":     openId,
+            "out_trade_no": tradeno,
+            "order_code":   OrderCode,
+            "pay_way":      payWayReq,
+            "creat_time":   FormatDate(&now, Date_Full_Layout),
+        }) <= 0 {
+            return nil, fmt.Errorf("数据保存异常")
+        }
+        return payParam, nil
+    }()
+    if errMsg != nil {
+        log.Printf("GetWxReturnPayParam %s获取回款支付参数异常%v", token, errMsg)
+    }
+    this.ServeJson(NewResult(rData, errMsg))
 }
 
 func (this *CommonAction) GetReturnResult() {
-	var token = this.GetString("token")
-	rData, errMsg := func() (interface{}, error) {
-		if token == "" {
-			return nil, fmt.Errorf("缺少参数")
-		}
-		var (
-			payed bool
-			r     = map[string]interface{}{}
-		)
-		res := util.Mysql.SelectBySql("SELECT r.status,r.order_code,r.return_money,p.pay_time,p.transaction_id FROM return_money_online r inner join return_money_online_pay p on (r.id = p.return_id and p.status=1) WHERE r.token=?", token)
-		if res != nil && len(*res) > 0 {
-			var (
-				rData = (*res)[0]
-			)
-			payed = true
-			r["order_code"] = rData["order_code"]
-			r["transaction_id"] = rData["transaction_id"]
-			r["return_money"] = rData["return_money"]
-			if payTime := gconv.String(rData["pay_time"]); payTime != "" {
-				if t, e := time.ParseInLocation("time.DateTime", payTime, time.Local); e == nil {
-					r["pay_time"] = t.Unix()
-				}
-			}
-		}
-		r["success"] = payed
-		return r, nil
-	}()
-	if errMsg != nil {
-		log.Printf("GetReturnResult %s获取回款支付异常%v", token, errMsg)
-	}
-	this.ServeJson(NewResult(rData, errMsg))
+    var token = this.GetString("token")
+    rData, errMsg := func() (interface{}, error) {
+        if token == "" {
+            return nil, fmt.Errorf("缺少参数")
+        }
+        var (
+            payed bool
+            r     = map[string]interface{}{}
+        )
+        res := util.Mysql.SelectBySql("SELECT r.status,r.order_code,r.return_money,p.pay_time,p.transaction_id FROM return_money_online r inner join return_money_online_pay p on (r.id = p.return_id and p.status=1) WHERE r.token=?", token)
+        if res != nil && len(*res) > 0 {
+            var (
+                rData = (*res)[0]
+            )
+            payed = true
+            r["order_code"] = rData["order_code"]
+            r["transaction_id"] = rData["transaction_id"]
+            r["return_money"] = rData["return_money"]
+            if payTime := gconv.String(rData["pay_time"]); payTime != "" {
+                if t, e := time.ParseInLocation(time.DateTime, payTime, time.Local); e == nil {
+                    r["pay_time"] = t.Unix()
+                }
+            }
+        }
+        r["success"] = payed
+        return r, nil
+    }()
+    if errMsg != nil {
+        log.Printf("GetReturnResult %s获取回款支付异常%v", token, errMsg)
+    }
+    this.ServeJson(NewResult(rData, errMsg))
 }