feat:完善项目信息

This commit is contained in:
henry
2022-01-05 18:40:08 +08:00
parent 53c1f3912b
commit 7488e9526b
15 changed files with 317 additions and 313 deletions

View File

@ -98,25 +98,25 @@ func (a *Tenant) MemberBind(c *gin.Context) {
Mobile string `json:"mobile" form:"mobile" binding:"required"`
Password string `json:"password" form:"password" binding:"required"`
}{}
if err := bind(form)(c); err != nil {
APIFailure(err.(error))(c)
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := tenant.NewMember()(api.GetSession()(c).(*session.Admin)).Form((&api.IDStringForm{ID: form.TenantID}).Convert(),
&tenant.MemberParams{Mobile: form.Mobile, Password: form.Password})
APIResponse(err)(c)
api.APIResponse(err)(c)
}
func (a *Tenant) Menu(c *gin.Context) {
form := &struct {
TenantID uint64 `json:"tenant_id" form:"tenant_id" binding:"required"`
}{}
if err := bind(form)(c); err != nil {
APIFailure(err.(error))(c)
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
data, err := tenant.NewMenu()(getSession()(c).(*service.Session)).List(form.TenantID)
APIResponse(err, data)(c)
api.APIResponse(err, data)(c)
}
func (a *Tenant) MenuBind(c *gin.Context) {
@ -124,12 +124,12 @@ func (a *Tenant) MenuBind(c *gin.Context) {
TenantID uint64 `json:"tenant_id" form:"tenant_id" binding:"required"`
MenuIDs []uint64 `json:"menu_ids" form:"menu_ids" binding:"required"`
}{}
if err := bind(form)(c); err != nil {
APIFailure(err.(error))(c)
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := tenant.NewMenu()(getSession()(c).(*service.Session)).Bind(form.TenantID, form.MenuIDs)
APIResponse(err)(c)
api.APIResponse(err)(c)
}
func (a *Tenant) AuthBind(c *gin.Context) {
@ -137,10 +137,10 @@ func (a *Tenant) AuthBind(c *gin.Context) {
TenantID uint64 `json:"tenant_id" form:"tenant_id" binding:"required"`
AuthIDs []uint64 `json:"auth_ids" form:"auth_ids" binding:"required"`
}{}
if err := bind(form)(c); err != nil {
APIFailure(err.(error))(c)
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := tenant.NewAuth()(getSession()(c).(*service.Session)).Bind(form.TenantID, form.AuthIDs)
APIResponse(err)(c)
api.APIResponse(err)(c)
}

View File

@ -2,6 +2,7 @@ package api
import (
user2 "SciencesServer/app/api/admin/controller/user"
"SciencesServer/app/basic/api"
"SciencesServer/app/service"
"github.com/gin-gonic/gin"
@ -39,7 +40,7 @@ func (a *User) List(c *gin.Context) {
APIFailure(err.(error))(c)
return
}
data, err := user2.NewInstance()(getSession()(c).(*service.Session)).List(form.Name, form.Mobile, form.Status, form.Page, form.PageSize)
data, err := user2.NewInstance()(getSession()(c).(*service.Session)).Index(form.Name, form.Mobile, form.Status, form.Page, form.PageSize)
APIResponse(err, data)(c)
}
@ -148,18 +149,18 @@ func (a *User) Edit(c *gin.Context) {
* "data": null
* }
*/
func (a *User) QuickPassword(c *gin.Context) {
func (a *User) Password(c *gin.Context) {
form := &struct {
idForm
api.IDStringForm
Password string `json:"password" form:"password" binding:"required"`
RepeatPwd string `json:"repeat_pwd" form:"repeat_pwd" binding:"required"`
}{}
if err := bind(form)(c); err != nil {
APIFailure(err.(error))(c)
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := user2.NewInstance()(getSession()(c).(*service.Session)).Password(form.ID, form.Password, form.RepeatPwd)
APIResponse(err)(c)
err := user2.NewInstance()(getSession()(c).(*service.Session)).Password(form.Convert(), form.Password, form.RepeatPwd)
api.APIResponse(err)(c)
}
/**
@ -186,7 +187,7 @@ func (a *User) QuickPassword(c *gin.Context) {
* "data": null
* }
*/
func (a *User) EditPassword(c *gin.Context) {
func (a *User) PasswordEdit(c *gin.Context) {
form := &struct {
OldPwd string `json:"original_pwd" form:"original_pwd" binding:"required"`
Password string `json:"password" form:"password" binding:"required"`