作者 linmadan

重构读取消息接口url

... ... @@ -570,7 +570,7 @@
{
"name": "notificationType",
"in": "query",
"description": "通知类型",
"description": "通知类型(1.系统通知2.互动通知)",
"required": false,
"type": "integer"
},
... ... @@ -638,8 +638,8 @@
"tags": [
"notification"
],
"summary": "读取全部为读取的发送出的通知",
"description": "读取全部为读取的发送出的通知",
"summary": "读取全部未读取的发送出的通知",
"description": "读取全部未读取的发送出的通知",
"operationId": "notification#readAllUnReadSentNotification",
"parameters": [
{
... ... @@ -967,6 +967,37 @@
]
}
},
"/statistics/person-notification": {
"post": {
"tags": [
"statistics"
],
"summary": "获取个人消息通知统计",
"description": "获取个人消息通知统计",
"operationId": "statistics#personNotificationStatistics",
"parameters": [
{
"name": "PersonNotificationStatisticsRequestBody",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/StatisticsPersonNotificationStatisticsRequestBody"
}
}
],
"responses": {
"200": {
"description": "OK response.",
"schema": {
"$ref": "#/definitions/StatisticsPersonNotificationStatisticsResponseBody"
}
}
},
"schemes": [
"http"
]
}
},
"/statistics/person-su-money": {
"post": {
"tags": [
... ... @@ -2615,6 +2646,35 @@
}
}
},
"StatisticsPersonNotificationStatisticsRequestBody": {
"title": "StatisticsPersonNotificationStatisticsRequestBody",
"type": "object",
"properties": {
"uid": {
"type": "integer",
"description": "统一用户UID",
"required": [
"uid"
]
}
}
},
"StatisticsPersonNotificationStatisticsResponseBody": {
"title": "Mediatype identifier: StatisticsPersonNotificationStatisticsResponseBody",
"type": "object",
"properties": {
"unReadInteractionNotification": {
"type": "integer",
"description": "未读互动消息条数",
"format": "int64"
},
"unReadSystemNotification": {
"type": "integer",
"description": "未读系统消息条数",
"format": "int64"
}
}
},
"StatisticsPersonSuMoneyStatisticsRequestBody": {
"title": "StatisticsPersonSuMoneyStatisticsRequestBody",
"type": "object",
... ... @@ -3634,6 +3694,14 @@
"type": "integer",
"description": "任务类型",
"format": "int64"
},
"taskTypes": {
"type": "array",
"items": {
"type": "integer",
"format": "int64"
},
"description": "任务类型列表"
}
}
},
... ... @@ -4007,12 +4075,19 @@
"type": "object",
"properties": {
"externalResource": {
"type": "string",
"type": "integer",
"description": "外部资源引用",
"required": [
"externalResource"
]
},
"externalResourceType": {
"type": "integer",
"description": "外部资源引用类型(1任务2驳回任务记录)",
"required": [
"externalResourceType"
]
},
"notificationContent": {
"type": "string",
"description": "通知内容",
... ... @@ -4043,7 +4118,7 @@
},
"notificationType": {
"type": "integer",
"description": "通知类型",
"description": "通知类型(1.系统通知2.互动通知)",
"required": [
"notificationType"
]
... ...
... ... @@ -385,7 +385,7 @@ paths:
type: integer
- name: notificationType
in: query
description: 通知类型
description: 通知类型(1.系统通知2.互动通知)
required: false
type: integer
- name: offset
... ... @@ -429,8 +429,8 @@ paths:
post:
tags:
- notification
summary: 读取全部为读取的发送出的通知
description: 读取全部为读取的发送出的通知
summary: 读取全部未读取的发送出的通知
description: 读取全部未读取的发送出的通知
operationId: notification#readAllUnReadSentNotification
parameters:
- name: ReadAllUnReadSentNotificationRequestBody
... ... @@ -647,6 +647,26 @@ paths:
$ref: '#/definitions/RejectTaskRecordSearchRejectTaskRecordResponseBody'
schemes:
- http
/statistics/person-notification:
post:
tags:
- statistics
summary: 获取个人消息通知统计
description: 获取个人消息通知统计
operationId: statistics#personNotificationStatistics
parameters:
- name: PersonNotificationStatisticsRequestBody
in: body
required: true
schema:
$ref: '#/definitions/StatisticsPersonNotificationStatisticsRequestBody'
responses:
"200":
description: OK response.
schema:
$ref: '#/definitions/StatisticsPersonNotificationStatisticsResponseBody'
schemes:
- http
/statistics/person-su-money:
post:
tags:
... ... @@ -1766,6 +1786,27 @@ definitions:
type: array
items:
$ref: '#/definitions/rejectTaskRecordResponseBody'
StatisticsPersonNotificationStatisticsRequestBody:
title: StatisticsPersonNotificationStatisticsRequestBody
type: object
properties:
uid:
type: integer
description: 统一用户UID
required:
- uid
StatisticsPersonNotificationStatisticsResponseBody:
title: 'Mediatype identifier: StatisticsPersonNotificationStatisticsResponseBody'
type: object
properties:
unReadInteractionNotification:
type: integer
description: 未读互动消息条数
format: int64
unReadSystemNotification:
type: integer
description: 未读系统消息条数
format: int64
StatisticsPersonSuMoneyStatisticsRequestBody:
title: StatisticsPersonSuMoneyStatisticsRequestBody
type: object
... ... @@ -2498,6 +2539,12 @@ definitions:
type: integer
description: 任务类型
format: int64
taskTypes:
type: array
items:
type: integer
format: int64
description: 任务类型列表
TaskSearchTaskResponseBody:
title: 'Mediatype identifier: TaskSearchTaskResponseBody'
type: object
... ... @@ -2767,10 +2814,15 @@ definitions:
type: object
properties:
externalResource:
type: string
type: integer
description: 外部资源引用
required:
- externalResource
externalResourceType:
type: integer
description: 外部资源引用类型(1任务2驳回任务记录)
required:
- externalResourceType
notificationContent:
type: string
description: 通知内容
... ... @@ -2793,7 +2845,7 @@ definitions:
- notificationTitle
notificationType:
type: integer
description: 通知类型
description: 通知类型(1.系统通知2.互动通知)
required:
- notificationType
description: 通知
... ...
... ... @@ -18,6 +18,8 @@ func (controller *NotificationController) ReadSentNotification() {
notificationService := service.NewNotificationService(nil)
readSentNotificationCommand := &command.ReadSentNotificationCommand{}
json.Unmarshal(controller.Ctx.Input.GetData("requestBody").([]byte), readSentNotificationCommand)
sentNotificationId, _ := controller.GetInt64(":sentNotificationId")
readSentNotificationCommand.SentNotificationId = sentNotificationId
data, err := notificationService.ReadSentNotification(readSentNotificationCommand)
var response utils.JsonResponse
if err != nil {
... ...
... ... @@ -6,7 +6,7 @@ import (
)
func init() {
beego.Router("/notifications/read", &controllers.NotificationController{}, "Post:ReadSentNotification")
beego.Router("/notifications/:sentNotificationId/read", &controllers.NotificationController{}, "Post:ReadSentNotification")
beego.Router("/notifications/read-all", &controllers.NotificationController{}, "Post:ReadAllUnReadSentNotification")
beego.Router("/notifications/", &controllers.NotificationController{}, "Get:ListSentNotification")
}
... ...
package notification
import (
"fmt"
"github.com/gavv/httpexpect"
"github.com/go-pg/pg"
. "github.com/onsi/ginkgo"
... ... @@ -8,6 +9,7 @@ import (
"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain"
pG "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/pg"
"net/http"
"strconv"
"time"
)
... ... @@ -33,9 +35,8 @@ var _ = Describe("读取发送出的通知", func() {
It("读取成功", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
body := map[string]interface{}{
"sentNotificationId": sentNotificationId,
}
httpExpect.POST("/notifications/read").
httpExpect.POST(fmt.Sprintf("/notifications/%s/read", strconv.FormatInt(sentNotificationId, 10))).
WithJSON(body).
Expect().
Status(http.StatusOK).
... ...