Explorar el Código

update

add_mode
DengBiao hace 1 año
padre
commit
81b6e2d4d0
Se han modificado 5 ficheros con 16 adiciones y 9 borrados
  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 Ver fichero

@@ -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,


+ 4
- 3
app/customer/hdl/test/hdl_wx.go Ver fichero

@@ -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,


+ 4
- 4
app/customer/svc/order/svc_central_kitchen_for_school_order.go Ver fichero

@@ -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)
}


+ 3
- 0
app/enum/enum_sys_cfg.go Ver fichero

@@ -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 "未知"
}


+ 1
- 1
app/router/customer_router.go Ver fichero

@@ -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) {


Cargando…
Cancelar
Guardar