code refactor
This commit is contained in:
parent
3589c7de69
commit
e82f560c44
|
@ -113,11 +113,7 @@ type hostTenantForm struct {
|
||||||
Tenant string `json:"tenant"`
|
Tenant string `json:"tenant"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// 管理员修改主机设备的租户,相当于分配设备
|
func (f *hostTenantForm) Validate() {
|
||||||
func hostTenantPut(c *gin.Context) {
|
|
||||||
var f hostTenantForm
|
|
||||||
bind(c, &f)
|
|
||||||
|
|
||||||
if len(f.Ids) == 0 {
|
if len(f.Ids) == 0 {
|
||||||
bomb("ids is empty")
|
bomb("ids is empty")
|
||||||
}
|
}
|
||||||
|
@ -125,6 +121,13 @@ func hostTenantPut(c *gin.Context) {
|
||||||
if f.Tenant == "" {
|
if f.Tenant == "" {
|
||||||
bomb("tenant is blank")
|
bomb("tenant is blank")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 管理员修改主机设备的租户,相当于分配设备
|
||||||
|
func hostTenantPut(c *gin.Context) {
|
||||||
|
var f hostTenantForm
|
||||||
|
bind(c, &f)
|
||||||
|
f.Validate()
|
||||||
|
|
||||||
hosts, err := models.HostByIds(f.Ids)
|
hosts, err := models.HostByIds(f.Ids)
|
||||||
dangerous(err)
|
dangerous(err)
|
||||||
|
|
Loading…
Reference in New Issue