Browse Source

update

master
shenjiachi 1 month ago
parent
commit
cda47a6391
3 changed files with 49 additions and 3 deletions
  1. +43
    -3
      app/hdl/institutional_management/public_platoon/hdl_basic.go
  2. +5
    -0
      app/md/institutional_management/public_platoon/md_public_platoon.go
  3. +1
    -0
      app/router/router.go

+ 43
- 3
app/hdl/institutional_management/public_platoon/hdl_basic.go View File

@@ -6,6 +6,7 @@ import (
"applet/app/md/institutional_management/public_platoon"
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement"
"code.fnuoos.com/EggPlanet/egg_models.git/src/model"
"errors"
"github.com/gin-gonic/gin"
"time"
)
@@ -126,7 +127,7 @@ func UpdatePublicPlatoonBasic(c *gin.Context) {
// @Router /api/publicPlatoon/relationshipMap [get]
func GetRelationshipMap(c *gin.Context) {
var req *public_platoon.GetRelationshipMapReq
if err := c.ShouldBindJSON(&req); err != nil {
if err := c.ShouldBindQuery(&req); err != nil {
e.OutErr(c, e.ERR_INVALID_ARGS, err)
return
}
@@ -254,7 +255,7 @@ func GetRelationshipMap(c *gin.Context) {
// @Router /api/publicPlatoon/findUserRelationshipMap [get]
func FindUserRelationshipMap(c *gin.Context) {
var req *public_platoon.FindUserRelationshipMapReq
if err := c.ShouldBindJSON(&req); err != nil {
if err := c.ShouldBindQuery(&req); err != nil {
e.OutErr(c, e.ERR_INVALID_ARGS, err)
return
}
@@ -319,7 +320,7 @@ func FindUserRelationshipMap(c *gin.Context) {
// @Router /api/publicPlatoon/findSubUserRelationshipMap [get]
func FindSubUserRelationshipMap(c *gin.Context) {
var req *public_platoon.FindSubUserRelationshipMapReq
if err := c.ShouldBindJSON(&req); err != nil {
if err := c.ShouldBindQuery(&req); err != nil {
e.OutErr(c, e.ERR_INVALID_ARGS, err)
return
}
@@ -375,3 +376,42 @@ func FindSubUserRelationshipMap(c *gin.Context) {
}
e.OutSuc(c, res, nil)
}

func ExchangeUserPosition(c *gin.Context) {
var req *public_platoon.ExchangeUserPositionReq
if err1 := c.ShouldBindJSON(&req); err1 != nil {
e.OutErr(c, e.ERR_INVALID_ARGS, err1)
return
}

relationDb := implement.NewPublicPlatoonUserRelationDb(db.Db)
relation1, err2 := relationDb.PublicPlatoonUserRelationGetOneByPosition(req.Position1)
if err2 != nil {
e.OutErr(c, e.ERR_DB_ORM, err2)
return
}
if relation1 == nil {
e.OutErr(c, e.ERR_BAD_REQUEST, errors.New("position_1 位置有误"))
return
}

relation2, err3 := relationDb.PublicPlatoonUserRelationGetOneByPosition(req.Position1)
if err3 != nil {
e.OutErr(c, e.ERR_DB_ORM, err3)
return
}
if relation2 == nil {
e.OutErr(c, e.ERR_BAD_REQUEST, errors.New("position_2 位置有误"))
return
}

if relation1.Uid == 1 || relation2.Uid == 1 {
e.OutErr(c, e.ERR_BAD_REQUEST, errors.New("创始人位置不能被修改"))
}

//uid1 := relation1.Uid
//uid2 := relation2.Uid
//recommendUid1 := relation1.RecommendUid
//recommendUid2 := relation2.RecommendUid
//relation1.Uid = ""
}

+ 5
- 0
app/md/institutional_management/public_platoon/md_public_platoon.go View File

@@ -50,3 +50,8 @@ type FindUserRelationshipMapReq struct {
type FindSubUserRelationshipMapReq struct {
Uid int64 `json:"uid"`
}

type ExchangeUserPositionReq struct {
Position1 int64 `json:"position_1"`
Position2 int64 `json:"position_2"`
}

+ 1
- 0
app/router/router.go View File

@@ -64,6 +64,7 @@ func rInstitutionalManagement(r *gin.RouterGroup) { //制度管理
rPublicPlatoon.GET("/relationshipMap", public_platoon.GetRelationshipMap)
rPublicPlatoon.GET("/findUserRelationshipMap", public_platoon.FindUserRelationshipMap)
rPublicPlatoon.GET("/findSubUserRelationshipMap", public_platoon.FindSubUserRelationshipMap)
rPublicPlatoon.POST("/exchangeUserPosition", public_platoon.ExchangeUserPosition)
}
}



Loading…
Cancel
Save