diff --git a/docs/docs.go b/docs/docs.go index 9b3702a..7cab7b7 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -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" diff --git a/docs/swagger.json b/docs/swagger.json index 8fdfe7a..8757102 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -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" diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 12d49de..d3168cf 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -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 diff --git a/internal/api/app/app_list.go b/internal/api/app/app_list.go index 5e9947c..0d4c97f 100755 --- a/internal/api/app/app_list.go +++ b/internal/api/app/app_list.go @@ -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, } }