Commit d9deee2b authored by haoyanbin's avatar haoyanbin

User

parent 344f0a26
...@@ -103,6 +103,7 @@ type SysUserInsertReq struct { ...@@ -103,6 +103,7 @@ type SysUserInsertReq struct {
PostId int `json:"postId" comment:"岗位"` PostId int `json:"postId" comment:"岗位"`
Remark string `json:"remark" comment:"备注"` Remark string `json:"remark" comment:"备注"`
Status string `json:"status" comment:"状态" vd:"len($)>0" default:"2"` Status string `json:"status" comment:"状态" vd:"len($)>0" default:"2"`
UserType string `json:"userType" comment:"用户类型 2 赛事 3 俱乐部 4 球队 " default:"1"`
common.ControlBy common.ControlBy
} }
...@@ -122,6 +123,7 @@ func (s *SysUserInsertReq) Generate(model *models.SysUser) { ...@@ -122,6 +123,7 @@ func (s *SysUserInsertReq) Generate(model *models.SysUser) {
model.PostId = s.PostId model.PostId = s.PostId
model.Remark = s.Remark model.Remark = s.Remark
model.Status = s.Status model.Status = s.Status
model.UserType = s.UserType
} }
func (s *SysUserInsertReq) GetId() interface{} { func (s *SysUserInsertReq) GetId() interface{} {
......
...@@ -131,7 +131,7 @@ func (e OrgClub) Insert(c *gin.Context) { ...@@ -131,7 +131,7 @@ func (e OrgClub) Insert(c *gin.Context) {
reqSysUser.NickName = req.ClubContacts reqSysUser.NickName = req.ClubContacts
reqSysUser.NickNameEn = req.ClubContactsEn reqSysUser.NickNameEn = req.ClubContactsEn
reqSysUser.Phone = req.ClubMobile reqSysUser.Phone = req.ClubMobile
reqSysUser.RoleId = 1 reqSysUser.RoleId = 8
reqSysUser.Avatar = "" reqSysUser.Avatar = ""
reqSysUser.Sex = "0" reqSysUser.Sex = "0"
reqSysUser.Email = "" reqSysUser.Email = ""
...@@ -139,6 +139,7 @@ func (e OrgClub) Insert(c *gin.Context) { ...@@ -139,6 +139,7 @@ func (e OrgClub) Insert(c *gin.Context) {
reqSysUser.PostId = 1 reqSysUser.PostId = 1
reqSysUser.Remark = "俱乐部" reqSysUser.Remark = "俱乐部"
reqSysUser.Status = "2" reqSysUser.Status = "2"
reqSysUser.UserType = "3"
// 设置创建人 // 设置创建人
reqSysUser.SetCreateBy(user.GetUserId(c)) reqSysUser.SetCreateBy(user.GetUserId(c))
......
...@@ -54,7 +54,7 @@ func (e OrgTeamMatch) GetPage(c *gin.Context) { ...@@ -54,7 +54,7 @@ func (e OrgTeamMatch) GetPage(c *gin.Context) {
p := actions.GetPermissionFromContext(c) p := actions.GetPermissionFromContext(c)
list := make([]dto.OrgTeamMatchGetPageReply, 0) list := make([]dto.OrgTeamMatchGetPageReply, 0)
var count int64 var count int64
fmt.Println(user.GetUserId(c))
req.TeamId = e.getTeamId(c) req.TeamId = e.getTeamId(c)
err = s.GetPage(&req, p, &list, &count) err = s.GetPage(&req, p, &list, &count)
......
...@@ -121,7 +121,7 @@ func (e OrgTeamUser) Insert(c *gin.Context) { ...@@ -121,7 +121,7 @@ func (e OrgTeamUser) Insert(c *gin.Context) {
reqSysUser.NickName = req.Name reqSysUser.NickName = req.Name
reqSysUser.NickNameEn = req.NameEn reqSysUser.NickNameEn = req.NameEn
reqSysUser.Phone = req.Username reqSysUser.Phone = req.Username
reqSysUser.RoleId = 1 reqSysUser.RoleId = 7
reqSysUser.Avatar = "" reqSysUser.Avatar = ""
reqSysUser.Sex = req.Sex reqSysUser.Sex = req.Sex
reqSysUser.Email = "" reqSysUser.Email = ""
...@@ -129,6 +129,7 @@ func (e OrgTeamUser) Insert(c *gin.Context) { ...@@ -129,6 +129,7 @@ func (e OrgTeamUser) Insert(c *gin.Context) {
reqSysUser.PostId = 1 reqSysUser.PostId = 1
reqSysUser.Remark = "球队工作人员" reqSysUser.Remark = "球队工作人员"
reqSysUser.Status = "2" reqSysUser.Status = "2"
reqSysUser.UserType = "4"
// 设置创建人 // 设置创建人
reqSysUser.SetCreateBy(user.GetUserId(c)) reqSysUser.SetCreateBy(user.GetUserId(c))
......
...@@ -2,7 +2,10 @@ package apis ...@@ -2,7 +2,10 @@ package apis
import ( import (
"github.com/gin-gonic/gin/binding" "github.com/gin-gonic/gin/binding"
sService "go-admin/app/admin/service"
sDto "go-admin/app/admin/service/dto"
"net/http" "net/http"
"strconv"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/go-admin-team/go-admin-core/sdk/api" "github.com/go-admin-team/go-admin-core/sdk/api"
...@@ -93,7 +96,7 @@ func (e OrgUser) Get(c *gin.Context) { ...@@ -93,7 +96,7 @@ func (e OrgUser) Get(c *gin.Context) {
// @Tags 用户 // @Tags 用户
// @Accept application/json // @Accept application/json
// @Product application/json // @Product application/json
// @Param data body dto.SysUserInsertReq true "用户数据" // @Param data body dto.OrgUserInsertReq true "用户数据"
// @Success 200 {string} string "{"code": 200, "data": [...]}" // @Success 200 {string} string "{"code": 200, "data": [...]}"
// @Router /api/v1/org-user [post] // @Router /api/v1/org-user [post]
// @Security Bearer // @Security Bearer
...@@ -110,9 +113,28 @@ func (e OrgUser) Insert(c *gin.Context) { ...@@ -110,9 +113,28 @@ func (e OrgUser) Insert(c *gin.Context) {
e.Error(500, err, err.Error()) e.Error(500, err, err.Error())
return return
} }
sSysUser := sService.SysUser{}
reqSysUser := sDto.SysUserInsertReq{}
e.MakeContext(c).MakeOrm().MakeService(&sSysUser.Service)
reqSysUser.Username = req.Username
reqSysUser.Password = "123456"
reqSysUser.NickName = req.NickName
reqSysUser.NickNameEn = req.NickNameEn
reqSysUser.Phone = req.Username
reqSysUser.RoleId, _ = strconv.Atoi(req.RoleId)
reqSysUser.Avatar = ""
reqSysUser.Sex = "0"
reqSysUser.Email = ""
reqSysUser.DeptId = 1
reqSysUser.PostId = 1
reqSysUser.Remark = "赛事"
reqSysUser.Status = "2"
reqSysUser.UserType = "2"
// 设置创建人 // 设置创建人
req.SetCreateBy(user.GetUserId(c)) reqSysUser.SetCreateBy(user.GetUserId(c))
err = s.Insert(&req) err = sSysUser.Insert(&reqSysUser)
if err != nil { if err != nil {
e.Logger.Error(err) e.Logger.Error(err)
e.Error(500, err, err.Error()) e.Error(500, err, err.Error())
......
...@@ -28,7 +28,7 @@ func (e *OrgMatchEvaluate) GetPage(c *dto.OrgMatchEvaluateGetPageReq, p *actions ...@@ -28,7 +28,7 @@ func (e *OrgMatchEvaluate) GetPage(c *dto.OrgMatchEvaluateGetPageReq, p *actions
"ome.remark" "ome.remark"
err = e.Orm.Table("org_match_team_player as omtp"). err = e.Orm.Table("org_match_team_player as omtp").
Select(field). Select(field).
Joins("left join org_match_evaluate as ome on omtp.player_id = ome.player_id"). Joins("left join org_match_evaluate as ome on omtp.match_id = ome.id and omtp.rounds = ome.rounds").
Joins("left join org_match as om on omtp.match_id = om.id and omtp.rounds = om.rounds"). Joins("left join org_match as om on omtp.match_id = om.id and omtp.rounds = om.rounds").
Joins("left join org_league as ol on ol.id = om.league_id"). Joins("left join org_league as ol on ol.id = om.league_id").
Joins("left join org_division as od on od.id = om.division_id"). Joins("left join org_division as od on od.id = om.division_id").
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment