|
|
@@ -1,6 +1,7 @@ |
|
|
|
package hdl |
|
|
|
|
|
|
|
import ( |
|
|
|
"applet/app/cfg" |
|
|
|
"applet/app/customer/lib/validate" |
|
|
|
"applet/app/customer/md" |
|
|
|
"applet/app/customer/svc" |
|
|
@@ -76,34 +77,36 @@ func OrdState(c *gin.Context) { |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
//if ord.State == enum.CentralKitchenForSchoolPackageOrdStateForWait { |
|
|
|
// //处于待支付状态,请求支付宝同步订单状态 |
|
|
|
// sysCfgDb := db.SysCfgDb{} |
|
|
|
// sysCfgDb.Set() |
|
|
|
// sysCfg := sysCfgDb.SysCfgFindWithDb(enum.JsapiPayAppAutToken, enum.OpenAlipayAppid, enum.OpenAlipayAppPrivateKey, enum.OpenAlipayPublicKey) |
|
|
|
// err2, result := svc.CurlAlipayTradeQuery(md.CurlAlipayTradeQueryReq{ |
|
|
|
// Config: struct { |
|
|
|
// PayAliAppId string `json:"pay_ali_app_id" label:"支付宝开放平台-第三方应用-appid"` |
|
|
|
// PayAliPrivateKey string `json:"pay_ali_private_key" label:"支付宝开放平台-第三方应用-接口加签-应用私钥"` |
|
|
|
// PayAliPublicKey string `json:"pay_ali_public_key" label:"支付宝开放平台-第三方应用-接口加签-支付宝公钥"` |
|
|
|
// }{ |
|
|
|
// PayAliAppId: sysCfg[enum.OpenAlipayAppid], |
|
|
|
// PayAliPrivateKey: sysCfg[enum.OpenAlipayAppPrivateKey], |
|
|
|
// PayAliPublicKey: sysCfg[enum.OpenAlipayPublicKey], |
|
|
|
// }, |
|
|
|
// OutTradeNo: outTradeNo, |
|
|
|
// AppAuthToken: sysCfg[enum.JsapiPayAppAutToken], |
|
|
|
// }) |
|
|
|
// if err2 != nil { |
|
|
|
// e.OutErr(c, e.ERR, err2.Error()) |
|
|
|
// return |
|
|
|
// } |
|
|
|
// ord.State, err2 = svc.DealCentralKitchenForSchoolOrderCallBack(outTradeNo, result.TradeStatus) |
|
|
|
// if err != nil { |
|
|
|
// e.OutErr(c, e.ERR, err2.Error()) |
|
|
|
// return |
|
|
|
// } |
|
|
|
//} |
|
|
|
if !cfg.Prd { |
|
|
|
if ord.State == enum.CentralKitchenForSchoolPackageOrdStateForWait { |
|
|
|
//处于待支付状态,请求支付宝同步订单状态 |
|
|
|
sysCfgDb := db.SysCfgDb{} |
|
|
|
sysCfgDb.Set() |
|
|
|
sysCfg := sysCfgDb.SysCfgFindWithDb(enum.JsapiPayAppAutToken, enum.OpenAlipayAppid, enum.OpenAlipayAppPrivateKey, enum.OpenAlipayPublicKey) |
|
|
|
err2, result := svc.CurlAlipayTradeQuery(md.CurlAlipayTradeQueryReq{ |
|
|
|
Config: struct { |
|
|
|
PayAliAppId string `json:"pay_ali_app_id" label:"支付宝开放平台-第三方应用-appid"` |
|
|
|
PayAliPrivateKey string `json:"pay_ali_private_key" label:"支付宝开放平台-第三方应用-接口加签-应用私钥"` |
|
|
|
PayAliPublicKey string `json:"pay_ali_public_key" label:"支付宝开放平台-第三方应用-接口加签-支付宝公钥"` |
|
|
|
}{ |
|
|
|
PayAliAppId: sysCfg[enum.OpenAlipayAppid], |
|
|
|
PayAliPrivateKey: sysCfg[enum.OpenAlipayAppPrivateKey], |
|
|
|
PayAliPublicKey: sysCfg[enum.OpenAlipayPublicKey], |
|
|
|
}, |
|
|
|
OutTradeNo: outTradeNo, |
|
|
|
AppAuthToken: sysCfg[enum.JsapiPayAppAutToken], |
|
|
|
}) |
|
|
|
if err2 != nil { |
|
|
|
e.OutErr(c, e.ERR, err2.Error()) |
|
|
|
return |
|
|
|
} |
|
|
|
ord.State, err2 = svc.DealCentralKitchenForSchoolOrderCallBack(outTradeNo, result.TradeStatus) |
|
|
|
if err != nil { |
|
|
|
e.OutErr(c, e.ERR, err2.Error()) |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
e.OutSuc(c, map[string]interface{}{ |
|
|
|
"sate": ord.State, |
|
|
|