作者 郑周

Merge remote-tracking branch 'origin/dev' into dev

正在显示 44 个修改的文件 包含 2675 行增加636 行删除
syntax = "v1"
import "core/article_type.api"
import "core/comment.api"
import "core/message.api"
import "core/article_tag.api"
import "core/user.api"
import "core/company.api"
import "core/article_type.api"
import "core/article.api"
import "core/role.api"
import "core/department.api"
\ No newline at end of file
... ...
... ... @@ -669,6 +669,148 @@
]
}
},
"v1/system/account": {
"post": {
"summary": "系统新增账号",
"operationId": "systemUserAccountSave",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/SystemUserAccountSaveResponse"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/SystemUserAccountSaveRequest"
}
}
],
"requestBody": {},
"tags": [
"user"
]
}
},
"v1/system/account/enable": {
"post": {
"summary": "系统启用/禁用账号",
"operationId": "systemUserAccountEnable",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/SystemUserAccountEnableResponse"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/SystemUserAccountEnableRequest"
}
}
],
"requestBody": {},
"tags": [
"user"
]
}
},
"v1/system/account/search": {
"post": {
"summary": "系统搜索账号",
"operationId": "systemUserAccountSearch",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/SystemUserAccountSearchResponse"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/SystemUserAccountSearchRequest"
}
}
],
"requestBody": {},
"tags": [
"user"
]
}
},
"v1/system/account/{id}": {
"get": {
"summary": "系统账号详情",
"operationId": "systemUserAccountGet",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/SystemUserAccountGetResponse"
}
}
},
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "string"
}
],
"requestBody": {},
"tags": [
"user"
]
},
"put": {
"summary": "系统更新账号",
"operationId": "systemUserAccountUpdate",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/SystemUserAccountUpdateResponse"
}
}
},
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "string"
},
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/SystemUserAccountUpdateRequest"
}
}
],
"requestBody": {},
"tags": [
"user"
]
}
},
"v1/system/article/search": {
"post": {
"summary": "管理后台获取文章列表",
... ... @@ -1078,6 +1220,120 @@
]
}
},
"v1/system/user/search": {
"post": {
"summary": "搜索用户",
"operationId": "systemUserSearch",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/SystemUserSearchResponse"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/SystemUserSearchRequest"
}
}
],
"requestBody": {},
"tags": [
"user"
]
}
},
"v1/system/user/statistics": {
"post": {
"summary": "用户统计",
"operationId": "systemUserStatistics",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/UserStatisticsResponse"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/UserStatisticsRequest"
}
}
],
"requestBody": {},
"tags": [
"user"
]
}
},
"v1/system/user/{id}": {
"get": {
"summary": "用户详情",
"operationId": "systemUserGet",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/SystemUserGetResponse"
}
}
},
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "string"
}
],
"requestBody": {},
"tags": [
"user"
]
},
"put": {
"summary": "更新用户",
"operationId": "systemUserUpdate",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/SystemUserUpdateResponse"
}
}
},
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "string"
},
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/SystemUserUpdateRequest"
}
}
],
"requestBody": {},
"tags": [
"user"
]
}
},
"v1/user/mylike": {
"post": {
"summary": "我点赞的文章或评论",
... ... @@ -2810,6 +3066,26 @@
"position"
]
},
"StatisticsItem": {
"type": "object",
"properties": {
"itemFlag": {
"type": "integer",
"format": "int32",
"description": " 1:他的帖子 2:他的评论/回复 4:他收到的赞 8:TA的圆桌讨论 16:被采纳"
},
"value": {
"type": "number",
"format": "double",
"description": " 统计值"
}
},
"title": "StatisticsItem",
"required": [
"itemFlag",
"value"
]
},
"SystemArticleGetRequest": {
"type": "object",
"properties": {
... ... @@ -3055,32 +3331,308 @@
"list"
]
},
"SystemUserInfoRequest": {
"type": "object",
"title": "SystemUserInfoRequest"
},
"SystemUserInfoResponse": {
"SystemUser": {
"type": "object",
"properties": {
"userId": {
"id": {
"type": "integer",
"format": "int64"
"format": "int64",
"description": " 用户ID"
},
"userName": {
"type": "string"
"name": {
"type": "string",
"description": " 名称"
},
"avatar": {
"type": "string"
"type": "string",
"description": " 头像"
},
"companyId": {
"type": "integer",
"format": "int64"
"phone": {
"type": "string",
"description": " 手机号 唯一"
},
"companyName": {
"type": "string"
}
},
"title": "SystemUserInfoResponse",
"position": {
"type": "string",
"description": " 职位"
},
"enable": {
"type": "integer",
"format": "int32",
"description": " 启用状态 1:启用 2:禁用"
},
"departments": {
"type": "array",
"items": {
"type": "integer",
"format": "int64"
},
"description": " 所属部门"
},
"accountFrom": {
"type": "string",
"description": " 账号来源 后台新增、扫码注册"
},
"createdAt": {
"type": "integer",
"format": "int64",
"description": " 注册时间"
},
"roles": {
"type": "array",
"items": {
"type": "integer",
"format": "int64"
},
"description": " 角色"
},
"rolesDesc": {
"type": "string",
"description": " 角色描述"
},
"departmentsDesc": {
"type": "string",
"description": " 部门描述"
}
},
"title": "SystemUser",
"required": [
"id",
"name",
"avatar",
"phone",
"position",
"enable",
"departments",
"accountFrom",
"createdAt",
"roles",
"rolesDesc",
"departmentsDesc"
]
},
"SystemUserAccountEnableRequest": {
"type": "object",
"properties": {
"userIds": {
"type": "array",
"items": {
"type": "integer",
"format": "int64"
},
"description": " 用户ID列表"
},
"status": {
"type": "integer",
"format": "int32",
"description": " 状态 1:启用 2:禁用"
}
},
"title": "SystemUserAccountEnableRequest",
"required": [
"userIds",
"status"
]
},
"SystemUserAccountEnableResponse": {
"type": "object",
"title": "SystemUserAccountEnableResponse"
},
"SystemUserAccountGetRequest": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
}
},
"title": "SystemUserAccountGetRequest",
"required": [
"id"
]
},
"SystemUserAccountGetResponse": {
"type": "object",
"properties": {
"user": {
"$ref": "#/definitions/SystemUser"
}
},
"title": "SystemUserAccountGetResponse",
"required": [
"user"
]
},
"SystemUserAccountSaveRequest": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": " 名称"
},
"phone": {
"type": "string",
"description": " 手机号 唯一"
},
"enable": {
"type": "integer",
"format": "int32",
"description": " 启用状态 1:启用 2:禁用"
},
"roles": {
"type": "array",
"items": {
"type": "integer",
"format": "int64"
},
"description": " 角色"
}
},
"title": "SystemUserAccountSaveRequest",
"required": [
"name",
"phone",
"enable",
"roles"
]
},
"SystemUserAccountSaveResponse": {
"type": "object",
"title": "SystemUserAccountSaveResponse"
},
"SystemUserAccountSearchRequest": {
"type": "object",
"properties": {
"page": {
"type": "integer",
"format": "int32"
},
"size": {
"type": "integer",
"format": "int32"
},
"name": {
"type": "string",
"description": " 名称"
},
"phone": {
"type": "string",
"description": " 手机号 唯一"
},
"roleId": {
"type": "integer",
"format": "int64",
"description": " 角色权限"
},
"enable": {
"type": "integer",
"format": "int32",
"description": " 启用状态 1:启用 2:禁用"
},
"beginTime": {
"type": "integer",
"format": "int64",
"description": " 注册日期-开始"
},
"endTime": {
"type": "integer",
"format": "int64",
"description": " 注册日期-结束"
}
},
"title": "SystemUserAccountSearchRequest",
"required": [
"page",
"size"
]
},
"SystemUserAccountSearchResponse": {
"type": "object",
"properties": {
"list": {
"type": "array",
"items": {
"$ref": "#/definitions/SystemUser"
}
},
"total": {
"type": "integer",
"format": "int64"
}
},
"title": "SystemUserAccountSearchResponse",
"required": [
"list",
"total"
]
},
"SystemUserAccountUpdateRequest": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
}
},
"title": "SystemUserAccountUpdateRequest",
"required": [
"id"
]
},
"SystemUserAccountUpdateResponse": {
"type": "object",
"title": "SystemUserAccountUpdateResponse"
},
"SystemUserGetRequest": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
}
},
"title": "SystemUserGetRequest",
"required": [
"id"
]
},
"SystemUserGetResponse": {
"type": "object",
"properties": {
"user": {
"$ref": "#/definitions/SystemUser"
}
},
"title": "SystemUserGetResponse",
"required": [
"user"
]
},
"SystemUserInfoRequest": {
"type": "object",
"title": "SystemUserInfoRequest"
},
"SystemUserInfoResponse": {
"type": "object",
"properties": {
"userId": {
"type": "integer",
"format": "int64"
},
"userName": {
"type": "string"
},
"avatar": {
"type": "string"
},
"companyId": {
"type": "integer",
"format": "int64"
},
"companyName": {
"type": "string"
}
},
"title": "SystemUserInfoResponse",
"required": [
"userId",
"userName",
... ... @@ -3089,6 +3641,101 @@
"companyName"
]
},
"SystemUserSearchRequest": {
"type": "object",
"properties": {
"page": {
"type": "integer",
"format": "int32"
},
"size": {
"type": "integer",
"format": "int32"
},
"name": {
"type": "string",
"description": " 名称"
},
"phone": {
"type": "string",
"description": " 手机号 唯一"
},
"position": {
"type": "string",
"description": " 职位"
},
"enable": {
"type": "integer",
"format": "int32",
"description": " 启用状态 1:启用 2:禁用"
},
"departmentId": {
"type": "integer",
"format": "int64",
"description": " 所属部门"
}
},
"title": "SystemUserSearchRequest",
"required": [
"page",
"size"
]
},
"SystemUserSearchResponse": {
"type": "object",
"properties": {
"list": {
"type": "array",
"items": {
"$ref": "#/definitions/SystemUser"
}
},
"total": {
"type": "integer",
"format": "int64"
}
},
"title": "SystemUserSearchResponse",
"required": [
"list",
"total"
]
},
"SystemUserUpdateRequest": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"avatar": {
"type": "string",
"description": " 头像"
},
"position": {
"type": "string",
"description": " 职位"
},
"departments": {
"type": "array",
"items": {
"type": "integer",
"format": "int64"
},
"description": " 所属部门"
}
},
"title": "SystemUserUpdateRequest",
"required": [
"id",
"position",
"departments"
]
},
"SystemUserUpdateResponse": {
"type": "object",
"title": "SystemUserUpdateResponse"
},
"TagCreateRequest": {
"type": "object",
"properties": {
... ... @@ -3548,6 +4195,40 @@
"name"
]
},
"UserStatisticsRequest": {
"type": "object",
"properties": {
"userId": {
"type": "integer",
"format": "int64"
},
"itemFlag": {
"type": "integer",
"format": "int32",
"description": " 1:他的帖子 2:他的评论/回复 4:他收到的赞 8:TA的圆桌讨论 16:被采纳"
}
},
"title": "UserStatisticsRequest",
"required": [
"userId",
"itemFlag"
]
},
"UserStatisticsResponse": {
"type": "object",
"properties": {
"list": {
"type": "array",
"items": {
"$ref": "#/definitions/StatisticsItem"
}
}
},
"title": "UserStatisticsResponse",
"required": [
"list"
]
},
"WhichUserLikeArticle": {
"type": "object",
"properties": {
... ...
... ... @@ -8,11 +8,10 @@ type Location {
}
// 人员的简单展示信息
type Author {
type ArticleAuthor {
Id int64 `json:"id"` // 人员id
Name string `json:"name"` // 人员的名字
Avatar string `json:"avatar"` // 人员头像URL
Group string `json:"group"` // 人员的分组
Position string `json:"position"` // 职位
Company string `json:"company"` // 公司
}
... ... @@ -37,13 +36,14 @@ type (
type (
MiniArticleGetRequest {
Id int64 `path:"id"` //id
CompanyId int64 `path:",optional"`
CompanyId int64 `path:",optional"`//当前公司
UserId int `path:",optional"` //当前用户
}
MiniArticleGetResponse {
Id int64 `json:"id"` //id
Title string `json:"title"` //标题
AuthorId int64 `json:"authorId"` //发布人id
Author Author `json:"author"` //发布人
Author ArticleAuthor `json:"author"` //发布人
CreatedAt int64 `json:"createdAt"` //文章的发布时间
Section []ArticleSection `json:"section"` //文章的文本内容
Images []string `json:"images"` //图片
... ... @@ -55,6 +55,7 @@ type (
CountRead int `json:"countRead"` // 浏览数量
Show int `json:"show"` // 评论的展示状态(0显示、1不显示)
Edit int `json:"edit"` // 文章是否存在变更记录 (0 不存在 1存在)
MeLoveFlag int `json:"meLoveFlag"` //当前人员对文章的点赞标识
}
ArticleSection {
Id int64 `json:"id"` //段落id
... ... @@ -160,7 +161,7 @@ type (
}
)
//创建文章到草稿箱
//小程序端创建文章到草稿箱
type (
MiniArticleDraftCreateRequest {
CompanyId int64 `json:",optional"`
... ... @@ -179,7 +180,7 @@ type (
}
)
//更新文章草稿
//小程序端更新文章草稿
type (
MiniArticleDraftUpdateRequest {
Id int64 `json:"id"`
... ... @@ -199,7 +200,7 @@ type (
}
)
//获取我的草稿列表
//小程序端获取我的草稿列表
type (
MiniArticleDraftSearchMeRequest {
CompanyId int64 `json:",optional"` // 公司id
... ... @@ -222,7 +223,7 @@ type (
}
)
//获取我的草稿内容
//小程序端获取我的草稿内容
type (
MiniArticleDraftGetMeRequest {
CompanyId int64 `path:",optional"` // 公司id
... ... @@ -242,7 +243,7 @@ type (
}
)
//删除我的草稿内容
// 小程序端删除我的草稿内容
type (
MiniArticleDraftDeleteMeRequest {
CompanyId int64 `path:",optional"` // 公司id
... ... @@ -254,7 +255,7 @@ type (
Id int64 `json:"id"` //
}
)
// 小程序端获取我的浏览记录
type (
MiniArticleMarkListRequest {
Page int `json:"page"`
... ... @@ -275,9 +276,11 @@ type (
Author SimpleUser `json:"author"` // 发布人
UpdatedAt int64 `json:"updatedAt"`
}
)
//管理后台获取文章详情
type (
SystemArticleGetRequest {
... ... @@ -294,7 +297,7 @@ type (
Id int64 `json:"id"` // id
Title string `json:"title"` // 标题
AuthorId int64 `json:"authorId"` // 发布人id
Author Author `json:"author"` // 发布人
Author ArticleAuthor `json:"author"` // 发布人
CreatedAt int64 `json:"createdAt"` // 文章的发布时间
Section []ArticleSection `json:"section"` // 文章的文本内容
Images []string `json:"images"` // 图片
... ...
syntax = "v1"
info(
title: "天联鹰蜓"
desc: "天联鹰蜓"
author: "email"
title: "评论相关"
desc: "编辑处理文章的评论"
author: "author"
email: "email"
version: "v1"
)
// 小程序接口
@server(
prefix: v1
prefix: v1/mini
group: comment
jwt: MiniAuth
)
service Core {
@doc "小程序评论"
@handler miniComment
get /mini/comment (CommentRequest) returns (CommentResposne)
@doc "小程序获取回复@人可选列表"
@handler MiniArticleCommentAtUser
post /article_comment/at_user/select (MiniArticleCommentAtUserRequest) returns (MiniArticleCommentAtUserResponse)
@doc "小程序填写文章的评论"
@handler MiniCreateArticleComment
post /article_comment (MiniCreateArticleCommentRequest) returns (MiniCreateArticleCommentResponse)
}
// 后台接口
@server(
prefix: v1
group: comment
jwt: SystemAuth
//
// 小程序获取回复@人可选列表
type (
MiniArticleCommentAtUserRequest {
ArtitceId int64 `json:"articleId"`
}
MiniArticleCommentAtUserResponse {
}
)
service Core {
@doc "系统评论"
@handler systemComment
get /system/comment (CommentRequest) returns (CommentResposne)
//评论的填写人
type CommentAuthor {
Id int64 `json:"id"` // 人员id
Name string `json:"name"` // 人员的名字
Avatar string `json:"avatar"` // 人员头像URL
Position string `json:"position"` // 职位
Company string `json:"company"` // 公司
}
// 小程序填写文章的评论
type (
CommentRequest {
}
CommentResposne {
List []Comment `json:"list"`
MiniCreateArticleCommentRequest {
ArtitcleId int64 `json:"articleId"` // 文章id
SectionId int64 `json:"sectionId"` // 段落id
FromUserId int64 `json:",optional"` // 填写文章的人,服务端自动获取
CompanyId int64 `json:",optional"` // 服务端自动获取
Pid int64 `json:"commnet"` // 回复那个评论的id
Content string `json:"content"` // 评论的内容
AtWho []int64 `json:"atWho"` // 填写评论时@的人
}
Comment {
MiniCreateArticleCommentResponse {
Id int64 `json:"id"`
Pid int64 `json:"pid"`
TopId int64 `json:"topId"`
ArtitcleId int64 `json:"articleId"` // 文章id
SectionId int64 `json:"sectionId"` // 段落id
FromUserId int64 `json:"fromUserId"` // 填写评论的人
FromUser CommentAuthor `json:"fromUser"` // 填写评论的人
ToUserId int64 `json:"toUserId"` // 回复哪个人
ToUser CommentAuthor `json:"toUser"` // 回复哪个人
SectionContent string `json:"sectionContent"` // 引用的文章内容文本
CountReply int `json:"countReply"` // 回复数量
CountUserLove int `json:"countUserLove"` // 用户点赞数量
CountAdminLove int `json:"countAdminLove"` // 运营点赞数量
AtWho []CommentAuthor `json:"atWho"` // 填写评论时@的人
}
)
\ No newline at end of file
... ...
... ... @@ -215,6 +215,36 @@ service Core {
@doc "系统用户信息"
@handler systemUserInfo
post /system/user/info(SystemUserInfoRequest) returns (SystemUserInfoResponse)
@doc "用户统计"
@handler systemUserStatistics
post /system/user/statistics (UserStatisticsRequest) returns (UserStatisticsResponse)
@doc "用户详情"
@handler systemUserGet
get /system/user/:id (SystemUserGetRequest) returns (SystemUserGetResponse)
@doc "更新用户"
@handler systemUserUpdate
put /system/user/:id (SystemUserUpdateRequest) returns (SystemUserUpdateResponse)
@doc "搜索用户"
@handler systemUserSearch
post /system/user/search (SystemUserSearchRequest) returns (SystemUserSearchResponse)
@doc "系统账号详情"
@handler systemUserAccountGet
get /system/account/:id (SystemUserAccountGetRequest) returns (SystemUserAccountGetResponse)
@doc "系统新增账号"
@handler systemUserAccountSave
post /system/account (SystemUserAccountSaveRequest) returns (SystemUserAccountSaveResponse)
@doc "系统启用/禁用账号"
@handler systemUserAccountEnable
post /system/account/enable (SystemUserAccountEnableRequest) returns (SystemUserAccountEnableResponse)
@doc "系统更新账号"
@handler systemUserAccountUpdate
put /system/account/:id (SystemUserAccountUpdateRequest) returns (SystemUserAccountUpdateResponse)
@doc "系统搜索账号"
@handler systemUserAccountSearch
post /system/account/search (SystemUserAccountSearchRequest) returns (SystemUserAccountSearchResponse)
}
type(
... ... @@ -228,4 +258,101 @@ type(
CompanyId int64 `json:"companyId"`
CompanyName string `json:"companyName"`
}
UserStatisticsRequest{
UserId int64 `json:"userId"`
ItemFlag int `json:"itemFlag"` // 1:他的帖子 2:他的评论/回复 4:他收到的赞 8:TA的圆桌讨论 16:被采纳
}
UserStatisticsResponse{
List []StatisticsItem `json:"list"`
}
StatisticsItem{
ItemFlag int `json:"itemFlag"` // 1:他的帖子 2:他的评论/回复 4:他收到的赞 8:TA的圆桌讨论 16:被采纳
Value float64 `json:"value"` // 统计值
}
SystemUserGetRequest {
Id int64 `path:"id"`
}
SystemUserGetResponse struct{
User SystemUser `json:"user"`
}
SystemUser struct{
Id int64 `json:"id"` // 用户ID
Name string `json:"name"` // 名称
Avatar string `json:"avatar"` // 头像
Phone string `json:"phone"` // 手机号 唯一
Position string `json:"position"` // 职位
Enable int `json:"enable"` // 启用状态 1:启用 2:禁用
Departments []int64 `json:"departments"` // 所属部门
AccountFrom string `json:"accountFrom"` // 账号来源 后台新增、扫码注册
CreatedAt int64 `json:"createdAt"` // 注册时间
Roles []int64 `json:"roles"` // 角色
RolesDesc string `json:"rolesDesc"` // 角色描述
DepartmentsDesc string `json:"departmentsDesc"` // 部门描述
}
SystemUserUpdateRequest struct{
Id int64 `path:"id"`
Avatar string `json:"avatar,optional"` // 头像
Position string `json:"position"` // 职位
Departments []int64 `json:"departments"` // 所属部门
}
SystemUserUpdateResponse struct{}
SystemUserSearchRequest struct{
Page int `json:"page"`
Size int `json:"size"`
Name string `json:"name,optional"` // 名称
Phone string `json:"phone,optional"` // 手机号 唯一
Position string `json:"position,optional"` // 职位
Enable int `json:"enable,optional"` // 启用状态 1:启用 2:禁用
DepartmentId int64 `json:"departmentId,optional"` // 所属部门
}
SystemUserSearchResponse{
List []SystemUser `json:"list"`
Total int64 `json:"total"`
}
SystemUserAccountGetRequest {
Id int64 `path:"id"`
}
SystemUserAccountGetResponse struct{
User SystemUser `json:"user"`
}
SystemUserAccountSaveRequest struct{
Name string `json:"name"` // 名称
Phone string `json:"phone"` // 手机号 唯一
Enable int `json:"enable"` // 启用状态 1:启用 2:禁用
Roles []int64 `json:"roles"` // 角色
}
SystemUserAccountSaveResponse struct{
}
SystemUserAccountEnableRequest struct{
UserIds []int64 `json:"userIds"` // 用户ID列表
Status int `json:"status"` // 状态 1:启用 2:禁用
}
SystemUserAccountEnableResponse struct{
}
SystemUserAccountUpdateRequest struct{
Id int64 `path:"id"`
}
SystemUserAccountUpdateResponse struct{}
SystemUserAccountSearchRequest struct{
Page int `json:"page"`
Size int `json:"size"`
Name string `json:"name,optional"` // 名称
Phone string `json:"phone,optional"` // 手机号 唯一
RoleId int64 `json:"roleId,optional"` // 角色权限
Enable int `json:"enable,optional"` // 启用状态 1:启用 2:禁用
BeginTime int64 `json:"beginTime,optional"` // 注册日期-开始
EndTime int64 `json:"endTime,optional"` // 注册日期-结束
}
SystemUserAccountSearchResponse{
List []SystemUser `json:"list"`
Total int64 `json:"total"`
}
)
\ No newline at end of file
... ...
... ... @@ -9,16 +9,16 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
)
func MiniCommentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
func MiniArticleCommentAtUserHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.CommentRequest
var req types.MiniArticleCommentAtUserRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := comment.NewMiniCommentLogic(r.Context(), svcCtx)
resp, err := l.MiniComment(&req)
l := comment.NewMiniArticleCommentAtUserLogic(r.Context(), svcCtx)
resp, err := l.MiniArticleCommentAtUser(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
... ...
... ... @@ -7,22 +7,22 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/comment"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
)
func SystemCommentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
func MiniCreateArticleCommentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.CommentRequest
var req types.MiniCreateArticleCommentRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := comment.NewSystemCommentLogic(r.Context(), svcCtx)
resp, err := l.SystemComment(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
l := comment.NewMiniCreateArticleCommentLogic(r.Context(), svcCtx)
token := contextdata.GetUserTokenFromCtx(r.Context())
req.CompanyId = token.CompanyId
req.FromUserId = token.UserId
resp, err := l.MiniCreateArticleComment(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
... ... @@ -21,25 +21,18 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodGet,
Path: "/mini/comment",
Handler: comment.MiniCommentHandler(serverCtx),
Method: http.MethodPost,
Path: "/article_comment/at_user/select",
Handler: comment.MiniArticleCommentAtUserHandler(serverCtx),
},
},
rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret),
rest.WithPrefix("/v1"),
)
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodGet,
Path: "/system/comment",
Handler: comment.SystemCommentHandler(serverCtx),
Method: http.MethodPost,
Path: "/article_comment",
Handler: comment.MiniCreateArticleCommentHandler(serverCtx),
},
},
rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret),
rest.WithPrefix("/v1"),
rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret),
rest.WithPrefix("/v1/mini"),
)
server.AddRoutes(
... ... @@ -171,6 +164,51 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
Path: "/system/user/info",
Handler: user.SystemUserInfoHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/system/user/statistics",
Handler: user.SystemUserStatisticsHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/system/user/:id",
Handler: user.SystemUserGetHandler(serverCtx),
},
{
Method: http.MethodPut,
Path: "/system/user/:id",
Handler: user.SystemUserUpdateHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/system/user/search",
Handler: user.SystemUserSearchHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/system/account/:id",
Handler: user.SystemUserAccountGetHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/system/account",
Handler: user.SystemUserAccountSaveHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/system/account/enable",
Handler: user.SystemUserAccountEnableHandler(serverCtx),
},
{
Method: http.MethodPut,
Path: "/system/account/:id",
Handler: user.SystemUserAccountUpdateHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/system/account/search",
Handler: user.SystemUserAccountSearchHandler(serverCtx),
},
},
rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret),
rest.WithPrefix("/v1"),
... ...
package user
import (
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/user"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
)
func SystemUserAccountEnableHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.SystemUserAccountEnableRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := user.NewSystemUserAccountEnableLogic(r.Context(), svcCtx)
resp, err := l.SystemUserAccountEnable(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package user
import (
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/user"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
)
func SystemUserAccountGetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.SystemUserAccountGetRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := user.NewSystemUserAccountGetLogic(r.Context(), svcCtx)
resp, err := l.SystemUserAccountGet(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package user
import (
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/user"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
)
func SystemUserAccountSaveHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.SystemUserAccountSaveRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := user.NewSystemUserAccountSaveLogic(r.Context(), svcCtx)
resp, err := l.SystemUserAccountSave(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package user
import (
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/user"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
)
func SystemUserAccountSearchHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.SystemUserAccountSearchRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := user.NewSystemUserAccountSearchLogic(r.Context(), svcCtx)
resp, err := l.SystemUserAccountSearch(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package user
import (
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/user"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
)
func SystemUserAccountUpdateHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.SystemUserAccountUpdateRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := user.NewSystemUserAccountUpdateLogic(r.Context(), svcCtx)
resp, err := l.SystemUserAccountUpdate(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package user
import (
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/user"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
)
func SystemUserGetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.SystemUserGetRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := user.NewSystemUserGetLogic(r.Context(), svcCtx)
resp, err := l.SystemUserGet(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package user
import (
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
... ... @@ -19,10 +20,6 @@ func SystemUserInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
l := user.NewSystemUserInfoLogic(r.Context(), svcCtx)
resp, err := l.SystemUserInfo(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
result.HttpResult(r, w, resp, err)
}
}
... ...
package user
import (
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/user"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
)
func SystemUserSearchHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.SystemUserSearchRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := user.NewSystemUserSearchLogic(r.Context(), svcCtx)
resp, err := l.SystemUserSearch(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package user
import (
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/user"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
)
func SystemUserStatisticsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.UserStatisticsRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := user.NewSystemUserStatisticsLogic(r.Context(), svcCtx)
resp, err := l.SystemUserStatistics(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package user
import (
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/user"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
)
func SystemUserUpdateHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.SystemUserUpdateRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := user.NewSystemUserUpdateLogic(r.Context(), svcCtx)
resp, err := l.SystemUserUpdate(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
... ... @@ -43,19 +43,10 @@ func (l *MiniCreateArticleLogic) MiniCreateArticle(req *types.MiniArticleCreateR
Id: author.Id,
Name: author.Name,
Avatar: author.Avatar,
GroupId: 0,
Group: "",
Position: author.Position,
Company: companyInfo.Name,
CompanyId: author.CompanyId,
}
if author.DepartmentId > 0 {
department, err := l.svcCtx.DepartmentRepository.FindOne(l.ctx, conn, author.DepartmentId)
if err == nil {
articleAuthor.GroupId = department.Id
articleAuthor.Group = department.Name
}
}
if len(req.Images) > 9 {
return nil, xerr.NewErrMsg("图片数量最多9张")
}
... ...
... ... @@ -38,7 +38,10 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) (
return nil, xerr.NewErrMsg("没有查看权限")
}
//TODO 检查可查看人
if articleInfo.Show == domain.ArticleShowDisable {
// 文章内容不显示
resp = &types.MiniArticleGetResponse{
Id: articleInfo.Id,
Title: articleInfo.Title,
... ... @@ -54,6 +57,20 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) (
if err != nil {
return nil, xerr.NewErrMsgErr("读取文章内容失败", err)
}
var meLoveFlag int
if req.UserId > 0 {
// 获取我对文章的点赞标识
queryOption = domain.NewQueryOptions().
WithCountOnly().
MustWithKV("articleId", articleInfo.Id).
MustWithKV("commentId", 0).
MustWithKV("userId", req.UserId)
cnt, _, _ := l.svcCtx.UserLoveFlagRepository.Find(l.ctx, conn, queryOption)
if cnt > 0 {
meLoveFlag = 1
}
}
sortBy := domain.SortArticleSection(sectionList)
sort.Sort(sortBy)
articleSection := []types.ArticleSection{}
... ... @@ -70,11 +87,11 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) (
Id: articleInfo.Id,
Title: articleInfo.Title,
AuthorId: articleInfo.AuthorId,
Author: types.Author{
Id: articleInfo.Author.Id,
Name: articleInfo.Author.Name,
Avatar: articleInfo.Author.Avatar,
Group: articleInfo.Author.Group,
Author: types.ArticleAuthor{
Id: articleInfo.Author.Id,
Name: articleInfo.Author.Name,
Avatar: articleInfo.Author.Avatar,
// Group: articleInfo.Author.Group,
Position: articleInfo.Author.Position,
Company: articleInfo.Author.Company,
},
... ... @@ -93,6 +110,7 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) (
CountRead: articleInfo.CountRead,
Show: int(articleInfo.Show),
Edit: 0,
MeLoveFlag: meLoveFlag,
}
if articleInfo.CreatedAt != articleInfo.UpdatedAt {
resp.Edit = 1
... ...
... ... @@ -9,21 +9,21 @@ import (
"github.com/zeromicro/go-zero/core/logx"
)
type MiniCommentLogic struct {
type MiniArticleCommentAtUserLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewMiniCommentLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniCommentLogic {
return &MiniCommentLogic{
func NewMiniArticleCommentAtUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniArticleCommentAtUserLogic {
return &MiniArticleCommentAtUserLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *MiniCommentLogic) MiniComment(req *types.CommentRequest) (resp *types.CommentResposne, err error) {
func (l *MiniArticleCommentAtUserLogic) MiniArticleCommentAtUser(req *types.MiniArticleCommentAtUserRequest) (resp *types.MiniArticleCommentAtUserResponse, err error) {
// todo: add your logic here and delete this line
return
... ...
package comment
import (
"context"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
"text/template"
"github.com/zeromicro/go-zero/core/logx"
)
type MiniCreateArticleCommentLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewMiniCreateArticleCommentLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniCreateArticleCommentLogic {
return &MiniCreateArticleCommentLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
// 填写评论
func (l *MiniCreateArticleCommentLogic) MiniCreateArticleComment(req *types.MiniCreateArticleCommentRequest) (resp *types.MiniCreateArticleCommentResponse, err error) {
var conn = l.svcCtx.DefaultDBConn()
// 获取评论填写人的信息
fromUser, err := l.svcCtx.UserRepository.FindOne(l.ctx, conn, req.FromUserId)
if err != nil {
return nil, xerr.NewErrMsgErr("获取评论人信息失败", err)
}
companyInfo, err := l.svcCtx.CompanyRepository.FindOne(l.ctx, conn, req.CompanyId)
if err != nil {
return nil, xerr.NewErrMsgErr("获取公司信息失败", err)
}
// 获取文章
articleInfo, err := l.svcCtx.ArticleRepository.FindOne(l.ctx, conn, req.ArtitcleId)
if err != nil {
return nil, xerr.NewErrMsgErr("获取文章信息失败", err)
}
if articleInfo.CompanyId != req.CompanyId {
return nil, xerr.NewErrMsg("没有评论权限")
}
//查看评论权限,
//临时注释
// if len(articleInfo.WhoReview) > 0 {
// ok := lo.IndexOf(articleInfo.WhoReview, req.FromUserId)
// if ok < 0 {
// return nil, xerr.NewErrMsg("没有评论权限")
// }
// }
// 对段落进行评论
var selctionInfo *domain.ArticleSection
if req.SectionId > 0 {
//获取段落
selctionInfo, err = l.svcCtx.ArticleSectionRepository.FindOne(l.ctx, conn, req.SectionId)
if err != nil {
return nil, xerr.NewErrMsgErr("获取文章段落信息失败", err)
}
if selctionInfo.ArticleId != articleInfo.Id {
return nil, xerr.NewErrMsg("获取文章段落信息失败")
}
}
// 回复哪个评论
var pComment *domain.ArticleComment
if req.Pid > 0 {
pComment, err = l.svcCtx.ArticleCommentRepository.FindOne(l.ctx, conn, req.Pid)
if err != nil {
return nil, xerr.NewErrMsgErr("获取上一层级的评论信息失败", err)
}
if pComment.ArticleId != articleInfo.Id {
if err != nil {
return nil, xerr.NewErrMsg("评论信息与文章不匹配")
}
}
}
var atWhoList []*domain.User
if len(req.AtWho) > 0 {
queryOption := domain.NewQueryOptions().WithFindOnly().WithKV("ids", req.AtWho)
_, atWhoList, err = l.svcCtx.UserRepository.Find(l.ctx, conn, queryOption)
if err != nil {
return nil, xerr.NewErrMsgErr("检查@的人员失败", err)
}
}
// 处理文本内容
// content:=
content := template.HTMLEscapeString(req.Content)
newComment := domain.ArticleComment{
Id: 0,
CompanyId: req.CompanyId,
CreatedAt: 0,
UpdatedAt: 0,
DeletedAt: 0,
Version: 0,
Pid: req.Pid,
TopId: 0,
ArticleId: req.ArtitcleId,
SectionId: req.SectionId,
SectionContent: "",
FromUserId: req.FromUserId,
FromUser: domain.UserSimple{
Id: fromUser.Id,
Name: fromUser.Name,
Avatar: fromUser.Avatar,
Position: fromUser.Position,
Company: companyInfo.Name,
CompanyId: companyInfo.Id,
},
ToUserId: 0,
ToUser: domain.UserSimple{},
Content: content,
CountReply: 0,
CountUserLove: 0,
CountAdminLove: 0,
Show: 0,
AtWho: []domain.UserSimple{},
}
if selctionInfo != nil {
newComment.SectionContent = selctionInfo.Content
}
if pComment != nil {
newComment.TopId = pComment.TopId
if pComment.TopId == 0 {
newComment.TopId = pComment.Id
}
newComment.ToUser = pComment.FromUser
newComment.ToUserId = pComment.FromUserId
newComment.SectionId = pComment.SectionId
}
for i := range atWhoList {
newComment.AtWho = append(newComment.AtWho, domain.UserSimple{
Id: atWhoList[i].Id,
Name: atWhoList[i].Name,
Avatar: atWhoList[i].Avatar,
Position: atWhoList[i].Position,
Company: companyInfo.Name,
CompanyId: companyInfo.Id,
})
}
//保存数据
err = transaction.UseTrans(l.ctx, conn.DB(), func(ctx context.Context, c transaction.Conn) error {
// 增加平评论计数
err = l.svcCtx.ArticleRepository.IncreaseCountComment(ctx, c, 1, articleInfo)
if err != nil {
return err
}
//保存评论
_, err = l.svcCtx.ArticleCommentRepository.Insert(ctx, c, &newComment)
if err != nil {
return err
}
return nil
}, true)
if err != nil {
return nil, xerr.NewErrMsgErr("保存评论失败", err)
}
resp = &types.MiniCreateArticleCommentResponse{
Id: newComment.Id,
Pid: newComment.Pid,
TopId: newComment.TopId,
ArtitcleId: newComment.ArticleId,
SectionId: newComment.ArticleId,
FromUserId: newComment.FromUserId,
FromUser: types.CommentAuthor{
Id: newComment.FromUser.Id,
Name: newComment.FromUser.Name,
Avatar: newComment.FromUser.Avatar,
Position: newComment.FromUser.Position,
Company: newComment.FromUser.Company,
},
ToUserId: newComment.ToUserId,
ToUser: types.CommentAuthor{
Id: newComment.ToUser.Id,
Name: newComment.ToUser.Name,
Avatar: newComment.ToUser.Avatar,
Position: newComment.ToUser.Position,
Company: newComment.ToUser.Company,
},
SectionContent: newComment.SectionContent,
CountReply: 0,
CountUserLove: 0,
CountAdminLove: 0,
AtWho: []types.CommentAuthor{},
}
for _, val := range newComment.AtWho {
resp.AtWho = append(resp.AtWho, types.CommentAuthor{
Id: val.Id,
Name: val.Name,
Avatar: val.Avatar,
Position: val.Position,
Company: val.Company,
})
}
return resp, nil
}
... ...
... ... @@ -75,6 +75,7 @@ func (l *MiniUserApplyJoinCompanyLogic) MiniUserApplyJoinCompany(req *types.Mini
AccountFrom: domain.AccountFromQr,
Departments: make([]int64, 0),
}
user.WithName(name)
if user, err = l.svcCtx.UserRepository.Insert(ctx, conn, user); err != nil {
return err
}
... ...
package user
import (
"context"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type SystemUserAccountEnableLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewSystemUserAccountEnableLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemUserAccountEnableLogic {
return &SystemUserAccountEnableLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *SystemUserAccountEnableLogic) SystemUserAccountEnable(req *types.SystemUserAccountEnableRequest) (resp *types.SystemUserAccountEnableResponse, err error) {
var (
conn = l.svcCtx.DefaultDBConn()
users []*domain.User
userToken = contextdata.GetUserTokenFromCtx(l.ctx)
)
if _, users, err = l.svcCtx.UserRepository.Find(l.ctx, conn, domain.IndexCompanyId(userToken.CompanyId)().MustWithKV("ids", req.UserIds).WithFindOnly()); err != nil {
return nil, xerr.NewErrMsgErr("公司不存在", err)
}
if err = transaction.UseTrans(l.ctx, l.svcCtx.DB, func(ctx context.Context, conn transaction.Conn) error {
for _, user := range users {
if user.Enable == req.Status {
continue
}
user.Enable = req.Status
if user, err = l.svcCtx.UserRepository.UpdateWithVersion(ctx, conn, user); err != nil {
return err
}
}
return nil
}, true); err != nil {
return nil, xerr.NewErrMsgErr("更新启用状态失败", err)
}
return
}
... ...
package user
import (
"context"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
"strings"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type SystemUserAccountGetLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewSystemUserAccountGetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemUserAccountGetLogic {
return &SystemUserAccountGetLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *SystemUserAccountGetLogic) SystemUserAccountGet(req *types.SystemUserAccountGetRequest) (resp *types.SystemUserAccountGetResponse, err error) {
var (
conn = l.svcCtx.DefaultDBConn()
user *domain.User
userToken = contextdata.GetUserTokenFromCtx(l.ctx)
departments []*domain.Department
roles []*domain.Role
)
if user, err = l.svcCtx.UserRepository.FindOne(l.ctx, conn, req.Id); err != nil {
return nil, xerr.NewErrMsgErr("公司不存在", err)
}
if userToken.CompanyId != user.CompanyId {
return nil, xerr.NewErrMsgErr("无权限访问改用户", err)
}
if len(user.Departments) > 0 {
_, departments, err = l.svcCtx.DepartmentRepository.Find(l.ctx, conn, domain.IndexCompanyId(userToken.CompanyId)().MustWithKV("ids", user.Departments))
if err != nil {
return nil, xerr.NewErrMsgErr("获取账号详情失败", err)
}
}
if len(user.Roles) > 0 {
_, roles, err = l.svcCtx.RoleRepository.Find(l.ctx, conn, domain.IndexCompanyId(userToken.CompanyId)().MustWithKV("ids", user.Roles))
if err != nil {
return nil, xerr.NewErrMsgErr("获取账号详情失败", err)
}
}
departmentsDesc := domain.Values(departments, func(item *domain.Department) string {
return item.Name
})
rolesDesc := domain.Values(roles, func(item *domain.Role) string {
return item.Name
})
item := NewSystemUser(user)
item.DepartmentsDesc = strings.Join(departmentsDesc, "、")
item.RolesDesc = strings.Join(rolesDesc, "、")
resp = &types.SystemUserAccountGetResponse{
User: item,
}
return
}
func NewSystemUser(item *domain.User) types.SystemUser {
result := types.SystemUser{
Id: item.Id,
Name: item.Name,
Avatar: item.Avatar,
Phone: item.Phone,
Position: item.Position,
Enable: item.Enable,
Departments: item.Departments,
Roles: item.Roles,
AccountFrom: item.AccountFrom,
CreatedAt: item.CreatedAt,
}
return result
}
... ...
package user
import (
"context"
"fmt"
"github.com/pkg/errors"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/tool"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type SystemUserAccountSaveLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewSystemUserAccountSaveLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemUserAccountSaveLogic {
return &SystemUserAccountSaveLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *SystemUserAccountSaveLogic) SystemUserAccountSave(req *types.SystemUserAccountSaveRequest) (resp *types.SystemUserAccountSaveResponse, err error) {
var (
conn = l.svcCtx.DefaultDBConn()
company *domain.Company
user *domain.User
name = fmt.Sprintf("用户%s", tool.Krand(6, tool.KC_RAND_KIND_NUM))
userToken = contextdata.GetUserTokenFromCtx(l.ctx)
)
if req.Name != "" {
name = req.Name
}
if company, err = l.svcCtx.CompanyRepository.FindOne(l.ctx, conn, userToken.CompanyId); err != nil {
return nil, xerr.NewErrMsgErr("公司不存在", err)
}
if user, err = l.svcCtx.UserRepository.FindOneByCompanyIdAndPhone(l.ctx, conn, company.Id, req.Phone, []int{domain.UserAuditStatusWait, domain.UserAuditStatusPassed}); err != nil {
if errors.Is(err, domain.ErrNotFound) {
err = nil
}
}
if err != nil {
return nil, xerr.NewErrMsgErr("申请失败", err)
}
if err = transaction.UseTrans(l.ctx, l.svcCtx.DB, func(ctx context.Context, conn transaction.Conn) error {
user = &domain.User{
CompanyId: company.Id,
Phone: req.Phone,
Name: name,
Flag: domain.UserCommon,
Enable: req.Enable,
Roles: make([]int64, 0),
Follower: make([]int64, 0),
Following: make([]int64, 0),
AccountFrom: domain.AccountFromMr,
Departments: make([]int64, 0),
AuditStatus: domain.UserAuditStatusPassed,
}
user.WithName(name)
for _, roleId := range req.Roles {
user.AddRole(roleId)
}
if user, err = l.svcCtx.UserRepository.Insert(ctx, conn, user); err != nil {
return err
}
return nil
}, true); err != nil {
return nil, xerr.NewErrMsgErr("添加用户失败", err)
}
resp = &types.SystemUserAccountSaveResponse{}
return
}
... ...
package user
import (
"context"
"github.com/samber/lo"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
"strings"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type SystemUserAccountSearchLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewSystemUserAccountSearchLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemUserAccountSearchLogic {
return &SystemUserAccountSearchLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *SystemUserAccountSearchLogic) SystemUserAccountSearch(req *types.SystemUserAccountSearchRequest) (resp *types.SystemUserAccountSearchResponse, err error) {
var (
conn = l.svcCtx.DefaultDBConn()
users []*domain.User
userToken = contextdata.GetUserTokenFromCtx(l.ctx)
total int64
departmentMap = make(map[int64]*domain.Department)
roleMap = make(map[int64]*domain.Role)
)
queryOptions := domain.IndexCompanyId(userToken.CompanyId)().WithOffsetLimit(req.Page, req.Size).WithOrder("id desc").
WithKV("likeName", req.Name).
WithKV("likePhone", req.Phone).
WithKV("roleId", req.RoleId).
WithKV("enable", req.Enable).
WithKV("beginTime", req.BeginTime).
WithKV("endTime", req.EndTime)
if total, users, err = l.svcCtx.UserRepository.Find(l.ctx, conn, queryOptions); err != nil {
return nil, xerr.NewErr(err)
}
resp = &types.SystemUserAccountSearchResponse{
Total: total,
List: make([]types.SystemUser, 0),
}
lo.ForEach(users, func(item *domain.User, index int) {
var departments []string
for _, id := range item.Departments {
if department, _ := domain.LazyLoad(departmentMap, l.ctx, conn, id, l.svcCtx.DepartmentRepository.FindOne); department != nil {
departments = append(departments, department.Name)
}
}
var roles []string
for _, id := range item.Roles {
if role, _ := domain.LazyLoad(roleMap, l.ctx, conn, id, l.svcCtx.RoleRepository.FindOne); role != nil {
roles = append(roles, role.Name)
}
}
user := NewSystemUser(item)
user.RolesDesc = strings.Join(roles, "、")
user.DepartmentsDesc = strings.Join(departments, "、")
resp.List = append(resp.List, user)
})
return
}
... ...
package user
import (
"context"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type SystemUserAccountUpdateLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewSystemUserAccountUpdateLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemUserAccountUpdateLogic {
return &SystemUserAccountUpdateLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *SystemUserAccountUpdateLogic) SystemUserAccountUpdate(req *types.SystemUserAccountUpdateRequest) (resp *types.SystemUserAccountUpdateResponse, err error) {
// todo: add your logic here and delete this line
return
}
... ...
package user
import (
"context"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
"strings"
"github.com/zeromicro/go-zero/core/logx"
)
type SystemUserGetLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewSystemUserGetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemUserGetLogic {
return &SystemUserGetLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *SystemUserGetLogic) SystemUserGet(req *types.SystemUserGetRequest) (resp *types.SystemUserGetResponse, err error) {
var (
user *domain.User
conn = l.svcCtx.DefaultDBConn()
userToken = contextdata.GetUserTokenFromCtx(l.ctx)
)
if user, err = l.svcCtx.UserRepository.FindOne(l.ctx, conn, req.Id); err != nil {
return nil, xerr.NewErrMsgErr("用户不存在", err)
}
var roles []*domain.Role
if len(user.Roles) > 0 {
_, roles, err = l.svcCtx.RoleRepository.Find(l.ctx, conn, domain.IndexCompanyId(userToken.CompanyId)().MustWithKV("ids", user.Roles))
if err != nil {
return nil, xerr.NewErrMsgErr("获取账号详情失败", err)
}
}
rolesDesc := domain.Values(roles, func(item *domain.Role) string {
return item.Name
})
userItem := NewSystemUser(user)
userItem.RolesDesc = strings.Join(rolesDesc, "、")
resp = &types.SystemUserGetResponse{
User: userItem,
}
return
}
... ...
... ... @@ -2,7 +2,6 @@ package user
import (
"context"
"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 +23,6 @@ func NewSystemUserInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Sy
}
func (l *SystemUserInfoLogic) SystemUserInfo(req *types.SystemUserInfoRequest) (resp *types.SystemUserInfoResponse, err error) {
// todo: add your logic here and delete this line
return
}
... ...
package user
import (
"context"
"github.com/samber/lo"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
"strings"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type SystemUserSearchLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewSystemUserSearchLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemUserSearchLogic {
return &SystemUserSearchLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *SystemUserSearchLogic) SystemUserSearch(req *types.SystemUserSearchRequest) (resp *types.SystemUserSearchResponse, err error) {
var (
conn = l.svcCtx.DefaultDBConn()
users []*domain.User
userToken = contextdata.GetUserTokenFromCtx(l.ctx)
total int64
roleMap = make(map[int64]*domain.Role)
)
queryOptions := domain.IndexCompanyId(userToken.CompanyId)().WithOffsetLimit(req.Page, req.Size).WithOrder("id desc").
WithKV("likeName", req.Name).
WithKV("likePhone", req.Phone).
WithKV("likePosition", req.Position).
WithKV("enable", req.Enable).
WithKV("departmentId", req.DepartmentId)
if total, users, err = l.svcCtx.UserRepository.Find(l.ctx, conn, queryOptions); err != nil {
return nil, xerr.NewErr(err)
}
resp = &types.SystemUserSearchResponse{
Total: total,
List: make([]types.SystemUser, 0),
}
lo.ForEach(users, func(item *domain.User, index int) {
var roles []string
for _, id := range item.Roles {
if role, _ := domain.LazyLoad(roleMap, l.ctx, conn, id, l.svcCtx.RoleRepository.FindOne); role != nil {
roles = append(roles, role.Name)
}
}
user := NewSystemUser(item)
user.RolesDesc = strings.Join(roles, "、")
resp.List = append(resp.List, user)
})
return
}
... ...
package comment
package user
import (
"context"
... ... @@ -9,21 +9,21 @@ import (
"github.com/zeromicro/go-zero/core/logx"
)
type SystemCommentLogic struct {
type SystemUserStatisticsLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewSystemCommentLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemCommentLogic {
return &SystemCommentLogic{
func NewSystemUserStatisticsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemUserStatisticsLogic {
return &SystemUserStatisticsLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *SystemCommentLogic) SystemComment(req *types.CommentRequest) (resp *types.CommentResposne, err error) {
func (l *SystemUserStatisticsLogic) SystemUserStatistics(req *types.UserStatisticsRequest) (resp *types.UserStatisticsResponse, err error) {
// todo: add your logic here and delete this line
return
... ...
package user
import (
"context"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type SystemUserUpdateLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewSystemUserUpdateLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemUserUpdateLogic {
return &SystemUserUpdateLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *SystemUserUpdateLogic) SystemUserUpdate(req *types.SystemUserUpdateRequest) (resp *types.SystemUserUpdateResponse, err error) {
var (
userToken = contextdata.GetUserTokenFromCtx(l.ctx)
user *domain.User
conn = l.svcCtx.DefaultDBConn()
)
if user, err = l.svcCtx.UserRepository.FindOne(l.ctx, conn, req.Id); err != nil {
return nil, xerr.NewErrMsgErr("用户不存在", err)
}
if user.CompanyId != userToken.CompanyId {
return nil, xerr.NewErrMsgErr("无权限更改", err)
}
user.Avatar = req.Avatar
user.Position = req.Position
user.Departments = req.Departments
user.WithName(user.Name)
if err = transaction.UseTrans(l.ctx, l.svcCtx.DB, func(ctx context.Context, conn transaction.Conn) error {
if user, err = l.svcCtx.UserRepository.UpdateWithVersion(ctx, conn, user); err != nil {
return err
}
return nil
}, true); err != nil {
return nil, xerr.NewErrMsgErr("更新用户信息失败", err)
}
resp = &types.SystemUserUpdateResponse{}
return
}
... ...
// Code generated by goctl. DO NOT EDIT.
package types
type Location struct {
Longitude float64 `json:"longitude,optional"` //经度
Latitude float64 `json:"latitude,optional"` //纬度
Descript string `json:"descript,optional"` //地点描述
type MiniArticleCommentAtUserRequest struct {
ArtitceId int64 `json:"articleId"`
}
type Author struct {
type MiniArticleCommentAtUserResponse struct {
}
type CommentAuthor struct {
Id int64 `json:"id"` // 人员id
Name string `json:"name"` // 人员的名字
Avatar string `json:"avatar"` // 人员头像URL
Group string `json:"group"` // 人员的分组
Position string `json:"position"` // 职位
Company string `json:"company"` // 公司
}
type MiniArticleCreateRequest struct {
Title string `json:"title"` //标题
Section []string `json:"section"` //文章的文本内容
AuthorId int64 `json:"authorId,optional"` //发布人id
Images []string `json:"images,optional"` //图片
WhoRead []int64 `json:"whoRead,optional"` //谁可查看
WhoReview []int64 `json:"whoReview,optional"` //谁可评论
Location Location `json:"location,optional"` //定位坐标
type MiniCreateArticleCommentRequest struct {
ArtitcleId int64 `json:"articleId"` // 文章id
SectionId int64 `json:"sectionId"` // 段落id
FromUserId int64 `json:",optional"` // 填写文章的人,服务端自动获取
CompanyId int64 `json:",optional"` // 服务端自动获取
Pid int64 `json:"commnet"` // 回复那个评论的id
Content string `json:"content"` // 评论的内容
AtWho []int64 `json:"atWho"` // 填写评论时@的人
}
type MiniCreateArticleCommentResponse struct {
Id int64 `json:"id"`
Pid int64 `json:"pid"`
TopId int64 `json:"topId"`
ArtitcleId int64 `json:"articleId"` // 文章id
SectionId int64 `json:"sectionId"` // 段落id
FromUserId int64 `json:"fromUserId"` // 填写评论的人
FromUser CommentAuthor `json:"fromUser"` // 填写评论的人
ToUserId int64 `json:"toUserId"` // 回复哪个人
ToUser CommentAuthor `json:"toUser"` // 回复哪个人
SectionContent string `json:"sectionContent"` // 引用的文章内容文本
CountReply int `json:"countReply"` // 回复数量
CountUserLove int `json:"countUserLove"` // 用户点赞数量
CountAdminLove int `json:"countAdminLove"` // 运营点赞数量
AtWho []CommentAuthor `json:"atWho"` // 填写评论时@的人
}
type MiniArticleCreateResponse struct {
Id int64 `json:"id"`
type MessageSystemRequest struct {
Page int `json:"page"`
Size int `json:"size"`
}
type MiniArticleGetRequest struct {
Id int64 `path:"id"` //id
CompanyId int64 `path:",optional"`
type MessageSystemResponse struct {
List []MessageSystemItem `json:"list"`
Total int64 `json:"total"`
}
type MiniArticleGetResponse struct {
Id int64 `json:"id"` //id
Title string `json:"title"` //标题
AuthorId int64 `json:"authorId"` //发布人id
Author Author `json:"author"` //发布人
CreatedAt int64 `json:"createdAt"` //文章的发布时间
Section []ArticleSection `json:"section"` //文章的文本内容
Images []string `json:"images"` //图片
WhoRead []int64 `json:"whoRead"` //谁可查看
WhoReview []int64 `json:"whoReview"` //谁可评论
Location Location `json:"location"` //定位坐标
CountLove int `json:"countLove"` // 点赞数量
CountComment int `json:"countComment"` // 评论数量
CountRead int `json:"countRead"` // 浏览数量
Show int `json:"show"` // 评论的展示状态(0显示、1不显示)
Edit int `json:"edit"` // 文章是否存在变更记录 (0 不存在 1存在)
type MessageSystemItem struct {
Id int64 `json:"id"` // ID
Type int `json:"type"` // 系统分类
Title string `json:"title"` // 标题
Content string `json:"content"` // 内容
CreatedAt int64 `json:"createdAt"` // 创建时间
}
type ArticleSection struct {
Id int64 `json:"id"` //段落id
Content string `json:"content"` // 文本内容
SortBy int `json:"sortBy"` // 排序
TotalComment int `json:"totalComment"` // 评论的数量
type MessageBusinessRequest struct {
Type int `json:"type"`
Page int `json:"page"`
Size int `json:"size"`
}
type MiniArticleSearchMeRequest struct {
AuthorId int64 `json:",optional"`
CompanyId int64 `json:",optional"`
Page int `json:"page"`
Size int `json:"size"`
type MessageBusinessResponse struct {
List []MessageBusinessItem `json:"list"`
Total int64 `json:"total"`
}
type MiniArticleSearchMeResponse struct {
Total int `json:"total"`
List []ArticleSearchMe `json:"list"`
type MessageBusinessItem struct {
Id int64 `json:"id"`
Type int `json:"type"` // 分类 (1回复 2点赞 3被采纳)
OptType int `json:"optType"` // 操作类型(1针对文章、1针对评论、2针对圆桌)
CompanyId int64 `json:"companyId"` // 操作人公司ID
UserId int64 `json:"userId"` // 操作人用户ID
RecipientId int64 `json:"recipientId"` // 接收者ID
ArticleId int64 `json:"articleId"` // 文章ID
CommentId int64 `json:"commentId"` // 评论ID
DiscussionId int64 `json:"discussionId"` // 圆桌ID
DiscussionOpinionId int64 `json:"discussionOpinionId"` // 观点ID
Content string `json:"content"` // 消息内容
CreatedAt int64 `json:"createdAt"` // 创建时间
User *SimpleUser `json:"user"` // 操作人
Article *SimpleArticle `json:"article"` // 文章
Comment *SimpleComment `json:"comment"` // 评论(不一定是自己,可能是被人@到)
}
type ArticleSearchMe struct {
Id int64 `json:"id"` //id
Title string `json:"title"` //标题
Images []string `json:"images"` //图片
CreatedAt int64 `json:"createdAt"` //文章的创建日期
CountLove int `json:"countLove"` //点赞数量
CountComment int `json:"CountComment"` //评论数量
Show int `json:"show"` //是否隐藏 [0显示、1不显示]
type SimpleUser struct {
Id int64 `json:"id"`
CompanyId int64 `json:"companyId,omitempty"` // 公司ID
CompanyName string `json:"companyName,omitempty"` // 公司名称
Name string `json:"name,omitempty"` // 名称
Avatar string `json:"avatar,omitempty"` // 头像
Position string `json:"position,omitempty"` // 职位
}
type MiniUserLikeArticleRequest struct {
ArticleId int64 `json:"articleId"` // 文章id
CompanyId int64 `json:",optional"` //公司id
Page int `json:"page"` //分页,第几页
Size int `json:"size"` //分页,每页几条
type SimpleArticle struct {
Id int64 `json:"id"`
Title string `json:"title"` // 文章标题
Summary string `json:"summary"` // 文章概要
CountLove int `json:"countLove"` // 点赞数量
CountComment int `json:"countComment"` // 评论数量
Show int `json:"show"` // 文章的展示状态(0显示、1不显示)
}
type MiniUserLikeArticleResponse struct {
Total int64 `json:"total"` //总数
List []WhichUserLikeArticle `json:"list"` //列表
type TagCreateRequest struct {
CompanyId int64 `json:"companyId"`
Image string `json:"image"`
Name string `json:"name"` // 标签名称
Group string `json:"group"` // 标签分类
Remark string `json:"remark,optional"` // 备注
}
type WhichUserLikeArticle struct {
ArticleId int64 `json:"articleId"` // 文章id
UserId int64 `json:"userId"` // 人员id
Name string `json:"name"` // 人员名称
Avatar string `json:"avatar"` // 人员头像
CreatedAt int64 `json:"createdAt"` // 点赞记录的时间
type TagCreateResponse struct {
Id int64 `json:"id"`
}
type MiniSetUserLikeRequset struct {
ArticleId int64 `json:"articleId"` //文章id
CommentId int64 `json:"commentId"` //评论id
UserId int64 `json:",optional"` //操作人
Flag int `json:"flag"` //点赞标志 1、点赞 2 、取消点赞
type TagEditRequest struct {
Id int64 `json:"id"`
CompanyId int64 `json:"-"`
Image string `json:"image"`
Name string `json:"name"` // 标签名称
Group string `json:"group"` // 标签分类
Remark string `json:"remark,optional"` // 备注
}
type MiniSetUserLikeResponse struct {
ArticleId int64 `json:"articleId"` //文章id
CommentId int64 `json:"commentId"` //评论id
Count int `json:"count"` //现有的点赞数量
type TagEditResponse struct {
Id int64 `json:"id"`
}
type MiniArticleBackupSearchRequest struct {
Page int `json:"page"`
Size int `json:"size"`
ArticleId int `json:"articleId"`
CompanyId int64 `json:",optional"` // 服务端自动获取
type TagGetRequest struct {
Id int64 `path:"id"`
CompanyId int64 `path:"-"`
}
type MiniArticleBackupSearchResponse struct {
Total int64 `json:"total"`
List []MiniArticleBackupItem `json:"list"`
type TagGetResponse struct {
Id int64 `json:"id"`
Image string `json:"image"`
Name string `json:"name"` // 标签名称
Group string `json:"group"` // 标签分类
Remark string `json:"remark"` // 备注
}
type MiniArticleBackupItem struct {
Id int64 `json:"id"`
Title string `json:"title"`
Content string `json:"content"`
Images []string `json:"images"`
CreatedAt int64 `json:"createdAt"`
Location Location `json:"location"`
type TagListRequest struct {
Page int `json:"page"`
Size int `json:"size"`
CompanyId int64 `json:"-"`
TagName string `json:"tagName,optional"`
Group string `json:"group,optional"`
Remark string `json:"remark,optional"`
}
type MiniArticleMarkUserReadRequest struct {
UserId int64 `json:",optional"` // 当前操作人
CompanyId int64 `json:",optional"` // 当前公司
ArticleId int64 `json:"articleId"` // 文章id
type TagListResponse struct {
Total int64 `json:"total"`
List []TagItem `json:"list"`
}
type MiniArticleMarkUserReadResponse struct {
Id int64 `json:"id"`
type TagItem struct {
Id int64 `json:"id"`
Image string `json:"image"`
Name string `json:"name"` // 标签名称
Group string `json:"group"` // 标签分类
Remark string `json:"remark"` // 备注
CreatedAt int64 `json:"createdAt"`
}
type MiniArticleDraftCreateRequest struct {
CompanyId int64 `json:",optional"`
AuthorId int64 `json:",optional"` // 发布人
Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式
Section []string `json:"section"` // 填写的内容
Title string `json:"title"` // 标题
Images []string `json:"images"` // 图片
WhoRead []int64 `json:"whoRead"` // 谁可以看
WhoReview []int64 `json:"whoReview"` // 评论人
Location Location `json:"location"` // 坐标
type TagDeleteRequest struct {
Id int64 `path:"id"`
CompanyId int64 `path:"-"`
}
type MiniArticleDraftCreateResponse struct {
type TagDeleteResponse struct {
Id int64 `json:"id"`
}
type MiniArticleDraftUpdateRequest struct {
Id int64 `json:"id"`
CompanyId int64 `json:",optional"`
AuthorId int64 `json:",optional"` // 发布人
Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式
Section []string `json:"section"` // 填写的内容
Title string `json:"title"` // 标题
Images []string `json:"images"` // 图片
WhoRead []int64 `json:"whoRead"` // 谁可以看
WhoReview []int64 `json:"whoReview"` // 评论人
Location Location `json:"location"` // 坐标
}
type MiniArticleDraftUpdateResponse struct {
Id int64 `json:"id"`
type MiniUserLoginRequest struct {
LoginType string `json:"loginType"` // 登录类型 wechat-login whchat-phone-login phone-password-login phone-smscode-login
WechatAuthCode string `json:"wechatAuthcode,optional"` // 微信登录 授权码
WechatEncryptedData string `json:"wechatEncryptedData,optional"` // 微信登录 加密数据
WechatIV string `json:"wechatIV,optional"` // 微信登录 加密算法初始向量
Phone string `json:"phone,optional"` // 手机号
Password string `json:"password,optional"` // 密码
SmsCode string `json:"smsCode,optional"` // 短信验证码
}
type MiniArticleDraftSearchMeRequest struct {
CompanyId int64 `json:",optional"` // 公司id
AuthorId int64 `json:",optional"` // 发布人
Page int `json:"page"`
Size int `json:"size"`
type MiniUserLoginResponse struct {
Token string `json:"token"` // x-token
Phone string `json:"phone"` // 手机号
Message string `json:"message"` // 失败消息(审核中,注册成功等待审核)
Success bool `json:"success"` // 成功标识
}
type MiniArticleDraftSearchMeResponse struct {
Total int64 `json:"total"`
List []MiniArticleDraftItem `json:"list"`
type MiniUserSwitchAccountRequest struct {
CompanyId int64 `json:"companyId"`
}
type MiniArticleDraftItem struct {
Id int64 `json:"id"`
Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式
Section []string `json:"section"` // 填写的内容
Title string `json:"title"` // 标题
Images []string `json:"images"` // 图片
CreatedAt int64 `json:"createdAt"`
type MiniUserInfoRequest struct {
}
type MiniArticleDraftGetMeRequest struct {
CompanyId int64 `path:",optional"` // 公司id
AuthorId int64 `path:",optional"` // 发布人
Id int64 `path:"id"`
}
type MiniArticleDraftGetMeResponse struct {
Id int64 `json:"id"` //
Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式
Section []string `json:"Section"` // 填写的内容
Title string `json:"title"` // 标题
Images []string `json:"images"` // 图片
WhoRead []int64 `json:"whoRead"` // 谁可以看
WhoReview []int64 `json:"whoReview"` // 评论人
Location Location `json:"location"` // 坐标
type MiniUserInfoResponse struct {
User *UserItem `json:"user,omitempty"` // 用户信息
TotalArticle int64 `json:"totalArticle"` // 累计信息发布
TotalLoved int64 `json:"totalLoved"` // 累计收到的赞
TotalAccepted int64 `json:"totalAccepted"` // 累计被采纳
Accounts []Account `json:"accounts"` // 公司账号
Auths []Auth `json:"auths"` // 权限列表
}
type MiniArticleDraftDeleteMeRequest struct {
CompanyId int64 `path:",optional"` // 公司id
AuthorId int64 `path:",optional"` // 发布人
Id int64 `path:"id"`
type MiniUserApplyJoinCompanyRequest struct {
Phone string `json:"phone"`
Code string `json:"code"`
}
type MiniArticleDraftDeleteMeResponse struct {
Id int64 `json:"id"` //
type MiniUserApplyJoinCompanyResponse struct {
}
type MiniArticleMarkListRequest struct {
Page int `json:"page"`
Size int `json:"size"`
type MiniUserAuditRequest struct {
UserId int64 `json:"userId"` // 用户ID
Status int `json:"status"` // 审核状态 1:审核通过 2:拒绝
}
type MiniArticleMarkListResponse struct {
Total int64 `json:"total"`
List []MiniArticleMarkItem `json:"list"`
type MiniUserDepartmentUsersRequest struct {
}
type MiniArticleMarkItem struct {
Id int64 `json:"id"`
CompanyId int64 `json:"companyId"`
UserId int64 `json:"userId"`
ArticleId int64 `json:"articleId"`
Title string `json:"title"`
Author SimpleUser `json:"author"` // 发布人
UpdatedAt int64 `json:"updatedAt"`
type MiniUserDepartmentUsersResponse struct {
Departments []*Department `json:"departments"`
Users []*UserItem `json:"users"`
}
type SystemArticleGetRequest struct {
Id int64 `path:"id"` //id
CompanyId int64 `path:",optional"`
type MiniUserFollowedSearchRequest struct {
Page int `json:"page,optional"`
Size int `json:"size,optional"`
}
type UserShowName struct {
Id int `json:"id"`
Name int `json:"name"`
type MiniUserFollowedSearchResponse struct {
List []*UserFollowItem `json:"users"`
Total int64 `json:"total"`
}
type SystemArticleGetResponse struct {
Id int64 `json:"id"` // id
Title string `json:"title"` // 标题
AuthorId int64 `json:"authorId"` // 发布人id
Author Author `json:"author"` // 发布人
CreatedAt int64 `json:"createdAt"` // 文章的发布时间
Section []ArticleSection `json:"section"` // 文章的文本内容
Images []string `json:"images"` // 图片
WhoRead []int64 `json:"whoRead"` // 谁可查看
WhoReadInfo []UserShowName `json:"whoReadInfo"` // 谁可查看
WhoReview []int64 `json:"whoReview"` // 谁可评论
WhoReviewInfo []UserShowName `json:"whoReviewInfo"` // 谁可评论
Location Location `json:"location"` // 定位坐标
CountLove int `json:"countLove"` // 点赞数量
CountComment int `json:"countComment"` // 评论数量
CountRead int `json:"countRead"` // 浏览数量
Show int `json:"show"` // 评论的展示状态(0显示、1不显示)
type UserItem struct {
Id int64 `json:"id,omitempty"` // 用户ID
CompanyId int64 `json:"companyId,omitempty"` // 公司ID
CompanyName string `json:"companyName,omitempty"` // 公司名称
Flag int `json:"flag,omitempty"` // 标识 1:管理员 2:普通用户 (有绑定角色是管理员)
Name string `json:"name,omitempty"` // 名称
Avatar string `json:"avatar,omitempty"` // 头像
Phone string `json:"phone,omitempty"` // 手机号 唯一
Position string `json:"position,omitempty"` // 职位
Enable int `json:"enable,omitempty"` // 启用状态 1:启用 2:禁用
AuditStatus *int `json:"auditStatus,omitempty"` // 审核状态 0:待审核 1:审核通过 2:拒绝
Follower []int64 `json:"followers,omitempty"` // 关注我的人 (冗余)
Following []int64 `json:"following,omitempty"` // 我关注的人 (冗余)
Departments []int64 `json:"departments,omitempty"` // 所属部门
AccountFrom string `json:"accountFrom,omitempty"` // 账号来源 后台新增、扫码注册
}
type SystemArticleSearchRequest struct {
CompanyId int64 `json:",optional"`
Page int `json:"page"`
Size int `json:"size"`
type Account struct {
CompanyId int64 `json:"companyId"` // 公司ID
CompanyName string `json:"companyName"` // 公司名称
Logo string `json:"logo"` // 公司图标
UserId int64 `json:"userId"` // 用户ID
Name string `json:"name"` // 名称
Position string `json:"position"` // 职位
}
type SystemArticleSearchResponse struct {
Total int `json:"total"`
List []SystemArticleSearch `json:"list"`
type Department struct {
Id int64 `json:"id,omitempty"` // 部门ID
CompanyId int64 `json:"companyId,omitempty"` // 公司ID
ParentId int64 `json:"parentId,omitempty"` // 父级ID
Name string `json:"name,omitempty"` // 部门名称
}
type SystemArticleSearch struct {
Id int64 `json:"id"` //id
Title string `json:"title"` //标题
Author string `json:"author"` //发布人
Images []string `json:"images"` //图片
CreatedAt int64 `json:"createdAt"` //文章的创建日期
CountLove int `json:"countLove"` //点赞数量
CountComment int `json:"CountComment"` //评论数量
Show int `json:"show"` //是否隐藏 [0显示、1不显示]
Tags []string `json:"tags"` //标签
TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人]
type UserSearchRequest struct {
Page int `json:"page,optional"`
Size int `json:"size,optional"`
AuditFlag *int `json:"auditFlag,optional"` // 按审核状态 0:待审核 1:审核通过 2:拒绝
}
type CommentRequest struct {
type UserSearchResponse struct {
List []*UserItem `json:"list"`
Total int64 `json:"total"`
}
type CommentResposne struct {
List []Comment `json:"list"`
type FollowRequest struct {
UserId int64 `json:"userId"`
}
type Comment struct {
type UserFollowItem struct {
Id int64 `json:"id"` // 用户ID
Name string `json:"name"` // 名称
CompanyName string `json:"companyName"` // 公司名称
Avatar string `json:"avatar"` // 头像
Position string `json:"position"` // 职位
Followed bool `json:"followed"` // 关注
MutualFollowed bool `json:"mutualFollowed"` // 互相关注标识
}
type MessageSystemRequest struct {
type MiniMyLikeRequest struct {
Page int `json:"page"`
Size int `json:"size"`
}
type MessageSystemResponse struct {
List []MessageSystemItem `json:"list"`
Total int64 `json:"total"`
type MiniMyLikeResponse struct {
List []MyLikeItem `json:"list"`
Total int64 `json:"total"`
}
type MessageSystemItem struct {
Id int64 `json:"id"` // ID
Type int `json:"type"` // 系统分类
Title string `json:"title"` // 标题
Content string `json:"content"` // 内容
CreatedAt int64 `json:"createdAt"` // 创建时间
type MyLikeItem struct {
UserId int64 `json:"userId"` // 发布人id
ArticleId int64 `json:"articleId"` // 文章id
CommentId int64 `json:"commentId"` // 评论id
CreatedAt int64 `json:"createdAt"` // 创建时间
User *SimpleUser `json:"user"` // 发布人
Article *SimpleArticle `json:"article"` // 文章
Comment *SimpleComment `json:"comment"` // 评论
}
type MessageBusinessRequest struct {
Type int `json:"type"`
Page int `json:"page"`
Size int `json:"size"`
type SimpleComment struct {
Id int64 `json:"id"`
Content string `json:"content"` // 评论内容
CountLove int `json:"countLove"` // 点赞数量
CountComment int `json:"countComment"` // 评论数量
Show int `json:"show"` // 评论的展示状态(0显示、1不显示)
}
type MessageBusinessResponse struct {
List []MessageBusinessItem `json:"list"`
Total int64 `json:"total"`
type SystemUserInfoRequest struct {
}
type MessageBusinessItem struct {
Id int64 `json:"id"`
Type int `json:"type"` // 分类 (1回复 2点赞 3被采纳)
OptType int `json:"optType"` // 操作类型(1针对文章、1针对评论、2针对圆桌)
CompanyId int64 `json:"companyId"` // 操作人公司ID
UserId int64 `json:"userId"` // 操作人用户ID
RecipientId int64 `json:"recipientId"` // 接收者ID
ArticleId int64 `json:"articleId"` // 文章ID
CommentId int64 `json:"commentId"` // 评论ID
DiscussionId int64 `json:"discussionId"` // 圆桌ID
DiscussionOpinionId int64 `json:"discussionOpinionId"` // 观点ID
Content string `json:"content"` // 消息内容
CreatedAt int64 `json:"createdAt"` // 创建时间
User *SimpleUser `json:"user"` // 操作人
Article *SimpleArticle `json:"article"` // 文章
Comment *SimpleComment `json:"comment"` // 评论(不一定是自己,可能是被人@到)
type SystemUserInfoResponse struct {
UserId int64 `json:"userId"`
UserName string `json:"userName"`
Avatar string `json:"avatar"`
CompanyId int64 `json:"companyId"`
CompanyName string `json:"companyName"`
}
type SimpleUser struct {
Id int64 `json:"id"`
CompanyId int64 `json:"companyId,omitempty"` // 公司ID
CompanyName string `json:"companyName,omitempty"` // 公司名称
Name string `json:"name,omitempty"` // 名称
Avatar string `json:"avatar,omitempty"` // 头像
Position string `json:"position,omitempty"` // 职位
type UserStatisticsRequest struct {
UserId int64 `json:"userId"`
ItemFlag int `json:"itemFlag"` // 1:他的帖子 2:他的评论/回复 4:他收到的赞 8:TA的圆桌讨论 16:被采纳
}
type SimpleArticle struct {
Id int64 `json:"id"`
Title string `json:"title"` // 文章标题
Summary string `json:"summary"` // 文章概要
CountLove int `json:"countLove"` // 点赞数量
CountComment int `json:"countComment"` // 评论数量
Show int `json:"show"` // 文章的展示状态(0显示、1不显示)
type UserStatisticsResponse struct {
List []StatisticsItem `json:"list"`
}
type TagCreateRequest struct {
CompanyId int64 `json:"companyId"`
Image string `json:"image"`
Name string `json:"name"` // 标签名称
Group string `json:"group"` // 标签分类
Remark string `json:"remark,optional"` // 备注
type StatisticsItem struct {
ItemFlag int `json:"itemFlag"` // 1:他的帖子 2:他的评论/回复 4:他收到的赞 8:TA的圆桌讨论 16:被采纳
Value float64 `json:"value"` // 统计值
}
type TagCreateResponse struct {
Id int64 `json:"id"`
type SystemUserGetRequest struct {
Id int64 `path:"id"`
}
type TagEditRequest struct {
Id int64 `json:"id"`
CompanyId int64 `json:"-"`
Image string `json:"image"`
Name string `json:"name"` // 标签名称
Group string `json:"group"` // 标签分类
Remark string `json:"remark,optional"` // 备注
type SystemUserGetResponse struct {
User SystemUser `json:"user"`
}
type TagEditResponse struct {
Id int64 `json:"id"`
type SystemUser struct {
Id int64 `json:"id"` // 用户ID
Name string `json:"name"` // 名称
Avatar string `json:"avatar"` // 头像
Phone string `json:"phone"` // 手机号 唯一
Position string `json:"position"` // 职位
Enable int `json:"enable"` // 启用状态 1:启用 2:禁用
Departments []int64 `json:"departments"` // 所属部门
AccountFrom string `json:"accountFrom"` // 账号来源 后台新增、扫码注册
CreatedAt int64 `json:"createdAt"` // 注册时间
Roles []int64 `json:"roles"` // 角色
RolesDesc string `json:"rolesDesc"` // 角色描述
DepartmentsDesc string `json:"departmentsDesc"` // 部门描述
}
type TagGetRequest struct {
Id int64 `path:"id"`
CompanyId int64 `path:"-"`
type SystemUserUpdateRequest struct {
Id int64 `path:"id"`
Avatar string `json:"avatar,optional"` // 头像
Position string `json:"position"` // 职位
Departments []int64 `json:"departments"` // 所属部门
}
type TagGetResponse struct {
Id int64 `json:"id"`
Image string `json:"image"`
Name string `json:"name"` // 标签名称
Group string `json:"group"` // 标签分类
Remark string `json:"remark"` // 备注
type SystemUserUpdateResponse struct {
}
type TagListRequest struct {
Page int `json:"page"`
Size int `json:"size"`
CompanyId int64 `json:"-"`
TagName string `json:"tagName,optional"`
Group string `json:"group,optional"`
Remark string `json:"remark,optional"`
type SystemUserSearchRequest struct {
Page int `json:"page"`
Size int `json:"size"`
Name string `json:"name,optional"` // 名称
Phone string `json:"phone,optional"` // 手机号 唯一
Position string `json:"position,optional"` // 职位
Enable int `json:"enable,optional"` // 启用状态 1:启用 2:禁用
DepartmentId int64 `json:"departmentId,optional"` // 所属部门
}
type TagListResponse struct {
Total int64 `json:"total"`
List []TagItem `json:"list"`
type SystemUserSearchResponse struct {
List []SystemUser `json:"list"`
Total int64 `json:"total"`
}
type TagItem struct {
Id int64 `json:"id"`
Image string `json:"image"`
Name string `json:"name"` // 标签名称
Group string `json:"group"` // 标签分类
Remark string `json:"remark"` // 备注
CreatedAt int64 `json:"createdAt"`
type SystemUserAccountGetRequest struct {
Id int64 `path:"id"`
}
type TagDeleteRequest struct {
Id int64 `path:"id"`
CompanyId int64 `path:"-"`
type SystemUserAccountGetResponse struct {
User SystemUser `json:"user"`
}
type TagDeleteResponse struct {
type SystemUserAccountSaveRequest struct {
Name string `json:"name"` // 名称
Phone string `json:"phone"` // 手机号 唯一
Enable int `json:"enable"` // 启用状态 1:启用 2:禁用
Roles []int64 `json:"roles"` // 角色
}
type SystemUserAccountSaveResponse struct {
}
type SystemUserAccountEnableRequest struct {
UserIds []int64 `json:"userIds"` // 用户ID列表
Status int `json:"status"` // 状态 1:启用 2:禁用
}
type SystemUserAccountEnableResponse struct {
}
type SystemUserAccountUpdateRequest struct {
Id int64 `path:"id"`
}
type SystemUserAccountUpdateResponse struct {
}
type SystemUserAccountSearchRequest struct {
Page int `json:"page"`
Size int `json:"size"`
Name string `json:"name,optional"` // 名称
Phone string `json:"phone,optional"` // 手机号 唯一
RoleId int64 `json:"roleId,optional"` // 角色权限
Enable int `json:"enable,optional"` // 启用状态 1:启用 2:禁用
BeginTime int64 `json:"beginTime,optional"` // 注册日期-开始
EndTime int64 `json:"endTime,optional"` // 注册日期-结束
}
type SystemUserAccountSearchResponse struct {
List []SystemUser `json:"list"`
Total int64 `json:"total"`
}
type CompanySearchRequest struct {
Page int `json:"page,optional"`
Size int `json:"size,optional"`
Flag int `json:"flag,optional"` // 1:用户已加入的 2:用户未加入的公司
UserId int64 `json:"userId,optional"` // 按用户搜索(用户所加入的企业)
Code string `json:"code,optional"` // 按编码搜索
}
type CompanySearchResponse struct {
List []Company `json:"list"`
Total int64 `json:"total"`
}
type Company struct {
Id int64 `json:"id,omitempty"` // 唯一标识
Name string `json:"name,omitempty"` // 名称
Code string `json:"code,omitempty"` // 编码(搜索使用,4位字母数字)
Logo string `json:"logo,omitempty"` // 公司LOGO
}
type Location struct {
Longitude float64 `json:"longitude,optional"` //经度
Latitude float64 `json:"latitude,optional"` //纬度
Descript string `json:"descript,optional"` //地点描述
}
type ArticleAuthor struct {
Id int64 `json:"id"` // 人员id
Name string `json:"name"` // 人员的名字
Avatar string `json:"avatar"` // 人员头像URL
Position string `json:"position"` // 职位
Company string `json:"company"` // 公司
}
type MiniArticleCreateRequest struct {
Title string `json:"title"` //标题
Section []string `json:"section"` //文章的文本内容
AuthorId int64 `json:"authorId,optional"` //发布人id
Images []string `json:"images,optional"` //图片
WhoRead []int64 `json:"whoRead,optional"` //谁可查看
WhoReview []int64 `json:"whoReview,optional"` //谁可评论
Location Location `json:"location,optional"` //定位坐标
}
type MiniArticleCreateResponse struct {
Id int64 `json:"id"`
}
type MiniUserLoginRequest struct {
LoginType string `json:"loginType"` // 登录类型 wechat-login whchat-phone-login phone-password-login phone-smscode-login
WechatAuthCode string `json:"wechatAuthcode,optional"` // 微信登录 授权码
WechatEncryptedData string `json:"wechatEncryptedData,optional"` // 微信登录 加密数据
WechatIV string `json:"wechatIV,optional"` // 微信登录 加密算法初始向量
Phone string `json:"phone,optional"` // 手机号
Password string `json:"password,optional"` // 密码
SmsCode string `json:"smsCode,optional"` // 短信验证码
type MiniArticleGetRequest struct {
Id int64 `path:"id"` //id
CompanyId int64 `path:",optional"` //当前公司
UserId int `path:",optional"` //当前用户
}
type MiniUserLoginResponse struct {
Token string `json:"token"` // x-token
Phone string `json:"phone"` // 手机号
Message string `json:"message"` // 失败消息(审核中,注册成功等待审核)
Success bool `json:"success"` // 成功标识
type MiniArticleGetResponse struct {
Id int64 `json:"id"` //id
Title string `json:"title"` //标题
AuthorId int64 `json:"authorId"` //发布人id
Author ArticleAuthor `json:"author"` //发布人
CreatedAt int64 `json:"createdAt"` //文章的发布时间
Section []ArticleSection `json:"section"` //文章的文本内容
Images []string `json:"images"` //图片
WhoRead []int64 `json:"whoRead"` //谁可查看
WhoReview []int64 `json:"whoReview"` //谁可评论
Location Location `json:"location"` //定位坐标
CountLove int `json:"countLove"` // 点赞数量
CountComment int `json:"countComment"` // 评论数量
CountRead int `json:"countRead"` // 浏览数量
Show int `json:"show"` // 评论的展示状态(0显示、1不显示)
Edit int `json:"edit"` // 文章是否存在变更记录 (0 不存在 1存在)
MeLoveFlag int `json:"meLoveFlag"` //当前人员对文章的点赞标识
}
type MiniUserSwitchAccountRequest struct {
CompanyId int64 `json:"companyId"`
type ArticleSection struct {
Id int64 `json:"id"` //段落id
Content string `json:"content"` // 文本内容
SortBy int `json:"sortBy"` // 排序
TotalComment int `json:"totalComment"` // 评论的数量
}
type MiniUserInfoRequest struct {
type MiniArticleSearchMeRequest struct {
AuthorId int64 `json:",optional"`
CompanyId int64 `json:",optional"`
Page int `json:"page"`
Size int `json:"size"`
}
type MiniUserInfoResponse struct {
User *UserItem `json:"user,omitempty"` // 用户信息
TotalArticle int64 `json:"totalArticle"` // 累计信息发布
TotalLoved int64 `json:"totalLoved"` // 累计收到的赞
TotalAccepted int64 `json:"totalAccepted"` // 累计被采纳
Accounts []Account `json:"accounts"` // 公司账号
Auths []Auth `json:"auths"` // 权限列表
type MiniArticleSearchMeResponse struct {
Total int `json:"total"`
List []ArticleSearchMe `json:"list"`
}
type MiniUserApplyJoinCompanyRequest struct {
Phone string `json:"phone"`
Code string `json:"code"`
type ArticleSearchMe struct {
Id int64 `json:"id"` //id
Title string `json:"title"` //标题
Images []string `json:"images"` //图片
CreatedAt int64 `json:"createdAt"` //文章的创建日期
CountLove int `json:"countLove"` //点赞数量
CountComment int `json:"CountComment"` //评论数量
Show int `json:"show"` //是否隐藏 [0显示、1不显示]
}
type MiniUserApplyJoinCompanyResponse struct {
type MiniUserLikeArticleRequest struct {
ArticleId int64 `json:"articleId"` // 文章id
CompanyId int64 `json:",optional"` //公司id
Page int `json:"page"` //分页,第几页
Size int `json:"size"` //分页,每页几条
}
type MiniUserAuditRequest struct {
UserId int64 `json:"userId"` // 用户ID
Status int `json:"status"` // 审核状态 1:审核通过 2:拒绝
type MiniUserLikeArticleResponse struct {
Total int64 `json:"total"` //总数
List []WhichUserLikeArticle `json:"list"` //列表
}
type MiniUserDepartmentUsersRequest struct {
type WhichUserLikeArticle struct {
ArticleId int64 `json:"articleId"` // 文章id
UserId int64 `json:"userId"` // 人员id
Name string `json:"name"` // 人员名称
Avatar string `json:"avatar"` // 人员头像
CreatedAt int64 `json:"createdAt"` // 点赞记录的时间
}
type MiniUserDepartmentUsersResponse struct {
Departments []*Department `json:"departments"`
Users []*UserItem `json:"users"`
type MiniSetUserLikeRequset struct {
ArticleId int64 `json:"articleId"` //文章id
CommentId int64 `json:"commentId"` //评论id
UserId int64 `json:",optional"` //操作人
Flag int `json:"flag"` //点赞标志 1、点赞 2 、取消点赞
}
type MiniUserFollowedSearchRequest struct {
Page int `json:"page,optional"`
Size int `json:"size,optional"`
type MiniSetUserLikeResponse struct {
ArticleId int64 `json:"articleId"` //文章id
CommentId int64 `json:"commentId"` //评论id
Count int `json:"count"` //现有的点赞数量
}
type MiniUserFollowedSearchResponse struct {
List []*UserFollowItem `json:"users"`
Total int64 `json:"total"`
type MiniArticleBackupSearchRequest struct {
Page int `json:"page"`
Size int `json:"size"`
ArticleId int `json:"articleId"`
CompanyId int64 `json:",optional"` // 服务端自动获取
}
type UserItem struct {
Id int64 `json:"id,omitempty"` // 用户ID
CompanyId int64 `json:"companyId,omitempty"` // 公司ID
CompanyName string `json:"companyName,omitempty"` // 公司名称
Flag int `json:"flag,omitempty"` // 标识 1:管理员 2:普通用户 (有绑定角色是管理员)
Name string `json:"name,omitempty"` // 名称
Avatar string `json:"avatar,omitempty"` // 头像
Phone string `json:"phone,omitempty"` // 手机号 唯一
Position string `json:"position,omitempty"` // 职位
Enable int `json:"enable,omitempty"` // 启用状态 1:启用 2:禁用
AuditStatus *int `json:"auditStatus,omitempty"` // 审核状态 0:待审核 1:审核通过 2:拒绝
Follower []int64 `json:"followers,omitempty"` // 关注我的人 (冗余)
Following []int64 `json:"following,omitempty"` // 我关注的人 (冗余)
Departments []int64 `json:"departments,omitempty"` // 所属部门
AccountFrom string `json:"accountFrom,omitempty"` // 账号来源 后台新增、扫码注册
type MiniArticleBackupSearchResponse struct {
Total int64 `json:"total"`
List []MiniArticleBackupItem `json:"list"`
}
type Account struct {
CompanyId int64 `json:"companyId"` // 公司ID
CompanyName string `json:"companyName"` // 公司名称
Logo string `json:"logo"` // 公司图标
UserId int64 `json:"userId"` // 用户ID
Name string `json:"name"` // 名称
Position string `json:"position"` // 职位
type MiniArticleBackupItem struct {
Id int64 `json:"id"`
Title string `json:"title"`
Content string `json:"content"`
Images []string `json:"images"`
CreatedAt int64 `json:"createdAt"`
Location Location `json:"location"`
}
type Department struct {
Id int64 `json:"id,omitempty"` // 部门ID
CompanyId int64 `json:"companyId,omitempty"` // 公司ID
ParentId int64 `json:"parentId,omitempty"` // 父级ID
Name string `json:"name,omitempty"` // 部门名称
type MiniArticleMarkUserReadRequest struct {
UserId int64 `json:",optional"` // 当前操作人
CompanyId int64 `json:",optional"` // 当前公司
ArticleId int64 `json:"articleId"` // 文章id
}
type UserSearchRequest struct {
Page int `json:"page,optional"`
Size int `json:"size,optional"`
AuditFlag *int `json:"auditFlag,optional"` // 按审核状态 0:待审核 1:审核通过 2:拒绝
type MiniArticleMarkUserReadResponse struct {
Id int64 `json:"id"`
}
type UserSearchResponse struct {
List []*UserItem `json:"list"`
Total int64 `json:"total"`
type MiniArticleDraftCreateRequest struct {
CompanyId int64 `json:",optional"`
AuthorId int64 `json:",optional"` // 发布人
Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式
Section []string `json:"section"` // 填写的内容
Title string `json:"title"` // 标题
Images []string `json:"images"` // 图片
WhoRead []int64 `json:"whoRead"` // 谁可以看
WhoReview []int64 `json:"whoReview"` // 评论人
Location Location `json:"location"` // 坐标
}
type FollowRequest struct {
UserId int64 `json:"userId"`
type MiniArticleDraftCreateResponse struct {
Id int64 `json:"id"`
}
type UserFollowItem struct {
Id int64 `json:"id"` // 用户ID
Name string `json:"name"` // 名称
CompanyName string `json:"companyName"` // 公司名称
Avatar string `json:"avatar"` // 头像
Position string `json:"position"` // 职位
Followed bool `json:"followed"` // 关注
MutualFollowed bool `json:"mutualFollowed"` // 互相关注标识
type MiniArticleDraftUpdateRequest struct {
Id int64 `json:"id"`
CompanyId int64 `json:",optional"`
AuthorId int64 `json:",optional"` // 发布人
Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式
Section []string `json:"section"` // 填写的内容
Title string `json:"title"` // 标题
Images []string `json:"images"` // 图片
WhoRead []int64 `json:"whoRead"` // 谁可以看
WhoReview []int64 `json:"whoReview"` // 评论人
Location Location `json:"location"` // 坐标
}
type MiniMyLikeRequest struct {
type MiniArticleDraftUpdateResponse struct {
Id int64 `json:"id"`
}
type MiniArticleDraftSearchMeRequest struct {
CompanyId int64 `json:",optional"` // 公司id
AuthorId int64 `json:",optional"` // 发布人
Page int `json:"page"`
Size int `json:"size"`
}
type MiniArticleDraftSearchMeResponse struct {
Total int64 `json:"total"`
List []MiniArticleDraftItem `json:"list"`
}
type MiniArticleDraftItem struct {
Id int64 `json:"id"`
Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式
Section []string `json:"section"` // 填写的内容
Title string `json:"title"` // 标题
Images []string `json:"images"` // 图片
CreatedAt int64 `json:"createdAt"`
}
type MiniArticleDraftGetMeRequest struct {
CompanyId int64 `path:",optional"` // 公司id
AuthorId int64 `path:",optional"` // 发布人
Id int64 `path:"id"`
}
type MiniArticleDraftGetMeResponse struct {
Id int64 `json:"id"` //
Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式
Section []string `json:"Section"` // 填写的内容
Title string `json:"title"` // 标题
Images []string `json:"images"` // 图片
WhoRead []int64 `json:"whoRead"` // 谁可以看
WhoReview []int64 `json:"whoReview"` // 评论人
Location Location `json:"location"` // 坐标
}
type MiniArticleDraftDeleteMeRequest struct {
CompanyId int64 `path:",optional"` // 公司id
AuthorId int64 `path:",optional"` // 发布人
Id int64 `path:"id"`
}
type MiniArticleDraftDeleteMeResponse struct {
Id int64 `json:"id"` //
}
type MiniArticleMarkListRequest struct {
Page int `json:"page"`
Size int `json:"size"`
}
type MiniMyLikeResponse struct {
List []MyLikeItem `json:"list"`
Total int64 `json:"total"`
type MiniArticleMarkListResponse struct {
Total int64 `json:"total"`
List []MiniArticleMarkItem `json:"list"`
}
type MyLikeItem struct {
UserId int64 `json:"userId"` // 发布人id
ArticleId int64 `json:"articleId"` // 文章id
CommentId int64 `json:"commentId"` // 评论id
CreatedAt int64 `json:"createdAt"` // 创建时间
User *SimpleUser `json:"user"` // 发布人
Article *SimpleArticle `json:"article"` // 文章
Comment *SimpleComment `json:"comment"` // 评论
type MiniArticleMarkItem struct {
Id int64 `json:"id"`
CompanyId int64 `json:"companyId"`
UserId int64 `json:"userId"`
ArticleId int64 `json:"articleId"`
Title string `json:"title"`
Author SimpleUser `json:"author"` // 发布人
UpdatedAt int64 `json:"updatedAt"`
}
type SimpleComment struct {
Id int64 `json:"id"`
Content string `json:"content"` // 评论内容
CountLove int `json:"countLove"` // 点赞数量
CountComment int `json:"countComment"` // 评论数量
Show int `json:"show"` // 评论的展示状态(0显示、1不显示)
type SystemArticleGetRequest struct {
Id int64 `path:"id"` //id
CompanyId int64 `path:",optional"`
}
type SystemUserInfoRequest struct {
type UserShowName struct {
Id int `json:"id"`
Name int `json:"name"`
}
type SystemUserInfoResponse struct {
UserId int64 `json:"userId"`
UserName string `json:"userName"`
Avatar string `json:"avatar"`
CompanyId int64 `json:"companyId"`
CompanyName string `json:"companyName"`
type SystemArticleGetResponse struct {
Id int64 `json:"id"` // id
Title string `json:"title"` // 标题
AuthorId int64 `json:"authorId"` // 发布人id
Author ArticleAuthor `json:"author"` // 发布人
CreatedAt int64 `json:"createdAt"` // 文章的发布时间
Section []ArticleSection `json:"section"` // 文章的文本内容
Images []string `json:"images"` // 图片
WhoRead []int64 `json:"whoRead"` // 谁可查看
WhoReadInfo []UserShowName `json:"whoReadInfo"` // 谁可查看
WhoReview []int64 `json:"whoReview"` // 谁可评论
WhoReviewInfo []UserShowName `json:"whoReviewInfo"` // 谁可评论
Location Location `json:"location"` // 定位坐标
CountLove int `json:"countLove"` // 点赞数量
CountComment int `json:"countComment"` // 评论数量
CountRead int `json:"countRead"` // 浏览数量
Show int `json:"show"` // 评论的展示状态(0显示、1不显示)
}
type CompanySearchRequest struct {
Page int `json:"page,optional"`
Size int `json:"size,optional"`
Flag int `json:"flag,optional"` // 1:用户已加入的 2:用户未加入的公司
UserId int64 `json:"userId,optional"` // 按用户搜索(用户所加入的企业)
Code string `json:"code,optional"` // 按编码搜索
type SystemArticleSearchRequest struct {
CompanyId int64 `json:",optional"`
Page int `json:"page"`
Size int `json:"size"`
}
type CompanySearchResponse struct {
List []Company `json:"list"`
Total int64 `json:"total"`
type SystemArticleSearchResponse struct {
Total int `json:"total"`
List []SystemArticleSearch `json:"list"`
}
type Company struct {
Id int64 `json:"id,omitempty"` // 唯一标识
Name string `json:"name,omitempty"` // 名称
Code string `json:"code,omitempty"` // 编码(搜索使用,4位字母数字)
Logo string `json:"logo,omitempty"` // 公司LOGO
type SystemArticleSearch struct {
Id int64 `json:"id"` //id
Title string `json:"title"` //标题
Author string `json:"author"` //发布人
Images []string `json:"images"` //图片
CreatedAt int64 `json:"createdAt"` //文章的创建日期
CountLove int `json:"countLove"` //点赞数量
CountComment int `json:"CountComment"` //评论数量
Show int `json:"show"` //是否隐藏 [0显示、1不显示]
Tags []string `json:"tags"` //标签
TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人]
}
type RoleGetRequest struct {
... ...
... ... @@ -10,27 +10,28 @@ import (
)
type ArticleComment struct {
Id int64 `gorm:"primaryKey"` // 唯一标识
CompanyId int64
CreatedAt int64
UpdatedAt int64
IsDel soft_delete.DeletedAt `gorm:"softDelete:flag,DeletedAtField:DeletedAt"`
DeletedAt int64
Version int
Pid int64 // 对哪个评论进行回复
TopId int64 // 归属于最上级的哪个评论
ArticleId int64 // 文章id
ArticleSectionId int64 // 文本内容id
SectionContent string // 引用的文章内容文本
FromUserId int64 // 谁填写的评论
FromUser domain.UserSimple `gorm:"type:jsonb;serializer:json"` // 谁填写的评论
ToUserId int64 // 回复谁的评论
ToUser domain.UserSimple `gorm:"type:jsonb;serializer:json"` // 回复谁的评论
Content string // 评论内容
CountReply int // 回复数量
CountUserLove int // 用户点赞数量
CountAdminLove int // 运营点赞数量
Show int // 评论的展示状态(0显示、1不显示)
Id int64 `gorm:"primaryKey"` // 唯一标识
CompanyId int64
CreatedAt int64
UpdatedAt int64
IsDel soft_delete.DeletedAt `gorm:"softDelete:flag,DeletedAtField:DeletedAt"`
DeletedAt int64
Version int
Pid int64 // 对哪个评论进行回复
TopId int64 // 归属于最上级的哪个评论
ArticleId int64 // 文章id
SectionId int64 // 文本内容id
SectionContent string // 引用的文章内容文本
FromUserId int64 // 谁填写的评论
FromUser domain.UserSimple `gorm:"type:jsonb;serializer:json"` // 谁填写的评论
ToUserId int64 // 回复谁的评论
ToUser domain.UserSimple `gorm:"type:jsonb;serializer:json"` // 回复谁的评论
AtWho []domain.UserSimple `gorm:"type:jsonb;serializer:json"` // 填写评论@的人
Content string // 评论内容
CountReply int // 回复数量
CountUserLove int // 用户点赞数量
CountAdminLove int // 运营点赞数量
Show int // 评论的展示状态(0显示、1不显示)
}
func (m *ArticleComment) TableName() string {
... ...
... ... @@ -14,6 +14,7 @@ type User struct {
Roles []int64 `gorm:"type:jsonb;serializer:json"` // 角色
Flag int // 标识 1:管理员 2:普通用户 (有绑定角色是管理员)
Name string // 名称
PinYinName string
Avatar string // 头像
Phone string // 手机号 唯一
Position string // 职位
... ...
... ... @@ -142,26 +142,26 @@ func (repository *ArticleCommentRepository) Find(ctx context.Context, conn trans
func (repository *ArticleCommentRepository) ModelToDomainModel(from *models.ArticleComment) (*domain.ArticleComment, error) {
to := &domain.ArticleComment{
Id: from.Id,
CompanyId: from.CompanyId,
CreatedAt: from.CreatedAt,
UpdatedAt: from.UpdatedAt,
DeletedAt: from.DeletedAt,
Version: from.Version,
Pid: from.Pid,
TopId: from.TopId,
ArticleId: from.ArticleId,
ArticleSectionId: from.ArticleSectionId,
SectionContent: from.SectionContent,
FromUserId: from.FromUserId,
FromUser: from.FromUser,
ToUserId: from.ToUser.Id,
ToUser: from.ToUser,
Content: from.Content,
CountReply: from.CountReply,
CountUserLove: from.CountUserLove,
CountAdminLove: from.CountAdminLove,
Show: domain.CommentShow(from.Show),
Id: from.Id,
CompanyId: from.CompanyId,
CreatedAt: from.CreatedAt,
UpdatedAt: from.UpdatedAt,
DeletedAt: from.DeletedAt,
Version: from.Version,
Pid: from.Pid,
TopId: from.TopId,
ArticleId: from.ArticleId,
SectionId: from.SectionId,
SectionContent: from.SectionContent,
FromUserId: from.FromUserId,
FromUser: from.FromUser,
ToUserId: from.ToUser.Id,
ToUser: from.ToUser,
Content: from.Content,
CountReply: from.CountReply,
CountUserLove: from.CountUserLove,
CountAdminLove: from.CountAdminLove,
Show: domain.CommentShow(from.Show),
}
// err := copier.Copy(to, from)
return to, nil
... ... @@ -169,26 +169,26 @@ func (repository *ArticleCommentRepository) ModelToDomainModel(from *models.Arti
func (repository *ArticleCommentRepository) DomainModelToModel(from *domain.ArticleComment) (*models.ArticleComment, error) {
to := &models.ArticleComment{
Id: from.Id,
CompanyId: from.CompanyId,
CreatedAt: from.CreatedAt,
UpdatedAt: from.UpdatedAt,
DeletedAt: from.DeletedAt,
Version: from.Version,
Pid: from.Pid,
TopId: from.TopId,
ArticleId: from.ArticleId,
ArticleSectionId: from.ArticleSectionId,
SectionContent: from.SectionContent,
FromUserId: from.FromUserId,
FromUser: from.FromUser,
ToUserId: from.ToUser.Id,
ToUser: from.ToUser,
Content: from.Content,
CountReply: from.CountReply,
CountUserLove: from.CountUserLove,
CountAdminLove: from.CountAdminLove,
Show: int(from.Show),
Id: from.Id,
CompanyId: from.CompanyId,
CreatedAt: from.CreatedAt,
UpdatedAt: from.UpdatedAt,
DeletedAt: from.DeletedAt,
Version: from.Version,
Pid: from.Pid,
TopId: from.TopId,
ArticleId: from.ArticleId,
SectionId: from.SectionId,
SectionContent: from.SectionContent,
FromUserId: from.FromUserId,
FromUser: from.FromUser,
ToUserId: from.ToUser.Id,
ToUser: from.ToUser,
Content: from.Content,
CountReply: from.CountReply,
CountUserLove: from.CountUserLove,
CountAdminLove: from.CountAdminLove,
Show: int(from.Show),
}
// err := copier.Copy(to, from)
return to, nil
... ...
... ... @@ -2,6 +2,7 @@ package repository
import (
"context"
"fmt"
"github.com/jinzhu/copier"
"github.com/pkg/errors"
"github.com/tiptok/gocomm/pkg/cache"
... ... @@ -141,7 +142,7 @@ func (repository *UserRepository) Find(ctx context.Context, conn transaction.Con
total int64
)
queryFunc := func() (interface{}, error) {
tx = tx.Model(&ms).Order("id asc")
tx = tx.Model(&ms)
if v, ok := queryOptions["companyId"]; ok {
tx.Where("company_id = ?", v)
}
... ... @@ -154,6 +155,34 @@ func (repository *UserRepository) Find(ctx context.Context, conn transaction.Con
if v, ok := queryOptions["auditStatus"]; ok {
tx.Where("audit_status in (?)", v)
}
// 列表查询条件
if v, ok := queryOptions["likeName"]; ok {
tx.Where("name like ? ", fmt.Sprintf("%%%v%%", v))
}
if v, ok := queryOptions["likePhone"]; ok {
tx.Where("phone like ? ", fmt.Sprintf("%%%v%%", v))
}
if v, ok := queryOptions["departmentId"]; ok {
tx.Where(fmt.Sprintf("departments @>'[%v]'", v))
}
if v, ok := queryOptions["roleId"]; ok {
tx.Where(fmt.Sprintf("roles @>'[%v]'", v))
}
if v, ok := queryOptions["enable"]; ok {
tx.Where("enable = ?", v)
}
if v, ok := queryOptions["beginTime"]; ok {
tx.Where("created_at >= ?", v)
}
if v, ok := queryOptions["endTime"]; ok {
tx.Where("created_at < ?", v)
}
if v, ok := queryOptions["orderBy"]; ok {
tx.Order(v)
} else {
tx.Order("id asc")
}
if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil {
return dms, tx.Error
}
... ...
... ... @@ -8,26 +8,27 @@ import (
// 文章评论
type ArticleComment struct {
Id int64 `json:"id"` // 评论id
CompanyId int64 `json:"companyId"`
CreatedAt int64 `json:"createdAt,omitempty"`
UpdatedAt int64 `json:"updatedAt,omitempty"`
DeletedAt int64 `json:"deletedAt,omitempty"`
Version int `json:"version,omitempty"`
Pid int64 `json:"pid"` // 对哪个评论进行回复
TopId int64 `json:"topId"` // 归属于最上级的哪个评论
ArticleId int64 `json:"articleId"` // 文章id
ArticleSectionId int64 `json:"articleSectionId"` // 文本内容id
SectionContent string `json:"sectionContent"` // 引用的文章内容文本
FromUserId int64 `json:"fromUserId"` // 谁填写的评论
FromUser UserSimple `json:"fromUser"` // 谁填写的评论
ToUserId int64 `json:"toUserId"` // 回复谁的评论
ToUser UserSimple `json:"toUser"` // 回复谁的评论
Content string `json:"content"` // 评论内容
CountReply int `json:"countReply"` // 回复数量
CountUserLove int `json:"countUserLove"` // 用户点赞数量
CountAdminLove int `json:"countAdminLove"` // 运营点赞数量
Show CommentShow `json:"showState"` // 评论的展示状态(0显示、1不显示)
Id int64 `json:"id"` // 评论id
CompanyId int64 `json:"companyId"`
CreatedAt int64 `json:"createdAt,omitempty"`
UpdatedAt int64 `json:"updatedAt,omitempty"`
DeletedAt int64 `json:"deletedAt,omitempty"`
Version int `json:"version,omitempty"`
Pid int64 `json:"pid"` // 对哪个评论进行回复
TopId int64 `json:"topId"` // 归属于最上级的哪个评论
ArticleId int64 `json:"articleId"` // 文章id
SectionId int64 `json:"sectionId"` // 文本段落内容id
SectionContent string `json:"sectionContent"` // 引用的文章内容文本
FromUserId int64 `json:"fromUserId"` // 谁填写的评论
FromUser UserSimple `json:"fromUser"` // 谁填写的评论
ToUserId int64 `json:"toUserId"` // 回复谁的评论
ToUser UserSimple `json:"toUser"` // 回复谁的评论
Content string `json:"content"` // 评论内容
CountReply int `json:"countReply"` // 回复数量
CountUserLove int `json:"countUserLove"` // 用户点赞数量
CountAdminLove int `json:"countAdminLove"` // 运营点赞数量
Show CommentShow `json:"showState"` // 评论的展示状态(0显示、1不显示)
AtWho []UserSimple `json:"atWho"` // 填写评论时@的人
// ...more
}
... ...
... ... @@ -64,6 +64,10 @@ func (options QueryOptions) WithFindOnly() QueryOptions {
options["findOnly"] = true
return options
}
func (options QueryOptions) WithOrder(order string) QueryOptions {
options["orderBy"] = order
return options
}
func LazyLoad[K comparable, T any](source map[K]T, ctx context.Context, conn transaction.Conn, k K, load func(context.Context, transaction.Conn, K) (T, error)) (T, error) {
if v, ok := source[k]; ok {
... ... @@ -77,6 +81,15 @@ func LazyLoad[K comparable, T any](source map[K]T, ctx context.Context, conn tra
}
}
func Values[T any, V any](list []T, each func(item T) V) []V {
var result []V
for _, item := range list {
value := each(item)
result = append(result, value)
}
return result
}
/*************** 索引函数 ****************/
func IndexCompanyId(companyId int64) IndexQueryOptionFunc {
return func() QueryOptions {
... ...
... ... @@ -29,11 +29,11 @@ type Opinion struct {
}
type UserSimple struct {
Id int64 `json:"id"` // 人员id
Name string `json:"name"` // 人员的名字
Avatar string `json:"avatar,omitempty"` // 人员头像URL
GroupId int64 `json:"groupId,omitempty"`
Group string `json:"group,omitempty"` // 人员的分组
Id int64 `json:"id"` // 人员id
Name string `json:"name"` // 人员的名字
Avatar string `json:"avatar,omitempty"` // 人员头像URL
// GroupId int64 `json:"groupId"` //分组id
//Group string `json:"group,omitempty"` // 人员的分组
Position string `json:"position,omitempty"` // 职位
Company string `json:"company,omitempty"` // 公司
CompanyId int64 `json:"companyId"`
... ...
... ... @@ -5,6 +5,7 @@ import (
"fmt"
"github.com/samber/lo"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/tool"
)
type User struct {
... ... @@ -14,6 +15,7 @@ type User struct {
Roles []int64 `json:"roleId,omitempty"` // 角色
Flag int `json:"flag,omitempty"` // 标识 1:管理员 2:普通用户 (有绑定角色是管理员)
Name string `json:"name,omitempty"` // 名称
PinYinName string `json:"pin_yin_name"` // 拼音名
Avatar string `json:"avatar,omitempty"` // 头像
Phone string `json:"phone,omitempty"` // 手机号 唯一
Position string `json:"position,omitempty"` // 职位
... ... @@ -111,6 +113,7 @@ func (m *User) AddRole(roleId int64) {
return
}
m.Roles = append(m.Roles, roleId)
m.Flag = lo.Ternary(len(m.Roles) > 0, UserAdmin, UserCommon)
}
// RemoveRole 移除角色
... ... @@ -121,6 +124,12 @@ func (m *User) RemoveRole(roleId int64) {
m.Roles = lo.Without(m.Roles, roleId)
}
func (m *User) WithName(name string) *User {
m.Name = name
m.PinYinName = tool.ToPinYin(name, " ")
return m
}
type (
LoginCreator interface {
WechatLogin(r WechatLoginRequest) (*LoginInfo, error)
... ...
... ... @@ -6,6 +6,7 @@ require (
github.com/golang-jwt/jwt/v4 v4.5.0
github.com/jinzhu/copier v0.4.0
github.com/jinzhu/now v1.1.5
github.com/mozillazg/go-pinyin v0.20.0
github.com/pkg/errors v0.9.1
github.com/samber/lo v1.38.1
github.com/silenceper/wechat/v2 v2.1.4
... ...
package tool
import (
"strings"
"github.com/mozillazg/go-pinyin"
)
func ToPinYin(hans string, sep string) string {
a := pinyin.NewArgs()
tmp := pinyin.Pinyin(hans, a)
result := make([]string, 0)
for i := range tmp {
result = append(result, tmp[i]...)
}
py := strings.Join(result, sep)
if len(py) == 0 {
return strings.ToLower(hans)
}
return py
}
... ...