feat(1.0):新增消息总数字段

This commit is contained in:
summer 2025-11-05 14:12:07 +08:00
parent 34c8394e8f
commit 23ce0e6982
4 changed files with 43 additions and 18 deletions

View File

@ -1958,6 +1958,10 @@ const docTemplate = `{
"description": "小程序编号",
"type": "integer"
},
"message_total": {
"description": "消息总数",
"type": "integer"
},
"name": {
"description": "小程序名称",
"type": "string"
@ -2415,6 +2419,10 @@ const docTemplate = `{
"description": "消息内容",
"type": "string"
},
"id": {
"description": "消息ID",
"type": "integer"
},
"msg_type": {
"description": "消息类型(1:文本 2:图片)",
"type": "integer"

View File

@ -1950,6 +1950,10 @@
"description": "小程序编号",
"type": "integer"
},
"message_total": {
"description": "消息总数",
"type": "integer"
},
"name": {
"description": "小程序名称",
"type": "string"
@ -2407,6 +2411,10 @@
"description": "消息内容",
"type": "string"
},
"id": {
"description": "消息ID",
"type": "integer"
},
"msg_type": {
"description": "消息类型(1:文本 2:图片)",
"type": "integer"

View File

@ -320,6 +320,9 @@ definitions:
id:
description: 小程序编号
type: integer
message_total:
description: 消息总数
type: integer
name:
description: 小程序名称
type: string
@ -643,6 +646,9 @@ definitions:
content:
description: 消息内容
type: string
id:
description: 消息ID
type: integer
msg_type:
description: 消息类型(1:文本 2:图片)
type: integer

View File

@ -21,15 +21,16 @@ type listRequest struct {
}
type listData struct {
ID int32 `json:"id"` // 小程序编号
AppID string `json:"app_id"` // 小程序ID
AppSecret string `json:"app_secret"` // 小程序密钥
Name string `json:"name"` // 小程序名称
Description string `json:"description"` // 小程序描述
Avatar string `json:"avatar"` // 小程序头像
TemplateID string `json:"template_id"` // 模版ID
CreatedAt string `json:"created_at"` // 创建时间
UpdatedAt string `json:"updated_at"` // 更新时间
ID int32 `json:"id"` // 小程序编号
AppID string `json:"app_id"` // 小程序ID
AppSecret string `json:"app_secret"` // 小程序密钥
Name string `json:"name"` // 小程序名称
Description string `json:"description"` // 小程序描述
Avatar string `json:"avatar"` // 小程序头像
TemplateID string `json:"template_id"` // 模版ID
CreatedAt string `json:"created_at"` // 创建时间
UpdatedAt string `json:"updated_at"` // 更新时间
MessageTotal int64 `json:"message_total"` // 消息总数
}
type listResponse struct {
@ -135,16 +136,18 @@ func (h *handler) PageList() core.HandlerFunc {
res.List = make([]listData, len(resultData))
for k, v := range resultData {
messageTotalCount, _ := h.readDB.AppMessageLog.WithContext(ctx.RequestContext()).Where(h.readDB.AppMessageLog.AppID.Eq(v.AppID)).Count()
res.List[k] = listData{
ID: v.ID,
AppID: v.AppID,
AppSecret: v.AppSecret,
Name: v.Name,
Description: v.Description,
Avatar: v.Avatar,
TemplateID: v.TemplateID,
CreatedAt: timeutil.FriendlyTime(v.CreatedAt),
UpdatedAt: timeutil.FriendlyTime(v.UpdatedAt),
ID: v.ID,
AppID: v.AppID,
AppSecret: v.AppSecret,
Name: v.Name,
Description: v.Description,
Avatar: v.Avatar,
TemplateID: v.TemplateID,
CreatedAt: timeutil.FriendlyTime(v.CreatedAt),
UpdatedAt: timeutil.FriendlyTime(v.UpdatedAt),
MessageTotal: messageTotalCount,
}
}