|
@@ -10,7 +10,6 @@ import (
|
|
|
"jy/src/jfw/config"
|
|
|
"jy/src/jfw/jyutil"
|
|
|
"jy/src/jfw/wx"
|
|
|
- "log"
|
|
|
"net/url"
|
|
|
"regexp"
|
|
|
"strings"
|
|
@@ -96,22 +95,15 @@ func (this *ReturnMoneyPage) WxReturnMoney() {
|
|
|
}
|
|
|
|
|
|
if openid == "" {
|
|
|
- return fmt.Errorf("请在微信端打开")
|
|
|
+ return fmt.Errorf("<p>请在微信端打开</p>")
|
|
|
}
|
|
|
this.Session().Set("openid_returnMoney", openid)
|
|
|
|
|
|
token := gconv.String(data["token"])
|
|
|
- if token == "" {
|
|
|
- return errors.New("未知回款单")
|
|
|
- }
|
|
|
rData, err := getReturnPayDetail(token)
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|
|
|
- if err != nil {
|
|
|
- log.Print("WxPayCommon.ReturnMoneyOnline.Err", err)
|
|
|
- return err
|
|
|
- }
|
|
|
|
|
|
var pay_param map[string]interface{}
|
|
|
if payWay, payParam := gconv.String(rData["pay_way"]), gconv.String(rData["pay_param"]); payWay == "wx_js" && payParam != "" {
|
|
@@ -124,16 +116,14 @@ func (this *ReturnMoneyPage) WxReturnMoney() {
|
|
|
return this.Render("/common/returnMoney/wxReturnMoney.html", &this.T)
|
|
|
}()
|
|
|
if err != nil {
|
|
|
- _ = this.Write(err.Error())
|
|
|
+ this.T["note"] = err.Error()
|
|
|
+ this.Render("/weixin/commonPay/orderStatus.html", &this.T)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func (this *ReturnMoneyPage) AliReturnMoney() {
|
|
|
err := func() error {
|
|
|
token := this.GetString("token")
|
|
|
- if token == "" {
|
|
|
- return errors.New("参数异常")
|
|
|
- }
|
|
|
rData, err := getReturnPayDetail(token)
|
|
|
if err != nil {
|
|
|
return err
|
|
@@ -148,23 +138,31 @@ func (this *ReturnMoneyPage) AliReturnMoney() {
|
|
|
return this.Render("/common/returnMoney/aliReturnMoney.html", &this.T)
|
|
|
}()
|
|
|
if err != nil {
|
|
|
- _ = this.Write(err.Error())
|
|
|
+ this.T["note"] = err.Error()
|
|
|
+ this.Render("/weixin/commonPay/orderStatus.html", &this.T)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func getReturnPayDetail(token string) (map[string]interface{}, error) {
|
|
|
- rList := public.Mysql.SelectBySql("SELECT d.product_type,d.user_phone,d.company_name,r.return_money,r.pay_param,r.pay_way,r.expire_time FROM dataexport_order d inner join return_money_online r on (d.order_code=r.order_code) WHERE r.status=0 and r.token=? ", token)
|
|
|
+ if token == "" {
|
|
|
+ return nil, errors.New("<p>参数异常</p>")
|
|
|
+ }
|
|
|
+ rList := public.Mysql.SelectBySql("SELECT d.product_type,d.user_phone,d.company_name,r.return_money,r.pay_param,r.pay_way,r.expire_time,r.status FROM dataexport_order d inner join return_money_online r on (d.order_code=r.order_code) WHERE r.token=? ", token)
|
|
|
if rList == nil || len(*rList) == 0 {
|
|
|
- return nil, fmt.Errorf("未知回款单")
|
|
|
+ return nil, fmt.Errorf("<p>未知回款单</p>")
|
|
|
}
|
|
|
var (
|
|
|
rMap = (*rList)[0]
|
|
|
expire_time = gconv.String(rMap["expire_time"])
|
|
|
+ status = gconv.Int64(rMap["status"])
|
|
|
)
|
|
|
+ if status > 0 {
|
|
|
+ return nil, fmt.Errorf("<p>您已完成支付!</p>")
|
|
|
+ }
|
|
|
if expire, err := time.ParseInLocation(time.DateTime, expire_time, time.Local); err == 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("回款单已过期,请重新联系销售")
|
|
|
+ return nil, fmt.Errorf("<p>支付二维码已过期,请联<br>系您的客户经理重新提供</p>")
|
|
|
}
|
|
|
}
|
|
|
return rMap, nil
|