diff --git a/app/admin/enum/enum_admin.go b/app/admin/enum/enum_admin.go index 17132bf..e69c56d 100644 --- a/app/admin/enum/enum_admin.go +++ b/app/admin/enum/enum_admin.go @@ -17,3 +17,21 @@ func (gt AdminState) String() string { return "未知" } } + +type IsSuperAdministrator int32 + +const ( + IsSuperAdministratorTure = 1 + IsSuperAdministratorFalse = 2 +) + +func (gt IsSuperAdministrator) String() string { + switch gt { + case IsSuperAdministratorTure: + return "超管" + case IsSuperAdministratorFalse: + return "非超管" + default: + return "未知" + } +} diff --git a/app/admin/hdl/hdl_comm.go b/app/admin/hdl/hdl_comm.go new file mode 100644 index 0000000..e373c3c --- /dev/null +++ b/app/admin/hdl/hdl_comm.go @@ -0,0 +1,89 @@ +package hdl + +import ( + "applet/app/admin/enum" + "applet/app/admin/md" + "applet/app/admin/svc" + "applet/app/db" + "applet/app/e" + "applet/app/utils" + "github.com/gin-gonic/gin" +) + +func MenuList(c *gin.Context) { + admin := svc.GetUser(c) + qrcodeWithBatchRecordsDb := db.PermissionGroupDb{} + qrcodeWithBatchRecordsDb.Set() + groupList, err := qrcodeWithBatchRecordsDb.FindPermissionGroup() + if err != nil { + e.OutErr(c, e.ERR_DB_ORM, err.Error()) + return + } + + //1、查询出当前用户所有角色 + adminRoleDb := db.AdminRoleDb{} + adminRoleDb.Set() + roles, err := adminRoleDb.FindAdminRole(admin.AdmId) + if err != nil { + e.OutErr(c, e.ERR_DB_ORM, err.Error()) + return + } + + roleDb := db.RoleDb{} + roleDb.Set(0) + var adminHasPermissionGroupIds []string + for _, v := range *roles { + list, _, err := roleDb.FindPermissionGroupByRole(v.RoleId) + if err != nil { + e.OutErr(c, e.ERR_DB_ORM, err.Error()) + return + } + for _, v1 := range list { + adminHasPermissionGroupIds = append(adminHasPermissionGroupIds, utils.IntToStr(v1.PermissionGroup.Id)) + } + } + + var tempRespMap = map[string]*md.PermissionGroupListResp{} + var tempRespMapKeys []string + for _, v := range *groupList { + isCheck := false + if utils.InArr(utils.IntToStr(v.Id), adminHasPermissionGroupIds) { + isCheck = true + } + tempRespMap[utils.IntToStr(v.Id)] = &md.PermissionGroupListResp{ + Id: v.Id, + Name: v.Name, + State: v.State, + ParentId: v.ParentId, + CreateAt: v.CreateAt.Format("2006-01-02 15:04:05"), + UpdateAt: v.UpdateAt.Format("2006-01-02 15:04:05"), + IsCheck: isCheck, + } + tempRespMapKeys = append(tempRespMapKeys, utils.IntToStr(v.Id)) + } + for _, v := range tempRespMap { + if v.ParentId != 0 { + tempRespMap[utils.IntToStr(v.ParentId)].SubPermissionGroupList = append(tempRespMap[utils.IntToStr(v.ParentId)].SubPermissionGroupList, *v) + } + } + + var resp []md.PermissionGroupListResp + for _, v := range tempRespMapKeys { + resp = append(resp, *tempRespMap[v]) + } + + e.OutSuc(c, map[string]interface{}{ + "list": resp, + "state": []map[string]interface{}{ + { + "name": enum.PermissionGroupState(enum.PermissionGroupStateForNormal).String(), + "value": enum.PermissionGroupStateForNormal, + }, + { + "name": enum.PermissionGroupState(enum.PermissionGroupStateForDiscard).String(), + "value": enum.PermissionGroupStateForDiscard, + }, + }, + }, nil) + return +} diff --git a/app/admin/hdl/hdl_role.go b/app/admin/hdl/hdl_role.go index bf605b0..85ea1b7 100644 --- a/app/admin/hdl/hdl_role.go +++ b/app/admin/hdl/hdl_role.go @@ -94,15 +94,15 @@ func RoleList(c *gin.Context) { for _, v := range *roleList { var temp md.RoleListResp temp.Data = v - adminRole, err := adminRoleDb.GetAdminRoleByRole(v.Id) - if err != nil { - e.OutErr(c, e.ERR_DB_ORM, err.Error()) + adminRole, err1 := adminRoleDb.GetAdminRoleByRole(v.Id) + if err1 != nil { + e.OutErr(c, e.ERR_DB_ORM, err1.Error()) return } if adminRole != nil { - admin, err := adminDb.GetAdmin(adminRole.AdmId) - if err != nil { - e.OutErr(c, e.ERR_DB_ORM, err.Error()) + admin, err2 := adminDb.GetAdmin(adminRole.AdmId) + if err2 != nil { + e.OutErr(c, e.ERR_DB_ORM, err2.Error()) return } temp.AdminList = append(temp.AdminList, struct { diff --git a/app/admin/mw/mw_admin_permission.go b/app/admin/mw/mw_admin_permission.go index 32a9bfb..b309b2e 100644 --- a/app/admin/mw/mw_admin_permission.go +++ b/app/admin/mw/mw_admin_permission.go @@ -1,6 +1,7 @@ package mw import ( + "applet/app/admin/enum" "applet/app/admin/md" "applet/app/admin/svc" "applet/app/e" @@ -12,6 +13,11 @@ import ( // CheckPermission 检查权限 func CheckPermission(c *gin.Context) { admin := svc.GetUser(c) + //TODO::判断是否为超管 + if admin.IsSuperAdministrator == enum.IsSuperAdministratorTure { + c.Next() + } + rolePermissionKey := fmt.Sprintf(md.AdminRolePermissionKey, utils.GetIP(c.Request), utils.AnyToString(admin.AdmId)) isHasPermission, err := svc.CheckUserRole(rolePermissionKey, c.Request.RequestURI, admin.AdmId) if err != nil { diff --git a/app/admin/svc/enterprise_manage/svc_central_kitchen_for_school.go b/app/admin/svc/enterprise_manage/svc_central_kitchen_for_school.go index e1a50e1..c5c399f 100644 --- a/app/admin/svc/enterprise_manage/svc_central_kitchen_for_school.go +++ b/app/admin/svc/enterprise_manage/svc_central_kitchen_for_school.go @@ -55,8 +55,8 @@ func CentralKitchenForSchoolUserUpdate(req md.CentralKitchenForSchoolUserUpdateR Identity: enum2.UserIdentityForCentralKitchenForTeacher, EnterpriseId: req.EnterpriseId, Memo: "", - CreateAt: now, - UpdateAt: now, + CreateAt: now.Format("2006-01-02 15:04:05"), + UpdateAt: now.Format("2006-01-02 15:04:05"), }) if err3 != nil { _ = session.Rollback() @@ -73,8 +73,8 @@ func CentralKitchenForSchoolUserUpdate(req md.CentralKitchenForSchoolUserUpdateR Identity: enum2.UserIdentityForCentralKitchenForStudent, EnterpriseId: req.EnterpriseId, Memo: "", - CreateAt: now, - UpdateAt: now, + CreateAt: now.Format("2006-01-02 15:04:05"), + UpdateAt: now.Format("2006-01-02 15:04:05"), }) if err1 != nil { _ = session.Rollback() @@ -84,8 +84,8 @@ func CentralKitchenForSchoolUserUpdate(req md.CentralKitchenForSchoolUserUpdateR _, err2 := classWithUserDb.ClassWithUserInsertBySession(session, &model.ClassWithUser{ UserIdentityId: insertId, ClassId: v.ClassId, - CreateAt: now, - UpdateAt: now, + CreateAt: now.Format("2006-01-02 15:04:05"), + UpdateAt: now.Format("2006-01-02 15:04:05"), }) if err2 != nil { _ = session.Rollback() @@ -269,8 +269,8 @@ func CentralKitchenForSchoolStudentUpdate(req md.CentralKitchenForSchoolStudentU _, err = classWithUserDb.ClassWithUserInsertBySession(session, &model.ClassWithUser{ UserIdentityId: req.UserIdentityId, ClassId: req.ClassId, - CreateAt: time.Time{}, - UpdateAt: time.Time{}, + CreateAt: time.Time{}.Format("2006-01-02 15:04:05"), + UpdateAt: time.Time{}.Format("2006-01-02 15:04:05"), }) return session.Commit() @@ -357,7 +357,7 @@ func CentralKitchenForSchoolOrdList(req md.CentralKitchenForSchoolOrdListReq) (r } } - sess := db.Db.Desc("central_kitchen_for_school_package_ord.id") + sess := db.Db.Desc("central_kitchen_for_school_package_ord.id") if req.EnterpriseId != 0 { sess.And("central_kitchen_for_school_package_ord.enterprise_id =?", req.EnterpriseId) } diff --git a/app/admin/svc/svc_central_kitchen_for_school_package.go b/app/admin/svc/svc_central_kitchen_for_school_package.go index 8777f65..296ba48 100644 --- a/app/admin/svc/svc_central_kitchen_for_school_package.go +++ b/app/admin/svc/svc_central_kitchen_for_school_package.go @@ -13,6 +13,16 @@ func AddCentralKitchenForSchoolPackage(req md.SaveCentralKitchenForSchoolPackage defer session.Close() session.Begin() now := time.Now() + //TODO::判断当前月份是否存在 + centralKitchenForSchoolPackageDb := db.CentralKitchenForSchoolPackageDb{} + isHasPackage, err := centralKitchenForSchoolPackageDb.GetCentralKitchenForSchoolPackageByMonth(req.Year, req.Month) + if err != nil { + return err + } + if isHasPackage != nil { + return errors.New("请勿重复添加【" + req.Month + "】套餐") + } + //1、查询`central_kitchen_for_school_with_spec` centralKitchenForSchoolWithSpec := db.CentralKitchenForSchoolWithSpec{} centralKitchenForSchoolWithSpec.Set(req.EnterpriseId) @@ -22,7 +32,6 @@ func AddCentralKitchenForSchoolPackage(req md.SaveCentralKitchenForSchoolPackage return err } //1、新增`central_kitchen_for_school_package` - centralKitchenForSchoolPackageDb := db.CentralKitchenForSchoolPackageDb{} packageId, err := centralKitchenForSchoolPackageDb.CentralKitchenForSchoolPackageInsertBySession(session, &model.CentralKitchenForSchoolPackage{ EnterpriseId: req.EnterpriseId, Year: req.Year, diff --git a/app/admin/svc/svc_role.go b/app/admin/svc/svc_role.go index b2825e7..8446c7c 100644 --- a/app/admin/svc/svc_role.go +++ b/app/admin/svc/svc_role.go @@ -4,6 +4,7 @@ import ( "applet/app/admin/md" "applet/app/db" "applet/app/db/model" + md2 "applet/app/md" "applet/app/utils" "applet/app/utils/cache" "encoding/json" @@ -19,6 +20,13 @@ func CheckUserRole(cacheKey, uri string, admId int) (isHasPermission bool, err e var rolePermission []string var rolePermissionString string rolePermissionString, _ = cache.GetString(cacheKey) + + //TODO::判断是否在白名单中 + if utils.InArr(uri, md2.WhiteUri) { + isHasPermission = true + return + } + //if rolePermissionString != "" { if false { if err = json.Unmarshal([]byte(rolePermissionString), &rolePermission); err != nil { diff --git a/app/customer/hdl/hdl_user_identity.go b/app/customer/hdl/hdl_user_identity.go index ef0d71e..9d20a64 100644 --- a/app/customer/hdl/hdl_user_identity.go +++ b/app/customer/hdl/hdl_user_identity.go @@ -37,50 +37,92 @@ func SaveCentralKitchenForSchoolUserIdentity(c *gin.Context) { e.OutErr(c, e.ERR_DB_ORM, err.Error()) return } - if isHasUserIdentity != nil && isHasUserIdentity.Uid != 0 && isHasUserIdentity.Uid != user.Id { - e.OutErr(c, e.ERR, "当前身份信息已被绑定使用") - return - } - //2、新增身份信息 now := time.Time{} - userIdentity := &model.UserIdentity{ - Uid: user.Id, - Name: req.Name, - IdNo: req.IdNo, - Kind: enum.UserIdentityKindForCommon, - Identity: identity, - EnterpriseId: req.EnterpriseId, - State: enum.UserIdentityStateForNormal, - Memo: "", - CreateAt: now, - UpdateAt: now, - } - insertAffected, err := userIdentityDb.UserIdentityInsert(userIdentity) - if err != nil { - e.OutErr(c, e.ERR_DB_ORM, err.Error()) - return - } - if insertAffected <= 0 { - e.OutErr(c, e.ERR_DB_ORM, "新增身份数据失败") - return - } + if isHasUserIdentity == nil { + //2、新增身份信息 + userIdentity := &model.UserIdentity{ + Uid: user.Id, + Name: req.Name, + IdNo: req.IdNo, + Kind: enum.UserIdentityKindForCommon, + Identity: identity, + EnterpriseId: req.EnterpriseId, + State: enum.UserIdentityStateForNormal, + Memo: "", + CreateAt: now.Format("2006-01-02 15:04:05"), + UpdateAt: now.Format("2006-01-02 15:04:05"), + } + insertAffected, err := userIdentityDb.UserIdentityInsert(userIdentity) + if err != nil { + e.OutErr(c, e.ERR_DB_ORM, err.Error()) + return + } + if insertAffected <= 0 { + e.OutErr(c, e.ERR_DB_ORM, "新增身份数据失败") + return + } - //3、新增 class_with_user 记录 - if !req.IsTeacher { - classWithUserDb := db.ClassWithUserDb{} - classWithUserDb.Set() - _, err = classWithUserDb.ClassWithUserInsert(&model.ClassWithUser{ - UserIdentityId: insertAffected, - ClassId: req.ClassId, - CreateAt: now, - UpdateAt: now, - }) + //3、新增 class_with_user 记录 + if !req.IsTeacher { + classWithUserDb := db.ClassWithUserDb{} + classWithUserDb.Set() + _, err = classWithUserDb.ClassWithUserInsert(&model.ClassWithUser{ + UserIdentityId: insertAffected, + ClassId: req.ClassId, + CreateAt: now.Format("2006-01-02 15:04:05"), + UpdateAt: now.Format("2006-01-02 15:04:05"), + }) + if err != nil { + e.OutErr(c, e.ERR_DB_ORM, err.Error()) + return + } + } + } else { + if isHasUserIdentity.Uid != user.Id { + e.OutErr(c, e.ERR, "当前身份信息已被绑定使用") + return + } + //4、修改身份信息 + isHasUserIdentity.Uid = user.Id + isHasUserIdentity.Name = req.Name + _, err = userIdentityDb.UserIdentityUpdate(isHasUserIdentity.Id, isHasUserIdentity, "uid", "name") if err != nil { e.OutErr(c, e.ERR_DB_ORM, err.Error()) return } + + //5、修改 class_with_user 记录 + if !req.IsTeacher { + classWithUserDb := db.ClassWithUserDb{} + classWithUserDb.Set() + classWithUser, err1 := classWithUserDb.GetClassWithUserByUserIdentityId(isHasUserIdentity.Id) + if err1 != nil { + e.OutErr(c, e.ERR_DB_ORM, err1.Error()) + return + } + if classWithUser == nil { + _, err2 := classWithUserDb.ClassWithUserInsert(&model.ClassWithUser{ + UserIdentityId: isHasUserIdentity.Id, + ClassId: req.ClassId, + CreateAt: now.Format("2006-01-02 15:04:05"), + UpdateAt: now.Format("2006-01-02 15:04:05"), + }) + if err2 != nil { + e.OutErr(c, e.ERR_DB_ORM, err2.Error()) + return + } + } else { + classWithUser.ClassId = req.ClassId + _, err2 := classWithUserDb.ClassWithUserUpdateByUserIdentity(isHasUserIdentity.Id, classWithUser, "class_id") + if err2 != nil { + e.OutErr(c, e.ERR_DB_ORM, err2.Error()) + return + } + } + } } + e.OutSuc(c, "success", nil) return } @@ -131,8 +173,8 @@ func SaveSelfSupportForSchoolUserIdentity(c *gin.Context) { EnterpriseId: req.EnterpriseId, State: enum.UserIdentityStateForNormal, Memo: "", - CreateAt: now, - UpdateAt: now, + CreateAt: now.Format("2006-01-02 15:04:05"), + UpdateAt: now.Format("2006-01-02 15:04:05"), } insertAffected, err := userIdentityDb.UserIdentityInsert(userIdentity) if err != nil { @@ -150,8 +192,8 @@ func SaveSelfSupportForSchoolUserIdentity(c *gin.Context) { _, err = classWithUserDb.ClassWithUserInsert(&model.ClassWithUser{ UserIdentityId: insertAffected, ClassId: req.ClassId, - CreateAt: now, - UpdateAt: now, + CreateAt: now.Format("2006-01-02 15:04:05"), + UpdateAt: now.Format("2006-01-02 15:04:05"), }) if err != nil { e.OutErr(c, e.ERR_DB_ORM, err.Error()) @@ -185,8 +227,8 @@ func SaveSelfSupportForSchoolUserIdentity(c *gin.Context) { _, err2 := classWithUserDb.ClassWithUserInsert(&model.ClassWithUser{ UserIdentityId: isHasUserIdentity.Id, ClassId: req.ClassId, - CreateAt: now, - UpdateAt: now, + CreateAt: now.Format("2006-01-02 15:04:05"), + UpdateAt: now.Format("2006-01-02 15:04:05"), }) if err2 != nil { e.OutErr(c, e.ERR_DB_ORM, err2.Error()) diff --git a/app/customer/svc/order/svc_central_kitchen_for_school_order.go b/app/customer/svc/order/svc_central_kitchen_for_school_order.go index 2708342..3f52278 100644 --- a/app/customer/svc/order/svc_central_kitchen_for_school_order.go +++ b/app/customer/svc/order/svc_central_kitchen_for_school_order.go @@ -13,9 +13,7 @@ import ( func OrderList(req md.CentralKitchenForSchoolOrderListReq) (m []model.CentralKitchenForSchoolPackageOrd, total int64, err error) { sess := db.Db.Desc("id").Where("user_identity_id =?", req.UserIdentityId).Limit(req.Limit, (req.Page-1)*req.Limit) - if req.OrdState != 0 { - sess.And("ord_state = ?", req.OrdState) - } + sess.And("ord_state = ?", req.OrdState) total, err = sess.FindAndCount(&m) if err != nil { return diff --git a/app/db/db_admin_role.go b/app/db/db_admin_role.go index 83331a1..fab6bf7 100644 --- a/app/db/db_admin_role.go +++ b/app/db/db_admin_role.go @@ -15,16 +15,12 @@ func (adminRoleDb *AdminRoleDb) Set() { // set方法 adminRoleDb.Db = Db } -func (adminRoleDb *AdminRoleDb) GetAdminRole(id int) (m *model.AdminRole, err error) { - m = new(model.AdminRole) - has, err := adminRoleDb.Db.Where("adm_id =?", id).Get(m) - if err != nil { +func (adminRoleDb *AdminRoleDb) FindAdminRole(id int) (*[]model.AdminRole, error) { + var m []model.AdminRole + if err := adminRoleDb.Db.Where("adm_id =?", id).Find(&m); err != nil { return nil, logx.Error(err) } - if has == false { - return nil, nil - } - return m, nil + return &m, nil } func (adminRoleDb *AdminRoleDb) AdminDeleteBySessionForAdmId(session *xorm.Session, admId interface{}) (int64, error) { diff --git a/app/db/db_central_kitchen_for_school_package.go b/app/db/db_central_kitchen_for_school_package.go index efbfed7..c4f1dc9 100644 --- a/app/db/db_central_kitchen_for_school_package.go +++ b/app/db/db_central_kitchen_for_school_package.go @@ -28,6 +28,18 @@ func (centralKitchenForSchoolPackageDb *CentralKitchenForSchoolPackageDb) GetCen return m, nil } +func (centralKitchenForSchoolPackageDb *CentralKitchenForSchoolPackageDb) GetCentralKitchenForSchoolPackageByMonth(year, month string) (m *model.CentralKitchenForSchoolPackage, err error) { + m = new(model.CentralKitchenForSchoolPackage) + has, err := centralKitchenForSchoolPackageDb.Db.Where("year =? and month =?", year, month).Get(m) + if err != nil { + return nil, logx.Error(err) + } + if has == false { + return nil, nil + } + return m, nil +} + func (centralKitchenForSchoolPackageDb *CentralKitchenForSchoolPackageDb) FindCentralKitchenForSchoolPackage() (*[]model.CentralKitchenForSchoolPackage, error) { var m []model.CentralKitchenForSchoolPackage if err := centralKitchenForSchoolPackageDb.Db.Desc("id").Find(&m); err != nil { diff --git a/app/db/db_permission_group.go b/app/db/db_permission_group.go index 5538e6b..f748a9b 100644 --- a/app/db/db_permission_group.go +++ b/app/db/db_permission_group.go @@ -16,7 +16,7 @@ func (permissionGroupDb *PermissionGroupDb) Set() { // set方法 func (permissionGroupDb *PermissionGroupDb) FindPermissionGroup() (*[]model.PermissionGroup, error) { var m []model.PermissionGroup - if err := permissionGroupDb.Db.Desc("id").Find(&m); err != nil { + if err := permissionGroupDb.Db.Asc("id").Find(&m); err != nil { return nil, logx.Error(err) } return &m, nil diff --git a/app/db/db_user_identity.go b/app/db/db_user_identity.go index 6da4a2a..d64716f 100644 --- a/app/db/db_user_identity.go +++ b/app/db/db_user_identity.go @@ -31,7 +31,7 @@ func (userIdentityDb *UserIdentityDb) GetUserIdentity(id int) (m *model.UserIden func (userIdentityDb *UserIdentityDb) UserIdentityExist(enterpriseId int, idNo string) (m *model.UserIdentity, err error) { m = new(model.UserIdentity) - has, err := userIdentityDb.Db.Where("enterprise_id =?", enterpriseId).And("id_no =?", idNo).Exist(m) + has, err := userIdentityDb.Db.Where("enterprise_id =?", enterpriseId).And("id_no =?", idNo).Get(m) if err != nil { return nil, logx.Error(err) } diff --git a/app/db/model/class_with_user.go b/app/db/model/class_with_user.go index a88b1c9..3429fae 100644 --- a/app/db/model/class_with_user.go +++ b/app/db/model/class_with_user.go @@ -1,13 +1,9 @@ package model -import ( - "time" -) - type ClassWithUser struct { - Id int `json:"id" xorm:"not null pk autoincr INT(11)"` - UserIdentityId int `json:"user_identity_id" xorm:"not null default 0 comment('用户身份id') INT(11)"` - ClassId int `json:"class_id" xorm:"not null default 0 INT(11)"` - CreateAt time.Time `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` - UpdateAt time.Time `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + UserIdentityId int `json:"user_identity_id" xorm:"not null default 0 comment('用户身份id') INT(11)"` + ClassId int `json:"class_id" xorm:"not null default 0 INT(11)"` + CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` + UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` } diff --git a/app/db/model/user_identity.go b/app/db/model/user_identity.go index f51b40b..de4f43a 100644 --- a/app/db/model/user_identity.go +++ b/app/db/model/user_identity.go @@ -1,19 +1,15 @@ package model -import ( - "time" -) - type UserIdentity struct { - Id int `json:"id" xorm:"not null pk autoincr INT(11)"` - Uid int `json:"uid" xorm:"not null default 0 comment('用户id') INT(11)"` - Name string `json:"name" xorm:"not null default '' comment('名称') VARCHAR(255)"` - IdNo string `json:"id_no" xorm:"not null default '' comment('身份证号码') VARCHAR(255)"` - Kind int `json:"kind" xorm:"not null default 1 comment('类型(1:普通用户 2:工作人员)') TINYINT(1)"` - Identity int `json:"identity" xorm:"not null default 1 comment('身份类型(1:央厨-学生 2:央厨-教职员工 3:央厨-工作人员 4:自营-学生 5:自营-教职员工 6:自营-工作人员)') TINYINT(1)"` - EnterpriseId int `json:"enterprise_id" xorm:"not null default 0 comment('所属单位id') INT(11)"` - State int `json:"state" xorm:"not null default 1 comment('状态(1:正常 2:冻结)') TINYINT(1)"` - Memo string `json:"memo" xorm:"not null default '' comment('备注信息') VARCHAR(244)"` - CreateAt time.Time `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` - UpdateAt time.Time `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + Uid int `json:"uid" xorm:"not null default 0 comment('用户id') INT(11)"` + Name string `json:"name" xorm:"not null default '' comment('名称') VARCHAR(255)"` + IdNo string `json:"id_no" xorm:"not null default '' comment('身份证号码') VARCHAR(255)"` + Kind int `json:"kind" xorm:"not null default 1 comment('类型(1:普通用户 2:工作人员)') TINYINT(1)"` + Identity int `json:"identity" xorm:"not null default 1 comment('身份类型(1:央厨-学生 2:央厨-教职员工 3:央厨-工作人员 4:自营-学生 5:自营-教职员工 6:自营-工作人员)') TINYINT(1)"` + EnterpriseId int `json:"enterprise_id" xorm:"not null default 0 comment('所属单位id') INT(11)"` + State int `json:"state" xorm:"not null default 1 comment('状态(1:正常 2:冻结)') TINYINT(1)"` + Memo string `json:"memo" xorm:"not null default '' comment('备注信息') VARCHAR(244)"` + CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` + UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` } diff --git a/app/md/md_white_uri.go b/app/md/md_white_uri.go new file mode 100644 index 0000000..b5c54d7 --- /dev/null +++ b/app/md/md_white_uri.go @@ -0,0 +1,5 @@ +package md + +var WhiteUri = []string{ + "/api/admin/comm/getMenuList", +} diff --git a/app/router/admin_router.go b/app/router/admin_router.go index 6d0d5d0..7e09ed9 100644 --- a/app/router/admin_router.go +++ b/app/router/admin_router.go @@ -62,6 +62,10 @@ func rBanner(r *gin.RouterGroup) { r.DELETE("/delete/:id", hdl2.BannerDelete) } +func rComm(r *gin.RouterGroup) { + r.POST("/getMenuList", hdl2.MenuList) // 获取菜单栏列表 +} + func rOss(r *gin.RouterGroup) { r.POST("/upload/token", hdl2.ImgReqUpload) // 文件上传获取七牛云上传token } @@ -164,6 +168,7 @@ func AdminRoute(r *gin.RouterGroup) { r.Use(mw.CheckPermission) //检测权限 rOss(r.Group("/oss")) + rComm(r.Group("/comm")) rCompany(r.Group("/company")) //公司管理 rNotice(r.Group("/notice")) //公告管理 rBanner(r.Group("/banner")) //轮播图管理