|
@@ -7,12 +7,12 @@ import (
|
|
"time"
|
|
"time"
|
|
"wechat-api/ent"
|
|
"wechat-api/ent"
|
|
"wechat-api/ent/wxcarduser"
|
|
"wechat-api/ent/wxcarduser"
|
|
|
|
+ "wechat-api/hook/wechat"
|
|
"wechat-api/internal/svc"
|
|
"wechat-api/internal/svc"
|
|
"wechat-api/internal/types"
|
|
"wechat-api/internal/types"
|
|
"wechat-api/internal/utils/dberrorhandler"
|
|
"wechat-api/internal/utils/dberrorhandler"
|
|
"wechat-api/internal/utils/jwt"
|
|
"wechat-api/internal/utils/jwt"
|
|
|
|
|
|
- mini "github.com/ArtisanCloud/PowerWeChat/v2/src/miniProgram"
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
)
|
|
)
|
|
|
|
|
|
@@ -32,24 +32,11 @@ func NewDoApiUserLoginLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Do
|
|
func (l *DoApiUserLoginLogic) DoApiUserLogin(req *types.UserLoginReq) (*types.UserLoginResp, error) {
|
|
func (l *DoApiUserLoginLogic) DoApiUserLogin(req *types.UserLoginReq) (*types.UserLoginResp, error) {
|
|
var err error
|
|
var err error
|
|
|
|
|
|
- Appid := l.svcCtx.Config.Miniprogram.Appid
|
|
|
|
|
|
+ AppId := l.svcCtx.Config.Miniprogram.Appid
|
|
Secret := l.svcCtx.Config.Miniprogram.Secret
|
|
Secret := l.svcCtx.Config.Miniprogram.Secret
|
|
- //RedisAddr := l.svcCtx.Config.Miniprogram.Redisaddr
|
|
|
|
|
|
|
|
// 1. 初始化小程序应用实例
|
|
// 1. 初始化小程序应用实例
|
|
- app, err := mini.NewMiniProgram(&mini.UserConfig{
|
|
|
|
- AppID: Appid, // 小程序、公众号或者企业微信的appid
|
|
|
|
- Secret: Secret, // 商户号 appID
|
|
|
|
- HttpDebug: true,
|
|
|
|
- Debug: false,
|
|
|
|
- // 可选,不传默认走程序内存
|
|
|
|
- //Cache: kernel.NewRedisClient(&kernel.RedisOptions{
|
|
|
|
- // Addr: RedisAddr,
|
|
|
|
- // Password: "",
|
|
|
|
- // DB: 0,
|
|
|
|
- //}),
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
|
|
+ app, err := wechat.NewClient(AppId, Secret)
|
|
if err != nil {
|
|
if err != nil {
|
|
return nil, errorx.NewApiInternalError("init wechat miniprogram failed")
|
|
return nil, errorx.NewApiInternalError("init wechat miniprogram failed")
|
|
}
|
|
}
|