12345678910111213141516171819202122232425262728293031323334353637 |
- package controller
- import (
- "github.com/gin-gonic/gin"
- "github.com/go-playground/validator/v10"
- "project_management/app/e"
- "project_management/app/model"
- "project_management/app/services"
- "project_management/unity"
- )
- var Apply services.Apply = &model.Apply{}
- func GetApplyList(c *gin.Context) {
- }
- // AddApply 添加应用
- func AddApply(c *gin.Context) {
- var apply model.Apply
- if err := c.ShouldBindJSON(&apply); err != nil {
- e.ResponseWithMsg(c, e.JSONParsingFailed, e.JSONParsingFailed.GetMsg())
- return
- }
- validate := validator.New()
- if err := validate.Struct(apply); err != nil {
- e.ResponseWithMsg(c, e.ERROR, err.Error())
- return
- }
- // 生成应用ID
- id := unity.RandomAppID()
- for model.AppIdISRepeat(id) {
- id = unity.RandomAppID()
- }
- apply.AppID = id
- Apply.AddApply(apply)
- }
|