diff --git a/app/hdl/institutional_management/public_platoon/hdl_basic.go b/app/hdl/institutional_management/public_platoon/hdl_basic.go index b72a16c..d859725 100644 --- a/app/hdl/institutional_management/public_platoon/hdl_basic.go +++ b/app/hdl/institutional_management/public_platoon/hdl_basic.go @@ -12,7 +12,9 @@ import ( rule "code.fnuoos.com/EggPlanet/egg_system_rules.git" ruleSvc "code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy" "errors" + "fmt" "github.com/gin-gonic/gin" + "math" "time" ) @@ -434,6 +436,57 @@ func ExchangeUserPosition(c *gin.Context) { e.OutSuc(c, nil, nil) } +// NineDimensionalSpace +// @Summary 制度中心-公排管理-关系分布图(公排详情) +// @Tags 公排管理 +// @Description 关系分布图(公排详情) +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Param uid query string false "用户id" +// @Success 200 {} "成功返回" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/institutionalManagement/publicPlatoon/nineDimensionalSpace [GET] +func NineDimensionalSpace(c *gin.Context) { + uid := c.Query("uid") + // 1. 查询公排基础设置 + settingDb := implement.NewPublicPlatoonBasicSettingDb(db.Db) + setting, err := settingDb.PublicPlatoonBasicSettingGetOneByParams(map[string]interface{}{ + "key": "is_open", + "value": 1, + }) + if err != nil { + e.OutErr(c, e.ERR_DB_ORM, err.Error()) + return + } + if setting == nil { + e.OutErr(c, e.ERR_NO_DATA, nil) + return + } + + var spaceTotalNums float64 + var list []md.SpaceListNode + for i := 1; i <= setting.SeveralRows; i++ { + var tmpSql = fmt.Sprintf("SELECT COUNT(*)AS total FROM `public_platoon_user_relation` WHERE father_uid%d = %s", i, uid) + tmpNativeString, _ := db.QueryNativeString(db.Db, tmpSql) + nowUserCount := utils.StrToInt64(tmpNativeString[0]["total"]) + maxCount := math.Pow(float64(setting.SeveralTimes), float64(i)) + if nowUserCount > int64(maxCount) { + nowUserCount = int64(maxCount) + } + + list = append(list, md.SpaceListNode{ + Name: utils.IntToStr(i) + "维", + MaxCount: int(maxCount), + NowCount: int(nowUserCount), + }) + spaceTotalNums += maxCount + } + + resp := md.NineDimensionalSpaceResp{SpaceList: list} + e.OutSuc(c, resp, nil) +} + // GetFreePublishUser // @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 d17d531..741ff18 100644 --- a/app/md/institutional_management/public_platoon/md_public_platoon.go +++ b/app/md/institutional_management/public_platoon/md_public_platoon.go @@ -53,6 +53,16 @@ type ExchangeUserPositionReq struct { Position2 int64 `json:"position_2,required"` //位置2,具体值取返回数据中的 system_id } +type SpaceListNode struct { + Name string `json:"name"` // 维度 + MaxCount int `json:"max_count"` // 最大容纳人数 + NowCount int `json:"now_count"` // 当前人数 +} + +type NineDimensionalSpaceResp struct { + SpaceList []SpaceListNode `json:"space_list"` // 数据列表 +} + type SelectMemberReq struct { Uid int64 `json:"uid"` // 会员 ID Phone string `json:"phone"` // 会员手机号 diff --git a/app/router/router.go b/app/router/router.go index 6b04103..f77c634 100644 --- a/app/router/router.go +++ b/app/router/router.go @@ -225,6 +225,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.GET("/nineDimensionalSpace", public_platoon.NineDimensionalSpace) rPublicPlatoon.POST("/selectMember", public_platoon.SelectMember) rPublicPlatoonUserFreePunish := rPublicPlatoon.Group("/publicPlatoonUserFreePunish") { diff --git a/docs/docs.go b/docs/docs.go index 42e4cee..5fa4cfc 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -1,5 +1,4 @@ -// Code generated by swaggo/swag. DO NOT EDIT. - +// Package docs Code generated by swaggo/swag. DO NOT EDIT package docs import "github.com/swaggo/swag" @@ -1656,9 +1655,7 @@ const docTemplate = `{ "name": "req", "in": "body", "required": true, - "schema": { - "type": "object" - } + "schema": {} } ], "responses": { @@ -5439,6 +5436,50 @@ const docTemplate = `{ } } }, + "/api/institutionalManagement/publicPlatoon/nineDimensionalSpace": { + "get": { + "description": "关系分布图(公排详情)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "公排管理" + ], + "summary": "制度中心-公排管理-关系分布图(公排详情)", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "type": "string", + "description": "用户id", + "name": "uid", + "in": "query" + } + ], + "responses": { + "200": { + "description": "成功返回", + "schema": { + "type": "" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, "/api/institutionalManagement/publicPlatoon/publicPlatoonUserFreePunish/delete": { "delete": { "description": "免罚用户(删除)", @@ -9514,6 +9555,10 @@ const docTemplate = `{ } ] }, + "initial_price": { + "description": "初始价格", + "type": "string" + }, "is_open": { "description": "是否开启(1:开启 0:关闭)", "type": "integer" @@ -14932,6 +14977,9 @@ const docTemplate = `{ "md.StatisticsEggPointReq": { "type": "object", "properties": { + "kind": { + "type": "string" + }, "week": { "type": "string", "example": "周份" @@ -17026,7 +17074,6 @@ const docTemplate = `{ "type": "object", "required": [ "audit_state", - "reason", "withdraw_apply_id" ], "properties": { @@ -17272,6 +17319,8 @@ var SwaggerInfo = &swag.Spec{ Description: "管理后台接口文档", InfoInstanceName: "swagger", SwaggerTemplate: docTemplate, + LeftDelim: "{{", + RightDelim: "}}", } func init() { diff --git a/docs/swagger.json b/docs/swagger.json index e433d20..7a429ae 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -1648,9 +1648,7 @@ "name": "req", "in": "body", "required": true, - "schema": { - "type": "object" - } + "schema": {} } ], "responses": { @@ -5431,6 +5429,50 @@ } } }, + "/api/institutionalManagement/publicPlatoon/nineDimensionalSpace": { + "get": { + "description": "关系分布图(公排详情)", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "公排管理" + ], + "summary": "制度中心-公排管理-关系分布图(公排详情)", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "type": "string", + "description": "用户id", + "name": "uid", + "in": "query" + } + ], + "responses": { + "200": { + "description": "成功返回", + "schema": { + "type": "" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, "/api/institutionalManagement/publicPlatoon/publicPlatoonUserFreePunish/delete": { "delete": { "description": "免罚用户(删除)", @@ -9506,6 +9548,10 @@ } ] }, + "initial_price": { + "description": "初始价格", + "type": "string" + }, "is_open": { "description": "是否开启(1:开启 0:关闭)", "type": "integer" @@ -14924,6 +14970,9 @@ "md.StatisticsEggPointReq": { "type": "object", "properties": { + "kind": { + "type": "string" + }, "week": { "type": "string", "example": "周份" @@ -17018,7 +17067,6 @@ "type": "object", "required": [ "audit_state", - "reason", "withdraw_apply_id" ], "properties": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index f19796c..ad84fc6 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -90,6 +90,9 @@ definitions: allOf: - $ref: '#/definitions/md.DirectPushRewardSettingStruct' description: 直推奖励 + initial_price: + description: 初始价格 + type: string is_open: description: 是否开启(1:开启 0:关闭) type: integer @@ -3858,6 +3861,8 @@ definitions: type: object md.StatisticsEggPointReq: properties: + kind: + type: string week: example: 周份 type: string @@ -5317,7 +5322,6 @@ definitions: type: integer required: - audit_state - - reason - withdraw_apply_id type: object md.WithdrawFeeSetStruct: @@ -6545,8 +6549,7 @@ paths: in: body name: req required: true - schema: - type: object + schema: {} produces: - application/json responses: @@ -9044,6 +9047,35 @@ paths: summary: 制度中心-公排管理-公排基础设置(获取) tags: - 公排管理 + /api/institutionalManagement/publicPlatoon/nineDimensionalSpace: + get: + consumes: + - application/json + description: 关系分布图(公排详情) + parameters: + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization + required: true + type: string + - description: 用户id + in: query + name: uid + type: string + produces: + - application/json + responses: + "200": + description: 成功返回 + schema: + type: "" + "400": + description: 具体错误 + schema: + $ref: '#/definitions/md.Response' + summary: 制度中心-公排管理-关系分布图(公排详情) + tags: + - 公排管理 /api/institutionalManagement/publicPlatoon/publicPlatoonUserFreePunish/delete: delete: consumes: