81 lines
2.4 KiB
Go
81 lines
2.4 KiB
Go
package biz
|
|
|
|
import (
|
|
"context"
|
|
"github.com/go-kratos/kratos/v2/log"
|
|
v1 "voucher/api/v1"
|
|
"voucher/internal/biz/bo"
|
|
"voucher/internal/biz/cmb"
|
|
"voucher/internal/biz/mixrepos"
|
|
"voucher/internal/biz/repo"
|
|
"voucher/internal/biz/vo"
|
|
"voucher/internal/biz/wechatrepo"
|
|
"voucher/internal/conf"
|
|
"voucher/internal/data"
|
|
)
|
|
|
|
type VoucherBiz struct {
|
|
bc *conf.Bootstrap
|
|
rdb *data.Rdb
|
|
Cmb *cmb.Cmb
|
|
ProductRepo repo.ProductRepo
|
|
OrderRepo repo.OrderRepo
|
|
OrderNotifyRepo repo.OrderNotifyRepo
|
|
WechatNotifyRegisterTagRepo repo.WechatNotifyRegisterTagRepo
|
|
MqSendMixRepo mixrepos.MQSendMixRepo
|
|
GenerateMixRepo mixrepos.GenerateMixRepo
|
|
WechatCpnRepo wechatrepo.WechatCpnRepo
|
|
DingMixRepo mixrepos.DingMixRepo
|
|
CmbMixRepo mixrepos.CmbMixRepo
|
|
KxMixRepo mixrepos.KxMixRepo
|
|
}
|
|
|
|
func NewVoucherBiz(
|
|
bc *conf.Bootstrap,
|
|
rdb *data.Rdb,
|
|
Cmb *cmb.Cmb,
|
|
ProductRepo repo.ProductRepo,
|
|
OrderRepo repo.OrderRepo,
|
|
OrderNotifyRepo repo.OrderNotifyRepo,
|
|
WechatNotifyRegisterTagRepo repo.WechatNotifyRegisterTagRepo,
|
|
MqSendMixRepo mixrepos.MQSendMixRepo,
|
|
GenerateMixRepo mixrepos.GenerateMixRepo,
|
|
WechatCpnRepo wechatrepo.WechatCpnRepo,
|
|
DingMixRepo mixrepos.DingMixRepo,
|
|
CmbMixRepo mixrepos.CmbMixRepo,
|
|
KxMixRepo mixrepos.KxMixRepo,
|
|
) *VoucherBiz {
|
|
return &VoucherBiz{
|
|
bc: bc,
|
|
rdb: rdb,
|
|
Cmb: Cmb,
|
|
ProductRepo: ProductRepo,
|
|
OrderRepo: OrderRepo,
|
|
OrderNotifyRepo: OrderNotifyRepo,
|
|
WechatNotifyRegisterTagRepo: WechatNotifyRegisterTagRepo,
|
|
MqSendMixRepo: MqSendMixRepo,
|
|
GenerateMixRepo: GenerateMixRepo,
|
|
WechatCpnRepo: WechatCpnRepo,
|
|
DingMixRepo: DingMixRepo,
|
|
CmbMixRepo: CmbMixRepo,
|
|
KxMixRepo: KxMixRepo,
|
|
}
|
|
}
|
|
|
|
func (c *VoucherBiz) GetResponse(ctx context.Context, replyBizContent []byte) (*v1.CmbReply, error) {
|
|
|
|
req := &bo.CmbResponseBo{
|
|
RespCode: vo.CmbResponseStatusSuccess.GetValue(),
|
|
RespMsg: "成功",
|
|
BizContent: string(replyBizContent),
|
|
}
|
|
|
|
reply, err := c.CmbMixRepo.GetResponse(ctx, req)
|
|
if err != nil {
|
|
log.Errorf("build cmb response fail: %v", err)
|
|
return nil, err
|
|
}
|
|
|
|
return reply, nil
|
|
}
|