作者 郑周

1. 消息列表 样式

... ... @@ -15,6 +15,119 @@
"application/json"
],
"paths": {
"v1/mini/article_tag": {
"delete": {
"summary": "后台删除文章标签",
"operationId": "DeleteTag",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/TagDeleteResponse"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/TagDeleteRequest"
}
}
],
"requestBody": {},
"tags": [
"tags"
]
},
"post": {
"summary": "后台创建文章标签",
"operationId": "CreateTag",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/TagCreateResponse"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/TagCreateRequest"
}
}
],
"requestBody": {},
"tags": [
"tags"
]
},
"put": {
"summary": "后台编辑文章标签",
"operationId": "EditTag",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/TagEditResponse"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/TagEditRequest"
}
}
],
"requestBody": {},
"tags": [
"tags"
]
}
},
"v1/mini/article_tag/{id}": {
"get": {
"summary": "后台获取文章标签",
"operationId": "GetTag",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/TagGetResponse"
}
}
},
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "string"
},
{
"name": "id",
"in": "query",
"required": true,
"type": "integer",
"format": "int64"
}
],
"requestBody": {},
"tags": [
"tags"
]
}
},
"v1/mini/comment": {
"get": {
"summary": "小程序评论",
... ... @@ -33,6 +146,364 @@
]
}
},
"v1/mini/company/search": {
"post": {
"summary": "公司搜索",
"operationId": "miniCompanySearch",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/CompanySearchResponse"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/CompanySearchRequest"
}
}
],
"requestBody": {},
"tags": [
"company"
]
}
},
"v1/mini/message/business": {
"post": {
"summary": "业务消息",
"operationId": "miniBusiness",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/MessageBusinessResponse"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/MessageBusinessRequest"
}
}
],
"requestBody": {},
"tags": [
"message"
]
}
},
"v1/mini/message/system": {
"post": {
"summary": "系统消息",
"operationId": "miniSystem",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/MessageSystemResponse"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/MessageSystemRequest"
}
}
],
"requestBody": {},
"tags": [
"message"
]
}
},
"v1/mini/user/apply-join-company": {
"post": {
"summary": "用户申请加入公司",
"operationId": "miniUserApplyJoinCompany",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/MiniUserApplyJoinCompanyResponse"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/MiniUserApplyJoinCompanyRequest"
}
}
],
"requestBody": {},
"tags": [
"user"
]
}
},
"v1/mini/user/audit": {
"post": {
"summary": "用户审核",
"operationId": "miniUserAudit",
"responses": {
"200": {
"description": "A successful response.",
"schema": {}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/MiniUserAuditRequest"
}
}
],
"requestBody": {},
"tags": [
"user"
]
}
},
"v1/mini/user/audit-list": {
"post": {
"summary": "用户审核列表",
"operationId": "miniUserAuditList",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/UserSearchResponse"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/UserSearchRequest"
}
}
],
"requestBody": {},
"tags": [
"user"
]
}
},
"v1/mini/user/department-users": {
"post": {
"summary": "部门用户列表",
"operationId": "miniUserDepartmentUsers",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/MiniUserInfoResponse"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/MiniUserDepartmentUsersRequest"
}
}
],
"requestBody": {},
"tags": [
"user"
]
}
},
"v1/mini/user/follow": {
"post": {
"summary": "关注",
"operationId": "miniUserFollow",
"responses": {
"200": {
"description": "A successful response.",
"schema": {}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/FollowRequest"
}
}
],
"requestBody": {},
"tags": [
"user"
]
}
},
"v1/mini/user/follower": {
"post": {
"summary": "关注我的人",
"operationId": "miniUserFollower",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/UserSearchResponse"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/UserSearchRequest"
}
}
],
"requestBody": {},
"tags": [
"user"
]
}
},
"v1/mini/user/following": {
"post": {
"summary": "我关注的人",
"operationId": "miniUserFollowing",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/UserSearchResponse"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/UserSearchRequest"
}
}
],
"requestBody": {},
"tags": [
"user"
]
}
},
"v1/mini/user/info": {
"post": {
"summary": "用户信息",
"operationId": "miniUserInfo",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/MiniUserInfoResponse"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/MiniUserInfoRequest"
}
}
],
"requestBody": {},
"tags": [
"user"
]
}
},
"v1/mini/user/login": {
"post": {
"summary": "用户登录",
"operationId": "miniUserLogin",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/MiniUserLoginResponse"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/MiniUserLoginRequest"
}
}
],
"requestBody": {},
"tags": [
"user"
]
}
},
"v1/mini/user/unfollow": {
"post": {
"summary": "取消关注",
"operationId": "miniUserUnFollow",
"responses": {
"200": {
"description": "A successful response.",
"schema": {}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/FollowRequest"
}
}
],
"requestBody": {},
"tags": [
"user"
]
}
},
"v1/system/comment": {
"get": {
"summary": "系统评论",
... ... @@ -50,16 +521,44 @@
"comment"
]
}
}
},
"definitions": {
"Comment": {
"type": "object",
"title": "Comment"
},
"CommentRequest": {
"type": "object",
"title": "CommentRequest"
},
"v1/system/company/search": {
"post": {
"summary": "公司搜索",
"operationId": "systemCompanySearch",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/CompanySearchResponse"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/CompanySearchRequest"
}
}
],
"requestBody": {},
"tags": [
"company"
]
}
}
},
"definitions": {
"Comment": {
"type": "object",
"title": "Comment"
},
"CommentRequest": {
"type": "object",
"title": "CommentRequest"
},
"CommentResposne": {
"type": "object",
... ... @@ -75,6 +574,886 @@
"required": [
"list"
]
},
"Company": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64",
"description": " 唯一标识"
},
"name": {
"type": "string",
"description": " 名称"
},
"code": {
"type": "string",
"description": " 编码(搜索使用,4位字母数字)"
},
"logo": {
"type": "string",
"description": " 公司LOGO"
}
},
"title": "Company",
"required": [
"id",
"name",
"code",
"logo"
]
},
"CompanySearchRequest": {
"type": "object",
"properties": {
"page": {
"type": "integer",
"format": "int32"
},
"size": {
"type": "integer",
"format": "int32"
},
"userId": {
"type": "integer",
"format": "int64",
"description": " 按用户搜索"
},
"code": {
"type": "string",
"description": " 按编码搜索"
}
},
"title": "CompanySearchRequest",
"required": [
"page",
"size"
]
},
"CompanySearchResponse": {
"type": "object",
"properties": {
"list": {
"type": "array",
"items": {
"$ref": "#/definitions/Company"
}
},
"total": {
"type": "integer",
"format": "int64"
}
},
"title": "CompanySearchResponse",
"required": [
"list",
"total"
]
},
"Department": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64",
"description": " 部门ID"
},
"companyId": {
"type": "integer",
"format": "int64",
"description": " 公司ID"
},
"parentId": {
"type": "integer",
"format": "int64",
"description": " 父级ID"
},
"name": {
"type": "string",
"description": " 部门名称"
}
},
"title": "Department",
"required": [
"id",
"companyId",
"parentId",
"name"
]
},
"FollowRequest": {
"type": "object",
"properties": {
"userId": {
"type": "integer",
"format": "int64"
}
},
"title": "FollowRequest",
"required": [
"userId"
]
},
"MessageBusinessItem": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"companyId": {
"type": "integer",
"format": "int64",
"description": " 公司ID"
},
"type": {
"type": "integer",
"format": "int32",
"description": " 分类 (1回复 2点赞 3被采纳)"
},
"optType": {
"type": "integer",
"format": "int32",
"description": " 操作类型(1针对文章、1针对评论、2针对圆桌)"
},
"triggerId": {
"type": "integer",
"format": "int64",
"description": " 触发者ID"
},
"recipientId": {
"type": "integer",
"format": "int64",
"description": " 接收者ID"
},
"articleId": {
"type": "integer",
"format": "int64",
"description": " 文章ID"
},
"commentId": {
"type": "integer",
"format": "int64",
"description": " 评论ID"
},
"discussionId": {
"type": "integer",
"format": "int64",
"description": " 圆桌ID"
},
"discussionOpinionId": {
"type": "integer",
"format": "int64",
"description": " 观点ID"
},
"content": {
"type": "string",
"description": " 消息内容"
},
"createdAt": {
"type": "integer",
"format": "int64",
"description": " 创建时间"
},
"userTrigger": {
"$ref": "#/definitions/User",
"description": " 触发者"
}
},
"title": "MessageBusinessItem",
"required": [
"id",
"companyId",
"type",
"optType",
"triggerId",
"recipientId",
"articleId",
"commentId",
"discussionId",
"discussionOpinionId",
"content",
"createdAt",
"userTrigger"
]
},
"MessageBusinessRequest": {
"type": "object",
"properties": {
"page": {
"type": "integer",
"format": "int32"
},
"size": {
"type": "integer",
"format": "int32"
}
},
"title": "MessageBusinessRequest",
"required": [
"page",
"size"
]
},
"MessageBusinessResponse": {
"type": "object",
"properties": {
"list": {
"type": "array",
"items": {
"$ref": "#/definitions/MessageBusinessItem"
}
},
"total": {
"type": "integer",
"format": "int64"
}
},
"title": "MessageBusinessResponse",
"required": [
"list",
"total"
]
},
"MessageSystemItem": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64",
"description": " ID"
},
"type": {
"type": "integer",
"format": "int32",
"description": " 系统分类"
},
"title": {
"type": "string",
"description": " 标题"
},
"content": {
"type": "string",
"description": " 内容"
},
"createdAt": {
"type": "integer",
"format": "int64",
"description": " 创建时间"
}
},
"title": "MessageSystemItem",
"required": [
"id",
"type",
"title",
"content",
"createdAt"
]
},
"MessageSystemRequest": {
"type": "object",
"properties": {
"page": {
"type": "integer",
"format": "int32"
},
"size": {
"type": "integer",
"format": "int32"
}
},
"title": "MessageSystemRequest",
"required": [
"page",
"size"
]
},
"MessageSystemResponse": {
"type": "object",
"properties": {
"list": {
"type": "array",
"items": {
"$ref": "#/definitions/MessageSystemItem"
}
},
"total": {
"type": "integer",
"format": "int64"
}
},
"title": "MessageSystemResponse",
"required": [
"list",
"total"
]
},
"MiniUserApplyJoinCompanyRequest": {
"type": "object",
"properties": {
"phone": {
"type": "string"
},
"code": {
"type": "string"
}
},
"title": "MiniUserApplyJoinCompanyRequest",
"required": [
"phone",
"code"
]
},
"MiniUserApplyJoinCompanyResponse": {
"type": "object",
"title": "MiniUserApplyJoinCompanyResponse"
},
"MiniUserAuditRequest": {
"type": "object",
"properties": {
"userId": {
"type": "integer",
"format": "int64",
"description": " 用户ID"
}
},
"title": "MiniUserAuditRequest",
"required": [
"userId"
]
},
"MiniUserDepartmentUsersRequest": {
"type": "object",
"title": "MiniUserDepartmentUsersRequest"
},
"MiniUserDepartmentUsersResponse": {
"type": "object",
"properties": {
"departments": {
"type": "array",
"items": {
"$ref": "#/definitions/Department"
}
},
"users": {
"type": "array",
"items": {
"$ref": "#/definitions/UserItem"
}
}
},
"title": "MiniUserDepartmentUsersResponse",
"required": [
"departments",
"users"
]
},
"MiniUserInfoRequest": {
"type": "object",
"title": "MiniUserInfoRequest"
},
"MiniUserInfoResponse": {
"type": "object",
"properties": {
"user": {
"$ref": "#/definitions/UserItem",
"description": " 用户信息"
},
"totalArticle": {
"type": "integer",
"format": "int64",
"description": " 累计信息发布"
},
"totalLoved": {
"type": "integer",
"format": "int64",
"description": " 累计收到的赞"
},
"totalAccepted": {
"type": "integer",
"format": "int64",
"description": " 累计被采纳"
}
},
"title": "MiniUserInfoResponse",
"required": [
"user",
"totalArticle",
"totalLoved",
"totalAccepted"
]
},
"MiniUserLoginRequest": {
"type": "object",
"properties": {
"loginType": {
"type": "string",
"description": " 登录类型 wechat-login whchat-phone-login phone-password-login phone-smscode-login"
},
"wechatAuthcode": {
"type": "string",
"description": " 微信登录 授权码"
},
"wechatEncryptedData": {
"type": "string",
"description": " 微信登录 加密数据"
},
"wechatIV": {
"type": "string",
"description": " 微信登录 加密算法初始向量"
},
"phone": {
"type": "string",
"description": " 手机号"
},
"password": {
"type": "string",
"description": " 密码"
},
"smsCode": {
"type": "string",
"description": " 短信验证码"
}
},
"title": "MiniUserLoginRequest",
"required": [
"loginType"
]
},
"MiniUserLoginResponse": {
"type": "object",
"properties": {
"token": {
"type": "string",
"description": " x-token"
},
"phone": {
"type": "string",
"description": " 手机号"
},
"message": {
"type": "string",
"description": " 失败消息(审核中,注册成功等待审核)"
},
"success": {
"type": "boolean",
"format": "boolean",
"description": " 成功标识"
}
},
"title": "MiniUserLoginResponse",
"required": [
"token",
"phone",
"message",
"success"
]
},
"TagCreateRequest": {
"type": "object",
"properties": {
"companyId": {
"type": "integer",
"format": "int64"
},
"image": {
"type": "string"
},
"name": {
"type": "string",
"description": " 标签名称"
},
"group": {
"type": "string",
"description": " 标签分类"
},
"remark": {
"type": "string",
"description": " 备注"
}
},
"title": "TagCreateRequest",
"required": [
"companyId",
"image",
"name",
"group",
"remark"
]
},
"TagCreateResponse": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
}
},
"title": "TagCreateResponse",
"required": [
"id"
]
},
"TagDeleteRequest": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
}
},
"title": "TagDeleteRequest",
"required": [
"id"
]
},
"TagDeleteResponse": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
}
},
"title": "TagDeleteResponse",
"required": [
"id"
]
},
"TagEditRequest": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"companyId": {
"type": "integer",
"format": "int64"
},
"image": {
"type": "string"
},
"name": {
"type": "string",
"description": " 标签名称"
},
"group": {
"type": "string",
"description": " 标签分类"
},
"remark": {
"type": "string",
"description": " 备注"
}
},
"title": "TagEditRequest",
"required": [
"id",
"companyId",
"image",
"name",
"group",
"remark"
]
},
"TagEditResponse": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
}
},
"title": "TagEditResponse",
"required": [
"id"
]
},
"TagGetRequest": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
}
},
"title": "TagGetRequest",
"required": [
"id"
]
},
"TagGetResponse": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"image": {
"type": "string"
},
"name": {
"type": "string",
"description": " 标签名称"
},
"group": {
"type": "string",
"description": " 标签分类"
},
"remark": {
"type": "string",
"description": " 备注"
}
},
"title": "TagGetResponse",
"required": [
"id",
"image",
"name",
"group",
"remark"
]
},
"TagItem": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"image": {
"type": "string"
},
"name": {
"type": "string",
"description": " 标签名称"
},
"group": {
"type": "string",
"description": " 标签分类"
},
"remark": {
"type": "string",
"description": " 备注"
},
"createdAt": {
"type": "integer",
"format": "int64"
}
},
"title": "TagItem",
"required": [
"id",
"image",
"name",
"group",
"remark",
"createdAt"
]
},
"TagListRequest": {
"type": "object",
"properties": {
"page": {
"type": "integer",
"format": "int32"
},
"size": {
"type": "integer",
"format": "int32"
}
},
"title": "TagListRequest",
"required": [
"page",
"size"
]
},
"TagListResponse": {
"type": "object",
"properties": {
"total": {
"type": "integer",
"format": "int32"
},
"list": {
"type": "array",
"items": {
"$ref": "#/definitions/TagItem"
}
}
},
"title": "TagListResponse",
"required": [
"total",
"list"
]
},
"User": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"companyId": {
"type": "integer",
"format": "int64",
"description": " 公司ID"
},
"departmentId": {
"type": "integer",
"format": "int64",
"description": " 部门ID"
},
"name": {
"type": "string",
"description": " 名称"
},
"avatar": {
"type": "string",
"description": " 头像"
},
"position": {
"type": "string",
"description": " 职位"
}
},
"title": "User",
"required": [
"id",
"companyId",
"departmentId",
"name",
"avatar",
"position"
]
},
"UserItem": {
"type": "object",
"properties": {
"companyId": {
"type": "integer",
"format": "int64",
"description": " 公司ID"
},
"departmentId": {
"type": "integer",
"format": "int64",
"description": " 部门ID"
},
"roleId": {
"type": "array",
"items": {
"type": "integer",
"format": "int64"
},
"description": " 角色"
},
"flag": {
"type": "integer",
"format": "int32",
"description": " 标识 1:管理员 2:普通用户 (有绑定角色是管理员)"
},
"name": {
"type": "string",
"description": " 名称"
},
"avatar": {
"type": "string",
"description": " 头像"
},
"phone": {
"type": "string",
"description": " 手机号 唯一"
},
"position": {
"type": "string",
"description": " 职位"
},
"enable": {
"type": "integer",
"format": "int32",
"description": " 启用状态 1:启用 2:禁用"
},
"auditStatus": {
"type": "integer",
"format": "int32",
"description": " 审核状态 0:待审核 1:审核通过 2:拒绝"
},
"followers": {
"type": "array",
"items": {
"type": "integer",
"format": "int64"
},
"description": " 关注我的人 (冗余)"
},
"following": {
"type": "array",
"items": {
"type": "integer",
"format": "int64"
},
"description": " 我关注的人 (冗余)"
}
},
"title": "UserItem",
"required": [
"companyId",
"departmentId",
"roleId",
"flag",
"name",
"avatar",
"phone",
"position",
"enable",
"auditStatus",
"followers",
"following"
]
},
"UserSearchRequest": {
"type": "object",
"properties": {
"page": {
"type": "integer",
"format": "int32"
},
"size": {
"type": "integer",
"format": "int32"
},
"auditFlag": {
"$ref": "#/definitions/int",
"description": " 按审核状态 0:待审核 1:审核通过 2:拒绝"
}
},
"title": "UserSearchRequest"
},
"UserSearchResponse": {
"type": "object",
"properties": {
"list": {
"type": "array",
"items": {
"$ref": "#/definitions/UserItem"
}
},
"total": {
"type": "integer",
"format": "int64"
}
},
"title": "UserSearchResponse",
"required": [
"list",
"total"
]
}
},
"securityDefinitions": {
... ...
... ... @@ -2,6 +2,7 @@ package message
import (
"context"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
... ... @@ -24,7 +25,26 @@ func NewMiniBusinessLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Mini
}
func (l *MiniBusinessLogic) MiniBusiness(req *types.MessageBusinessRequest) (resp *types.MessageBusinessResponse, err error) {
// todo: add your logic here and delete this line
return
queryOptions := domain.NewQueryOptions().WithOffsetLimit(req.Page, req.Size)
total, list, err := l.svcCtx.MessageBusinessRepository.Find(l.ctx, l.svcCtx.DefaultDBConn(), queryOptions)
if err != nil {
return nil, err
}
if err != nil {
return nil, err
}
resp = &types.MessageBusinessResponse{}
resp.Total = total
resp.List = make([]types.MessageBusinessItem, 0)
for _, item := range list {
to := types.MessageBusinessItem{
Id: item.Id,
Type: item.Type,
//Title: item.Title,
Content: item.Content,
CreatedAt: item.CreatedAt,
}
resp.List = append(resp.List, to)
}
return resp, nil
}
... ...
... ... @@ -5,6 +5,7 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
"gorm.io/gorm"
"gorm.io/plugin/soft_delete"
"time"
)
// MessageBusiness 消息中心业务
... ... @@ -32,13 +33,13 @@ func (m *MessageBusiness) TableName() string {
}
func (m *MessageBusiness) BeforeCreate(tx *gorm.DB) (err error) {
// m.CreatedAt = time.Now().Unix()
// m.UpdatedAt = time.Now().Unix()
m.CreatedAt = time.Now().Unix()
m.UpdatedAt = time.Now().Unix()
return
}
func (m *MessageBusiness) BeforeUpdate(tx *gorm.DB) (err error) {
// m.UpdatedAt = time.Now().Unix()
m.UpdatedAt = time.Now().Unix()
return
}
... ...
... ... @@ -120,7 +120,7 @@ func (repository *MessageBusinessRepository) Find(ctx context.Context, conn tran
total int64
)
queryFunc := func() (interface{}, error) {
tx = tx.Model(&ms).Order("id desc")
tx = tx.Model(&ms).Order("created_at desc")
if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil {
return dms, tx.Error
}
... ...