Bladeren bron

wip:未登陆异常提示修改

wangkaiyue 2 jaren geleden
bovenliggende
commit
41d5a6b6f0

+ 1 - 1
internal/controller/chatHistory.go

@@ -19,7 +19,7 @@ type cChatHistory struct{}
 func (c *cChatHistory) Method(ctx context.Context, req *v1.ChatHistoryReq) (res *v1.ChatHistoryRes, err error) {
 	session := model.SessionCtx.Get(ctx).JSession
 	if session.PositionId <= 0 {
-		return nil, fmt.Errorf("无用户身份")
+		return nil, fmt.Errorf("请登录")
 	}
 	res = &v1.ChatHistoryRes{}
 	if req.PrevId != "" {

+ 1 - 1
internal/controller/chatWs.go

@@ -23,7 +23,7 @@ var ChatWs = func(r *ghttp.Request) {
 	if session.PositionId == 0 {
 		_ = ws.WriteJSON(g.Map{
 			"error_code": -1,
-			"error_msg":  "无用户身份",
+			"error_msg":  "请登录",
 		})
 		return
 	}

+ 1 - 1
internal/controller/evaluate.go

@@ -19,7 +19,7 @@ func (c *cEvaluate) Method(ctx context.Context, req *v1.EvaluateReq) (res *v1.Ev
 	id := encrypt.SE.Decode4Hex(req.MessageId)
 	session := model.SessionCtx.Get(ctx).JSession
 	if session.PositionId <= 0 {
-		return nil, fmt.Errorf("无用户身份")
+		return nil, fmt.Errorf("请登录")
 	}
 
 	err = model.ChatHistory.Evaluate(session.PositionId, id, req.Evaluate)

+ 1 - 1
internal/controller/usuallyProblem.go

@@ -17,7 +17,7 @@ type cUsuallyProblem struct{}
 func (c *cUsuallyProblem) Method(ctx context.Context, req *v1.UsuallyProblemReq) (res *v1.QuestionRes, err error) {
 	session := model.SessionCtx.Get(ctx).JSession
 	if session.PersonId <= 0 {
-		return nil, fmt.Errorf("无用户身份")
+		return nil, fmt.Errorf("请登录")
 	}
 	var list []string
 	list, err = model.Question.GetUsuallyProblem(ctx, req.Href, g.Config().MustGet(ctx, "chat.usuallyProblem", 5).Int())