浏览代码

add NineDimensionalSpace

master
shenjiachi 1 天前
父节点
当前提交
14ec5753a0
共有 6 个文件被更改,包括 206 次插入13 次删除
  1. +53
    -0
      app/hdl/institutional_management/public_platoon/hdl_basic.go
  2. +10
    -0
      app/md/institutional_management/public_platoon/md_public_platoon.go
  3. +1
    -0
      app/router/router.go
  4. +55
    -6
      docs/docs.go
  5. +52
    -4
      docs/swagger.json
  6. +35
    -3
      docs/swagger.yaml

+ 53
- 0
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 公排管理


+ 10
- 0
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"` // 会员手机号


+ 1
- 0
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")
{


+ 55
- 6
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() {


+ 52
- 4
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": {


+ 35
- 3
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:


正在加载...
取消
保存