[FIX]搁浅项目
This commit is contained in:
parent
228028f560
commit
d71f8a9a55
139
docs/docs.go
139
docs/docs.go
|
@ -59,14 +59,20 @@ var doc = `{
|
||||||
},
|
},
|
||||||
"/admin/v1/employees": {
|
"/admin/v1/employees": {
|
||||||
"get": {
|
"get": {
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
|
"tags": [
|
||||||
|
"employees"
|
||||||
|
],
|
||||||
"summary": "获取员工列表",
|
"summary": "获取员工列表",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "auth by /auth",
|
"description": "auth by /admin/login",
|
||||||
"name": "Authorization",
|
"name": "Authorization",
|
||||||
"in": "header",
|
"in": "header",
|
||||||
"required": true
|
"required": true
|
||||||
|
@ -98,18 +104,81 @@ var doc = `{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"post": {
|
||||||
|
"consumes": [
|
||||||
|
"multipart/form-data"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"employees"
|
||||||
|
],
|
||||||
|
"summary": "新增员工",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "auth by /admin/login",
|
||||||
|
"name": "Authorization",
|
||||||
|
"in": "header",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "员工用户名",
|
||||||
|
"name": "username",
|
||||||
|
"in": "formData",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "员工密码",
|
||||||
|
"name": "password",
|
||||||
|
"in": "formData",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "员工部门",
|
||||||
|
"name": "department",
|
||||||
|
"in": "formData",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "员工职位",
|
||||||
|
"name": "position",
|
||||||
|
"in": "formData",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "{\"code\": 200, \"data\":{}, \"msg\":\"ok\"}",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/admin/v1/employees/{id}": {
|
"/admin/v1/employees/{id}": {
|
||||||
"get": {
|
"get": {
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
|
"tags": [
|
||||||
|
"employees"
|
||||||
|
],
|
||||||
"summary": "获取单个员工",
|
"summary": "获取单个员工",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "auth by /auth",
|
"description": "auth by /admin/login",
|
||||||
"name": "Authorization",
|
"name": "Authorization",
|
||||||
"in": "header",
|
"in": "header",
|
||||||
"required": true
|
"required": true
|
||||||
|
@ -130,6 +199,72 @@ var doc = `{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"put": {
|
||||||
|
"consumes": [
|
||||||
|
"multipart/form-data"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"employees"
|
||||||
|
],
|
||||||
|
"summary": "更新员工",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "auth by /admin/login",
|
||||||
|
"name": "Authorization",
|
||||||
|
"in": "header",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "ID",
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "员工用户名",
|
||||||
|
"name": "username",
|
||||||
|
"in": "formData"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "员工密码",
|
||||||
|
"name": "password",
|
||||||
|
"in": "formData"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "员工部门",
|
||||||
|
"name": "department",
|
||||||
|
"in": "formData"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "员工职位",
|
||||||
|
"name": "position",
|
||||||
|
"in": "formData"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "员工状态",
|
||||||
|
"name": "state",
|
||||||
|
"in": "formData"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "{\"code\": 200, \"data\":{}, \"msg\":\"ok\"}",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,14 +39,20 @@
|
||||||
},
|
},
|
||||||
"/admin/v1/employees": {
|
"/admin/v1/employees": {
|
||||||
"get": {
|
"get": {
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
|
"tags": [
|
||||||
|
"employees"
|
||||||
|
],
|
||||||
"summary": "获取员工列表",
|
"summary": "获取员工列表",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "auth by /auth",
|
"description": "auth by /admin/login",
|
||||||
"name": "Authorization",
|
"name": "Authorization",
|
||||||
"in": "header",
|
"in": "header",
|
||||||
"required": true
|
"required": true
|
||||||
|
@ -78,18 +84,81 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"post": {
|
||||||
|
"consumes": [
|
||||||
|
"multipart/form-data"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"employees"
|
||||||
|
],
|
||||||
|
"summary": "新增员工",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "auth by /admin/login",
|
||||||
|
"name": "Authorization",
|
||||||
|
"in": "header",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "员工用户名",
|
||||||
|
"name": "username",
|
||||||
|
"in": "formData",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "员工密码",
|
||||||
|
"name": "password",
|
||||||
|
"in": "formData",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "员工部门",
|
||||||
|
"name": "department",
|
||||||
|
"in": "formData",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "员工职位",
|
||||||
|
"name": "position",
|
||||||
|
"in": "formData",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "{\"code\": 200, \"data\":{}, \"msg\":\"ok\"}",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/admin/v1/employees/{id}": {
|
"/admin/v1/employees/{id}": {
|
||||||
"get": {
|
"get": {
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
|
"tags": [
|
||||||
|
"employees"
|
||||||
|
],
|
||||||
"summary": "获取单个员工",
|
"summary": "获取单个员工",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "auth by /auth",
|
"description": "auth by /admin/login",
|
||||||
"name": "Authorization",
|
"name": "Authorization",
|
||||||
"in": "header",
|
"in": "header",
|
||||||
"required": true
|
"required": true
|
||||||
|
@ -110,6 +179,72 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"put": {
|
||||||
|
"consumes": [
|
||||||
|
"multipart/form-data"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"employees"
|
||||||
|
],
|
||||||
|
"summary": "更新员工",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "auth by /admin/login",
|
||||||
|
"name": "Authorization",
|
||||||
|
"in": "header",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "ID",
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "员工用户名",
|
||||||
|
"name": "username",
|
||||||
|
"in": "formData"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "员工密码",
|
||||||
|
"name": "password",
|
||||||
|
"in": "formData"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "员工部门",
|
||||||
|
"name": "department",
|
||||||
|
"in": "formData"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "员工职位",
|
||||||
|
"name": "position",
|
||||||
|
"in": "formData"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "员工状态",
|
||||||
|
"name": "state",
|
||||||
|
"in": "formData"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "{\"code\": 200, \"data\":{}, \"msg\":\"ok\"}",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,8 +25,10 @@ paths:
|
||||||
summary: 后台登录
|
summary: 后台登录
|
||||||
/admin/v1/employees:
|
/admin/v1/employees:
|
||||||
get:
|
get:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
parameters:
|
parameters:
|
||||||
- description: auth by /auth
|
- description: auth by /admin/login
|
||||||
in: header
|
in: header
|
||||||
name: Authorization
|
name: Authorization
|
||||||
required: true
|
required: true
|
||||||
|
@ -51,10 +53,53 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
type: string
|
type: string
|
||||||
summary: 获取员工列表
|
summary: 获取员工列表
|
||||||
|
tags:
|
||||||
|
- employees
|
||||||
|
post:
|
||||||
|
consumes:
|
||||||
|
- multipart/form-data
|
||||||
|
parameters:
|
||||||
|
- description: auth by /admin/login
|
||||||
|
in: header
|
||||||
|
name: Authorization
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- description: 员工用户名
|
||||||
|
in: formData
|
||||||
|
name: username
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- description: 员工密码
|
||||||
|
in: formData
|
||||||
|
name: password
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- description: 员工部门
|
||||||
|
in: formData
|
||||||
|
name: department
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- description: 员工职位
|
||||||
|
in: formData
|
||||||
|
name: position
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: '{"code": 200, "data":{}, "msg":"ok"}'
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
summary: 新增员工
|
||||||
|
tags:
|
||||||
|
- employees
|
||||||
/admin/v1/employees/{id}:
|
/admin/v1/employees/{id}:
|
||||||
get:
|
get:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
parameters:
|
parameters:
|
||||||
- description: auth by /auth
|
- description: auth by /admin/login
|
||||||
in: header
|
in: header
|
||||||
name: Authorization
|
name: Authorization
|
||||||
required: true
|
required: true
|
||||||
|
@ -72,4 +117,50 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
type: string
|
type: string
|
||||||
summary: 获取单个员工
|
summary: 获取单个员工
|
||||||
|
tags:
|
||||||
|
- employees
|
||||||
|
put:
|
||||||
|
consumes:
|
||||||
|
- multipart/form-data
|
||||||
|
parameters:
|
||||||
|
- description: auth by /admin/login
|
||||||
|
in: header
|
||||||
|
name: Authorization
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- description: ID
|
||||||
|
in: path
|
||||||
|
name: id
|
||||||
|
required: true
|
||||||
|
type: integer
|
||||||
|
- description: 员工用户名
|
||||||
|
in: formData
|
||||||
|
name: username
|
||||||
|
type: string
|
||||||
|
- description: 员工密码
|
||||||
|
in: formData
|
||||||
|
name: password
|
||||||
|
type: string
|
||||||
|
- description: 员工部门
|
||||||
|
in: formData
|
||||||
|
name: department
|
||||||
|
type: string
|
||||||
|
- description: 员工职位
|
||||||
|
in: formData
|
||||||
|
name: position
|
||||||
|
type: string
|
||||||
|
- description: 员工状态
|
||||||
|
in: formData
|
||||||
|
name: state
|
||||||
|
type: string
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: '{"code": 200, "data":{}, "msg":"ok"}'
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
summary: 更新员工
|
||||||
|
tags:
|
||||||
|
- employees
|
||||||
swagger: "2.0"
|
swagger: "2.0"
|
||||||
|
|
|
@ -37,6 +37,15 @@ func ExistEmployeeByID(id int) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ExistEmployeeByUsername(username string) bool {
|
||||||
|
var employee Employee
|
||||||
|
db.Select("username").Where("username = ?", username).First(&employee)
|
||||||
|
if employee.ID > 0 {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func GetEmployeeTotal(maps interface{}) (count int) {
|
func GetEmployeeTotal(maps interface{}) (count int) {
|
||||||
db.Model(&Employee{}).Where(maps).Count(&count)
|
db.Model(&Employee{}).Where(maps).Count(&count)
|
||||||
|
|
||||||
|
@ -56,7 +65,6 @@ func GetEmployee(id int) (employee Employee) {
|
||||||
|
|
||||||
func EditEmployee(id int, data interface{}) bool {
|
func EditEmployee(id int, data interface{}) bool {
|
||||||
db.Model(&Employee{}).Where("id = ?", id).Updates(data)
|
db.Model(&Employee{}).Where("id = ?", id).Updates(data)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,11 +74,16 @@ func AddArticle(data map[string]interface{}) bool {
|
||||||
Password: data["password"].(string),
|
Password: data["password"].(string),
|
||||||
Department: data["department"].(string),
|
Department: data["department"].(string),
|
||||||
Position: data["position"].(string),
|
Position: data["position"].(string),
|
||||||
State: data["state"].(int),
|
|
||||||
})
|
})
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (employee *Employee) BeforeCreate(scope *gorm.Scope) error {
|
||||||
|
scope.SetColumn("CreateOn", time.Now().Unix())
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (employee *Employee) BeforeUpdate(scope *gorm.Scope) error {
|
func (employee *Employee) BeforeUpdate(scope *gorm.Scope) error {
|
||||||
scope.SetColumn("ModifiedOn", time.Now().Unix())
|
scope.SetColumn("ModifiedOn", time.Now().Unix())
|
||||||
|
|
||||||
|
|
|
@ -18,10 +18,10 @@ func InitAdmin(r *gin.Engine) *gin.Engine {
|
||||||
adminv1.GET("/employees", v1.GetEmployees)
|
adminv1.GET("/employees", v1.GetEmployees)
|
||||||
// 获取指定员工列表
|
// 获取指定员工列表
|
||||||
adminv1.GET("/employees/:id", v1.GetEmployee)
|
adminv1.GET("/employees/:id", v1.GetEmployee)
|
||||||
//// 新建员工
|
// 新建员工
|
||||||
//adminv1.POST("/employees", v1.AddEmployee)
|
adminv1.POST("/employees", v1.AddEmployee)
|
||||||
//// 更新指定员工
|
// 更新指定员工
|
||||||
//adminv1.PUT("/employees/:id", v1.EditArticle)
|
adminv1.PUT("/employees/:id", v1.EditEmployee)
|
||||||
}
|
}
|
||||||
|
|
||||||
return r
|
return r
|
||||||
|
|
|
@ -13,8 +13,11 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// @Summary 获取单个员工
|
// @Summary 获取单个员工
|
||||||
|
// @Tags employees
|
||||||
|
// @Description
|
||||||
|
// @Accept json
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param Authorization header string true "auth by /auth"
|
// @Param Authorization header string true "auth by /admin/login"
|
||||||
// @Param id path int true "ID"
|
// @Param id path int true "ID"
|
||||||
// @Success 200 {string} json "{"code": 200, "data": {}, "msg": "ok"}"
|
// @Success 200 {string} json "{"code": 200, "data": {}, "msg": "ok"}"
|
||||||
// @Router /admin/v1/employees/{id} [GET]
|
// @Router /admin/v1/employees/{id} [GET]
|
||||||
|
@ -47,8 +50,11 @@ func GetEmployee(c *gin.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Summary 获取员工列表
|
// @Summary 获取员工列表
|
||||||
|
// @Tags employees
|
||||||
|
// @Description
|
||||||
|
// @Accept json
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param Authorization header string true "auth by /auth"
|
// @Param Authorization header string true "auth by /admin/login"
|
||||||
// @Param department query string false "Department"
|
// @Param department query string false "Department"
|
||||||
// @Param position query string false "Position"
|
// @Param position query string false "Position"
|
||||||
// @Param state query int false "State"
|
// @Param state query int false "State"
|
||||||
|
@ -84,3 +90,71 @@ func GetEmployees(c *gin.Context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Summary 新增员工
|
||||||
|
// @Tags employees
|
||||||
|
// @Description
|
||||||
|
// @Accept mpfd
|
||||||
|
// @Produce json
|
||||||
|
// @Param Authorization header string true "auth by /admin/login"
|
||||||
|
// @Param username formData string true "员工用户名"
|
||||||
|
// @Param password formData string true "员工密码"
|
||||||
|
// @Param department formData string true "员工部门"
|
||||||
|
// @Param position formData string true "员工职位"
|
||||||
|
// @Success 200 {string} json "{"code": 200, "data":{}, "msg":"ok"}"
|
||||||
|
// @Router /admin/v1/employees [post]
|
||||||
|
func AddEmployee(c *gin.Context) {
|
||||||
|
username := c.PostForm("username")
|
||||||
|
password := c.PostForm("password")
|
||||||
|
department := c.PostForm("department")
|
||||||
|
position := c.PostForm("position")
|
||||||
|
|
||||||
|
valid := validation.Validation{}
|
||||||
|
valid.Required(username, "username").Message("用户名不能为空")
|
||||||
|
valid.Required(password, "password").Message("密码不能为空")
|
||||||
|
valid.Required(department, "department").Message("部门不能为空")
|
||||||
|
valid.Required(position, "position").Message("职位不能为空")
|
||||||
|
|
||||||
|
data := make(map[string]interface{})
|
||||||
|
|
||||||
|
code := e.InvalidParams
|
||||||
|
|
||||||
|
if !valid.HasErrors() {
|
||||||
|
if !models.ExistEmployeeByUsername(username) {
|
||||||
|
data["username"] = username
|
||||||
|
data["password"] = password
|
||||||
|
data["department"] = department
|
||||||
|
data["position"] = position
|
||||||
|
code = e.SUCCESS
|
||||||
|
} else {
|
||||||
|
code = e.ErrorExistEmployee
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if code == 200 {
|
||||||
|
models.AddArticle(data)
|
||||||
|
}
|
||||||
|
|
||||||
|
c.JSON(http.StatusOK, gin.H{
|
||||||
|
"code" : code,
|
||||||
|
"msg" : e.GetMsg(code),
|
||||||
|
"data" : data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Summary 更新员工
|
||||||
|
// @Tags employees
|
||||||
|
// @Description
|
||||||
|
// @Accept mpfd
|
||||||
|
// @Produce json
|
||||||
|
// @Param Authorization header string true "auth by /admin/login"
|
||||||
|
// @Param id path int true "ID"
|
||||||
|
// @Param username formData string false "员工用户名"
|
||||||
|
// @Param password formData string false "员工密码"
|
||||||
|
// @Param department formData string false "员工部门"
|
||||||
|
// @Param position formData string false "员工职位"
|
||||||
|
// @Param state formData string false "员工状态"
|
||||||
|
// @Success 200 {string} json "{"code": 200, "data":{}, "msg":"ok"}"
|
||||||
|
// @Router /admin/v1/employees/{id} [put]
|
||||||
|
func EditEmployee(c *gin.Context) {
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue