Commit 48f8f0fd authored by haoyanbin's avatar haoyanbin

Msg

parent 0697acd4
...@@ -65,6 +65,7 @@ func (e OrgPlayerUser) GetMsg(c *gin.Context) { ...@@ -65,6 +65,7 @@ func (e OrgPlayerUser) GetMsg(c *gin.Context) {
} }
reqMsg.Username = req.Username reqMsg.Username = req.Username
reqMsg.Code = code reqMsg.Code = code
reqMsg.MsgType = "1"
err = sMsg.Insert(&reqMsg) err = sMsg.Insert(&reqMsg)
smsText := "您的验证码为:" + code smsText := "您的验证码为:" + code
...@@ -126,6 +127,7 @@ func (e OrgPlayerUser) Login(c *gin.Context) { ...@@ -126,6 +127,7 @@ func (e OrgPlayerUser) Login(c *gin.Context) {
} }
reqMsg.Username = req.Username reqMsg.Username = req.Username
reqMsg.Code = req.Code reqMsg.Code = req.Code
reqMsg.MsgType = "1"
err = sMsg.Get(&reqMsg) err = sMsg.Get(&reqMsg)
if err != nil { if err != nil {
e.Logger.Error(err) e.Logger.Error(err)
......
...@@ -18,6 +18,7 @@ type OrgMsgInsertReq struct { ...@@ -18,6 +18,7 @@ type OrgMsgInsertReq struct {
Id int `json:"-" comment:""` // Id int `json:"-" comment:""` //
Code string `json:"code" comment:""` Code string `json:"code" comment:""`
Username string `json:"username" comment:""` Username string `json:"username" comment:""`
MsgType string `json:"msgType" comment:""`
common.ControlBy common.ControlBy
} }
...@@ -27,6 +28,7 @@ func (s *OrgMsgInsertReq) Generate(model *models.OrgMsg) { ...@@ -27,6 +28,7 @@ func (s *OrgMsgInsertReq) Generate(model *models.OrgMsg) {
} }
model.Code = s.Code model.Code = s.Code
model.Username = s.Username model.Username = s.Username
model.MsgType = s.MsgType
} }
func (s *OrgMsgInsertReq) GetId() interface{} { func (s *OrgMsgInsertReq) GetId() interface{} {
...@@ -56,6 +58,7 @@ func (s *OrgMsgUpdateReq) GetId() interface{} { ...@@ -56,6 +58,7 @@ func (s *OrgMsgUpdateReq) GetId() interface{} {
type OrgMsgGetReq struct { type OrgMsgGetReq struct {
Username string `json:"username"` Username string `json:"username"`
Code string `json:"code"` Code string `json:"code"`
MsgType string `json:"msgType"`
} }
// OrgMsgDeleteReq 功能删除请求参数 // OrgMsgDeleteReq 功能删除请求参数
......
...@@ -51,6 +51,7 @@ func (e *OrgMsg) Get(d *dto.OrgMsgGetReq) error { ...@@ -51,6 +51,7 @@ func (e *OrgMsg) Get(d *dto.OrgMsgGetReq) error {
Where("code=?", d.Code). Where("code=?", d.Code).
Where("username=?", d.Username). Where("username=?", d.Username).
Where("created_at>?", nowBefore5Minute). Where("created_at>?", nowBefore5Minute).
Where("msg_type=?", d.MsgType).
Order("id desc"). Order("id desc").
First(&reply).Error First(&reply).Error
if err != nil && errors.Is(err, gorm.ErrRecordNotFound) { if err != nil && errors.Is(err, gorm.ErrRecordNotFound) {
......
...@@ -25,7 +25,7 @@ type OrgUser struct { ...@@ -25,7 +25,7 @@ type OrgUser struct {
// @Summary <赛事>列表用户信息数据 // @Summary <赛事>列表用户信息数据
// @Description 获取JSON // @Description 获取JSON
// @Tags 用户 // @Tags 用户
// @Param username query string false "username" // @Param data body dto.OrgUserGetPageReq true "data"
// @Success 200 {string} {object} response.Response "{"code": 200, "data": [...]}" // @Success 200 {string} {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/org-user [get] // @Router /api/v1/org-user [get]
// @Security Bearer // @Security Bearer
...@@ -150,7 +150,7 @@ func (e OrgUser) Insert(c *gin.Context) { ...@@ -150,7 +150,7 @@ func (e OrgUser) Insert(c *gin.Context) {
// @Tags 用户 // @Tags 用户
// @Accept application/json // @Accept application/json
// @Product application/json // @Product application/json
// @Param data body dto.SysUserUpdateReq true "body" // @Param data body dto.OrgUserUpdateReq true "body"
// @Success 200 {string} string "{"code": 200, "data": [...]}" // @Success 200 {string} string "{"code": 200, "data": [...]}"
// @Router /api/v1/org-user/{userId} [put] // @Router /api/v1/org-user/{userId} [put]
// @Security Bearer // @Security Bearer
...@@ -223,7 +223,7 @@ func (e OrgUser) Delete(c *gin.Context) { ...@@ -223,7 +223,7 @@ func (e OrgUser) Delete(c *gin.Context) {
// @Tags 用户 // @Tags 用户
// @Accept application/json // @Accept application/json
// @Product application/json // @Product application/json
// @Param data body dto.UpdateSysUserStatusReq true "body" // @Param data body dto.OrgUserUpdateStatusReq true "body"
// @Success 200 {string} string "{"code": 200, "data": [...]}" // @Success 200 {string} string "{"code": 200, "data": [...]}"
// @Router /api/v1/org-user/status [put] // @Router /api/v1/org-user/status [put]
// @Security Bearer // @Security Bearer
......
package models package models
import ( import (
// "gorm.io/gorm" // "gorm.io/gorm"
"go-admin/common/models" "go-admin/common/models"
) )
type OrgMsg struct { type OrgMsg struct {
models.Model models.Model
Code string `json:"code" gorm:"type:varchar(20);comment:Code"` Code string `json:"code" gorm:"type:varchar(20);comment:Code"`
Username string `json:"username" gorm:"type:varchar(20);comment:Username"` Username string `json:"username" gorm:"type:varchar(20);comment:Username"`
models.ModelTime MsgType string `json:"msgType" gorm:"type:varchar(20);comment:MsgType"`
models.ControlBy models.ModelTime
models.ControlBy
} }
func (OrgMsg) TableName() string { func (OrgMsg) TableName() string {
return "org_msg" return "org_msg"
} }
func (e *OrgMsg) Generate() models.ActiveRecord { func (e *OrgMsg) Generate() models.ActiveRecord {
...@@ -26,4 +27,4 @@ func (e *OrgMsg) Generate() models.ActiveRecord { ...@@ -26,4 +27,4 @@ func (e *OrgMsg) Generate() models.ActiveRecord {
func (e *OrgMsg) GetId() interface{} { func (e *OrgMsg) GetId() interface{} {
return e.Id return e.Id
} }
\ No newline at end of file
...@@ -19,7 +19,7 @@ type OrgUser struct { ...@@ -19,7 +19,7 @@ type OrgUser struct {
func (e *OrgUser) GetPage(c *dto.OrgUserGetPageReq, p *actions.DataPermission, list *[]dto.OrgUserGetPageReply, count *int64) error { func (e *OrgUser) GetPage(c *dto.OrgUserGetPageReq, p *actions.DataPermission, list *[]dto.OrgUserGetPageReply, count *int64) error {
var err error var err error
var data models.SysUser var data models.SysUser
field := "su.user_id, su.username, su.nick_name, su.nick_name_en, sr.role_name, su.status" field := "su.user_id, su.username, su.nick_name, su.nick_name_en, su.role_id, sr.role_name, su.status"
err = e.Orm.Table("sys_user as su"). err = e.Orm.Table("sys_user as su").
Select(field). Select(field).
...@@ -42,7 +42,7 @@ func (e *OrgUser) GetPage(c *dto.OrgUserGetPageReq, p *actions.DataPermission, l ...@@ -42,7 +42,7 @@ func (e *OrgUser) GetPage(c *dto.OrgUserGetPageReq, p *actions.DataPermission, l
// Get 获取OrgTeamUser对象 // Get 获取OrgTeamUser对象
func (e *OrgUser) Get(d *dto.OrgUserGetReq, p *actions.DataPermission, model *dto.OrgUserGetReply) error { func (e *OrgUser) Get(d *dto.OrgUserGetReq, p *actions.DataPermission, model *dto.OrgUserGetReply) error {
field := "su.user_id, su.username, su.nick_name, su.nick_name_en, su.status" field := "su.user_id, su.username, su.nick_name, su.nick_name_en, su.role_id, su.status"
err := e.Orm.Table("sys_user as su"). err := e.Orm.Table("sys_user as su").
Select(field). Select(field).
......
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