|
@@ -32,7 +32,7 @@ func (m *WsChat) Handle(ws *ghttp.WebSocket, msg []byte) {
|
|
|
|
|
|
req := &QuestionReq{}
|
|
req := &QuestionReq{}
|
|
if err := gjson.Unmarshal(msg, req); err != nil {
|
|
if err := gjson.Unmarshal(msg, req); err != nil {
|
|
- glog.Errorf(m.Ctx, "%d 接收消息Unmarshal出错:%v", jSession.AccountId, err)
|
|
|
|
|
|
+ glog.Errorf(m.Ctx, "%d 接收消息Unmarshal出错:%v", jSession.PositionId, err)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
@@ -41,18 +41,18 @@ func (m *WsChat) Handle(ws *ghttp.WebSocket, msg []byte) {
|
|
Content: req.Prompt,
|
|
Content: req.Prompt,
|
|
Type: 1,
|
|
Type: 1,
|
|
Refer: req.Href,
|
|
Refer: req.Href,
|
|
- PersonId: jSession.AccountId,
|
|
|
|
|
|
+ PersonId: jSession.PositionId,
|
|
CreateTime: time.Now().Format(date.Date_Full_Layout),
|
|
CreateTime: time.Now().Format(date.Date_Full_Layout),
|
|
})
|
|
})
|
|
// 校验是否在黑名单,黑名单不返回内容
|
|
// 校验是否在黑名单,黑名单不返回内容
|
|
- if UserBlackList.CheckBlackList(m.Ctx, jSession.AccountId) {
|
|
|
|
|
|
+ if UserBlackList.CheckBlackList(m.Ctx, jSession.PositionId) {
|
|
return "", 0, nil
|
|
return "", 0, nil
|
|
}
|
|
}
|
|
var err error
|
|
var err error
|
|
reply, from := "", 0
|
|
reply, from := "", 0
|
|
errReply := func() string {
|
|
errReply := func() string {
|
|
// 校验问答频率
|
|
// 校验问答频率
|
|
- if ChatLimit.GetBucket(m.Ctx, jSession.AccountId).TakeAvailable(1) == 0 {
|
|
|
|
|
|
+ if ChatLimit.GetBucket(m.Ctx, jSession.PositionId).TakeAvailable(1) == 0 {
|
|
return g.Cfg().MustGet(m.Ctx, "limit.exceedMsg").String()
|
|
return g.Cfg().MustGet(m.Ctx, "limit.exceedMsg").String()
|
|
}
|
|
}
|
|
// 问题敏感词过滤
|
|
// 问题敏感词过滤
|
|
@@ -79,7 +79,7 @@ func (m *WsChat) Handle(ws *ghttp.WebSocket, msg []byte) {
|
|
Type: 2,
|
|
Type: 2,
|
|
Actions: gconv.Int(If(errReply == "", 1, 0)),
|
|
Actions: gconv.Int(If(errReply == "", 1, 0)),
|
|
QuestionId: questionId,
|
|
QuestionId: questionId,
|
|
- PersonId: jSession.AccountId,
|
|
|
|
|
|
+ PersonId: jSession.PositionId,
|
|
Item: from,
|
|
Item: from,
|
|
CreateTime: time.Now().Format(date.Date_Full_Layout),
|
|
CreateTime: time.Now().Format(date.Date_Full_Layout),
|
|
})
|
|
})
|