12345678910111213141516171819202122232425262728293031323334353637 |
- package controller
- import (
- v1 "aiChat/api/v1"
- "aiChat/internal/model"
- "aiChat/utility"
- "app.yhyue.com/moapp/jybase/encrypt"
- "github.com/gogf/gf/v2/net/ghttp"
- )
- // Evaluate 点评问答
- func Evaluate(r *ghttp.Request) {
- final := func() (res v1.CommonRes) {
- session, _ := utility.GetSession(r)
- if session.AccountId == 0 {
- res.ErrorCode = -1
- res.ErrorMsg = "未登陆"
- return
- }
- evaluate := r.Get("Evaluate").Int()
- id := encrypt.SE.Decode4Hex(r.Get("MessageId").String())
- if id == "" {
- res.ErrorCode = -1
- res.ErrorMsg = "未找到记录"
- return
- }
- err := model.Message.Evaluate(session.AccountId, id, evaluate)
- if err != nil {
- res.ErrorCode = -1
- res.ErrorMsg = "评价异常"
- return
- }
- res.Data = true
- return
- }()
- r.Response.Write(final)
- }
|