添加门店管理员获取信息接口、调整微信登录账号生成逻辑

This commit is contained in:
2025-06-11 16:47:34 +08:00
parent 427df4a3bf
commit 1e94848f8d
11 changed files with 104 additions and 5 deletions

View File

@ -8,6 +8,7 @@ import (
"io"
"os"
v1 "server/api/wx/v1"
"server/internal/consts"
"server/internal/model"
"server/utility/ecode"
"server/utility/wechat"
@ -18,7 +19,7 @@ import (
func (c *ControllerV1) WeChatLogin(ctx context.Context, req *v1.WeChatLoginReq) (res *v1.WeChatLoginRes, err error) {
glog.Infof(ctx, "收到微信登录请求SceneId: %s", req.SceneId)
loginLimitKey := fmt.Sprintf("wx:login:limit:%s", req.SceneId)
loginLimitKey := fmt.Sprintf(consts.WeChatLoginLimit, req.SceneId)
// 检查登录限制
va, err := g.Redis().Get(ctx, loginLimitKey)
@ -77,7 +78,7 @@ func (c *ControllerV1) WeChatLogin(ctx context.Context, req *v1.WeChatLoginReq)
data, err := json.Marshal(loginCache)
if err == nil {
_ = g.Redis().SetEX(ctx, fmt.Sprintf("wx:login:cache:%s", req.SceneId), data, 60)
_ = g.Redis().SetEX(ctx, fmt.Sprintf(consts.WeChatLoginCache, req.SceneId), data, 60)
glog.Infof(ctx, "SceneId %s 登录缓存已写入 Redis", req.SceneId)
} else {
glog.Warningf(ctx, "SceneId %s登录缓存序列化失败: %v", req.SceneId, err)