diff --git a/app/hdl/institutional_management/public_platoon/hdl_basic.go b/app/hdl/institutional_management/public_platoon/hdl_basic.go index 4193cab..b724b9a 100644 --- a/app/hdl/institutional_management/public_platoon/hdl_basic.go +++ b/app/hdl/institutional_management/public_platoon/hdl_basic.go @@ -114,6 +114,70 @@ func UpdatePublicPlatoonBasic(c *gin.Context) { e.OutSuc(c, "success", nil) } +// SelectMember +// @Summary 制度中心-公排管理-公排基础设置选择会员(查询) +// @Tags 公排管理 +// @Description 公排基础设置选择会员(查询) +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param req body md.SelectMemberReq true "分页信息必填" +// @Success 200 {object} md.SelectMemberResp "具体数据" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/institutionalManagement/publicPlatoon/selectMember [post] +func SelectMember(c *gin.Context) { + var req *md.SelectMemberReq + if err1 := c.ShouldBindJSON(&req); err1 != nil { + e.OutErr(c, e.ERR_INVALID_ARGS, err1.Error()) + return + } + + levelDb := implement.NewUserLevelDb(db.Db) + levels, err1 := levelDb.UserLevelAllByAsc() + if err1 != nil { + e.OutErr(c, e.ERR_DB_ORM, err1.Error()) + return + } + levelsList := make([]map[string]interface{}, 0) + levelsMap := make(map[int]string) + for _, level := range levels { + levelsList = append(levelsList, map[string]interface{}{ + "id": level.Id, + "name": level.LevelName, + }) + levelsMap[level.Id] = level.LevelName + } + + userDb := implement.NewUserDb(db.Db) + users, total, err := userDb.UserFindAndCount(req.Uid, req.Phone, req.Nickname, req.Level, req.Page, req.Limit) + if err != nil { + e.OutErr(c, e.ERR_DB_ORM, err.Error()) + return + } + + list := make([]md.SelectMemberNode, len(*users)) + for i, user := range *users { + list[i] = md.SelectMemberNode{ + Uid: user.Id, + Avatar: user.Avatar, + Nickname: user.Nickname, + Phone: user.Phone, + Level: levelsMap[user.Level], + } + } + + resp := md.SelectMemberResp{ + List: list, + Paginate: md.Paginate{ + Limit: req.Limit, + Page: req.Page, + Total: total, + }, + } + + e.OutSuc(c, resp, nil) +} + // GetRelationshipMap // @Summary 制度中心-公排管理-关系分布图(获取) // @Tags 公排管理 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 1256399..3dcdb20 100644 --- a/app/md/institutional_management/public_platoon/md_public_platoon.go +++ b/app/md/institutional_management/public_platoon/md_public_platoon.go @@ -52,6 +52,28 @@ type ExchangeUserPositionReq struct { Position2 int64 `json:"position_2,required"` //位置2,具体值取返回数据中的 system_id } +type SelectMemberReq struct { + Uid int64 `json:"uid"` // 会员 ID + Phone string `json:"phone"` // 会员手机号 + Nickname string `json:"nickname"` // 会员昵称 + Level int `json:"level"` // 会员等级 + Page int `json:"page,required"` // 页数 + Limit int `json:"limit,required"` // 每页大小 +} + +type SelectMemberNode struct { + Uid int64 `json:"uid"` // 会员 ID + Avatar string `json:"avatar"` // 会员头像 + Nickname string `json:"nickname"` // 会员昵称 + Phone string `json:"phone"` // 会员手机号 + Level string `json:"level"` // 会员等级 +} + +type SelectMemberResp struct { + List []SelectMemberNode `json:"list"` // 会员数据 + Paginate Paginate `json:"paginate"` // 分页信息 +} + type TreeNode struct { AvatarURL string `json:"avatar_url" example:"头像"` Phone string `json:"phone" example:"手机号"` diff --git a/app/router/router.go b/app/router/router.go index a33d622..49d59d1 100644 --- a/app/router/router.go +++ b/app/router/router.go @@ -83,6 +83,7 @@ func rInstitutionalManagement(r *gin.RouterGroup) { //制度管理 rPublicPlatoon.GET("/findUserRelationshipMap", public_platoon.FindUserRelationshipMap) rPublicPlatoon.GET("/findSubUserRelationshipMap", public_platoon.FindSubUserRelationshipMap) rPublicPlatoon.POST("/exchangeUserPosition", public_platoon.ExchangeUserPosition) + rPublicPlatoon.POST("/selectMember", public_platoon.SelectMember) rPublicPlatoonUserFreePunish := rPublicPlatoon.Group("/publicPlatoonUserFreePunish") { rPublicPlatoonUserFreePunish.POST("/index", public_platoon.GetFreePublishUser) diff --git a/go.mod b/go.mod index 9579f01..5b1da49 100644 --- a/go.mod +++ b/go.mod @@ -13,11 +13,13 @@ require ( github.com/dchest/uniuri v0.0.0-20200228104902-7aecb25e1fe5 github.com/dgrijalva/jwt-go v3.2.0+incompatible github.com/forgoer/openssl v0.0.0-20201023062029-c3112b0c8700 - github.com/gin-gonic/gin v1.9.1 + github.com/gin-contrib/sessions v0.0.3 + github.com/gin-gonic/gin v1.9.0 github.com/go-playground/locales v0.14.1 github.com/go-playground/universal-translator v0.18.1 github.com/go-playground/validator/v10 v10.20.0 github.com/go-redis/redis v6.15.9+incompatible + github.com/gomodule/redigo v2.0.0+incompatible github.com/iGoogle-ink/gopay v1.5.36 github.com/makiuchi-d/gozxing v0.0.0-20210324052758-57132e828831 github.com/qiniu/api.v7/v7 v7.8.2 @@ -34,15 +36,13 @@ require ( ) require ( - code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241118081439-70519d0b030c - code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241118084151-870d25b871af - code.fnuoos.com/go_rely_warehouse/zyos_go_es.git v1.0.1-0.20241118083738-0f22da9ba0be + code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241118064045-6ecc894c9bf8 + code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.3 + code.fnuoos.com/go_rely_warehouse/zyos_go_es.git v1.0.0 code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5 github.com/aliyun/aliyun-oss-go-sdk v3.0.2+incompatible - github.com/gin-contrib/sessions v1.0.1 github.com/go-sql-driver/mysql v1.8.1 github.com/gocolly/colly v1.2.0 - github.com/gomodule/redigo v2.0.0+incompatible github.com/olivere/elastic/v7 v7.0.32 github.com/shopspring/decimal v1.3.1 github.com/tidwall/gjson v1.14.1 @@ -73,9 +73,9 @@ require ( github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/gookit/color v1.3.8 // indirect - github.com/gorilla/context v1.1.2 // indirect - github.com/gorilla/securecookie v1.1.2 // indirect - github.com/gorilla/sessions v1.2.2 // indirect + github.com/gorilla/context v1.1.1 // indirect + github.com/gorilla/securecookie v1.1.1 // indirect + github.com/gorilla/sessions v1.2.1 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/kennygrant/sanitize v1.2.4 // indirect @@ -85,7 +85,8 @@ require ( github.com/mattn/go-isatty v0.0.20 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/nxadm/tail v1.4.8 // indirect + github.com/onsi/ginkgo v1.16.5 // indirect + github.com/onsi/gomega v1.19.0 // indirect github.com/pelletier/go-toml/v2 v2.2.1 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/saintfish/chardet v0.0.0-20230101081208-5e3ef4b5456d // indirect