代码调整
This commit is contained in:
parent
76f67a41dc
commit
cb76dfdd9e
2
Makefile
2
Makefile
|
@ -78,4 +78,4 @@ union_pay_redpack:
|
||||||
make build-win name=union_pay_redpack
|
make build-win name=union_pay_redpack
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: zltx_v1 zltx_card_v1 alipay_cpn alipay_redpack wechat_cpn wechat_redpack union_pay_cpn union_pay_redpack
|
all: zltx_v1 zltx_card_v1 zltx_v2 alipay_cpn alipay_redpack wechat_cpn wechat_redpack
|
|
@ -3,6 +3,7 @@ package internal
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
"gitea.cdlsxd.cn/sdk/plugin/proto"
|
"gitea.cdlsxd.cn/sdk/plugin/proto"
|
||||||
"plugins/alipay_cpn/internal/po"
|
"plugins/alipay_cpn/internal/po"
|
||||||
)
|
)
|
||||||
|
@ -26,7 +27,14 @@ const (
|
||||||
|
|
||||||
type AlipayCpnService struct{}
|
type AlipayCpnService struct{}
|
||||||
|
|
||||||
func (s *AlipayCpnService) Order(ctx context.Context, request *proto.OrderRequest) (*proto.OrderResponse, error) {
|
func (s *AlipayCpnService) Order(ctx context.Context, request *proto.OrderRequest) (resp2 *proto.OrderResponse, respErr error) {
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
if err := recover(); err != nil {
|
||||||
|
respErr = fmt.Errorf("panic: %v", err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
c, err := transConfig(request.Config)
|
c, err := transConfig(request.Config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -60,7 +68,14 @@ func (s *AlipayCpnService) Order(ctx context.Context, request *proto.OrderReques
|
||||||
return orderResp(request, response), nil
|
return orderResp(request, response), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *AlipayCpnService) Query(ctx context.Context, request *proto.QueryRequest) (*proto.QueryResponse, error) {
|
func (s *AlipayCpnService) Query(ctx context.Context, request *proto.QueryRequest) (resp2 *proto.QueryResponse, respErr error) {
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
if err := recover(); err != nil {
|
||||||
|
respErr = fmt.Errorf("panic: %v", err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
c, err := transConfig(request.Config)
|
c, err := transConfig(request.Config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -94,7 +109,14 @@ func (s *AlipayCpnService) Query(ctx context.Context, request *proto.QueryReques
|
||||||
return queryResp(request, response), nil
|
return queryResp(request, response), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *AlipayCpnService) Notify(_ context.Context, request *proto.NotifyRequest) (*proto.NotifyResponse, error) {
|
func (s *AlipayCpnService) Notify(_ context.Context, request *proto.NotifyRequest) (resp2 *proto.NotifyResponse, respErr error) {
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
if err := recover(); err != nil {
|
||||||
|
respErr = fmt.Errorf("panic: %v", err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
c, err := transConfig(request.Config)
|
c, err := transConfig(request.Config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
@ -3,6 +3,7 @@ package internal
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
"gitea.cdlsxd.cn/sdk/plugin/proto"
|
"gitea.cdlsxd.cn/sdk/plugin/proto"
|
||||||
"plugins/alipay_redpack/internal/po"
|
"plugins/alipay_redpack/internal/po"
|
||||||
"plugins/utils/alipay"
|
"plugins/utils/alipay"
|
||||||
|
@ -26,7 +27,14 @@ const (
|
||||||
|
|
||||||
type AlipayRedPackService struct{}
|
type AlipayRedPackService struct{}
|
||||||
|
|
||||||
func (s *AlipayRedPackService) Order(ctx context.Context, request *proto.OrderRequest) (*proto.OrderResponse, error) {
|
func (s *AlipayRedPackService) Order(ctx context.Context, request *proto.OrderRequest) (resp2 *proto.OrderResponse, respErr error) {
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
if err := recover(); err != nil {
|
||||||
|
respErr = fmt.Errorf("panic: %v", err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
c, err := transConfig(request.Config)
|
c, err := transConfig(request.Config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -60,7 +68,14 @@ func (s *AlipayRedPackService) Order(ctx context.Context, request *proto.OrderRe
|
||||||
return orderResp(request, response), nil
|
return orderResp(request, response), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *AlipayRedPackService) Query(ctx context.Context, request *proto.QueryRequest) (*proto.QueryResponse, error) {
|
func (s *AlipayRedPackService) Query(ctx context.Context, request *proto.QueryRequest) (resp2 *proto.QueryResponse, respErr error) {
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
if err := recover(); err != nil {
|
||||||
|
respErr = fmt.Errorf("panic: %v", err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
c, err := transConfig(request.Config)
|
c, err := transConfig(request.Config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -89,7 +104,14 @@ func (s *AlipayRedPackService) Query(ctx context.Context, request *proto.QueryRe
|
||||||
return queryResp(request, response), nil
|
return queryResp(request, response), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *AlipayRedPackService) Notify(_ context.Context, request *proto.NotifyRequest) (*proto.NotifyResponse, error) {
|
func (s *AlipayRedPackService) Notify(_ context.Context, request *proto.NotifyRequest) (resp2 *proto.NotifyResponse, respErr error) {
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
if err := recover(); err != nil {
|
||||||
|
respErr = fmt.Errorf("panic: %v", err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
c, err := transConfig(request.Config)
|
c, err := transConfig(request.Config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
@ -19,7 +19,14 @@ const (
|
||||||
|
|
||||||
type WeChatCpnService struct{}
|
type WeChatCpnService struct{}
|
||||||
|
|
||||||
func (p *WeChatCpnService) Order(ctx context.Context, request *proto.OrderRequest) (*proto.OrderResponse, error) {
|
func (p *WeChatCpnService) Order(ctx context.Context, request *proto.OrderRequest) (resp2 *proto.OrderResponse, respErr error) {
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
if err := recover(); err != nil {
|
||||||
|
respErr = fmt.Errorf("panic: %v", err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
config, err := transConfig(request.Config)
|
config, err := transConfig(request.Config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -47,7 +54,14 @@ func (p *WeChatCpnService) Order(ctx context.Context, request *proto.OrderReques
|
||||||
return orderResp(request.GetOrder(), *resp.CouponId), nil
|
return orderResp(request.GetOrder(), *resp.CouponId), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *WeChatCpnService) Query(ctx context.Context, request *proto.QueryRequest) (*proto.QueryResponse, error) {
|
func (p *WeChatCpnService) Query(ctx context.Context, request *proto.QueryRequest) (resp2 *proto.QueryResponse, respErr error) {
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
if err := recover(); err != nil {
|
||||||
|
respErr = fmt.Errorf("panic: %v", err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
config, err := transConfig(request.Config)
|
config, err := transConfig(request.Config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -75,7 +89,14 @@ func (p *WeChatCpnService) Query(ctx context.Context, request *proto.QueryReques
|
||||||
return queryResp(request, resp), nil
|
return queryResp(request, resp), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *WeChatCpnService) Notify(ctx context.Context, request *proto.NotifyRequest) (*proto.NotifyResponse, error) {
|
func (p *WeChatCpnService) Notify(ctx context.Context, request *proto.NotifyRequest) (resp2 *proto.NotifyResponse, respErr error) {
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
if err := recover(); err != nil {
|
||||||
|
respErr = fmt.Errorf("panic: %v", err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
config, err := transConfig(request.Config)
|
config, err := transConfig(request.Config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
@ -59,7 +59,14 @@ func (p *ZLTXCardV1Service) Order(ctx context.Context, request *proto.OrderReque
|
||||||
return orderResp(request, resp), nil
|
return orderResp(request, resp), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *ZLTXCardV1Service) Query(ctx context.Context, request *proto.QueryRequest) (*proto.QueryResponse, error) {
|
func (p *ZLTXCardV1Service) Query(ctx context.Context, request *proto.QueryRequest) (resp2 *proto.QueryResponse, respErr error) {
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
if err := recover(); err != nil {
|
||||||
|
respErr = fmt.Errorf("panic: %v", err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
c, err := transConfig(request.Config)
|
c, err := transConfig(request.Config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
@ -21,7 +21,14 @@ const (
|
||||||
|
|
||||||
type ZLTXV1Service struct{}
|
type ZLTXV1Service struct{}
|
||||||
|
|
||||||
func (p *ZLTXV1Service) Order(ctx context.Context, request *proto.OrderRequest) (*proto.OrderResponse, error) {
|
func (p *ZLTXV1Service) Order(ctx context.Context, request *proto.OrderRequest) (resp2 *proto.OrderResponse, respErr error) {
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
if err := recover(); err != nil {
|
||||||
|
respErr = fmt.Errorf("panic: %v", err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
c, err := transConfig(request.Config)
|
c, err := transConfig(request.Config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -52,7 +59,14 @@ func (p *ZLTXV1Service) Order(ctx context.Context, request *proto.OrderRequest)
|
||||||
return orderResp(request, resp), nil
|
return orderResp(request, resp), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *ZLTXV1Service) Query(ctx context.Context, request *proto.QueryRequest) (*proto.QueryResponse, error) {
|
func (p *ZLTXV1Service) Query(ctx context.Context, request *proto.QueryRequest) (resp2 *proto.QueryResponse, respErr error) {
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
if err := recover(); err != nil {
|
||||||
|
respErr = fmt.Errorf("panic: %v", err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
c, err := transConfig(request.Config)
|
c, err := transConfig(request.Config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -75,7 +89,14 @@ func (p *ZLTXV1Service) Query(ctx context.Context, request *proto.QueryRequest)
|
||||||
return queryResp(request, resp)
|
return queryResp(request, resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *ZLTXV1Service) Notify(ctx context.Context, request *proto.NotifyRequest) (*proto.NotifyResponse, error) {
|
func (p *ZLTXV1Service) Notify(ctx context.Context, request *proto.NotifyRequest) (resp2 *proto.NotifyResponse, respErr error) {
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
if err := recover(); err != nil {
|
||||||
|
respErr = fmt.Errorf("panic: %v", err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
c, err := transConfig(request.Config)
|
c, err := transConfig(request.Config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
@ -22,7 +22,13 @@ const (
|
||||||
|
|
||||||
type ZLTXV2Service struct{}
|
type ZLTXV2Service struct{}
|
||||||
|
|
||||||
func (p *ZLTXV2Service) Order(ctx context.Context, request *proto.OrderRequest) (*proto.OrderResponse, error) {
|
func (p *ZLTXV2Service) Order(ctx context.Context, request *proto.OrderRequest) (resp2 *proto.OrderResponse, respErr error) {
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
if err := recover(); err != nil {
|
||||||
|
respErr = fmt.Errorf("panic: %v", err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
c, err := transConfig(request.Config)
|
c, err := transConfig(request.Config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -46,7 +52,14 @@ func (p *ZLTXV2Service) Order(ctx context.Context, request *proto.OrderRequest)
|
||||||
return orderResp(request, response), nil
|
return orderResp(request, response), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *ZLTXV2Service) Query(ctx context.Context, request *proto.QueryRequest) (*proto.QueryResponse, error) {
|
func (p *ZLTXV2Service) Query(ctx context.Context, request *proto.QueryRequest) (resp2 *proto.QueryResponse, respErr error) {
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
if err := recover(); err != nil {
|
||||||
|
respErr = fmt.Errorf("panic: %v", err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
c, err := transConfig(request.Config)
|
c, err := transConfig(request.Config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -69,7 +82,14 @@ func (p *ZLTXV2Service) Query(ctx context.Context, request *proto.QueryRequest)
|
||||||
return queryResp(c.AppKey, request, response)
|
return queryResp(c.AppKey, request, response)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *ZLTXV2Service) Notify(_ context.Context, request *proto.NotifyRequest) (*proto.NotifyResponse, error) {
|
func (p *ZLTXV2Service) Notify(_ context.Context, request *proto.NotifyRequest) (resp2 *proto.NotifyResponse, respErr error) {
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
if err := recover(); err != nil {
|
||||||
|
respErr = fmt.Errorf("panic: %v", err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
httpHeaders := make(http.Header)
|
httpHeaders := make(http.Header)
|
||||||
if err := json.Unmarshal(request.Headers, &httpHeaders); err != nil {
|
if err := json.Unmarshal(request.Headers, &httpHeaders); err != nil {
|
||||||
return nil, proto.ErrorParamFail(fmt.Sprintf("headers Unmarshal err [%v]", err))
|
return nil, proto.ErrorParamFail(fmt.Sprintf("headers Unmarshal err [%v]", err))
|
||||||
|
|
Loading…
Reference in New Issue