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