新增APP查询页

This commit is contained in:
2025-03-14 02:56:27 +08:00
parent ece4b5d1b1
commit 0e6cb95499
11 changed files with 209 additions and 33 deletions

View File

@@ -0,0 +1,30 @@
package query
import (
"context"
"tydata-server/app/user/cmd/api/internal/svc"
"tydata-server/app/user/cmd/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type QueryServiceAppLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewQueryServiceAppLogic(ctx context.Context, svcCtx *svc.ServiceContext) *QueryServiceAppLogic {
return &QueryServiceAppLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *QueryServiceAppLogic) QueryServiceApp(req *types.QueryServiceReq) (resp *types.QueryServiceResp, err error) {
// todo: add your logic here and delete this line
return
}

View File

@@ -40,30 +40,12 @@ func NewQueryServiceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Quer
func (l *QueryServiceLogic) QueryService(req *types.QueryServiceReq) (resp *types.QueryServiceResp, err error) {
if req.AgentIdentifier != "" {
l.ctx = context.WithValue(l.ctx, "agentIdentifier", req.AgentIdentifier)
return l.PreprocessLogic(req, req.Product)
} else if req.App {
l.ctx = context.WithValue(l.ctx, "app", req.App)
}
return l.PreprocessLogic(req, req.Product)
}
//func (l *QueryServiceLogic) agentParsing(req *types.QueryServiceReq) (*types.AgentIdentifier, error) {
// key, decodeErr := hex.DecodeString("8e3e7a2f60edb49221e953b9c029ed10")
// if decodeErr != nil {
// return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "查询服务, 获取AES密钥失败: %+v", decodeErr)
// }
//
// encrypted, err := crypto.AesDecryptURL(req.Product, key)
// if err != nil {
// return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "查询服务, %v", err)
// }
// var agentIdentifier types.AgentIdentifier
// err = json.Unmarshal(encrypted, &agentIdentifier)
// if err != nil {
// return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "查询服务,反序列化失败 %v", err)
// }
// l.ctx = context.WithValue(l.ctx, "agent", req.Agent)
// return &agentIdentifier, nil
//}
var productProcessors = map[string]func(*QueryServiceLogic, *types.QueryServiceReq) (*types.QueryServiceResp, error){
"marriage": (*QueryServiceLogic).ProcessMarriageLogic,
"homeservice": (*QueryServiceLogic).ProcessHomeServiceLogic,
@@ -1387,7 +1369,8 @@ func (l *QueryServiceLogic) CacheData(params map[string]interface{}, Product str
func (l *QueryServiceLogic) GetOrCreateUser(mobile string) (int64, error) {
agentIdentifier, ok := l.ctx.Value("agentIdentifier").(string)
if !ok || agentIdentifier == "" {
app, appOk := l.ctx.Value("app").(bool)
if (!ok || agentIdentifier == "") && (!appOk || app == false) {
// 不是代理查询
userID, getUidErr := ctxdata.GetUidFromCtx(l.ctx)
if getUidErr != nil {