作者 yangfu

Merge branch 'dev' into test

@@ -32,7 +32,7 @@ func NewMiniQrcodeInviteLogic(ctx context.Context, svcCtx *svc.ServiceContext) * @@ -32,7 +32,7 @@ func NewMiniQrcodeInviteLogic(ctx context.Context, svcCtx *svc.ServiceContext) *
32 32
33 func (l *MiniQrcodeInviteLogic) MiniQrcodeInvite(req *types.MiniQrCodeRequest) (resp interface{}, err error) { 33 func (l *MiniQrcodeInviteLogic) MiniQrcodeInvite(req *types.MiniQrCodeRequest) (resp interface{}, err error) {
34 var ( 34 var (
35 - q = l.svcCtx.MiniProgram.GetQRCode() 35 + q = l.svcCtx.GetMiniProgram().GetQRCode()
36 cacheData = fmt.Sprintf("%s?%s", req.Page, req.Scene) 36 cacheData = fmt.Sprintf("%s?%s", req.Page, req.Scene)
37 cacheKey = fmt.Sprintf("%s:qrcode:%s", l.svcCtx.Config.Name, tool.Md5ByString(cacheData)) 37 cacheKey = fmt.Sprintf("%s:qrcode:%s", l.svcCtx.Config.Name, tool.Md5ByString(cacheData))
38 ok bool 38 ok bool
@@ -109,3 +109,13 @@ func NewServiceContext(c config.Config) *ServiceContext { @@ -109,3 +109,13 @@ func NewServiceContext(c config.Config) *ServiceContext {
109 func (svc *ServiceContext) DefaultDBConn() transaction.Conn { 109 func (svc *ServiceContext) DefaultDBConn() transaction.Conn {
110 return transaction.NewTransactionContext(svc.DB) 110 return transaction.NewTransactionContext(svc.DB)
111 } 111 }
  112 +
  113 +func (svc *ServiceContext) GetMiniProgram() *miniprogram.MiniProgram {
  114 + c := svc.Config
  115 + miniProgram := wechat.NewWechat().GetMiniProgram(&miniConfig.Config{
  116 + AppID: c.Wechat.AppID,
  117 + AppSecret: c.Wechat.AppSecret,
  118 + Cache: minicache.NewMemory(),
  119 + })
  120 + return miniProgram
  121 +}