This commit is contained in:
parent
6e05cf2045
commit
bb5e9ee0e9
|
|
@ -1,4 +1,4 @@
|
||||||
package kx
|
package kog
|
||||||
|
|
||||||
// BBToWechatRequest 蓝色兄弟请求微信发券接口数据同步Api
|
// BBToWechatRequest 蓝色兄弟请求微信发券接口数据同步Api
|
||||||
type BBToWechatRequest struct {
|
type BBToWechatRequest struct {
|
||||||
|
|
@ -24,8 +24,8 @@ type BBToWechatRequest struct {
|
||||||
TransactionId string `protobuf:"bytes,18,opt,name=transactionId,proto3" json:"transactionId,omitempty"`
|
TransactionId string `protobuf:"bytes,18,opt,name=transactionId,proto3" json:"transactionId,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *BBToWechatRequest) GetSynNotice() *SynNotice {
|
func (this *BBToWechatRequest) GetNotice() *Notice {
|
||||||
return &SynNotice{
|
return &Notice{
|
||||||
OutBizBo: this.TransactionId,
|
OutBizBo: this.TransactionId,
|
||||||
Type: NoticeTypeBBToWechat,
|
Type: NoticeTypeBBToWechat,
|
||||||
BizContent: this,
|
BizContent: this,
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package kx
|
package kog
|
||||||
|
|
||||||
// CmbToBBRequest 招行请求蓝色兄弟发券接口数据同步Api
|
// CmbToBBRequest 招行请求蓝色兄弟发券接口数据同步Api
|
||||||
type CmbToBBRequest struct {
|
type CmbToBBRequest struct {
|
||||||
|
|
@ -18,8 +18,8 @@ type CmbToBBRequest struct {
|
||||||
Attach string `protobuf:"bytes,15,opt,name=attach,proto3" json:"attach,omitempty"`
|
Attach string `protobuf:"bytes,15,opt,name=attach,proto3" json:"attach,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *CmbToBBRequest) GetSynNotice() *SynNotice {
|
func (this *CmbToBBRequest) GetNotice() *Notice {
|
||||||
return &SynNotice{
|
return &Notice{
|
||||||
OutBizBo: this.TransactionId,
|
OutBizBo: this.TransactionId,
|
||||||
Type: NoticeTypeCmbToBB,
|
Type: NoticeTypeCmbToBB,
|
||||||
BizContent: this,
|
BizContent: this,
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package kx
|
package kog
|
||||||
|
|
||||||
type NoticeType uint8
|
type NoticeType uint8
|
||||||
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
package kog
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
)
|
||||||
|
|
||||||
|
var _ ApiInterface = (*CmbToBBRequest)(nil)
|
||||||
|
var _ ApiInterface = (*BBToWechatRequest)(nil)
|
||||||
|
var _ ApiInterface = (*WechatToBBRequest)(nil)
|
||||||
|
|
||||||
|
type ApiInterface interface {
|
||||||
|
GetNotice() *Notice
|
||||||
|
}
|
||||||
|
|
||||||
|
type Notice struct {
|
||||||
|
OutBizBo string
|
||||||
|
Type NoticeType
|
||||||
|
BizContent ApiInterface
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Notice) Marshal() ([]byte, error) {
|
||||||
|
return json.Marshal(this)
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package kx
|
package kog
|
||||||
|
|
||||||
// WechatToBBRequest 微信回调蓝色兄弟接口数据同步Api
|
// WechatToBBRequest 微信回调蓝色兄弟接口数据同步Api
|
||||||
type WechatToBBRequest struct {
|
type WechatToBBRequest struct {
|
||||||
|
|
@ -30,8 +30,8 @@ type WechatToBBRequest struct {
|
||||||
GmtVoucherCreate string `protobuf:"bytes,21,opt,name=gmtVoucherCreate,proto3" json:"gmtVoucherCreate,omitempty"`
|
GmtVoucherCreate string `protobuf:"bytes,21,opt,name=gmtVoucherCreate,proto3" json:"gmtVoucherCreate,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *WechatToBBRequest) GetSynNotice() *SynNotice {
|
func (this *WechatToBBRequest) GetNotice() *Notice {
|
||||||
return &SynNotice{
|
return &Notice{
|
||||||
OutBizBo: this.OrderId,
|
OutBizBo: this.OrderId,
|
||||||
Type: NoticeTypeWechatToBB,
|
Type: NoticeTypeWechatToBB,
|
||||||
BizContent: this,
|
BizContent: this,
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
package kx
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/json"
|
|
||||||
)
|
|
||||||
|
|
||||||
var _ SynApiInterface = (*CmbToBBRequest)(nil)
|
|
||||||
var _ SynApiInterface = (*BBToWechatRequest)(nil)
|
|
||||||
var _ SynApiInterface = (*WechatToBBRequest)(nil)
|
|
||||||
|
|
||||||
type SynApiInterface interface {
|
|
||||||
GetSynNotice() *SynNotice
|
|
||||||
}
|
|
||||||
|
|
||||||
type SynNotice struct {
|
|
||||||
OutBizBo string
|
|
||||||
Type NoticeType
|
|
||||||
BizContent SynApiInterface
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *SynNotice) Marshal() ([]byte, error) {
|
|
||||||
return json.Marshal(this)
|
|
||||||
}
|
|
||||||
|
|
@ -2,9 +2,9 @@ package mixrepos
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"voucher/internal/biz/kx"
|
"voucher/internal/biz/kog"
|
||||||
)
|
)
|
||||||
|
|
||||||
type KxMixRepo interface {
|
type KxMixRepo interface {
|
||||||
Request(ctx context.Context, req *kx.SynNotice) error
|
Request(ctx context.Context, req *kog.Notice) error
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import (
|
||||||
err2 "voucher/api/err"
|
err2 "voucher/api/err"
|
||||||
v1 "voucher/api/v1"
|
v1 "voucher/api/v1"
|
||||||
"voucher/internal/biz/bo"
|
"voucher/internal/biz/bo"
|
||||||
"voucher/internal/biz/kx"
|
"voucher/internal/biz/kog"
|
||||||
"voucher/internal/biz/vo"
|
"voucher/internal/biz/vo"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -27,7 +27,7 @@ func (v *VoucherBiz) CmbOrder(ctx context.Context, request *v1.CmbRequest) (*v1.
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// 通知kx
|
// 通知kg
|
||||||
b, _ := json.Marshal(reply)
|
b, _ := json.Marshal(reply)
|
||||||
_ = v.bbToWx(ctx, order, string(b))
|
_ = v.bbToWx(ctx, order, string(b))
|
||||||
|
|
||||||
|
|
@ -119,7 +119,7 @@ func (v *VoucherBiz) order(ctx context.Context, req *bo.OrderCreateReqBo, produc
|
||||||
// return nil, err
|
// return nil, err
|
||||||
//}
|
//}
|
||||||
|
|
||||||
voucherNo := order.OrderNo
|
voucherNo := order.OrderNo // mock成功
|
||||||
if err = v.success(ctx, order, voucherNo); err != nil {
|
if err = v.success(ctx, order, voucherNo); err != nil {
|
||||||
return order, err
|
return order, err
|
||||||
}
|
}
|
||||||
|
|
@ -221,7 +221,7 @@ func (c *VoucherBiz) OrderFail(ctx context.Context, err error) (*v1.CmbReply, er
|
||||||
|
|
||||||
func (v *VoucherBiz) cmbToBB(ctx context.Context, cmbReq *v1.CmbOrderRequest) error {
|
func (v *VoucherBiz) cmbToBB(ctx context.Context, cmbReq *v1.CmbOrderRequest) error {
|
||||||
|
|
||||||
req := &kx.CmbToBBRequest{
|
req := &kog.CmbToBBRequest{
|
||||||
TransactionId: cmbReq.TransactionId,
|
TransactionId: cmbReq.TransactionId,
|
||||||
ActivityId: cmbReq.ActivityId,
|
ActivityId: cmbReq.ActivityId,
|
||||||
CmbUid: cmbReq.CmbUid,
|
CmbUid: cmbReq.CmbUid,
|
||||||
|
|
@ -231,7 +231,7 @@ func (v *VoucherBiz) cmbToBB(ctx context.Context, cmbReq *v1.CmbOrderRequest) er
|
||||||
Attach: cmbReq.Attach,
|
Attach: cmbReq.Attach,
|
||||||
}
|
}
|
||||||
|
|
||||||
return v.KxMixRepo.Request(ctx, req.GetSynNotice())
|
return v.KxMixRepo.Request(ctx, req.GetNotice())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *VoucherBiz) bbToWx(ctx context.Context, order *bo.OrderBo, cmbRes string) error {
|
func (v *VoucherBiz) bbToWx(ctx context.Context, order *bo.OrderBo, cmbRes string) error {
|
||||||
|
|
@ -241,7 +241,7 @@ func (v *VoucherBiz) bbToWx(ctx context.Context, order *bo.OrderBo, cmbRes strin
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
req := &kx.BBToWechatRequest{
|
req := &kog.BBToWechatRequest{
|
||||||
StockId: order.BatchNo,
|
StockId: order.BatchNo,
|
||||||
OutRequestNo: order.OrderNo,
|
OutRequestNo: order.OrderNo,
|
||||||
AppId: order.AppID,
|
AppId: order.AppID,
|
||||||
|
|
@ -254,12 +254,12 @@ func (v *VoucherBiz) bbToWx(ctx context.Context, order *bo.OrderBo, cmbRes strin
|
||||||
TransactionId: order.OutBizNo,
|
TransactionId: order.OutBizNo,
|
||||||
}
|
}
|
||||||
|
|
||||||
return v.KxMixRepo.Request(ctx, req.GetSynNotice())
|
return v.KxMixRepo.Request(ctx, req.GetNotice())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *VoucherBiz) wxToBB(ctx context.Context, order *bo.OrderBo, wxReq *bo.WechatVoucherNotifyBo) error {
|
func (v *VoucherBiz) wxToBB(ctx context.Context, order *bo.OrderBo, wxReq *bo.WechatVoucherNotifyBo) error {
|
||||||
|
|
||||||
req := &kx.WechatToBBRequest{
|
req := &kog.WechatToBBRequest{
|
||||||
ActivityId: order.BatchNo,
|
ActivityId: order.BatchNo,
|
||||||
ActivityName: wxReq.PlainText.CouponName,
|
ActivityName: wxReq.PlainText.CouponName,
|
||||||
VoucherId: order.VoucherNo,
|
VoucherId: order.VoucherNo,
|
||||||
|
|
@ -282,12 +282,12 @@ func (v *VoucherBiz) wxToBB(ctx context.Context, order *bo.OrderBo, wxReq *bo.We
|
||||||
req.UseTime = fmt.Sprintf("%d", useTime.Unix())
|
req.UseTime = fmt.Sprintf("%d", useTime.Unix())
|
||||||
}
|
}
|
||||||
|
|
||||||
return v.KxMixRepo.Request(ctx, req.GetSynNotice())
|
return v.KxMixRepo.Request(ctx, req.GetNotice())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *VoucherBiz) wxToBBRefund(ctx context.Context, order *bo.OrderBo) error {
|
func (v *VoucherBiz) wxToBBRefund(ctx context.Context, order *bo.OrderBo) error {
|
||||||
|
|
||||||
req := &kx.WechatToBBRequest{
|
req := &kog.WechatToBBRequest{
|
||||||
ActivityId: order.BatchNo,
|
ActivityId: order.BatchNo,
|
||||||
ActivityName: "",
|
ActivityName: "",
|
||||||
VoucherId: order.VoucherNo,
|
VoucherId: order.VoucherNo,
|
||||||
|
|
@ -303,5 +303,5 @@ func (v *VoucherBiz) wxToBBRefund(ctx context.Context, order *bo.OrderBo) error
|
||||||
GmtVoucherCreate: fmt.Sprintf("%d", order.ReceiveSuccessTime.Unix()),
|
GmtVoucherCreate: fmt.Sprintf("%d", order.ReceiveSuccessTime.Unix()),
|
||||||
}
|
}
|
||||||
|
|
||||||
return v.KxMixRepo.Request(ctx, req.GetSynNotice())
|
return v.KxMixRepo.Request(ctx, req.GetNotice())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,12 @@ package mixrepoimpl
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"github.com/go-kratos/kratos/v2/log"
|
"github.com/go-kratos/kratos/v2/log"
|
||||||
"voucher/internal/biz/kx"
|
"voucher/internal/biz/kog"
|
||||||
"voucher/internal/biz/mixrepos"
|
"voucher/internal/biz/mixrepos"
|
||||||
"voucher/internal/conf"
|
"voucher/internal/conf"
|
||||||
)
|
)
|
||||||
|
|
||||||
// KxMixRepoImpl kx 空港
|
// KxMixRepoImpl kog 空港
|
||||||
type KxMixRepoImpl struct {
|
type KxMixRepoImpl struct {
|
||||||
bc *conf.Bootstrap
|
bc *conf.Bootstrap
|
||||||
}
|
}
|
||||||
|
|
@ -17,7 +17,7 @@ func NewKxMixRepoImpl(bc *conf.Bootstrap) mixrepos.KxMixRepo {
|
||||||
return &KxMixRepoImpl{bc: bc}
|
return &KxMixRepoImpl{bc: bc}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *KxMixRepoImpl) Request(ctx context.Context, req *kx.SynNotice) error {
|
func (s *KxMixRepoImpl) Request(ctx context.Context, req *kog.Notice) error {
|
||||||
|
|
||||||
body, err := req.Marshal()
|
body, err := req.Marshal()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,5 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func (c *CmbService) Order(ctx context.Context, request *v1.CmbRequest) (*v1.CmbReply, error) {
|
func (c *CmbService) Order(ctx context.Context, request *v1.CmbRequest) (*v1.CmbReply, error) {
|
||||||
|
|
||||||
return c.VoucherBiz.CmbOrder(ctx, request)
|
return c.VoucherBiz.CmbOrder(ctx, request)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue