作者 tangxvhui
正在显示 34 个修改的文件 包含 1121 行增加29 行删除
import "core/comment.api"
import "core/message.api"
import "core/article_tag.api"
import "core/user.api"
import "core/company.api"
\ No newline at end of file
... ...
syntax = "v1"
info(
title: "天联鹰蜓"
desc: "天联鹰蜓"
author: "email"
email: "email"
version: "v1"
)
// 小程序接口
@server(
prefix: v1
group: company
)
service Core {
@doc "公司搜索"
@handler miniCompanySearch
post /mini/company/search(CompanySearchRequest) returns (CompanySearchResponse)
}
// 小程序接口
@server(
prefix: v1
group: company
jwt : SystemAuth
)
service Core {
@doc "公司搜索"
@handler systemCompanySearch
post /system/company/search(CompanySearchRequest) returns (CompanySearchResponse)
}
type (
CompanySearchRequest struct{
Page int `json:"page"`
Size int `json:"size"`
UserId int64 `json:"userId,optional"` // 按用户搜索
Code string `json:"code,optional"` // 按编码搜索
}
CompanySearchResponse{
List []Company `json:"list"`
Total int64 `json:"total"`
}
Company struct{
Id int64 `json:"id,omitempty"` // 唯一标识
Name string `json:"name,omitempty"` // 名称
Code string `json:"code,omitempty"` // 编码(搜索使用,4位字母数字)
Logo string `json:"logo,omitempty"` // 公司LOGO
}
)
\ No newline at end of file
... ...
syntax = "v1"
info(
title: "天联鹰蜓"
desc: "天联鹰蜓"
author: "email"
email: "email"
version: "v1"
)
// 小程序接口
@server(
prefix: v1
group: user
)
service Core {
@doc "用户申请加入公司"
@handler miniUserApplyJoinCompany
post /mini/user/apply-join-company(MiniUserApplyJoinCompanyRequest) returns (MiniUserApplyJoinCompanyResponse)
@doc "用户登录"
@handler miniUserLogin
post /mini/user/login (MiniUserLoginRequest) returns (MiniUserLoginResponse)
}
@server(
prefix: v1
group: user
jwt: MiniAuth
)
service Core {
@doc "用户信息"
@handler miniUserInfo
post /mini/user/info (MiniUserInfoRequest) returns (MiniUserInfoResponse)
@doc "用户审核列表"
@handler miniUserAuditList
post /mini/user/audit-list (UserSearchRequest)returns(UserSearchResponse)
@doc "用户审核"
@handler miniUserAudit
post /mini/user/audit (MiniUserAuditRequest)
@doc "部门用户列表"
@handler miniUserDepartmentUsers
post /mini/user/department-users (MiniUserDepartmentUsersRequest)returns (MiniUserInfoResponse)
@doc "关注我的人"
@handler miniUserFollower
post /mini/user/follower (UserSearchRequest)returns(UserSearchResponse)
@doc "我关注的人"
@handler miniUserFollowing
post /mini/user/following (UserSearchRequest)returns(UserSearchResponse)
@doc "关注"
@handler miniUserFollow
post /mini/user/follow (FollowRequest)
@doc "取消关注"
@handler miniUserUnFollow
post /mini/user/unfollow (FollowRequest)
}
type(
MiniUserLoginRequest {
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"` // 短信验证码
}
MiniUserLoginResponse {
Token string `json:"token"` // x-token
Phone string `json:"phone"` // 手机号
Message string `json:"message"` // 失败消息(审核中,注册成功等待审核)
Success bool `json:"success"` // 成功标识
}
MiniUserInfoRequest {
//MyStatisticsFlag bool `json:"myStatisticsFlag"` // true:返回统计信息 false;统计信息不返回
}
MiniUserInfoResponse {
User *UserItem `json:"user,omitempty"` // 用户信息
TotalArticle int64 `json:"totalArticle"` // 累计信息发布
TotalLoved int64 `json:"totalLoved"` // 累计收到的赞
TotalAccepted int64 `json:"totalAccepted"` // 累计被采纳
}
MiniUserApplyJoinCompanyRequest{
Phone string `json:"phone"`
Code string `json:"code"`
}
MiniUserApplyJoinCompanyResponse{
}
MiniUserAuditRequest{
UserId int64 `json:"userId"` // 用户ID
}
MiniUserDepartmentUsersRequest{
}
MiniUserDepartmentUsersResponse{
Departments []*Department `json:"departments"`
Users []*UserItem `json:"users"`
}
UserItem {
CompanyId int64 `json:"companyId,omitempty"` // 公司ID
DepartmentId int64 `json:"departmentId,omitempty"` // 部门ID
Roles []int64 `json:"roleId,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"` // 我关注的人 (冗余)
}
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"` // 部门名称
}
UserSearchRequest{
Page int `json:"page,optional"`
Size int `json:"size,optional"`
AuditFlag *int `json:"auditFlag,optional"` // 按审核状态 0:待审核 1:审核通过 2:拒绝
}
UserSearchResponse{
List []*UserItem `json:"list"`
Total int64 `json:"total"`
}
FollowRequest{
UserId int64 `json:"userId"`
}
)
// 后台接口
//@server(
// prefix: v1
// group: user
// jwt: SystemAuth
//)
//service Core {
// @doc "系统评论"
// @handler systemUser
// get /system/user () returns ()
//}
\ No newline at end of file
... ...
package company
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/company"
"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 MiniCompanySearchHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.CompanySearchRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := company.NewMiniCompanySearchLogic(r.Context(), svcCtx)
resp, err := l.MiniCompanySearch(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}
... ...
package company
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/company"
"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 SystemCompanySearchHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.CompanySearchRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := company.NewSystemCompanySearchLogic(r.Context(), svcCtx)
resp, err := l.SystemCompanySearch(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}
... ...
... ... @@ -5,7 +5,9 @@ import (
"net/http"
comment "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/comment"
company "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/company"
message "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/message"
user "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/user"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"github.com/zeromicro/go-zero/rest"
... ... @@ -52,4 +54,90 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret),
rest.WithPrefix("/v1"),
)
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodPost,
Path: "/mini/user/apply-join-company",
Handler: user.MiniUserApplyJoinCompanyHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/mini/user/login",
Handler: user.MiniUserLoginHandler(serverCtx),
},
},
rest.WithPrefix("/v1"),
)
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodPost,
Path: "/mini/user/info",
Handler: user.MiniUserInfoHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/mini/user/audit-list",
Handler: user.MiniUserAuditListHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/mini/user/audit",
Handler: user.MiniUserAuditHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/mini/user/department-users",
Handler: user.MiniUserDepartmentUsersHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/mini/user/follower",
Handler: user.MiniUserFollowerHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/mini/user/following",
Handler: user.MiniUserFollowingHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/mini/user/follow",
Handler: user.MiniUserFollowHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/mini/user/unfollow",
Handler: user.MiniUserUnFollowHandler(serverCtx),
},
},
rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret),
rest.WithPrefix("/v1"),
)
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodPost,
Path: "/mini/company/search",
Handler: company.MiniCompanySearchHandler(serverCtx),
},
},
rest.WithPrefix("/v1"),
)
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodPost,
Path: "/system/company/search",
Handler: company.SystemCompanySearchHandler(serverCtx),
},
},
rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret),
rest.WithPrefix("/v1"),
)
}
... ...
package user
import (
"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 MiniUserApplyJoinCompanyHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.MiniUserApplyJoinCompanyRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := user.NewMiniUserApplyJoinCompanyLogic(r.Context(), svcCtx)
resp, err := l.MiniUserApplyJoinCompany(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}
... ...
package user
import (
"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 MiniUserAuditHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.MiniUserAuditRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := user.NewMiniUserAuditLogic(r.Context(), svcCtx)
err := l.MiniUserAudit(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.Ok(w)
}
}
}
... ...
package user
import (
"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 MiniUserAuditListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.UserSearchRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := user.NewMiniUserAuditListLogic(r.Context(), svcCtx)
resp, err := l.MiniUserAuditList(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}
... ...
package user
import (
"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 MiniUserDepartmentUsersHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.MiniUserDepartmentUsersRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := user.NewMiniUserDepartmentUsersLogic(r.Context(), svcCtx)
resp, err := l.MiniUserDepartmentUsers(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}
... ...
package user
import (
"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 MiniUserFollowHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.FollowRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := user.NewMiniUserFollowLogic(r.Context(), svcCtx)
err := l.MiniUserFollow(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.Ok(w)
}
}
}
... ...
package user
import (
"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 MiniUserFollowerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.UserSearchRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := user.NewMiniUserFollowerLogic(r.Context(), svcCtx)
resp, err := l.MiniUserFollower(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}
... ...
package user
import (
"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 MiniUserFollowingHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.UserSearchRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := user.NewMiniUserFollowingLogic(r.Context(), svcCtx)
resp, err := l.MiniUserFollowing(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}
... ...
package user
import (
"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 MiniUserInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.MiniUserInfoRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := user.NewMiniUserInfoLogic(r.Context(), svcCtx)
resp, err := l.MiniUserInfo(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}
... ...
package user
import (
"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 MiniUserLoginHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.MiniUserLoginRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := user.NewMiniUserLoginLogic(r.Context(), svcCtx)
resp, err := l.MiniUserLogin(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}
... ...
package user
import (
"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 MiniUserUnFollowHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.FollowRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := user.NewMiniUserUnFollowLogic(r.Context(), svcCtx)
err := l.MiniUserUnFollow(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.Ok(w)
}
}
}
... ...
package company
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 MiniCompanySearchLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewMiniCompanySearchLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniCompanySearchLogic {
return &MiniCompanySearchLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *MiniCompanySearchLogic) MiniCompanySearch(req *types.CompanySearchRequest) (resp *types.CompanySearchResponse, err error) {
// todo: add your logic here and delete this line
return
}
... ...
package company
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 SystemCompanySearchLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewSystemCompanySearchLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemCompanySearchLogic {
return &SystemCompanySearchLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *SystemCompanySearchLogic) SystemCompanySearch(req *types.CompanySearchRequest) (resp *types.CompanySearchResponse, 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"
"github.com/zeromicro/go-zero/core/logx"
)
type MiniUserApplyJoinCompanyLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewMiniUserApplyJoinCompanyLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniUserApplyJoinCompanyLogic {
return &MiniUserApplyJoinCompanyLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *MiniUserApplyJoinCompanyLogic) MiniUserApplyJoinCompany(req *types.MiniUserApplyJoinCompanyRequest) (resp *types.MiniUserApplyJoinCompanyResponse, 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"
"github.com/zeromicro/go-zero/core/logx"
)
type MiniUserAuditListLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewMiniUserAuditListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniUserAuditListLogic {
return &MiniUserAuditListLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *MiniUserAuditListLogic) MiniUserAuditList(req *types.UserSearchRequest) (resp *types.UserSearchResponse, 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"
"github.com/zeromicro/go-zero/core/logx"
)
type MiniUserAuditLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewMiniUserAuditLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniUserAuditLogic {
return &MiniUserAuditLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *MiniUserAuditLogic) MiniUserAudit(req *types.MiniUserAuditRequest) error {
// todo: add your logic here and delete this line
return nil
}
... ...
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 MiniUserDepartmentUsersLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewMiniUserDepartmentUsersLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniUserDepartmentUsersLogic {
return &MiniUserDepartmentUsersLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *MiniUserDepartmentUsersLogic) MiniUserDepartmentUsers(req *types.MiniUserDepartmentUsersRequest) (resp *types.MiniUserInfoResponse, 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"
"github.com/zeromicro/go-zero/core/logx"
)
type MiniUserFollowLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewMiniUserFollowLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniUserFollowLogic {
return &MiniUserFollowLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *MiniUserFollowLogic) MiniUserFollow(req *types.FollowRequest) error {
// todo: add your logic here and delete this line
return nil
}
... ...
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 MiniUserFollowerLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewMiniUserFollowerLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniUserFollowerLogic {
return &MiniUserFollowerLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *MiniUserFollowerLogic) MiniUserFollower(req *types.UserSearchRequest) (resp *types.UserSearchResponse, 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"
"github.com/zeromicro/go-zero/core/logx"
)
type MiniUserFollowingLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewMiniUserFollowingLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniUserFollowingLogic {
return &MiniUserFollowingLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *MiniUserFollowingLogic) MiniUserFollowing(req *types.UserSearchRequest) (resp *types.UserSearchResponse, 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"
"github.com/zeromicro/go-zero/core/logx"
)
type MiniUserInfoLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewMiniUserInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniUserInfoLogic {
return &MiniUserInfoLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *MiniUserInfoLogic) MiniUserInfo(req *types.MiniUserInfoRequest) (resp *types.MiniUserInfoResponse, 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"
"github.com/zeromicro/go-zero/core/logx"
)
type MiniUserLoginLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewMiniUserLoginLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniUserLoginLogic {
return &MiniUserLoginLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *MiniUserLoginLogic) MiniUserLogin(req *types.MiniUserLoginRequest) (resp *types.MiniUserLoginResponse, 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"
"github.com/zeromicro/go-zero/core/logx"
)
type MiniUserUnFollowLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewMiniUserUnFollowLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniUserUnFollowLogic {
return &MiniUserUnFollowLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *MiniUserUnFollowLogic) MiniUserUnFollow(req *types.FollowRequest) error {
// todo: add your logic here and delete this line
return nil
}
... ...
... ... @@ -62,3 +62,106 @@ type User struct {
Avatar string `json:"avatar,omitempty"` // 头像
Position string `json:"position,omitempty"` // 职位
}
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 MiniUserLoginResponse struct {
Token string `json:"token"` // x-token
Phone string `json:"phone"` // 手机号
Message string `json:"message"` // 失败消息(审核中,注册成功等待审核)
Success bool `json:"success"` // 成功标识
}
type MiniUserInfoRequest struct {
}
type MiniUserInfoResponse struct {
User *UserItem `json:"user,omitempty"` // 用户信息
TotalArticle int64 `json:"totalArticle"` // 累计信息发布
TotalLoved int64 `json:"totalLoved"` // 累计收到的赞
TotalAccepted int64 `json:"totalAccepted"` // 累计被采纳
}
type MiniUserApplyJoinCompanyRequest struct {
Phone string `json:"phone"`
Code string `json:"code"`
}
type MiniUserApplyJoinCompanyResponse struct {
}
type MiniUserAuditRequest struct {
UserId int64 `json:"userId"` // 用户ID
}
type MiniUserDepartmentUsersRequest struct {
}
type MiniUserDepartmentUsersResponse struct {
Departments []*Department `json:"departments"`
Users []*UserItem `json:"users"`
}
type UserItem struct {
CompanyId int64 `json:"companyId,omitempty"` // 公司ID
DepartmentId int64 `json:"departmentId,omitempty"` // 部门ID
Roles []int64 `json:"roleId,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"` // 我关注的人 (冗余)
}
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 UserSearchRequest struct {
Page int `json:"page,optional"`
Size int `json:"size,optional"`
AuditFlag *int `json:"auditFlag,optional"` // 按审核状态 0:待审核 1:审核通过 2:拒绝
}
type UserSearchResponse struct {
List []*UserItem `json:"list"`
Total int64 `json:"total"`
}
type FollowRequest struct {
UserId int64 `json:"userId"`
}
type CompanySearchRequest struct {
Page int `json:"page"`
Size int `json:"size"`
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
}
... ...
... ... @@ -13,6 +13,10 @@ func Migrate(db *gorm.DB) {
&models.ArticleDraft{},
&models.ArticleComment{},
&models.UserLoveFlag{},
&models.User{},
&models.Role{},
&models.Company{},
&models.UserFollow{},
}
db.AutoMigrate(modelsList...)
... ...
... ... @@ -9,14 +9,14 @@ import (
type Company struct {
Id int64 // 唯一标识
Name string `json:"name,omitempty"` // 名称
Code string `json:"code,omitempty"` // 编码(搜索使用,4位字母数字)
Logo string `json:"logo,omitempty"` // 公司LOGO
CreatedAt int64 `json:"createdAt,omitempty"`
UpdatedAt int64 `json:"updatedAt,omitempty"`
DeletedAt int64 `json:"deletedAt,omitempty"`
Version int `json:"version,omitempty"`
Name string // 名称
Code string // 编码(搜索使用,4位字母数字)
Logo string // 公司LOGO
CreatedAt int64
UpdatedAt int64
DeletedAt int64
Version int
}
func (m *Company) TableName() string {
... ...
... ... @@ -4,16 +4,18 @@ import (
"fmt"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
"gorm.io/gorm"
"gorm.io/plugin/soft_delete"
"time"
)
type Role struct {
Id int64 // 唯一标识
CreatedAt int64 `json:"createdAt,omitempty"`
UpdatedAt int64 `json:"updatedAt,omitempty"`
DeletedAt int64 `json:"deletedAt,omitempty"`
Version int `json:"version,omitempty"`
CreatedAt int64
UpdatedAt int64
DeletedAt int64
Version int
IsDel soft_delete.DeletedAt `gorm:"softDelete:flag,DeletedAtField:DeletedAt"`
}
func (m *Role) TableName() string {
... ...
... ... @@ -4,28 +4,30 @@ import (
"fmt"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
"gorm.io/gorm"
"gorm.io/plugin/soft_delete"
"time"
)
type User struct {
Id int64 // 唯一标识
CompanyId int64 `json:"companyId,omitempty"` // 公司ID
DepartmentId int64 `json:"departmentId,omitempty"` // 部门ID
Roles []int64 `json:"roleId,omitempty"` // 角色
Flag int `json:"flag"` // 标识 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"` // 我关注的人 (冗余)
CompanyId int64 // 公司ID
DepartmentId int64 // 部门ID
Roles []int64 `gorm:"type:jsonb;serializer:json"` // 角色
Flag int // 标识 1:管理员 2:普通用户 (有绑定角色是管理员)
Name string // 名称
Avatar string // 头像
Phone string // 手机号 唯一
Position string // 职位
Enable int // 启用状态 1:启用 2:禁用
AuditStatus int // 审核状态 0:待审核 1:审核通过 2:拒绝
Follower []int64 `gorm:"type:jsonb;serializer:json"` // 关注我的人 (冗余)
Following []int64 `gorm:"type:jsonb;serializer:json"` // 我关注的人 (冗余)
CreatedAt int64 `json:"createdAt,omitempty"`
UpdatedAt int64 `json:"updatedAt,omitempty"`
DeletedAt int64 `json:"deletedAt,omitempty"`
Version int `json:"version,omitempty"`
CreatedAt int64
UpdatedAt int64
DeletedAt int64
Version int
IsDel soft_delete.DeletedAt `gorm:"softDelete:flag,DeletedAtField:DeletedAt"`
}
func (m *User) TableName() string {
... ...
... ... @@ -10,7 +10,7 @@ type User struct {
CompanyId int64 `json:"companyId,omitempty"` // 公司ID
DepartmentId int64 `json:"departmentId,omitempty"` // 部门ID
Roles []int64 `json:"roleId,omitempty"` // 角色
Flag int `json:"flag"` // 标识 1:管理员 2:普通用户 (有绑定角色是管理员)
Flag int `json:"flag,omitempty"` // 标识 1:管理员 2:普通用户 (有绑定角色是管理员)
Name string `json:"name,omitempty"` // 名称
Avatar string `json:"avatar,omitempty"` // 头像
Phone string `json:"phone,omitempty"` // 手机号 唯一
... ...