Browse Source

update

add_mode
DengBiao 1 year ago
parent
commit
81b6e2d4d0
5 changed files with 16 additions and 9 deletions
  1. +4
    -1
      app/customer/hdl/hdl_central_kitchen_for_school_order.go
  2. +4
    -3
      app/customer/hdl/test/hdl_wx.go
  3. +4
    -4
      app/customer/svc/order/svc_central_kitchen_for_school_order.go
  4. +3
    -0
      app/enum/enum_sys_cfg.go
  5. +1
    -1
      app/router/customer_router.go

+ 4
- 1
app/customer/hdl/hdl_central_kitchen_for_school_order.go View File

@@ -15,7 +15,9 @@ import (
) )


func CentralKitchenForSchoolOrderList(c *gin.Context) { func CentralKitchenForSchoolOrderList(c *gin.Context) {
platform := c.DefaultQuery("platform", "alipay")
platform := c.GetHeader("platform")

//platform := c.DefaultQuery("platform", "alipay")
var req md.CentralKitchenForSchoolOrderListReq var req md.CentralKitchenForSchoolOrderListReq
err := c.ShouldBindJSON(&req) err := c.ShouldBindJSON(&req)
if err != nil { if err != nil {
@@ -34,6 +36,7 @@ func CentralKitchenForSchoolOrderList(c *gin.Context) {
e.OutErr(c, e.ERR, err.Error()) e.OutErr(c, e.ERR, err.Error())
return return
} }

e.OutSuc(c, map[string]interface{}{ e.OutSuc(c, map[string]interface{}{
"list": list, "list": list,
"sum_total": sumTotal, "sum_total": sumTotal,


+ 4
- 3
app/customer/hdl/test/hdl_wx.go View File

@@ -29,7 +29,7 @@ func WxRefundsTest(c *gin.Context) {
} }
sysCfgDb := db.SysCfgDb{} sysCfgDb := db.SysCfgDb{}
sysCfgDb.Set() sysCfgDb.Set()
sysCfg := sysCfgDb.SysCfgFindWithDb(enum2.WxSpMchId)
sysCfg := sysCfgDb.SysCfgFindWithDb(enum2.WxMchId, enum2.WxJsapiRefundPayNotifyUrl)
client, err := svc3.NewWxPayClient(c) client, err := svc3.NewWxPayClient(c)
if err != nil { if err != nil {
e.OutErr(c, e.ERR, err.Error()) e.OutErr(c, e.ERR, err.Error())
@@ -41,11 +41,11 @@ func WxRefundsTest(c *gin.Context) {


resp, result, err := wxSvc.Create(c, resp, result, err := wxSvc.Create(c,
refunddomestic.CreateRequest{ refunddomestic.CreateRequest{
SubMchid: core.String(sysCfg[enum2.WxSpMchId]),
SubMchid: core.String(sysCfg[enum2.WxMchId]),
OutTradeNo: core.String(ord.OutTradeNo), OutTradeNo: core.String(ord.OutTradeNo),
OutRefundNo: core.String(outRequestNo), OutRefundNo: core.String(outRequestNo),
Reason: core.String("央厨订餐退款"), Reason: core.String("央厨订餐退款"),
NotifyUrl: core.String("https://weixin.qq.com"),
NotifyUrl: core.String(sysCfg[enum2.WxJsapiRefundPayNotifyUrl]),
Amount: &refunddomestic.AmountReq{ Amount: &refunddomestic.AmountReq{
Currency: core.String("CNY"), Currency: core.String("CNY"),
Refund: core.Int64(utils.StrToInt64(refund)), Refund: core.Int64(utils.StrToInt64(refund)),
@@ -60,6 +60,7 @@ func WxRefundsTest(c *gin.Context) {
// 处理返回结果 // 处理返回结果
println("status=%d resp=%s", result.Response.StatusCode, resp) println("status=%d resp=%s", result.Response.StatusCode, resp)
} }

e.OutSuc(c, map[string]interface{}{ e.OutSuc(c, map[string]interface{}{
"resp": resp, "resp": resp,
"result": result, "result": result,


+ 4
- 4
app/customer/svc/order/svc_central_kitchen_for_school_order.go View File

@@ -17,10 +17,10 @@ func OrderList(req md.CentralKitchenForSchoolOrderListReq, platform string) (m [
sess := db.Db.Desc("id").Where("user_identity_id =?", req.UserIdentityId). 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) And("create_at >= ? And create_at <= ?", req.StartDate, req.EndDate).Limit(req.Limit, (req.Page-1)*req.Limit)
sess.And("ord_state = ?", req.OrdState) sess.And("ord_state = ?", req.OrdState)
if platform == "alipay" {
if platform == "alipay_applet" {
sess.And("pay_way = ?", enum2.PayWayForAli) sess.And("pay_way = ?", enum2.PayWayForAli)
} }
if platform == "wx" {
if platform == "wx_applet" {
sess.And("pay_way = ?", enum2.PayWayForWx) sess.And("pay_way = ?", enum2.PayWayForWx)
} }
total, err = sess.FindAndCount(&m) 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) { func OrderStatistic(req md.CentralKitchenForSchoolOrderListReq, platform string) (total float64, err error) {
var sql string 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 "+ 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) "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 "+ 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) "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)
} }


+ 3
- 0
app/enum/enum_sys_cfg.go View File

@@ -39,6 +39,7 @@ const (
WxSpAppId = "wx_sp_app_id" WxSpAppId = "wx_sp_app_id"
WxSpMchId = "wx_sp_mch_id" WxSpMchId = "wx_sp_mch_id"
WxJsapiPayNotifyUrl = "wx_jsapi_pay_notify_url" WxJsapiPayNotifyUrl = "wx_jsapi_pay_notify_url"
WxJsapiRefundPayNotifyUrl = "wx_jsapi_refund_pay_notify_url"
) )


func (gt SysCfg) String() string { func (gt SysCfg) String() string {
@@ -111,6 +112,8 @@ func (gt SysCfg) String() string {
return "微信服务商-商户id" return "微信服务商-商户id"
case WxJsapiPayNotifyUrl: case WxJsapiPayNotifyUrl:
return "微信-jsapi支付-异步通知" return "微信-jsapi支付-异步通知"
case WxJsapiRefundPayNotifyUrl:
return "微信-退款-异步通知"
default: default:
return "未知" return "未知"
} }


+ 1
- 1
app/router/customer_router.go View File

@@ -68,7 +68,7 @@ func CustomerInit(r *gin.RouterGroup) {
} }


func rTest(r *gin.RouterGroup) { func rTest(r *gin.RouterGroup) {
r.POST("/wxRefunds", test.WxRefundsTest) // 测试-微信退款
r.GET("/wxRefunds", test.WxRefundsTest) // 测试-微信退款
} }


func rPay(r *gin.RouterGroup) { func rPay(r *gin.RouterGroup) {


Loading…
Cancel
Save