Commit d9deee2b authored by haoyanbin's avatar haoyanbin

User

parent 344f0a26
......@@ -103,6 +103,7 @@ type SysUserInsertReq struct {
PostId int `json:"postId" comment:"岗位"`
Remark string `json:"remark" comment:"备注"`
Status string `json:"status" comment:"状态" vd:"len($)>0" default:"2"`
UserType string `json:"userType" comment:"用户类型 2 赛事 3 俱乐部 4 球队 " default:"1"`
common.ControlBy
}
......@@ -122,6 +123,7 @@ func (s *SysUserInsertReq) Generate(model *models.SysUser) {
model.PostId = s.PostId
model.Remark = s.Remark
model.Status = s.Status
model.UserType = s.UserType
}
func (s *SysUserInsertReq) GetId() interface{} {
......
......@@ -131,7 +131,7 @@ func (e OrgClub) Insert(c *gin.Context) {
reqSysUser.NickName = req.ClubContacts
reqSysUser.NickNameEn = req.ClubContactsEn
reqSysUser.Phone = req.ClubMobile
reqSysUser.RoleId = 1
reqSysUser.RoleId = 8
reqSysUser.Avatar = ""
reqSysUser.Sex = "0"
reqSysUser.Email = ""
......@@ -139,6 +139,7 @@ func (e OrgClub) Insert(c *gin.Context) {
reqSysUser.PostId = 1
reqSysUser.Remark = "俱乐部"
reqSysUser.Status = "2"
reqSysUser.UserType = "3"
// 设置创建人
reqSysUser.SetCreateBy(user.GetUserId(c))
......
......@@ -54,7 +54,7 @@ func (e OrgTeamMatch) GetPage(c *gin.Context) {
p := actions.GetPermissionFromContext(c)
list := make([]dto.OrgTeamMatchGetPageReply, 0)
var count int64
fmt.Println(user.GetUserId(c))
req.TeamId = e.getTeamId(c)
err = s.GetPage(&req, p, &list, &count)
......
......@@ -121,7 +121,7 @@ func (e OrgTeamUser) Insert(c *gin.Context) {
reqSysUser.NickName = req.Name
reqSysUser.NickNameEn = req.NameEn
reqSysUser.Phone = req.Username
reqSysUser.RoleId = 1
reqSysUser.RoleId = 7
reqSysUser.Avatar = ""
reqSysUser.Sex = req.Sex
reqSysUser.Email = ""
......@@ -129,6 +129,7 @@ func (e OrgTeamUser) Insert(c *gin.Context) {
reqSysUser.PostId = 1
reqSysUser.Remark = "球队工作人员"
reqSysUser.Status = "2"
reqSysUser.UserType = "4"
// 设置创建人
reqSysUser.SetCreateBy(user.GetUserId(c))
......
......@@ -2,7 +2,10 @@ package apis
import (
"github.com/gin-gonic/gin/binding"
sService "go-admin/app/admin/service"
sDto "go-admin/app/admin/service/dto"
"net/http"
"strconv"
"github.com/gin-gonic/gin"
"github.com/go-admin-team/go-admin-core/sdk/api"
......@@ -93,7 +96,7 @@ func (e OrgUser) Get(c *gin.Context) {
// @Tags 用户
// @Accept application/json
// @Product application/json
// @Param data body dto.SysUserInsertReq true "用户数据"
// @Param data body dto.OrgUserInsertReq true "用户数据"
// @Success 200 {string} string "{"code": 200, "data": [...]}"
// @Router /api/v1/org-user [post]
// @Security Bearer
......@@ -110,9 +113,28 @@ func (e OrgUser) Insert(c *gin.Context) {
e.Error(500, err, err.Error())
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))
err = s.Insert(&req)
reqSysUser.SetCreateBy(user.GetUserId(c))
err = sSysUser.Insert(&reqSysUser)
if err != nil {
e.Logger.Error(err)
e.Error(500, err, err.Error())
......
......@@ -28,7 +28,7 @@ func (e *OrgMatchEvaluate) GetPage(c *dto.OrgMatchEvaluateGetPageReq, p *actions
"ome.remark"
err = e.Orm.Table("org_match_team_player as omtp").
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_league as ol on ol.id = om.league_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