小程序一些功能更新
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -795,15 +796,40 @@ func AdminFeedbackList(ctx context.Context, req *v1.FeedbackListReq) (*v1.Feedba
|
||||
Content: r["content"].String(),
|
||||
Contact: r["contact"].String(),
|
||||
Status: r["status"].Int(),
|
||||
Reply: r["reply_content"].String(),
|
||||
ReplyAt: r["reply_at"].String(),
|
||||
CreatedAt: r["created_at"].String(),
|
||||
})
|
||||
}
|
||||
return &v1.FeedbackListRes{List: list, Total: total}, nil
|
||||
}
|
||||
|
||||
func AdminFeedbackHandle(ctx context.Context, id int64) (*v1.FeedbackHandleRes, error) {
|
||||
if _, err := g.Model(consts.TableFeedbacks).Where("id", id).Data(g.Map{"status": 1}).Update(); err != nil {
|
||||
// AdminFeedbackHandle 反馈处理:标记已处理 + 可选官方回复。
|
||||
// 带回复时置 reply_read=0(用户端红点提醒),再次回复会重新置为未读。
|
||||
func AdminFeedbackHandle(ctx context.Context, id int64, reply string) (*v1.FeedbackHandleRes, error) {
|
||||
reply = strings.TrimSpace(reply)
|
||||
if len(reply) > 1000 {
|
||||
reply = reply[:1000]
|
||||
}
|
||||
data := g.Map{"status": 1}
|
||||
if reply != "" {
|
||||
data["reply_content"] = reply
|
||||
data["reply_by"] = CtxAdminId(ctx)
|
||||
data["reply_at"] = gtime.Now()
|
||||
data["reply_read"] = 0
|
||||
}
|
||||
if _, err := g.Model(consts.TableFeedbacks).Where("id", id).Data(data).Update(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if reply != "" {
|
||||
WriteAudit(ctx, AuditEntry{
|
||||
Action: "feedback.reply",
|
||||
TargetType: "feedback",
|
||||
TargetId: strconv.FormatInt(id, 10),
|
||||
After: g.Map{"status": 1, "reply_len": len(reply)},
|
||||
Result: consts.AuditResultSuccess,
|
||||
Remark: "回复用户反馈",
|
||||
})
|
||||
}
|
||||
return &v1.FeedbackHandleRes{}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user