From a20cc70aabc8b2b92b7483feb0b7004ef14d9be7 Mon Sep 17 00:00:00 2001 From: dengbiao Date: Fri, 8 Nov 2024 21:47:17 +0800 Subject: [PATCH] update relationshipMap --- .../public_platoon/hdl_basic.go | 398 ++++++++---------- .../public_platoon/md_public_platoon.go | 16 +- app/router/router.go | 4 +- .../public_platoon/svc_relation_ship_map.go | 81 ++++ app/svc/svc_auth.go | 17 +- docs/docs.go | 88 ++-- docs/swagger.json | 88 ++-- docs/swagger.yaml | 61 ++- 8 files changed, 372 insertions(+), 381 deletions(-) create mode 100644 app/svc/public_platoon/svc_relation_ship_map.go diff --git a/app/hdl/institutional_management/public_platoon/hdl_basic.go b/app/hdl/institutional_management/public_platoon/hdl_basic.go index 9310db6..0353c51 100644 --- a/app/hdl/institutional_management/public_platoon/hdl_basic.go +++ b/app/hdl/institutional_management/public_platoon/hdl_basic.go @@ -3,7 +3,8 @@ package public_platoon import ( "applet/app/db" "applet/app/e" - "applet/app/md/institutional_management/public_platoon" + md "applet/app/md/institutional_management/public_platoon" + svc "applet/app/svc/public_platoon" "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" "code.fnuoos.com/EggPlanet/egg_models.git/src/model" "errors" @@ -18,7 +19,7 @@ import ( // @Accept json // @Produce json // @param Authorization header string true "验证参数Bearer和token空格拼接" -// @Success 200 {object} public_platoon.GetPublicPlatoonBasicResp "具体数据" +// @Success 200 {object} md.GetPublicPlatoonBasicResp "具体数据" // @Failure 400 {object} md.Response "具体错误" // @Router /api/publicPlatoon/getBasic [get] func GetPublicPlatoonBasic(c *gin.Context) { @@ -48,9 +49,8 @@ func GetPublicPlatoonBasic(c *gin.Context) { } } - - var resp public_platoon.GetPublicPlatoonBasicResp - resp = public_platoon.GetPublicPlatoonBasicResp{ + var resp md.GetPublicPlatoonBasicResp + resp = md.GetPublicPlatoonBasicResp{ IsOpen: publicPlatoonBasic.IsOpen, OriginatorUid: publicPlatoonBasic.OriginatorUid, SeveralTimes: publicPlatoonBasic.SeveralTimes, @@ -75,7 +75,7 @@ func GetPublicPlatoonBasic(c *gin.Context) { // @Failure 400 {object} md.Response "具体错误" // @Router /api/publicPlatoon/getBasic [post] func UpdatePublicPlatoonBasic(c *gin.Context) { - var req *public_platoon.UpdatePublicPlatoonBasicReq + var req *md.UpdatePublicPlatoonBasicReq if err := c.ShouldBindJSON(&req); err != nil { e.OutErr(c, e.ERR_INVALID_ARGS, err) return @@ -121,125 +121,55 @@ func UpdatePublicPlatoonBasic(c *gin.Context) { // @Accept json // @Produce json // @param Authorization header string true "验证参数Bearer和token空格拼接" -// @Param req query public_platoon.GetRelationshipMapReq false "用户ID 手机号" -// @Success 200 {object} public_platoon.RelationshipMapResp "具体数据" +// @param phone query string true "phone" +// @param uid query string true "uid" +// @Success 200 {object} md.TreeNode "具体数据" // @Failure 400 {object} md.Response "具体错误" // @Router /api/publicPlatoon/relationshipMap [get] func GetRelationshipMap(c *gin.Context) { - var req *public_platoon.GetRelationshipMapReq - if err := c.ShouldBindQuery(&req); err != nil { - e.OutErr(c, e.ERR_INVALID_ARGS, err) - return - } + phone := c.Query("phone") + uid := c.Query("uid") userDb := implement.NewUserDb(db.Db) - var uid int64 - if req.Phone != 0 { - user, err1 := userDb.UserGetOneByPhone(req.Phone) + + userRelationDb := implement.NewPublicPlatoonUserRelationDb(db.Db) + var relation *model.PublicPlatoonUserRelation + var err error + if phone != "" { + user, err1 := userDb.UserGetOneByParams(map[string]interface{}{ + "key": "phone", + "value": phone, + }) if err1 != nil { e.OutErr(c, e.ERR_DB_ORM, err1.Error()) } - uid = user.Id - } - - if req.Uid != 0 { - uid = req.Uid - } - - UserRelationDb := implement.NewPublicPlatoonUserRelationDb(db.Db) - relations, err2 := UserRelationDb.PublicPlatoonUserRelationFind(uid) - if err2 != nil { - e.OutErr(c, e.ERR_DB_ORM, err2.Error()) - return - } - user, err3 := userDb.UserGetOneById(relations[0].Uid) - if err3 != nil { - e.OutErr(c, e.ERR_DB_ORM, err3.Error()) - return - } - var son []public_platoon.RelationshipMap - res := public_platoon.RelationshipMap{ - AvatarUrl: user.Avatar, - Phone: user.Phone, - Nickname: user.Nickname, - Uid: user.Id, - Pid: relations[0].RecommendUid, - Level: relations[0].Level1, - Position: relations[0].Position1, - SystemID: relations[0].Id, - Son: son, - } - m := make(map[int64]public_platoon.RelationshipMap) - m[res.Uid] = res - for i := 1; i < len(relations); i++ { - currentUser, err4 := userDb.UserGetOneById(relations[i].Uid) - if err4 != nil { - e.OutErr(c, e.ERR_DB_ORM, err4.Error()) + relation, err = userRelationDb.PublicPlatoonUserRelationGetOneByParams(map[string]interface{}{ + "key": "uid", + "value": user.Id, + }) + } else if uid != "" { + relation, err = userRelationDb.PublicPlatoonUserRelationGetOneByParams(map[string]interface{}{ + "key": "uid", + "value": uid, + }) + } else { + relation, err = userRelationDb.PublicPlatoonUserRelationGetOneByParams(map[string]interface{}{ + "key": "level_total", + "value": 1, + }) + if err != nil { + e.OutErr(c, e.ERR_DB_ORM, err.Error()) return } - var sonNodes []public_platoon.RelationshipMap - node := public_platoon.RelationshipMap{ - AvatarUrl: currentUser.Avatar, - Phone: currentUser.Phone, - Nickname: currentUser.Nickname, - Uid: currentUser.Id, - Pid: relations[i].RecommendUid, - Level: relations[i].Level1, - Position: relations[i].Position1, - SystemID: relations[i].Id, - Son: sonNodes, - } - m[node.Uid] = node - if fatherNode, isOk := m[relations[i].FatherUid1]; isOk { - fatherNode.Son = append(fatherNode.Son, node) - } } - publicPlatoonBasicDb := implement.NewPublicPlatoonBasicSettingDb(db.Db) - publicPlatoonBasic, err := publicPlatoonBasicDb.PublicPlatoonBasicSettingGetOne() + var list *md.TreeNode + list, err = svc.GetTrees(db.Db, relation, 3) if err != nil { - e.OutErr(c, e.ERR_DB_ORM, err) + e.OutErr(c, e.ERR_DB_ORM, err.Error()) return } - now := time.Now() - if publicPlatoonBasic == nil { - publicPlatoonBasic = &model.PublicPlatoonBasicSetting{ - IsOpen: 1, - OriginatorUid: 0, - SeveralTimes: 0, - SeveralRows: 0, - SystemPunishReplace: 0, - SystemPunishReplaceValue: 0, - IsSelfActiveGetTeamRevenue: 0, - CreateAt: now.Format("2006-01-02 15:04:05"), - UpdateAt: now.Format("2006-01-02 15:04:05"), - } - _, err1 := publicPlatoonBasicDb.PublicPlatoonBasicSettingInsert(publicPlatoonBasic) - if err1 != nil { - e.OutErr(c, e.ERR_DB_ORM, err1.Error()) - return - } - } - var basicSetting public_platoon.GetPublicPlatoonBasicResp - basicSetting = public_platoon.GetPublicPlatoonBasicResp{ - IsOpen: publicPlatoonBasic.IsOpen, - OriginatorUid: publicPlatoonBasic.OriginatorUid, - SeveralTimes: publicPlatoonBasic.SeveralTimes, - SeveralRows: publicPlatoonBasic.SeveralRows, - SystemPunishReplace: publicPlatoonBasic.SystemPunishReplace, - SystemPunishReplaceValue: publicPlatoonBasic.SystemPunishReplaceValue, - IsSelfActiveGetTeamRevenue: publicPlatoonBasic.IsSelfActiveGetTeamRevenue, - } - if uid == 0 { - uid = relations[0].Uid - } - var resp public_platoon.RelationshipMapResp - resp = public_platoon.RelationshipMapResp{ - Map: res, - BasicSetting: basicSetting, - SearchUid: uid, - } - e.OutSuc(c, resp, nil) + e.OutSuc(c, list, nil) } // FindUserRelationshipMap @@ -253,132 +183,132 @@ func GetRelationshipMap(c *gin.Context) { // @Success 200 {object} public_platoon.RelationshipMap "具体数据" // @Failure 400 {object} md.Response "具体错误" // @Router /api/publicPlatoon/findUserRelationshipMap [get] -func FindUserRelationshipMap(c *gin.Context) { - var req *public_platoon.FindUserRelationshipMapReq - if err := c.ShouldBindQuery(&req); err != nil { - e.OutErr(c, e.ERR_INVALID_ARGS, err) - return - } - - RelationDb := implement.NewPublicPlatoonUserRelationDb(db.Db) - relations, err1 := RelationDb.PublicPlatoonUserRelationFindByUid(req.Uid) - if err1 != nil { - e.OutErr(c, e.ERR_DB_ORM, err1) - return - } - - userDb := implement.NewUserDb(db.Db) - user, err3 := userDb.UserGetOneById(relations[0].Uid) - if err3 != nil { - e.OutErr(c, e.ERR_DB_ORM, err3.Error()) - return - } - var son []public_platoon.RelationshipMap - res := public_platoon.RelationshipMap{ - AvatarUrl: user.Avatar, - Phone: user.Phone, - Nickname: user.Nickname, - Uid: user.Id, - Pid: relations[0].RecommendUid, - Level: relations[0].Level1, - Position: relations[0].Position1, - SystemID: relations[0].Id, - Son: son, - } - for i := 1; i < len(relations); i++ { - user, err4 := userDb.UserGetOneById(relations[i].Uid) - if err4 != nil { - e.OutErr(c, e.ERR_DB_ORM, err4.Error()) - return - } - node := public_platoon.RelationshipMap{ - AvatarUrl: user.Avatar, - Phone: user.Phone, - Nickname: user.Nickname, - Uid: user.Id, - Pid: relations[i].RecommendUid, - Level: relations[i].Level1, - Position: relations[i].Position1, - SystemID: relations[i].Id, - Son: nil, - } - res.Son = append(res.Son, node) - } - e.OutSuc(c, res, nil) -} - -// FindSubUserRelationshipMap -// @Summary 制度中心-公排管理-关系分布图(获取指定用户上级) -// @Tags 公排管理 -// @Description 关系分布图(获取指定用户上级) -// @Accept json -// @Produce json -// @param Authorization header string true "验证参数Bearer和token空格拼接" -// @Param req query public_platoon.FindSubUserRelationshipMapReq true "用户ID" -// @Success 200 {object} public_platoon.RelationshipMap "具体数据" -// @Failure 400 {object} md.Response "具体错误" -// @Router /api/publicPlatoon/findSubUserRelationshipMap [get] -func FindSubUserRelationshipMap(c *gin.Context) { - var req *public_platoon.FindSubUserRelationshipMapReq - if err := c.ShouldBindQuery(&req); err != nil { - e.OutErr(c, e.ERR_INVALID_ARGS, err) - return - } - - RelationDb := implement.NewPublicPlatoonUserRelationDb(db.Db) - sonRelation, err1 := RelationDb.PublicPlatoonUserRelationGetOneByUid(req.Uid) - if err1 != nil { - e.OutErr(c, e.ERR_DB_ORM, err1) - return - } - parentRelation, err2 := RelationDb.PublicPlatoonUserRelationGetOneByUid(sonRelation.FatherUid1) - if err2 != nil { - e.OutErr(c, e.ERR_DB_ORM, err2) - return - } - - userDb := implement.NewUserDb(db.Db) - son, err3 := userDb.UserGetOneById(sonRelation.Uid) - if err3 != nil { - e.OutErr(c, e.ERR_DB_ORM, err3.Error()) - return - } - - parent, err4 := userDb.UserGetOneById(parentRelation.Uid) - if err4 != nil { - e.OutErr(c, e.ERR_DB_ORM, err4.Error()) - return - } - - var sonNode []public_platoon.RelationshipMap - sonNode1 := public_platoon.RelationshipMap{ - AvatarUrl: son.Avatar, - Phone: son.Phone, - Nickname: son.Nickname, - Uid: son.Id, - Pid: sonRelation.RecommendUid, - Level: sonRelation.Level1, - Position: sonRelation.Position1, - SystemID: sonRelation.Id, - Son: nil, - } - sonNode = append(sonNode, sonNode1) - res := public_platoon.RelationshipMap{ - AvatarUrl: parent.Avatar, - Phone: parent.Phone, - Nickname: parent.Nickname, - Uid: parent.Id, - Pid: parentRelation.RecommendUid, - Level: parentRelation.Level1, - Position: parentRelation.Position1, - SystemID: parentRelation.Id, - Son: sonNode, - } - e.OutSuc(c, res, nil) -} +//func FindUserRelationshipMap(c *gin.Context) { +// var req *public_platoon.FindUserRelationshipMapReq +// if err := c.ShouldBindQuery(&req); err != nil { +// e.OutErr(c, e.ERR_INVALID_ARGS, err) +// return +// } +// +// RelationDb := implement.NewPublicPlatoonUserRelationDb(db.Db) +// relations, err1 := RelationDb.PublicPlatoonUserRelationFindByUid(req.Uid) +// if err1 != nil { +// e.OutErr(c, e.ERR_DB_ORM, err1) +// return +// } +// +// userDb := implement.NewUserDb(db.Db) +// user, err3 := userDb.UserGetOneById(relations[0].Uid) +// if err3 != nil { +// e.OutErr(c, e.ERR_DB_ORM, err3.Error()) +// return +// } +// var son []public_platoon.RelationshipMap +// res := public_platoon.RelationshipMap{ +// AvatarUrl: user.Avatar, +// Phone: user.Phone, +// Nickname: user.Nickname, +// Uid: user.Id, +// Pid: relations[0].RecommendUid, +// Level: relations[0].Level1, +// Position: relations[0].Position1, +// SystemID: relations[0].Id, +// Son: son, +// } +// for i := 1; i < len(relations); i++ { +// user, err4 := userDb.UserGetOneById(relations[i].Uid) +// if err4 != nil { +// e.OutErr(c, e.ERR_DB_ORM, err4.Error()) +// return +// } +// node := public_platoon.RelationshipMap{ +// AvatarUrl: user.Avatar, +// Phone: user.Phone, +// Nickname: user.Nickname, +// Uid: user.Id, +// Pid: relations[i].RecommendUid, +// Level: relations[i].Level1, +// Position: relations[i].Position1, +// SystemID: relations[i].Id, +// Son: nil, +// } +// res.Son = append(res.Son, node) +// } +// e.OutSuc(c, res, nil) +//} +// +//// FindSubUserRelationshipMap +//// @Summary 制度中心-公排管理-关系分布图(获取指定用户上级) +//// @Tags 公排管理 +//// @Description 关系分布图(获取指定用户上级) +//// @Accept json +//// @Produce json +//// @param Authorization header string true "验证参数Bearer和token空格拼接" +//// @Param req query public_platoon.FindSubUserRelationshipMapReq true "用户ID" +//// @Success 200 {object} public_platoon.RelationshipMap "具体数据" +//// @Failure 400 {object} md.Response "具体错误" +//// @Router /api/publicPlatoon/findSubUserRelationshipMap [get] +//func FindSubUserRelationshipMap(c *gin.Context) { +// var req *public_platoon.FindSubUserRelationshipMapReq +// if err := c.ShouldBindQuery(&req); err != nil { +// e.OutErr(c, e.ERR_INVALID_ARGS, err) +// return +// } +// +// RelationDb := implement.NewPublicPlatoonUserRelationDb(db.Db) +// sonRelation, err1 := RelationDb.PublicPlatoonUserRelationGetOneByUid(req.Uid) +// if err1 != nil { +// e.OutErr(c, e.ERR_DB_ORM, err1) +// return +// } +// parentRelation, err2 := RelationDb.PublicPlatoonUserRelationGetOneByUid(sonRelation.FatherUid1) +// if err2 != nil { +// e.OutErr(c, e.ERR_DB_ORM, err2) +// return +// } +// +// userDb := implement.NewUserDb(db.Db) +// son, err3 := userDb.UserGetOneById(sonRelation.Uid) +// if err3 != nil { +// e.OutErr(c, e.ERR_DB_ORM, err3.Error()) +// return +// } +// +// parent, err4 := userDb.UserGetOneById(parentRelation.Uid) +// if err4 != nil { +// e.OutErr(c, e.ERR_DB_ORM, err4.Error()) +// return +// } +// +// var sonNode []public_platoon.RelationshipMap +// sonNode1 := public_platoon.RelationshipMap{ +// AvatarUrl: son.Avatar, +// Phone: son.Phone, +// Nickname: son.Nickname, +// Uid: son.Id, +// Pid: sonRelation.RecommendUid, +// Level: sonRelation.Level1, +// Position: sonRelation.Position1, +// SystemID: sonRelation.Id, +// Son: nil, +// } +// sonNode = append(sonNode, sonNode1) +// res := public_platoon.RelationshipMap{ +// AvatarUrl: parent.Avatar, +// Phone: parent.Phone, +// Nickname: parent.Nickname, +// Uid: parent.Id, +// Pid: parentRelation.RecommendUid, +// Level: parentRelation.Level1, +// Position: parentRelation.Position1, +// SystemID: parentRelation.Id, +// Son: sonNode, +// } +// e.OutSuc(c, res, nil) +//} func ExchangeUserPosition(c *gin.Context) { - var req *public_platoon.ExchangeUserPositionReq + var req *md.ExchangeUserPositionReq if err1 := c.ShouldBindJSON(&req); err1 != nil { e.OutErr(c, e.ERR_INVALID_ARGS, err1) return diff --git a/app/md/institutional_management/public_platoon/md_public_platoon.go b/app/md/institutional_management/public_platoon/md_public_platoon.go index d934f51..e3d9f29 100644 --- a/app/md/institutional_management/public_platoon/md_public_platoon.go +++ b/app/md/institutional_management/public_platoon/md_public_platoon.go @@ -1,4 +1,4 @@ -package public_platoon +package md type GetPublicPlatoonBasicResp struct { IsOpen int `json:"is_open"` @@ -40,7 +40,7 @@ type RelationshipMap struct { type RelationshipMapResp struct { Map RelationshipMap `json:"map"` BasicSetting GetPublicPlatoonBasicResp `json:"basicSetting"` - SearchUid int64 `json:"searchUid"` + SearchUid string `json:"searchUid"` } type FindUserRelationshipMapReq struct { @@ -55,3 +55,15 @@ type ExchangeUserPositionReq struct { Position1 int64 `json:"position_1"` Position2 int64 `json:"position_2"` } + +type TreeNode struct { + AvatarURL string `json:"avatar_url"` + Phone string `json:"phone"` + Nickname string `json:"nickname"` + Uid int64 `json:"uid"` + PID int64 `json:"pid"` + Position int64 `json:"position"` + SystemID int64 `json:"system_id"` + Level int `json:"level"` + Son []*TreeNode `json:"son"` +} diff --git a/app/router/router.go b/app/router/router.go index 00f6c1a..cfae419 100644 --- a/app/router/router.go +++ b/app/router/router.go @@ -62,8 +62,8 @@ func rInstitutionalManagement(r *gin.RouterGroup) { //制度管理 rPublicPlatoon.GET("/getBasic", public_platoon.GetPublicPlatoonBasic) rPublicPlatoon.PUT("/updateBasic", public_platoon.UpdatePublicPlatoonBasic) rPublicPlatoon.GET("/relationshipMap", public_platoon.GetRelationshipMap) - rPublicPlatoon.GET("/findUserRelationshipMap", public_platoon.FindUserRelationshipMap) - rPublicPlatoon.GET("/findSubUserRelationshipMap", public_platoon.FindSubUserRelationshipMap) + //rPublicPlatoon.GET("/findUserRelationshipMap", public_platoon.FindUserRelationshipMap) + //rPublicPlatoon.GET("/findSubUserRelationshipMap", public_platoon.FindSubUserRelationshipMap) rPublicPlatoon.POST("/exchangeUserPosition", public_platoon.ExchangeUserPosition) } } diff --git a/app/svc/public_platoon/svc_relation_ship_map.go b/app/svc/public_platoon/svc_relation_ship_map.go new file mode 100644 index 0000000..04de525 --- /dev/null +++ b/app/svc/public_platoon/svc_relation_ship_map.go @@ -0,0 +1,81 @@ +package svc + +import ( + md "applet/app/md/institutional_management/public_platoon" + "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + "xorm.io/xorm" +) + +func GetTrees(engine *xorm.Engine, firstUser *model.PublicPlatoonUserRelation, leveLimit int) (list *md.TreeNode, err error) { + var trees func(list []*md.TreeNode) []*md.TreeNode + trees = func(list []*md.TreeNode) []*md.TreeNode { + for _, item := range list { + userPublicPlatoonRelations := make([]*model.PublicPlatoonUserRelation, 0) + err = engine.Where("father_uid1 = ?", item.Uid).Find(&userPublicPlatoonRelations) + if err != nil || len(userPublicPlatoonRelations) == 0 { + continue + } + + userIDs := make([]int64, len(userPublicPlatoonRelations)) + for i, relation := range userPublicPlatoonRelations { + userIDs[i] = relation.Uid + } + + users := make(map[int64]model.User) + var userRecords []model.User + err = engine.In("id", userIDs).Find(&userRecords) + if err != nil { + users = make(map[int64]model.User) + } else { + for _, user := range userRecords { + users[user.Id] = user + } + } + + tempValue := make([]*md.TreeNode, 0) + level := 1 + for _, relation := range userPublicPlatoonRelations { + user := users[relation.Uid] + tempValue = append(tempValue, &md.TreeNode{ + AvatarURL: user.Avatar, + Phone: user.Phone, + Nickname: user.Nickname, + Uid: relation.Uid, + PID: relation.RecommendUid, + Position: relation.Position1, + SystemID: relation.Id, + Level: relation.LevelTotal, + }) + level = relation.LevelTotal + } + item.Son = tempValue + if level <= leveLimit { + trees(item.Son) + } + } + return list + } + + if firstUser == nil { + return + } + + user := new(model.User) + has, err := engine.ID(firstUser.Uid).Get(user) + if err != nil || !has { + return + } + + rootNode := &md.TreeNode{ + AvatarURL: user.Avatar, + Phone: user.Phone, + Nickname: user.Nickname, + Uid: firstUser.Uid, + PID: firstUser.RecommendUid, + Level: firstUser.LevelTotal, + Position: firstUser.Position1, + SystemID: firstUser.Id, + } + trees([]*md.TreeNode{rootNode}) + return rootNode, nil +} diff --git a/app/svc/svc_auth.go b/app/svc/svc_auth.go index 9cd738d..76a13b6 100644 --- a/app/svc/svc_auth.go +++ b/app/svc/svc_auth.go @@ -15,15 +15,14 @@ func GetUser(c *gin.Context) *model.Admin { admin, _ := c.Get("admin") if admin == nil { return &model.Admin{ - AdmId: 0, - Username: "", - Password: "", - State: 0, - IsSuperAdministrator: 0, - IsObserverAdministrator: 0, - Memo: "", - CreateAt: time.Now().Format("2006-01-02 15:04:05"), - UpdateAt: time.Now().Format("2006-01-02 15:04:05"), + AdmId: 0, + Username: "", + Password: "", + State: 0, + IsSuperAdministrator: 0, + Memo: "", + CreateAt: time.Now().Format("2006-01-02 15:04:05"), + UpdateAt: time.Now().Format("2006-01-02 15:04:05"), } } return admin.(*model.Admin) diff --git a/docs/docs.go b/docs/docs.go index e812cee..15eb510 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -129,7 +129,7 @@ const docTemplate = `{ "200": { "description": "具体数据", "schema": { - "$ref": "#/definitions/public_platoon.GetPublicPlatoonBasicResp" + "$ref": "#/definitions/md.GetPublicPlatoonBasicResp" } }, "400": { @@ -207,22 +207,24 @@ const docTemplate = `{ }, { "type": "string", - "description": "用户ID", - "name": "uid", - "in": "query" + "description": "phone", + "name": "phone", + "in": "query", + "required": true }, { "type": "string", - "description": "手机号", - "name": "phone", - "in": "query" + "description": "uid", + "name": "uid", + "in": "query", + "required": true } ], "responses": { "200": { "description": "具体数据", "schema": { - "$ref": "#/definitions/public_platoon.RelationshipMapResp" + "$ref": "#/definitions/md.TreeNode" } }, "400": { @@ -236,6 +238,32 @@ const docTemplate = `{ } }, "definitions": { + "md.GetPublicPlatoonBasicResp": { + "type": "object", + "properties": { + "is_open": { + "type": "integer" + }, + "is_self_active_get_team_revenue": { + "type": "integer" + }, + "originator_uid": { + "type": "integer" + }, + "several_rows": { + "type": "integer" + }, + "several_times": { + "type": "integer" + }, + "system_punish_replace": { + "type": "integer" + }, + "system_punish_replace_value": { + "type": "integer" + } + } + }, "md.LoginReq": { "type": "object", "required": [ @@ -281,33 +309,7 @@ const docTemplate = `{ } } }, - "public_platoon.GetPublicPlatoonBasicResp": { - "type": "object", - "properties": { - "is_open": { - "type": "integer" - }, - "is_self_active_get_team_revenue": { - "type": "integer" - }, - "originator_uid": { - "type": "integer" - }, - "several_rows": { - "type": "integer" - }, - "several_times": { - "type": "integer" - }, - "system_punish_replace": { - "type": "integer" - }, - "system_punish_replace_value": { - "type": "integer" - } - } - }, - "public_platoon.RelationshipMap": { + "md.TreeNode": { "type": "object", "properties": { "avatar_url": { @@ -331,7 +333,7 @@ const docTemplate = `{ "son": { "type": "array", "items": { - "$ref": "#/definitions/public_platoon.RelationshipMap" + "$ref": "#/definitions/md.TreeNode" } }, "system_id": { @@ -341,20 +343,6 @@ const docTemplate = `{ "type": "integer" } } - }, - "public_platoon.RelationshipMapResp": { - "type": "object", - "properties": { - "basicSetting": { - "$ref": "#/definitions/public_platoon.GetPublicPlatoonBasicResp" - }, - "map": { - "$ref": "#/definitions/public_platoon.RelationshipMap" - }, - "searchUid": { - "type": "integer" - } - } } }, "securityDefinitions": { diff --git a/docs/swagger.json b/docs/swagger.json index 74de1de..348c67c 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -122,7 +122,7 @@ "200": { "description": "具体数据", "schema": { - "$ref": "#/definitions/public_platoon.GetPublicPlatoonBasicResp" + "$ref": "#/definitions/md.GetPublicPlatoonBasicResp" } }, "400": { @@ -200,22 +200,24 @@ }, { "type": "string", - "description": "用户ID", - "name": "uid", - "in": "query" + "description": "phone", + "name": "phone", + "in": "query", + "required": true }, { "type": "string", - "description": "手机号", - "name": "phone", - "in": "query" + "description": "uid", + "name": "uid", + "in": "query", + "required": true } ], "responses": { "200": { "description": "具体数据", "schema": { - "$ref": "#/definitions/public_platoon.RelationshipMapResp" + "$ref": "#/definitions/md.TreeNode" } }, "400": { @@ -229,6 +231,32 @@ } }, "definitions": { + "md.GetPublicPlatoonBasicResp": { + "type": "object", + "properties": { + "is_open": { + "type": "integer" + }, + "is_self_active_get_team_revenue": { + "type": "integer" + }, + "originator_uid": { + "type": "integer" + }, + "several_rows": { + "type": "integer" + }, + "several_times": { + "type": "integer" + }, + "system_punish_replace": { + "type": "integer" + }, + "system_punish_replace_value": { + "type": "integer" + } + } + }, "md.LoginReq": { "type": "object", "required": [ @@ -274,33 +302,7 @@ } } }, - "public_platoon.GetPublicPlatoonBasicResp": { - "type": "object", - "properties": { - "is_open": { - "type": "integer" - }, - "is_self_active_get_team_revenue": { - "type": "integer" - }, - "originator_uid": { - "type": "integer" - }, - "several_rows": { - "type": "integer" - }, - "several_times": { - "type": "integer" - }, - "system_punish_replace": { - "type": "integer" - }, - "system_punish_replace_value": { - "type": "integer" - } - } - }, - "public_platoon.RelationshipMap": { + "md.TreeNode": { "type": "object", "properties": { "avatar_url": { @@ -324,7 +326,7 @@ "son": { "type": "array", "items": { - "$ref": "#/definitions/public_platoon.RelationshipMap" + "$ref": "#/definitions/md.TreeNode" } }, "system_id": { @@ -334,20 +336,6 @@ "type": "integer" } } - }, - "public_platoon.RelationshipMapResp": { - "type": "object", - "properties": { - "basicSetting": { - "$ref": "#/definitions/public_platoon.GetPublicPlatoonBasicResp" - }, - "map": { - "$ref": "#/definitions/public_platoon.RelationshipMap" - }, - "searchUid": { - "type": "integer" - } - } } }, "securityDefinitions": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 28890db..18586cd 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -1,4 +1,21 @@ definitions: + md.GetPublicPlatoonBasicResp: + properties: + is_open: + type: integer + is_self_active_get_team_revenue: + type: integer + originator_uid: + type: integer + several_rows: + type: integer + several_times: + type: integer + system_punish_replace: + type: integer + system_punish_replace_value: + type: integer + type: object md.LoginReq: properties: code: @@ -30,24 +47,7 @@ definitions: example: 具体错误原因 type: string type: object - public_platoon.GetPublicPlatoonBasicResp: - properties: - is_open: - type: integer - is_self_active_get_team_revenue: - type: integer - originator_uid: - type: integer - several_rows: - type: integer - several_times: - type: integer - system_punish_replace: - type: integer - system_punish_replace_value: - type: integer - type: object - public_platoon.RelationshipMap: + md.TreeNode: properties: avatar_url: type: string @@ -63,22 +63,13 @@ definitions: type: integer son: items: - $ref: '#/definitions/public_platoon.RelationshipMap' + $ref: '#/definitions/md.TreeNode' type: array system_id: type: integer uid: type: integer type: object - public_platoon.RelationshipMapResp: - properties: - basicSetting: - $ref: '#/definitions/public_platoon.GetPublicPlatoonBasicResp' - map: - $ref: '#/definitions/public_platoon.RelationshipMap' - searchUid: - type: integer - type: object host: localhost:4001 info: contact: @@ -162,7 +153,7 @@ paths: "200": description: 具体数据 schema: - $ref: '#/definitions/public_platoon.GetPublicPlatoonBasicResp' + $ref: '#/definitions/md.GetPublicPlatoonBasicResp' "400": description: 具体错误 schema: @@ -210,13 +201,15 @@ paths: name: Authorization required: true type: string - - description: 用户ID + - description: phone in: query - name: uid + name: phone + required: true type: string - - description: 手机号 + - description: uid in: query - name: phone + name: uid + required: true type: string produces: - application/json @@ -224,7 +217,7 @@ paths: "200": description: 具体数据 schema: - $ref: '#/definitions/public_platoon.RelationshipMapResp' + $ref: '#/definitions/md.TreeNode' "400": description: 具体错误 schema: