diff --git a/app/customer/hdl/hdl_central_kitchen_for_school_order.go b/app/customer/hdl/hdl_central_kitchen_for_school_order.go index 52b806a..17eefff 100644 --- a/app/customer/hdl/hdl_central_kitchen_for_school_order.go +++ b/app/customer/hdl/hdl_central_kitchen_for_school_order.go @@ -15,7 +15,9 @@ import ( ) func CentralKitchenForSchoolOrderList(c *gin.Context) { - platform := c.DefaultQuery("platform", "alipay") + platform := c.GetHeader("platform") + + //platform := c.DefaultQuery("platform", "alipay") var req md.CentralKitchenForSchoolOrderListReq err := c.ShouldBindJSON(&req) if err != nil { @@ -34,6 +36,7 @@ func CentralKitchenForSchoolOrderList(c *gin.Context) { e.OutErr(c, e.ERR, err.Error()) return } + e.OutSuc(c, map[string]interface{}{ "list": list, "sum_total": sumTotal, diff --git a/app/customer/hdl/test/hdl_wx.go b/app/customer/hdl/test/hdl_wx.go index cfae7d0..5ac1cf3 100644 --- a/app/customer/hdl/test/hdl_wx.go +++ b/app/customer/hdl/test/hdl_wx.go @@ -29,7 +29,7 @@ func WxRefundsTest(c *gin.Context) { } sysCfgDb := db.SysCfgDb{} sysCfgDb.Set() - sysCfg := sysCfgDb.SysCfgFindWithDb(enum2.WxSpMchId) + sysCfg := sysCfgDb.SysCfgFindWithDb(enum2.WxMchId, enum2.WxJsapiRefundPayNotifyUrl) client, err := svc3.NewWxPayClient(c) if err != nil { e.OutErr(c, e.ERR, err.Error()) @@ -41,11 +41,11 @@ func WxRefundsTest(c *gin.Context) { resp, result, err := wxSvc.Create(c, refunddomestic.CreateRequest{ - SubMchid: core.String(sysCfg[enum2.WxSpMchId]), + SubMchid: core.String(sysCfg[enum2.WxMchId]), OutTradeNo: core.String(ord.OutTradeNo), OutRefundNo: core.String(outRequestNo), Reason: core.String("央厨订餐退款"), - NotifyUrl: core.String("https://weixin.qq.com"), + NotifyUrl: core.String(sysCfg[enum2.WxJsapiRefundPayNotifyUrl]), Amount: &refunddomestic.AmountReq{ Currency: core.String("CNY"), Refund: core.Int64(utils.StrToInt64(refund)), @@ -60,6 +60,7 @@ func WxRefundsTest(c *gin.Context) { // 处理返回结果 println("status=%d resp=%s", result.Response.StatusCode, resp) } + e.OutSuc(c, map[string]interface{}{ "resp": resp, "result": result, diff --git a/app/customer/svc/order/svc_central_kitchen_for_school_order.go b/app/customer/svc/order/svc_central_kitchen_for_school_order.go index 0a7c25f..8cb01ce 100644 --- a/app/customer/svc/order/svc_central_kitchen_for_school_order.go +++ b/app/customer/svc/order/svc_central_kitchen_for_school_order.go @@ -17,10 +17,10 @@ func OrderList(req md.CentralKitchenForSchoolOrderListReq, platform string) (m [ sess := db.Db.Desc("id").Where("user_identity_id =?", req.UserIdentityId). And("create_at >= ? And create_at <= ?", req.StartDate, req.EndDate).Limit(req.Limit, (req.Page-1)*req.Limit) sess.And("ord_state = ?", req.OrdState) - if platform == "alipay" { + if platform == "alipay_applet" { sess.And("pay_way = ?", enum2.PayWayForAli) } - if platform == "wx" { + if platform == "wx_applet" { sess.And("pay_way = ?", enum2.PayWayForWx) } total, err = sess.FindAndCount(&m) @@ -32,11 +32,11 @@ func OrderList(req md.CentralKitchenForSchoolOrderListReq, platform string) (m [ func OrderStatistic(req md.CentralKitchenForSchoolOrderListReq, platform string) (total float64, err error) { var sql string - if platform == "alipay" { + if platform == "alipay_applet" { sql = fmt.Sprintf("SELECT SUM(total_price) AS sum_total FROM central_kitchen_for_school_package_ord where "+ "user_identity_id = '%d' and create_at >= '%s' And create_at <= '%s' and ord_state = '%d' and pay_way = '%d'", req.UserIdentityId, req.StartDate, req.EndDate, req.OrdState, enum2.PayWayForAli) } - if platform == "wx" { + if platform == "wx_applet" { sql = fmt.Sprintf("SELECT SUM(total_price) AS sum_total FROM central_kitchen_for_school_package_ord where "+ "user_identity_id = '%d' and create_at >= '%s' And create_at <= '%s' and ord_state = '%d' and pay_way = '%d'", req.UserIdentityId, req.StartDate, req.EndDate, req.OrdState, enum2.PayWayForWx) } diff --git a/app/enum/enum_sys_cfg.go b/app/enum/enum_sys_cfg.go index 4f38bf4..cf87828 100644 --- a/app/enum/enum_sys_cfg.go +++ b/app/enum/enum_sys_cfg.go @@ -39,6 +39,7 @@ const ( WxSpAppId = "wx_sp_app_id" WxSpMchId = "wx_sp_mch_id" WxJsapiPayNotifyUrl = "wx_jsapi_pay_notify_url" + WxJsapiRefundPayNotifyUrl = "wx_jsapi_refund_pay_notify_url" ) func (gt SysCfg) String() string { @@ -111,6 +112,8 @@ func (gt SysCfg) String() string { return "微信服务商-商户id" case WxJsapiPayNotifyUrl: return "微信-jsapi支付-异步通知" + case WxJsapiRefundPayNotifyUrl: + return "微信-退款-异步通知" default: return "未知" } diff --git a/app/router/customer_router.go b/app/router/customer_router.go index 0cd8b1b..b19b19d 100644 --- a/app/router/customer_router.go +++ b/app/router/customer_router.go @@ -68,7 +68,7 @@ func CustomerInit(r *gin.RouterGroup) { } func rTest(r *gin.RouterGroup) { - r.POST("/wxRefunds", test.WxRefundsTest) // 测试-微信退款 + r.GET("/wxRefunds", test.WxRefundsTest) // 测试-微信退款 } func rPay(r *gin.RouterGroup) {