添加门店管理员获取信息接口、调整微信登录账号生成逻辑
This commit is contained in:
5
internal/controller/storeAdmin/storeAdmin.go
Normal file
5
internal/controller/storeAdmin/storeAdmin.go
Normal file
@ -0,0 +1,5 @@
|
||||
// =================================================================================
|
||||
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
// =================================================================================
|
||||
|
||||
package storeAdmin
|
||||
15
internal/controller/storeAdmin/storeAdmin_new.go
Normal file
15
internal/controller/storeAdmin/storeAdmin_new.go
Normal file
@ -0,0 +1,15 @@
|
||||
// =================================================================================
|
||||
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
// =================================================================================
|
||||
|
||||
package storeAdmin
|
||||
|
||||
import (
|
||||
"server/api/storeAdmin"
|
||||
)
|
||||
|
||||
type ControllerV1 struct{}
|
||||
|
||||
func NewV1() storeAdmin.IStoreAdminV1 {
|
||||
return &ControllerV1{}
|
||||
}
|
||||
14
internal/controller/storeAdmin/storeAdmin_v1_info.go
Normal file
14
internal/controller/storeAdmin/storeAdmin_v1_info.go
Normal file
@ -0,0 +1,14 @@
|
||||
package storeAdmin
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/errors/gcode"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
|
||||
"server/api/storeAdmin/v1"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) Info(ctx context.Context, req *v1.InfoReq) (res *v1.InfoRes, err error) {
|
||||
return nil, gerror.NewCode(gcode.CodeNotImplemented)
|
||||
}
|
||||
@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
v1 "server/api/wx/v1"
|
||||
"server/internal/consts"
|
||||
"server/internal/model"
|
||||
"server/internal/service"
|
||||
"strings"
|
||||
@ -50,7 +51,7 @@ func (c *ControllerV1) WeChatEvent(ctx context.Context, req *v1.WeChatEventReq)
|
||||
}
|
||||
|
||||
func updateLoginCache(ctx context.Context, key string, token string) error {
|
||||
loginCacheKey := fmt.Sprintf("wx:login:cache:%s", key)
|
||||
loginCacheKey := fmt.Sprintf(consts.WeChatLoginCache, key)
|
||||
glog.Infof(ctx, "【微信事件】准备更新登录缓存 | redisKey=%s, token=%s", loginCacheKey, token)
|
||||
|
||||
// 获取原缓存
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -5,6 +5,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
v1 "server/api/wx/v1"
|
||||
"server/internal/consts"
|
||||
"server/internal/model"
|
||||
"server/utility/ecode"
|
||||
|
||||
@ -13,7 +14,7 @@ import (
|
||||
)
|
||||
|
||||
func (c *ControllerV1) WeChatPolling(ctx context.Context, req *v1.WeChatPollingReq) (res *v1.WeChatPollingRes, err error) {
|
||||
loginCacheKey := fmt.Sprintf("wx:login:cache:%s", req.SceneId)
|
||||
loginCacheKey := fmt.Sprintf(consts.WeChatLoginCache, req.SceneId)
|
||||
glog.Infof(ctx, "开始处理微信长轮询请求,SceneID: %s", req.SceneId)
|
||||
|
||||
var loginCache model.LoginCache
|
||||
|
||||
Reference in New Issue
Block a user