diff --git a/app/db/dao/agent_dao.go b/app/db/dao/agent_dao.go new file mode 100644 index 0000000..e316ffd --- /dev/null +++ b/app/db/dao/agent_dao.go @@ -0,0 +1,13 @@ +package dao + +import ( + "applet/app/db/model" + "xorm.io/xorm" +) + +type AgentDao interface { + GetAgentByUsername(username string) (medium *model.Agent, err error) + AgentInsert(m *model.Agent) (int64, error) + AgentDeleteBySession(session *xorm.Session, id interface{}) (int64, error) + UpdateAgent(m *model.Agent, columns ...string) (int64, error) +} diff --git a/app/db/dao/agent_domain_dao.go b/app/db/dao/agent_domain_dao.go new file mode 100644 index 0000000..5e7a804 --- /dev/null +++ b/app/db/dao/agent_domain_dao.go @@ -0,0 +1,5 @@ +package dao + +type AgentDomainDao interface { + //TODO:: You can add specific method definitions here +} diff --git a/app/db/dao/agent_permission_dao.go b/app/db/dao/agent_permission_dao.go new file mode 100644 index 0000000..fc4f02a --- /dev/null +++ b/app/db/dao/agent_permission_dao.go @@ -0,0 +1,5 @@ +package dao + +type AgentPermissionDao interface { + //TODO:: You can add specific method definitions here +} diff --git a/app/db/dao/agent_permission_group_dao.go b/app/db/dao/agent_permission_group_dao.go new file mode 100644 index 0000000..d1e615a --- /dev/null +++ b/app/db/dao/agent_permission_group_dao.go @@ -0,0 +1,8 @@ +package dao + +import "applet/app/db/model" + +type AgentPermissionGroupDao interface { + FindAgentPermissionGroup() (*[]model.AgentPermissionGroup, error) + FindAgentPermissionGroupV2() (*[]model.AgentPermissionGroup, error) +} diff --git a/app/db/dao/agent_permission_group_permission_dao.go b/app/db/dao/agent_permission_group_permission_dao.go new file mode 100644 index 0000000..f831b9a --- /dev/null +++ b/app/db/dao/agent_permission_group_permission_dao.go @@ -0,0 +1,5 @@ +package dao + +type AgentPermissionGroupPermissionDao interface { + //TODO:: You can add specific method definitions here +} diff --git a/app/db/dao/agent_role_dao.go b/app/db/dao/agent_role_dao.go new file mode 100644 index 0000000..84be201 --- /dev/null +++ b/app/db/dao/agent_role_dao.go @@ -0,0 +1,25 @@ +package dao + +import ( + "applet/app/db/model" + "xorm.io/xorm" +) + +type AgentRoleDao interface { + FindAgentRole() (*[]model.AgentRole, error) + GetAgentRole() (m *model.AgentRole, err error) + UpdateAgentRole(m *model.AgentRole, columns ...string) (int64, error) + AgentRoleDeleteBySession(session *xorm.Session, id interface{}) (int64, error) + AgentRoleInsert(m *model.AgentRole) (int, error) + FindPermissionGroupByAgentRole(roleId int) (list []*AgentRolePermissionGroup, total int64, err error) +} + +type AgentRolePermissionGroup struct { + model.AgentRole `xorm:"extends"` + model.AgentRolePermissionGroup `xorm:"extends"` + model.AgentPermissionGroup `xorm:"extends"` +} + +func (AgentRolePermissionGroup) TableName() string { + return "agent_role" +} diff --git a/app/db/dao/agent_role_permission_group_dao.go b/app/db/dao/agent_role_permission_group_dao.go new file mode 100644 index 0000000..0d4bc79 --- /dev/null +++ b/app/db/dao/agent_role_permission_group_dao.go @@ -0,0 +1,11 @@ +package dao + +import ( + "applet/app/db/model" + "xorm.io/xorm" +) + +type AgentRolePermissionGroupDao interface { + AgentRolePermissionGroupDeleteForRoleBySession(session *xorm.Session, roleId interface{}) (int64, error) + BatchAddAgentRolePermissionGroupBySession(session *xorm.Session, mm []*model.AgentRolePermissionGroup) (int64, error) +} diff --git a/app/db/dao/agent_with_role_dao.go b/app/db/dao/agent_with_role_dao.go new file mode 100644 index 0000000..58c83a4 --- /dev/null +++ b/app/db/dao/agent_with_role_dao.go @@ -0,0 +1,16 @@ +package dao + +import ( + "applet/app/db/model" + "xorm.io/xorm" +) + +type AgentWithRoleDao interface { + FindAgentWithRole(id int) (*[]model.AgentWithRole, error) + FindAgentWithRoleByRoleId(id int) (*[]model.AgentWithRole, error) + AdminDeleteBySessionForAdmId(session *xorm.Session, admId interface{}) (int64, error) + GetAgentWithRoleByRole(id int) (m *model.AgentWithRole, err error) + AgentWithRoleDeleteForRoleBySession(session *xorm.Session, roleId interface{}) (int64, error) + AgentWithRoleDeleteBySession(session *xorm.Session, id interface{}) (int64, error) + BatchAddAgentWithRoleBySession(session *xorm.Session, mm []*model.AgentWithRole) (int64, error) +} diff --git a/app/db/dao/medium_dao.go b/app/db/dao/medium_dao.go new file mode 100644 index 0000000..eb77ea1 --- /dev/null +++ b/app/db/dao/medium_dao.go @@ -0,0 +1,13 @@ +package dao + +import ( + "applet/app/db/model" + "xorm.io/xorm" +) + +type MediumDao interface { + GetMediumByUsername(username string) (medium *model.Medium, err error) + MediumInsert(m *model.Medium) (int64, error) + MediumDeleteBySession(session *xorm.Session, id interface{}) (int64, error) + UpdateMedium(m *model.Medium, columns ...string) (int64, error) +} diff --git a/app/db/dao/medium_domain_dao.go b/app/db/dao/medium_domain_dao.go new file mode 100644 index 0000000..ef6693b --- /dev/null +++ b/app/db/dao/medium_domain_dao.go @@ -0,0 +1,10 @@ +package dao + +import ( + "applet/app/db/model" +) + +type MediumDomainDao interface { + GetMediumDomain(mediumId int) (medium *model.MediumDomain, err error) + MediumDomainInsert(m *model.MediumDomain) (int64, error) +} diff --git a/app/db/dao/medium_permission_dao.go b/app/db/dao/medium_permission_dao.go new file mode 100644 index 0000000..67db1c7 --- /dev/null +++ b/app/db/dao/medium_permission_dao.go @@ -0,0 +1,5 @@ +package dao + +type MediumPermissionDao interface { + //TODO:: You can add specific method definitions here +} diff --git a/app/db/dao/medium_permission_group_dao.go b/app/db/dao/medium_permission_group_dao.go new file mode 100644 index 0000000..403d3f7 --- /dev/null +++ b/app/db/dao/medium_permission_group_dao.go @@ -0,0 +1,8 @@ +package dao + +import "applet/app/db/model" + +type MediumPermissionGroupDao interface { + FindMediumPermissionGroup() (*[]model.MediumPermissionGroup, error) + FindMediumPermissionGroupV2() (*[]model.MediumPermissionGroup, error) +} diff --git a/app/db/dao/medium_permission_group_permission_dao.go b/app/db/dao/medium_permission_group_permission_dao.go new file mode 100644 index 0000000..a4585d2 --- /dev/null +++ b/app/db/dao/medium_permission_group_permission_dao.go @@ -0,0 +1,5 @@ +package dao + +type MediumPermissionGroupPermissionDao interface { + //TODO:: You can add specific method definitions here +} diff --git a/app/db/dao/medium_role_dao.go b/app/db/dao/medium_role_dao.go new file mode 100644 index 0000000..84190c4 --- /dev/null +++ b/app/db/dao/medium_role_dao.go @@ -0,0 +1,25 @@ +package dao + +import ( + "applet/app/db/model" + "xorm.io/xorm" +) + +type MediumRoleDao interface { + FindMediumRole() (*[]model.MediumRole, error) + GetMediumRole() (m *model.MediumRole, err error) + UpdateMediumRole(m *model.MediumRole, columns ...string) (int64, error) + MediumRoleDeleteBySession(session *xorm.Session, id interface{}) (int64, error) + MediumRoleInsert(m *model.MediumRole) (int, error) + FindPermissionGroupByMediumRole(roleId int) (list []*MediumRolePermissionGroup, total int64, err error) +} + +type MediumRolePermissionGroup struct { + model.MediumRole `xorm:"extends"` + model.MediumRolePermissionGroup `xorm:"extends"` + model.MediumPermissionGroup `xorm:"extends"` +} + +func (MediumRolePermissionGroup) TableName() string { + return "medium_role" +} diff --git a/app/db/dao/medium_role_permission_group_dao.go b/app/db/dao/medium_role_permission_group_dao.go new file mode 100644 index 0000000..68ab9ba --- /dev/null +++ b/app/db/dao/medium_role_permission_group_dao.go @@ -0,0 +1,11 @@ +package dao + +import ( + "applet/app/db/model" + "xorm.io/xorm" +) + +type MediumRolePermissionGroupDao interface { + MediumRolePermissionGroupDeleteForRoleBySession(session *xorm.Session, roleId interface{}) (int64, error) + BatchAddMediumRolePermissionGroupBySession(session *xorm.Session, mm []*model.MediumRolePermissionGroup) (int64, error) +} diff --git a/app/db/dao/medium_with_role_dao.go b/app/db/dao/medium_with_role_dao.go new file mode 100644 index 0000000..f6d285f --- /dev/null +++ b/app/db/dao/medium_with_role_dao.go @@ -0,0 +1,16 @@ +package dao + +import ( + "applet/app/db/model" + "xorm.io/xorm" +) + +type MediumWithRoleDao interface { + FindMediumWithRole(id int) (*[]model.MediumWithRole, error) + FindMediumWithRoleByRoleId(id int) (*[]model.MediumWithRole, error) + AdminDeleteBySessionForAdmId(session *xorm.Session, admId interface{}) (int64, error) + GetMediumWithRoleByRole(id int) (m *model.MediumWithRole, err error) + MediumWithRoleDeleteForRoleBySession(session *xorm.Session, roleId interface{}) (int64, error) + MediumWithRoleDeleteBySession(session *xorm.Session, id interface{}) (int64, error) + BatchAddMediumWithRoleBySession(session *xorm.Session, mm []*model.MediumWithRole) (int64, error) +} diff --git a/app/db/dao/sys_cfg_dao.go b/app/db/dao/sys_cfg_dao.go new file mode 100644 index 0000000..d66f4f3 --- /dev/null +++ b/app/db/dao/sys_cfg_dao.go @@ -0,0 +1,14 @@ +package dao + +import "applet/app/db/model" + +type SysCfgDao interface { + SysCfgGetAll() (*[]model.SysCfg, error) + SysCfgGetOneNoDataNoErr(key string) (*model.SysCfg, error) + SysCfgGetOne(key string) (*model.SysCfg, error) + SysCfgInsert(key, val, memo string) bool + SysCfgUpdate(key, val string) bool + SysCfgGetWithDb(HKey string) string + SysCfgDel(HKey string) error + SysCfgFindWithDb(keys ...string) map[string]string +} diff --git a/app/db/implement/admin_implement.go b/app/db/implement/admin_implement.go index b6eaca1..c7a5d5a 100644 --- a/app/db/implement/admin_implement.go +++ b/app/db/implement/admin_implement.go @@ -33,7 +33,7 @@ func (a AdminDb) AdminDeleteBySession(session *xorm.Session, admId interface{}) if reflect.TypeOf(admId).Kind() == reflect.Slice { return session.In("adm_id", admId).Delete(model.Admin{}) } else { - return session.Where("id = ?", admId).Delete(model.Admin{}) + return session.Where("adm_id = ?", admId).Delete(model.Admin{}) } } diff --git a/app/db/implement/admin_role_implement.go b/app/db/implement/admin_role_implement.go index d3964f7..d189b2f 100644 --- a/app/db/implement/admin_role_implement.go +++ b/app/db/implement/admin_role_implement.go @@ -62,7 +62,7 @@ func (a AdminRoleDb) AdminRoleDeleteForRoleBySession(session *xorm.Session, role func (a AdminRoleDb) AdminRoleDeleteBySession(session *xorm.Session, id interface{}) (int64, error) { if reflect.TypeOf(id).Kind() == reflect.Slice { - return session.In("id", id).Delete(model.AdminRole{}) + return session.In("adm_id", id).Delete(model.AdminRole{}) } else { return session.Where("adm_id = ?", id).Delete(model.AdminRole{}) } diff --git a/app/db/implement/agent_domain_implement.go b/app/db/implement/agent_domain_implement.go new file mode 100644 index 0000000..7ce2d7c --- /dev/null +++ b/app/db/implement/agent_domain_implement.go @@ -0,0 +1,14 @@ +package implement + +import ( + "applet/app/db/dao" + "xorm.io/xorm" +) + +func NewAgentDomainDb(engine *xorm.Engine) dao.AgentDomainDao { + return &AgentDomainDb{Db: engine} +} + +type AgentDomainDb struct { + Db *xorm.Engine +} diff --git a/app/db/implement/agent_implement.go b/app/db/implement/agent_implement.go new file mode 100644 index 0000000..abf6e4c --- /dev/null +++ b/app/db/implement/agent_implement.go @@ -0,0 +1,53 @@ +package implement + +import ( + "applet/app/db/dao" + "applet/app/db/model" + "applet/app/utils/logx" + "reflect" + "xorm.io/xorm" +) + +func NewAgentDb(engine *xorm.Engine) dao.AgentDao { + return &AgentDb{Db: engine} +} + +type AgentDb struct { + Db *xorm.Engine +} + +func (a AgentDb) GetAgentByUsername(username string) (agent *model.Agent, err error) { + agent = new(model.Agent) + has, err := a.Db.Where("username =?", username).Get(agent) + if err != nil { + return nil, logx.Error(err) + } + if has == false { + return nil, nil + } + return agent, nil +} + +func (a AgentDb) AgentInsert(m *model.Agent) (int64, error) { + insertAffected, err := a.Db.InsertOne(m) + if err != nil { + return 0, err + } + return insertAffected, nil +} + +func (a AgentDb) AgentDeleteBySession(session *xorm.Session, id interface{}) (int64, error) { + if reflect.TypeOf(id).Kind() == reflect.Slice { + return session.In("id", id).Delete(model.Admin{}) + } else { + return session.Where("id = ?", id).Delete(model.Admin{}) + } +} + +func (a AgentDb) UpdateAgent(m *model.Agent, columns ...string) (int64, error) { + affected, err := a.Db.Where("id =?", m.Id).Cols(columns...).Update(m) + if err != nil { + return 0, err + } + return affected, nil +} diff --git a/app/db/implement/agent_permission_group_implement.go b/app/db/implement/agent_permission_group_implement.go new file mode 100644 index 0000000..8c0a5f8 --- /dev/null +++ b/app/db/implement/agent_permission_group_implement.go @@ -0,0 +1,33 @@ +package implement + +import ( + "applet/app/db/dao" + "applet/app/db/model" + "applet/app/enum" + "applet/app/utils/logx" + "xorm.io/xorm" +) + +func NewAgentPermissionGroupDb(engine *xorm.Engine) dao.AgentPermissionGroupDao { + return &AgentPermissionGroupDb{Db: engine} +} + +type AgentPermissionGroupDb struct { + Db *xorm.Engine +} + +func (a AgentPermissionGroupDb) FindAgentPermissionGroup() (*[]model.AgentPermissionGroup, error) { + var mm []model.AgentPermissionGroup + if err := a.Db.Where("state = ?", enum.PermissionGroupStateForNormal).Asc("id").Find(&mm); err != nil { + return nil, logx.Error(err) + } + return &mm, nil +} + +func (a AgentPermissionGroupDb) FindAgentPermissionGroupV2() (*[]model.AgentPermissionGroup, error) { + var mm []model.AgentPermissionGroup + if err := a.Db.Asc("id").Find(&mm); err != nil { + return nil, logx.Error(err) + } + return &mm, nil +} diff --git a/app/db/implement/agent_permission_group_permission_implement.go b/app/db/implement/agent_permission_group_permission_implement.go new file mode 100644 index 0000000..9926689 --- /dev/null +++ b/app/db/implement/agent_permission_group_permission_implement.go @@ -0,0 +1,14 @@ +package implement + +import ( + "applet/app/db/dao" + "xorm.io/xorm" +) + +func NewAgentPermissionGroupPermissionDb(engine *xorm.Engine) dao.AgentPermissionGroupPermissionDao { + return &AgentPermissionGroupPermissionDb{Db: engine} +} + +type AgentPermissionGroupPermissionDb struct { + Db *xorm.Engine +} diff --git a/app/db/implement/agent_permission_implement.go b/app/db/implement/agent_permission_implement.go new file mode 100644 index 0000000..088c5a5 --- /dev/null +++ b/app/db/implement/agent_permission_implement.go @@ -0,0 +1,14 @@ +package implement + +import ( + "applet/app/db/dao" + "xorm.io/xorm" +) + +func NewAgentPermissionDb(engine *xorm.Engine) dao.AgentPermissionDao { + return &AgentPermissionDb{Db: engine} +} + +type AgentPermissionDb struct { + Db *xorm.Engine +} diff --git a/app/db/implement/agent_role_implement.go b/app/db/implement/agent_role_implement.go new file mode 100644 index 0000000..aeae0ef --- /dev/null +++ b/app/db/implement/agent_role_implement.go @@ -0,0 +1,69 @@ +package implement + +import ( + "applet/app/db/dao" + "applet/app/db/model" + "applet/app/utils/logx" + "reflect" + "xorm.io/xorm" +) + +func NewAgentRoleDb(engine *xorm.Engine) dao.AgentRoleDao { + return &AgentRoleDb{Db: engine} +} + +type AgentRoleDb struct { + Db *xorm.Engine +} + +func (a AgentRoleDb) FindAgentRole() (*[]model.AgentRole, error) { + var mm []model.AgentRole + if err := a.Db.Desc("id").Find(&mm); err != nil { + return nil, logx.Error(err) + } + return &mm, nil +} + +func (a AgentRoleDb) GetAgentRole() (m *model.AgentRole, err error) { + m = new(model.AgentRole) + has, err := a.Db.Where("id = ?", m.Id).Get(m) + if err != nil { + return nil, logx.Error(err) + } + if has == false { + return nil, nil + } + return m, nil +} + +func (a AgentRoleDb) UpdateAgentRole(m *model.AgentRole, columns ...string) (int64, error) { + affected, err := a.Db.Where("id =?", m.Id).Cols(columns...).Update(m) + if err != nil { + return 0, err + } + return affected, nil +} + +func (a AgentRoleDb) AgentRoleDeleteBySession(session *xorm.Session, id interface{}) (int64, error) { + if reflect.TypeOf(id).Kind() == reflect.Slice { + return session.In("id", id).Delete(model.Role{}) + } else { + return session.Where("id = ?", id).Delete(model.Role{}) + } +} + +func (a AgentRoleDb) AgentRoleInsert(m *model.AgentRole) (int, error) { + _, err := a.Db.InsertOne(m) + if err != nil { + return 0, err + } + return m.Id, nil +} + +func (a AgentRoleDb) FindPermissionGroupByAgentRole(roleId int) (list []*dao.AgentRolePermissionGroup, total int64, err error) { + total, err = a.Db.Where("agent_role.id =?", roleId). + Join("LEFT", "agent_role_permission_group", "agent_role_permission_group.role_id = agent_role.id"). + Join("LEFT", "agent_permission_group", "agent_permission_group.id = agent_role_permission_group.group_id"). + FindAndCount(&list) + return +} diff --git a/app/db/implement/agent_role_permission_group_implement.go b/app/db/implement/agent_role_permission_group_implement.go new file mode 100644 index 0000000..6bcd04f --- /dev/null +++ b/app/db/implement/agent_role_permission_group_implement.go @@ -0,0 +1,32 @@ +package implement + +import ( + "applet/app/db/dao" + "applet/app/db/model" + "reflect" + "xorm.io/xorm" +) + +func NewAgentRolePermissionGroupDb(engine *xorm.Engine) dao.AgentRolePermissionGroupDao { + return &AgentRolePermissionGroupDb{Db: engine} +} + +type AgentRolePermissionGroupDb struct { + Db *xorm.Engine +} + +func (a AgentRolePermissionGroupDb) AgentRolePermissionGroupDeleteForRoleBySession(session *xorm.Session, roleId interface{}) (int64, error) { + if reflect.TypeOf(roleId).Kind() == reflect.Slice { + return session.In("role_id", roleId).Delete(model.AgentRolePermissionGroup{}) + } else { + return session.Where("role_id = ?", roleId).Delete(model.AgentRolePermissionGroup{}) + } +} + +func (a AgentRolePermissionGroupDb) BatchAddAgentRolePermissionGroupBySession(session *xorm.Session, mm []*model.AgentRolePermissionGroup) (int64, error) { + affected, err := session.Insert(mm) + if err != nil { + return 0, err + } + return affected, nil +} diff --git a/app/db/implement/agent_with_role_implement.go b/app/db/implement/agent_with_role_implement.go new file mode 100644 index 0000000..385ccdd --- /dev/null +++ b/app/db/implement/agent_with_role_implement.go @@ -0,0 +1,77 @@ +package implement + +import ( + "applet/app/db/dao" + "applet/app/db/model" + "applet/app/utils/logx" + "reflect" + "xorm.io/xorm" +) + +func NewAgentWithRoleDb(engine *xorm.Engine) dao.AgentWithRoleDao { + return &AgentWithRoleDb{Db: engine} +} + +type AgentWithRoleDb struct { + Db *xorm.Engine +} + +func (a AgentWithRoleDb) FindAgentWithRole(id int) (*[]model.AgentWithRole, error) { + var mm []model.AgentWithRole + if err := a.Db.Where("adm_id =?", id).Find(&mm); err != nil { + return nil, logx.Error(err) + } + return &mm, nil +} + +func (a AgentWithRoleDb) FindAgentWithRoleByRoleId(id int) (*[]model.AgentWithRole, error) { + var mm []model.AgentWithRole + if err := a.Db.Where("role_id =?", id).Find(&mm); err != nil { + return nil, logx.Error(err) + } + return &mm, nil +} + +func (a AgentWithRoleDb) AdminDeleteBySessionForAdmId(session *xorm.Session, admId interface{}) (int64, error) { + if reflect.TypeOf(admId).Kind() == reflect.Slice { + return session.In("adm_id", admId).Delete(model.AgentWithRole{}) + } else { + return session.Where("adm_id = ?", admId).Delete(model.AgentWithRole{}) + } +} + +func (a AgentWithRoleDb) GetAgentWithRoleByRole(id int) (mm *model.AgentWithRole, err error) { + mm = new(model.AgentWithRole) + has, err := a.Db.Where("role_id =?", id).Get(mm) + if err != nil { + return nil, logx.Error(err) + } + if has == false { + return nil, nil + } + return mm, nil +} + +func (a AgentWithRoleDb) AgentWithRoleDeleteForRoleBySession(session *xorm.Session, roleId interface{}) (int64, error) { + if reflect.TypeOf(roleId).Kind() == reflect.Slice { + return session.In("role_id", roleId).Delete(model.AgentWithRole{}) + } else { + return session.Where("role_id = ?", roleId).Delete(model.AgentWithRole{}) + } +} + +func (a AgentWithRoleDb) AgentWithRoleDeleteBySession(session *xorm.Session, id interface{}) (int64, error) { + if reflect.TypeOf(id).Kind() == reflect.Slice { + return session.In("agent_id", id).Delete(model.AgentWithRole{}) + } else { + return session.Where("agent_id = ?", id).Delete(model.AgentWithRole{}) + } +} + +func (a AgentWithRoleDb) BatchAddAgentWithRoleBySession(session *xorm.Session, mm []*model.AgentWithRole) (int64, error) { + affected, err := session.Insert(mm) + if err != nil { + return 0, err + } + return affected, nil +} diff --git a/app/db/implement/medium_domain_implement.go b/app/db/implement/medium_domain_implement.go new file mode 100644 index 0000000..dfc56e4 --- /dev/null +++ b/app/db/implement/medium_domain_implement.go @@ -0,0 +1,36 @@ +package implement + +import ( + "applet/app/db/dao" + "applet/app/db/model" + "applet/app/utils/logx" + "xorm.io/xorm" +) + +func NewMediumDomainDb(engine *xorm.Engine) dao.MediumDomainDao { + return &MediumDomainDb{Db: engine} +} + +type MediumDomainDb struct { + Db *xorm.Engine +} + +func (m MediumDomainDb) GetMediumDomain(mediumId int) (medium *model.MediumDomain, err error) { + medium = new(model.MediumDomain) + has, err := m.Db.Where("medium_id =?", mediumId).Get(medium) + if err != nil { + return nil, logx.Error(err) + } + if has == false { + return nil, nil + } + return medium, nil +} + +func (m MediumDomainDb) MediumDomainInsert(medium *model.MediumDomain) (int64, error) { + insertAffected, err := m.Db.InsertOne(medium) + if err != nil { + return 0, err + } + return insertAffected, nil +} diff --git a/app/db/implement/medium_implement.go b/app/db/implement/medium_implement.go new file mode 100644 index 0000000..fdb3757 --- /dev/null +++ b/app/db/implement/medium_implement.go @@ -0,0 +1,53 @@ +package implement + +import ( + "applet/app/db/dao" + "applet/app/db/model" + "applet/app/utils/logx" + "reflect" + "xorm.io/xorm" +) + +func NewMediumDb(engine *xorm.Engine) dao.MediumDao { + return &MediumDb{Db: engine} +} + +type MediumDb struct { + Db *xorm.Engine +} + +func (m MediumDb) UpdateMedium(medium *model.Medium, columns ...string) (int64, error) { + affected, err := m.Db.Where("id =?", medium.Id).Cols(columns...).Update(m) + if err != nil { + return 0, err + } + return affected, nil +} + +func (m MediumDb) GetMediumByUsername(username string) (medium *model.Medium, err error) { + medium = new(model.Medium) + has, err := m.Db.Where("username =?", username).Get(medium) + if err != nil { + return nil, logx.Error(err) + } + if has == false { + return nil, nil + } + return medium, nil +} + +func (m MediumDb) MediumInsert(medium *model.Medium) (int64, error) { + insertAffected, err := m.Db.InsertOne(medium) + if err != nil { + return 0, err + } + return insertAffected, nil +} + +func (m MediumDb) MediumDeleteBySession(session *xorm.Session, id interface{}) (int64, error) { + if reflect.TypeOf(id).Kind() == reflect.Slice { + return session.In("id", id).Delete(model.Admin{}) + } else { + return session.Where("id = ?", id).Delete(model.Admin{}) + } +} diff --git a/app/db/implement/medium_permission_group_implement.go b/app/db/implement/medium_permission_group_implement.go new file mode 100644 index 0000000..a85ac46 --- /dev/null +++ b/app/db/implement/medium_permission_group_implement.go @@ -0,0 +1,33 @@ +package implement + +import ( + "applet/app/db/dao" + "applet/app/db/model" + "applet/app/enum" + "applet/app/utils/logx" + "xorm.io/xorm" +) + +func NewMediumPermissionGroupDb(engine *xorm.Engine) dao.MediumPermissionGroupDao { + return &MediumPermissionGroupDb{Db: engine} +} + +type MediumPermissionGroupDb struct { + Db *xorm.Engine +} + +func (m MediumPermissionGroupDb) FindMediumPermissionGroup() (*[]model.MediumPermissionGroup, error) { + var mm []model.MediumPermissionGroup + if err := m.Db.Where("state = ?", enum.PermissionGroupStateForNormal).Asc("id").Find(&mm); err != nil { + return nil, logx.Error(err) + } + return &mm, nil +} + +func (m MediumPermissionGroupDb) FindMediumPermissionGroupV2() (*[]model.MediumPermissionGroup, error) { + var mm []model.MediumPermissionGroup + if err := m.Db.Asc("id").Find(&mm); err != nil { + return nil, logx.Error(err) + } + return &mm, nil +} diff --git a/app/db/implement/medium_permission_group_permission_implement.go b/app/db/implement/medium_permission_group_permission_implement.go new file mode 100644 index 0000000..997217c --- /dev/null +++ b/app/db/implement/medium_permission_group_permission_implement.go @@ -0,0 +1,14 @@ +package implement + +import ( + "applet/app/db/dao" + "xorm.io/xorm" +) + +func NewMediumPermissionGroupPermissionDb(engine *xorm.Engine) dao.MediumPermissionGroupPermissionDao { + return &MediumPermissionGroupPermissionDb{Db: engine} +} + +type MediumPermissionGroupPermissionDb struct { + Db *xorm.Engine +} diff --git a/app/db/implement/medium_permission_implement.go b/app/db/implement/medium_permission_implement.go new file mode 100644 index 0000000..b543f53 --- /dev/null +++ b/app/db/implement/medium_permission_implement.go @@ -0,0 +1,14 @@ +package implement + +import ( + "applet/app/db/dao" + "xorm.io/xorm" +) + +func NewMediumPermissionDb(engine *xorm.Engine) dao.MediumPermissionDao { + return &MediumPermissionDb{Db: engine} +} + +type MediumPermissionDb struct { + Db *xorm.Engine +} diff --git a/app/db/implement/medium_role_implement.go b/app/db/implement/medium_role_implement.go new file mode 100644 index 0000000..1a1e4c1 --- /dev/null +++ b/app/db/implement/medium_role_implement.go @@ -0,0 +1,69 @@ +package implement + +import ( + "applet/app/db/dao" + "applet/app/db/model" + "applet/app/utils/logx" + "reflect" + "xorm.io/xorm" +) + +func NewMediumRoleDb(engine *xorm.Engine) dao.MediumRoleDao { + return &MediumRoleDb{Db: engine} +} + +type MediumRoleDb struct { + Db *xorm.Engine +} + +func (m MediumRoleDb) FindMediumRole() (*[]model.MediumRole, error) { + var mm []model.MediumRole + if err := m.Db.Desc("id").Find(&mm); err != nil { + return nil, logx.Error(err) + } + return &mm, nil +} + +func (m MediumRoleDb) GetMediumRole() (mm *model.MediumRole, err error) { + mm = new(model.MediumRole) + has, err := m.Db.Where("id = ?", mm.Id).Get(mm) + if err != nil { + return nil, logx.Error(err) + } + if has == false { + return nil, nil + } + return mm, nil +} + +func (m MediumRoleDb) UpdateMediumRole(mm *model.MediumRole, columns ...string) (int64, error) { + affected, err := m.Db.Where("id =?", mm.Id).Cols(columns...).Update(m) + if err != nil { + return 0, err + } + return affected, nil +} + +func (m MediumRoleDb) MediumRoleDeleteBySession(session *xorm.Session, id interface{}) (int64, error) { + if reflect.TypeOf(id).Kind() == reflect.Slice { + return session.In("id", id).Delete(model.MediumRole{}) + } else { + return session.Where("id = ?", id).Delete(model.MediumRole{}) + } +} + +func (m MediumRoleDb) MediumRoleInsert(mm *model.MediumRole) (int, error) { + _, err := m.Db.InsertOne(mm) + if err != nil { + return 0, err + } + return mm.Id, nil +} + +func (m MediumRoleDb) FindPermissionGroupByMediumRole(roleId int) (list []*dao.MediumRolePermissionGroup, total int64, err error) { + total, err = m.Db.Where("medium_role.id =?", roleId). + Join("LEFT", "medium_role_permission_group", "medium_role_permission_group.role_id = medium_role.id"). + Join("LEFT", "medium_permission_group", "medium_permission_group.id = medium_role_permission_group.group_id"). + FindAndCount(&list) + return +} diff --git a/app/db/implement/medium_role_permission_group_implement.go b/app/db/implement/medium_role_permission_group_implement.go new file mode 100644 index 0000000..9367d7d --- /dev/null +++ b/app/db/implement/medium_role_permission_group_implement.go @@ -0,0 +1,32 @@ +package implement + +import ( + "applet/app/db/dao" + "applet/app/db/model" + "reflect" + "xorm.io/xorm" +) + +func NewMediumRolePermissionGroupDb(engine *xorm.Engine) dao.MediumRolePermissionGroupDao { + return &MediumRolePermissionGroupDb{Db: engine} +} + +type MediumRolePermissionGroupDb struct { + Db *xorm.Engine +} + +func (m MediumRolePermissionGroupDb) MediumRolePermissionGroupDeleteForRoleBySession(session *xorm.Session, roleId interface{}) (int64, error) { + if reflect.TypeOf(roleId).Kind() == reflect.Slice { + return session.In("role_id", roleId).Delete(model.MediumRolePermissionGroup{}) + } else { + return session.Where("role_id = ?", roleId).Delete(model.MediumRolePermissionGroup{}) + } +} + +func (m MediumRolePermissionGroupDb) BatchAddMediumRolePermissionGroupBySession(session *xorm.Session, mm []*model.MediumRolePermissionGroup) (int64, error) { + affected, err := session.Insert(mm) + if err != nil { + return 0, err + } + return affected, nil +} diff --git a/app/db/implement/medium_with_role_implement.go b/app/db/implement/medium_with_role_implement.go new file mode 100644 index 0000000..0bef8b1 --- /dev/null +++ b/app/db/implement/medium_with_role_implement.go @@ -0,0 +1,77 @@ +package implement + +import ( + "applet/app/db/dao" + "applet/app/db/model" + "applet/app/utils/logx" + "reflect" + "xorm.io/xorm" +) + +func NewMediumWithRoleDb(engine *xorm.Engine) dao.MediumWithRoleDao { + return &MediumWithRoleDb{Db: engine} +} + +type MediumWithRoleDb struct { + Db *xorm.Engine +} + +func (m MediumWithRoleDb) FindMediumWithRole(id int) (*[]model.MediumWithRole, error) { + var mm []model.MediumWithRole + if err := m.Db.Where("adm_id =?", id).Find(&mm); err != nil { + return nil, logx.Error(err) + } + return &mm, nil +} + +func (m MediumWithRoleDb) FindMediumWithRoleByRoleId(id int) (*[]model.MediumWithRole, error) { + var mm []model.MediumWithRole + if err := m.Db.Where("role_id =?", id).Find(&mm); err != nil { + return nil, logx.Error(err) + } + return &mm, nil +} + +func (m MediumWithRoleDb) AdminDeleteBySessionForAdmId(session *xorm.Session, admId interface{}) (int64, error) { + if reflect.TypeOf(admId).Kind() == reflect.Slice { + return session.In("adm_id", admId).Delete(model.MediumWithRole{}) + } else { + return session.Where("adm_id = ?", admId).Delete(model.MediumWithRole{}) + } +} + +func (m MediumWithRoleDb) GetMediumWithRoleByRole(id int) (mm *model.MediumWithRole, err error) { + mm = new(model.MediumWithRole) + has, err := m.Db.Where("role_id =?", id).Get(mm) + if err != nil { + return nil, logx.Error(err) + } + if has == false { + return nil, nil + } + return mm, nil +} + +func (m MediumWithRoleDb) MediumWithRoleDeleteForRoleBySession(session *xorm.Session, roleId interface{}) (int64, error) { + if reflect.TypeOf(roleId).Kind() == reflect.Slice { + return session.In("role_id", roleId).Delete(model.MediumWithRole{}) + } else { + return session.Where("role_id = ?", roleId).Delete(model.MediumWithRole{}) + } +} + +func (m MediumWithRoleDb) MediumWithRoleDeleteBySession(session *xorm.Session, id interface{}) (int64, error) { + if reflect.TypeOf(id).Kind() == reflect.Slice { + return session.In("medium_id", id).Delete(model.MediumWithRole{}) + } else { + return session.Where("medium_id = ?", id).Delete(model.MediumWithRole{}) + } +} + +func (m MediumWithRoleDb) BatchAddMediumWithRoleBySession(session *xorm.Session, mm []*model.MediumWithRole) (int64, error) { + affected, err := session.Insert(mm) + if err != nil { + return 0, err + } + return affected, nil +} diff --git a/app/db/implement/sys_cfg_implement.go b/app/db/implement/sys_cfg_implement.go new file mode 100644 index 0000000..b9d9f90 --- /dev/null +++ b/app/db/implement/sys_cfg_implement.go @@ -0,0 +1,124 @@ +package implement + +import ( + "applet/app/db/dao" + "applet/app/db/model" + "applet/app/md" + "applet/app/utils/cache" + "applet/app/utils/logx" + "fmt" + "xorm.io/xorm" +) + +func NewSysCfgDb(engine *xorm.Engine, masterId string) dao.SysCfgDao { + return &SysCfgDb{ + Db: engine, + MasterId: masterId, + } +} + +type SysCfgDb struct { + Db *xorm.Engine + MasterId string +} + +func (s SysCfgDb) SysCfgGetAll() (*[]model.SysCfg, error) { + var cfgList []model.SysCfg + if err := s.Db.Cols("key,val,memo").Find(&cfgList); err != nil { + return nil, logx.Error(err) + } + return &cfgList, nil +} + +func (s SysCfgDb) SysCfgGetOneNoDataNoErr(key string) (*model.SysCfg, error) { + var cfgList model.SysCfg + has, err := s.Db.Where("`key`=?", key).Get(&cfgList) + if err != nil { + return nil, logx.Error(err) + } + if !has { + return nil, nil + } + return &cfgList, nil +} + +func (s SysCfgDb) SysCfgGetOne(key string) (*model.SysCfg, error) { + var cfgList model.SysCfg + if has, err := s.Db.Where("`key`=?", key).Get(&cfgList); err != nil || has == false { + return nil, logx.Error(err) + } + return &cfgList, nil +} + +func (s SysCfgDb) SysCfgInsert(key, val, memo string) bool { + cfg := model.SysCfg{Key: key, Val: val, Memo: memo} + _, err := s.Db.InsertOne(&cfg) + if err != nil { + logx.Error(err) + return false + } + return true +} + +func (s SysCfgDb) SysCfgUpdate(key, val string) bool { + cfg := model.SysCfg{Key: key, Val: val} + _, err := s.Db.Where("`key`=?", key).Cols("val").Update(&cfg) + if err != nil { + logx.Error(err) + return false + } + s.SysCfgDel(key) + return true +} + +func (s SysCfgDb) SysCfgGetWithDb(HKey string) string { + cacheKey := fmt.Sprintf(md.AppCfgCacheKey, s.MasterId, HKey[0:1]) + get, err := cache.HGetString(cacheKey, HKey) + if err != nil || get == "" { + cfg, err := s.SysCfgGetOne(HKey) + if err != nil || cfg == nil { + _ = logx.Error(err) + return "" + } + + // key是否存在 + cacheKeyExist := false + if cache.Exists(cacheKey) { + cacheKeyExist = true + } + + // 设置缓存 + _, err = cache.HSet(cacheKey, HKey, cfg.Val) + if err != nil { + _ = logx.Error(err) + return "" + } + if !cacheKeyExist { // 如果是首次设置 设置过期时间 + _, err := cache.Expire(cacheKey, md.CfgCacheTime) + if err != nil { + _ = logx.Error(err) + return "" + } + } + return cfg.Val + } + return get +} + +func (s SysCfgDb) SysCfgDel(HKey string) error { + cacheKey := fmt.Sprintf(md.AppCfgCacheKey, s.MasterId, HKey[0:1]) + _, err := cache.HDel(cacheKey, HKey) + if err != nil { + return err + } + return nil +} + +func (s SysCfgDb) SysCfgFindWithDb(keys ...string) map[string]string { + res := map[string]string{} + for _, v := range keys { + val := s.SysCfgGetWithDb(v) + res[v] = val + } + return res +} diff --git a/app/db/model/admin.go b/app/db/model/admin.go index c5f78da..125ae65 100644 --- a/app/db/model/admin.go +++ b/app/db/model/admin.go @@ -9,6 +9,4 @@ type Admin struct { 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"` - OpenId string `json:"open_id" xorm:"not null default '' comment('微信openid') VARCHAR(255)"` - UnionId string `json:"union_id" xorm:"not null default '' comment('微信用户id') VARCHAR(255)"` } diff --git a/app/db/model/agent.go b/app/db/model/agent.go new file mode 100644 index 0000000..703db69 --- /dev/null +++ b/app/db/model/agent.go @@ -0,0 +1,13 @@ +package model + +type Agent struct { + Id int `json:"id" xorm:"not null pk default 0 INT(11)"` + AgentId int `json:"agent_id" xorm:"not null default 0 comment('代理id') INT(11)"` + Username string `json:"username" xorm:"not null default '' comment('用户名') VARCHAR(255)"` + Password string `json:"password" xorm:"not null default '' comment('密码') VARCHAR(255)"` + State int `json:"state" xorm:"not null default 1 comment('状态(1:正常 2:冻结)') TINYINT(1)"` + IsSuperAdministrator int `json:"is_super_administrator" xorm:"not null default 0 comment('是否为超级管理员(0:否 1:是)') 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/db/model/agent_domain.go b/app/db/model/agent_domain.go new file mode 100644 index 0000000..79f4953 --- /dev/null +++ b/app/db/model/agent_domain.go @@ -0,0 +1,8 @@ +package model + +type AgentDomain struct { + Domain string `json:"domain" xorm:"not null pk comment('绑定域名') VARCHAR(100)"` + MediumId int `json:"medium_id" xorm:"not null comment('媒体id') index unique INT(11)"` + IsOfficial int `json:"is_official" xorm:"not null default 1 comment('是否官方指定域名(1:是 2:否)') TINYINT(1)"` + IsSsl int `json:"is_ssl" xorm:"not null default 0 comment('是否开启ssl:0否;1是') TINYINT(255)"` +} diff --git a/app/db/model/agent_permission.go b/app/db/model/agent_permission.go new file mode 100644 index 0000000..d519721 --- /dev/null +++ b/app/db/model/agent_permission.go @@ -0,0 +1,10 @@ +package model + +type AgentPermission struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + Name string `json:"name" xorm:"not null default '' comment('名称') VARCHAR(255)"` + Action string `json:"action" xorm:"not null default '' comment('路由') unique VARCHAR(255)"` + State int `json:"state" xorm:"not null default 1 comment('状态(1:正常 2:废弃)') TINYINT(1)"` + 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/agent_permission_group.go b/app/db/model/agent_permission_group.go new file mode 100644 index 0000000..a559a0e --- /dev/null +++ b/app/db/model/agent_permission_group.go @@ -0,0 +1,11 @@ +package model + +type AgentPermissionGroup struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + ParentId int `json:"parent_id" xorm:"not null default 0 comment('父级id') INT(11)"` + Key string `json:"key" xorm:"not null default '' VARCHAR(255)"` + Name string `json:"name" xorm:"not null default '' comment('名称') VARCHAR(255)"` + State int `json:"state" xorm:"not null default 1 comment('状态(1:正常 2:废弃)') TINYINT(1)"` + 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/agent_permission_group_permission.go b/app/db/model/agent_permission_group_permission.go new file mode 100644 index 0000000..d7712d8 --- /dev/null +++ b/app/db/model/agent_permission_group_permission.go @@ -0,0 +1,9 @@ +package model + +type AgentPermissionGroupPermission struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + GroupId int `json:"group_id" xorm:"not null default 0 comment('权限组id') INT(11)"` + PermissionId int `json:"permission_id" xorm:"not null default 0 comment('权限id') 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/agent_role.go b/app/db/model/agent_role.go new file mode 100644 index 0000000..91ebe49 --- /dev/null +++ b/app/db/model/agent_role.go @@ -0,0 +1,10 @@ +package model + +type AgentRole struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + Name string `json:"name" xorm:"not null default '' comment('名称') VARCHAR(255)"` + State int `json:"state" xorm:"not null default 1 comment('状态(1:正常 2:冻结)') TINYINT(1)"` + Memo string `json:"memo" xorm:"not null default '' comment('备注') VARCHAR(255)"` + 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/agent_role_permission_group.go b/app/db/model/agent_role_permission_group.go new file mode 100644 index 0000000..32a2f95 --- /dev/null +++ b/app/db/model/agent_role_permission_group.go @@ -0,0 +1,9 @@ +package model + +type AgentRolePermissionGroup struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + RoleId int `json:"role_id" xorm:"not null default 0 comment('角色id') INT(11)"` + GroupId int `json:"group_id" xorm:"not null default 0 comment('权限组id') 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/agent_with_role.go b/app/db/model/agent_with_role.go new file mode 100644 index 0000000..4ec6adb --- /dev/null +++ b/app/db/model/agent_with_role.go @@ -0,0 +1,10 @@ +package model + +type AgentWithRole struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + AgentId int `json:"agent_id" xorm:"not null default 0 comment('管理员id') INT(11)"` + RoleId int `json:"role_id" xorm:"not null default 0 comment('角色id') INT(11)"` + State int `json:"state" xorm:"not null default 1 comment('状态(1:正常 2:冻结)') TINYINT(1)"` + 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/medium.go b/app/db/model/medium.go new file mode 100644 index 0000000..a728b69 --- /dev/null +++ b/app/db/model/medium.go @@ -0,0 +1,13 @@ +package model + +type Medium struct { + Id int `json:"id" xorm:"not null pk default 0 INT(11)"` + MediumId int `json:"medium_id" xorm:"not null default 0 comment('媒体id') INT(11)"` + Username string `json:"username" xorm:"not null default '' comment('用户名') VARCHAR(255)"` + Password string `json:"password" xorm:"not null default '' comment('密码') VARCHAR(255)"` + State int `json:"state" xorm:"not null default 1 comment('状态(1:正常 2:冻结)') TINYINT(1)"` + IsSuperAdministrator int `json:"is_super_administrator" xorm:"not null default 0 comment('是否为超级管理员(0:否 1:是)') 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/db/model/medium_domain.go b/app/db/model/medium_domain.go new file mode 100644 index 0000000..337e167 --- /dev/null +++ b/app/db/model/medium_domain.go @@ -0,0 +1,8 @@ +package model + +type MediumDomain struct { + Domain string `json:"domain" xorm:"not null pk comment('绑定域名') VARCHAR(100)"` + MediumId int `json:"medium_id" xorm:"not null comment('媒体id') index unique INT(11)"` + IsOfficial int `json:"is_official" xorm:"not null default 1 comment('是否官方指定域名(1:是 2:否)') TINYINT(1)"` + IsSsl int `json:"is_ssl" xorm:"not null default 0 comment('是否开启ssl:0否;1是') TINYINT(255)"` +} diff --git a/app/db/model/medium_permission.go b/app/db/model/medium_permission.go new file mode 100644 index 0000000..31e6929 --- /dev/null +++ b/app/db/model/medium_permission.go @@ -0,0 +1,10 @@ +package model + +type MediumPermission struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + Name string `json:"name" xorm:"not null default '' comment('名称') VARCHAR(255)"` + Action string `json:"action" xorm:"not null default '' comment('路由') unique VARCHAR(255)"` + State int `json:"state" xorm:"not null default 1 comment('状态(1:正常 2:废弃)') TINYINT(1)"` + 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/medium_permission_group.go b/app/db/model/medium_permission_group.go new file mode 100644 index 0000000..95eddc6 --- /dev/null +++ b/app/db/model/medium_permission_group.go @@ -0,0 +1,11 @@ +package model + +type MediumPermissionGroup struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + ParentId int `json:"parent_id" xorm:"not null default 0 comment('父级id') INT(11)"` + Key string `json:"key" xorm:"not null default '' VARCHAR(255)"` + Name string `json:"name" xorm:"not null default '' comment('名称') VARCHAR(255)"` + State int `json:"state" xorm:"not null default 1 comment('状态(1:正常 2:废弃)') TINYINT(1)"` + 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/medium_permission_group_permission.go b/app/db/model/medium_permission_group_permission.go new file mode 100644 index 0000000..ec60f27 --- /dev/null +++ b/app/db/model/medium_permission_group_permission.go @@ -0,0 +1,9 @@ +package model + +type MediumPermissionGroupPermission struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + GroupId int `json:"group_id" xorm:"not null default 0 comment('权限组id') INT(11)"` + PermissionId int `json:"permission_id" xorm:"not null default 0 comment('权限id') 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/medium_role.go b/app/db/model/medium_role.go new file mode 100644 index 0000000..9384bfb --- /dev/null +++ b/app/db/model/medium_role.go @@ -0,0 +1,10 @@ +package model + +type MediumRole struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + Name string `json:"name" xorm:"not null default '' comment('名称') VARCHAR(255)"` + State int `json:"state" xorm:"not null default 1 comment('状态(1:正常 2:冻结)') TINYINT(1)"` + Memo string `json:"memo" xorm:"not null default '' comment('备注') VARCHAR(255)"` + 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/medium_role_permission_group.go b/app/db/model/medium_role_permission_group.go new file mode 100644 index 0000000..1ed49e4 --- /dev/null +++ b/app/db/model/medium_role_permission_group.go @@ -0,0 +1,9 @@ +package model + +type MediumRolePermissionGroup struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + RoleId int `json:"role_id" xorm:"not null default 0 comment('角色id') INT(11)"` + GroupId int `json:"group_id" xorm:"not null default 0 comment('权限组id') 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/medium_with_role.go b/app/db/model/medium_with_role.go new file mode 100644 index 0000000..f90e9ff --- /dev/null +++ b/app/db/model/medium_with_role.go @@ -0,0 +1,10 @@ +package model + +type MediumWithRole struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + MediumId int `json:"medium_id" xorm:"not null default 0 comment('媒体id') INT(11)"` + RoleId int `json:"role_id" xorm:"not null default 0 comment('角色id') INT(11)"` + State int `json:"state" xorm:"not null default 1 comment('状态(1:正常 2:冻结)') TINYINT(1)"` + 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/super/dao/admin_dao.go b/app/db/super/dao/admin_dao.go new file mode 100644 index 0000000..742fdd4 --- /dev/null +++ b/app/db/super/dao/admin_dao.go @@ -0,0 +1,44 @@ +package dao + +import ( + "applet/app/db/model" + "xorm.io/xorm" +) + +type AdminDao interface { + CreateAdminId() (admId int, err error) + AdminDeleteBySession(session *xorm.Session, admId interface{}) (int64, error) + GetAdmin(id int) (m *model.Admin, err error) + GetAdminByUserName(userName string) (m *model.Admin, err error) + GetAdminRolePermission(admId int) (list []*AdminRolePermission, total int64, err error) + FindAdmin(username string, state, page, limit int) (list []model.Admin, total int64, err error) + UpdateAdmin(m *model.Admin, columns ...string) (int64, error) + AdminInsert(m *model.Admin) (int64, error) + FindAdminRolePermissionGroup(admId int) (list []*AdminRolePermissionGroup, total int64, err error) +} + +type AdminRolePermissionGroup struct { + model.Admin `xorm:"extends"` + model.AdminRole `xorm:"extends"` + model.Role `xorm:"extends"` + model.RolePermissionGroup `xorm:"extends"` + model.PermissionGroup `xorm:"extends"` +} + +func (AdminRolePermissionGroup) TableName() string { + return "admin" +} + +type AdminRolePermission struct { + model.Admin `xorm:"extends"` + model.AdminRole `xorm:"extends"` + model.Role `xorm:"extends"` + model.RolePermissionGroup `xorm:"extends"` + model.PermissionGroup `xorm:"extends"` + model.PermissionGroupPermission `xorm:"extends"` + model.Permission `xorm:"extends"` +} + +func (AdminRolePermission) TableName() string { + return "admin" +} diff --git a/app/db/super/dao/admin_role_dao.go b/app/db/super/dao/admin_role_dao.go new file mode 100644 index 0000000..d1ce742 --- /dev/null +++ b/app/db/super/dao/admin_role_dao.go @@ -0,0 +1,25 @@ +package dao + +import ( + "applet/app/db/model" + "xorm.io/xorm" +) + +type AdminRoleDao interface { + FindAdminRole(id int) (*[]model.AdminRole, error) + FindAdminRoleByRoleId(id int) (*[]model.AdminRole, error) + AdminDeleteBySessionForAdmId(session *xorm.Session, admId interface{}) (int64, error) + GetAdminRoleByRole(id int) (m *model.AdminRole, err error) + AdminRoleDeleteForRoleBySession(session *xorm.Session, roleId interface{}) (int64, error) + AdminRoleDeleteBySession(session *xorm.Session, id interface{}) (int64, error) + BatchAddAdminRoleBySession(session *xorm.Session, mm []*model.AdminRole) (int64, error) +} + +type AdminRole struct { + model.Admin `xorm:"extends"` + model.AdminRole `xorm:"extends"` +} + +func (AdminRole) TableName() string { + return "admin_role" +} diff --git a/app/db/super/dao/agent_list_dao.go b/app/db/super/dao/agent_list_dao.go new file mode 100644 index 0000000..f2ac208 --- /dev/null +++ b/app/db/super/dao/agent_list_dao.go @@ -0,0 +1,9 @@ +package dao + +import "applet/app/db/super/model" + +type AgentListDao interface { + GetAgentList(agentId int) (medium *model.AgentList, err error) + AgentListInsert(m *model.AgentList) (int64, error) + UpdateAgentList(m *model.AgentList, columns ...string) (int64, error) +} diff --git a/app/db/super/dao/medium_list_dao.go b/app/db/super/dao/medium_list_dao.go index 0cd3bf2..e80d688 100644 --- a/app/db/super/dao/medium_list_dao.go +++ b/app/db/super/dao/medium_list_dao.go @@ -1,5 +1,9 @@ package dao +import "applet/app/db/super/model" + type MediumListDao interface { - //TODO:: You can add specific method definitions here + GetMediumList(mediumId int) (medium *model.MediumList, err error) + MediumListInsert(m *model.MediumList) (int64, error) + UpdateMediumList(m *model.MediumList, columns ...string) (int64, error) } diff --git a/app/db/super/dao/permission_dao.go b/app/db/super/dao/permission_dao.go new file mode 100644 index 0000000..e94d561 --- /dev/null +++ b/app/db/super/dao/permission_dao.go @@ -0,0 +1,5 @@ +package dao + +type PermissionDao interface { + //TODO:: You can add specific method definitions here +} diff --git a/app/db/super/dao/permission_group_dao.go b/app/db/super/dao/permission_group_dao.go new file mode 100644 index 0000000..bcec860 --- /dev/null +++ b/app/db/super/dao/permission_group_dao.go @@ -0,0 +1,8 @@ +package dao + +import "applet/app/db/model" + +type PermissionGroupDao interface { + FindPermissionGroup() (*[]model.PermissionGroup, error) + FindPermissionGroupV2() (*[]model.PermissionGroup, error) +} diff --git a/app/db/super/dao/permission_group_permission_dao.go b/app/db/super/dao/permission_group_permission_dao.go new file mode 100644 index 0000000..3f32ce3 --- /dev/null +++ b/app/db/super/dao/permission_group_permission_dao.go @@ -0,0 +1,5 @@ +package dao + +type PermissionGroupPermissionDao interface { + //TODO:: You can add specific method definitions here +} diff --git a/app/db/super/dao/role_dao.go b/app/db/super/dao/role_dao.go new file mode 100644 index 0000000..0a65841 --- /dev/null +++ b/app/db/super/dao/role_dao.go @@ -0,0 +1,25 @@ +package dao + +import ( + "applet/app/db/model" + "xorm.io/xorm" +) + +type RoleDao interface { + FindRole() (*[]model.Role, error) + GetRole() (m *model.Role, err error) + UpdateRole(m *model.Role, columns ...string) (int64, error) + RoleDeleteBySession(session *xorm.Session, id interface{}) (int64, error) + RoleInsert(m *model.Role) (int, error) + FindPermissionGroupByRole(roleId int) (list []*RolePermissionGroup, total int64, err error) +} + +type RolePermissionGroup struct { + model.Role `xorm:"extends"` + model.RolePermissionGroup `xorm:"extends"` + model.PermissionGroup `xorm:"extends"` +} + +func (RolePermissionGroup) TableName() string { + return "role" +} diff --git a/app/db/super/dao/role_permission_group_dao.go b/app/db/super/dao/role_permission_group_dao.go new file mode 100644 index 0000000..2c2000d --- /dev/null +++ b/app/db/super/dao/role_permission_group_dao.go @@ -0,0 +1,11 @@ +package dao + +import ( + "applet/app/db/model" + "xorm.io/xorm" +) + +type RolePermissionGroupDao interface { + RolePermissionGroupDeleteForRoleBySession(session *xorm.Session, roleId interface{}) (int64, error) + BatchAddRolePermissionGroupBySession(session *xorm.Session, mm []*model.RolePermissionGroup) (int64, error) +} diff --git a/app/db/super/implement/admin_implement.go b/app/db/super/implement/admin_implement.go new file mode 100644 index 0000000..c7a5d5a --- /dev/null +++ b/app/db/super/implement/admin_implement.go @@ -0,0 +1,115 @@ +package implement + +import ( + "applet/app/db/dao" + "applet/app/db/model" + "applet/app/utils/logx" + "reflect" + "xorm.io/xorm" +) + +func NewAdminDb(engine *xorm.Engine) dao.AdminDao { + return &AdminDb{Db: engine} +} + +type AdminDb struct { + Db *xorm.Engine +} + +func (a AdminDb) CreateAdminId() (admId int, err error) { + m := new(model.Admin) + has, err := a.Db.Desc("adm_id").Get(m) + if err != nil { + return 0, logx.Error(err) + } + if has == false { + return 0, nil + } + admId = m.AdmId + 1 + return admId, nil +} + +func (a AdminDb) AdminDeleteBySession(session *xorm.Session, admId interface{}) (int64, error) { + if reflect.TypeOf(admId).Kind() == reflect.Slice { + return session.In("adm_id", admId).Delete(model.Admin{}) + } else { + return session.Where("adm_id = ?", admId).Delete(model.Admin{}) + } +} + +func (a AdminDb) GetAdmin(id int) (m *model.Admin, err error) { + m = new(model.Admin) + has, err := a.Db.Where("adm_id =?", id).Get(m) + if err != nil { + return nil, logx.Error(err) + } + if has == false { + return nil, nil + } + return m, nil +} + +func (a AdminDb) GetAdminByUserName(userName string) (m *model.Admin, err error) { + m = new(model.Admin) + has, err := a.Db.Where("username =?", userName).Get(m) + if err != nil { + return nil, logx.Error(err) + } + if has == false { + return nil, nil + } + return m, nil +} + +func (a AdminDb) GetAdminRolePermission(admId int) (list []*dao.AdminRolePermission, total int64, err error) { + total, err = a.Db.Where("admin.adm_id =?", admId). + Join("LEFT", "admin_role", "admin.adm_id = admin_role.adm_id"). + Join("LEFT", "role", "admin_role.role_id = role.id"). + Join("LEFT", "role_permission_group", "role.id = role_permission_group.role_id"). + Join("LEFT", "permission_group", "role_permission_group.group_id = permission_group.id"). + Join("LEFT", "permission_group_permission", "permission_group.id = permission_group_permission.group_id"). + Join("LEFT", "permission", "permission_group_permission.permission_id = permission.id"). + FindAndCount(&list) + return +} + +func (a AdminDb) FindAdmin(username string, state, page, limit int) (list []model.Admin, total int64, err error) { + sess := a.Db.Desc("adm_id").Limit(limit, (page-1)*limit) + if username != "" { + sess.And("username like ?", "%"+username+"%") + } + if state != 0 { + sess.And("state = ?", state) + } + total, err = sess.FindAndCount(&list) + if err != nil { + return nil, 0, err + } + return +} + +func (a AdminDb) UpdateAdmin(m *model.Admin, columns ...string) (int64, error) { + affected, err := a.Db.Where("adm_id =?", m.AdmId).Cols(columns...).Update(m) + if err != nil { + return 0, err + } + return affected, nil +} + +func (a AdminDb) AdminInsert(m *model.Admin) (int64, error) { + insertAffected, err := a.Db.InsertOne(m) + if err != nil { + return 0, err + } + return insertAffected, nil +} + +func (a AdminDb) FindAdminRolePermissionGroup(admId int) (list []*dao.AdminRolePermissionGroup, total int64, err error) { + total, err = a.Db.Where("admin.adm_id =?", admId). + Join("LEFT", "admin_role", "admin.adm_id = admin_role.adm_id"). + Join("LEFT", "role", "admin_role.role_id = role.id"). + //Join("LEFT", "role_permission_group", "role.id = role_permission_group.role_id"). + //Join("LEFT", "permission_group", "role_permission_group.group_id = permission_group.id"). + FindAndCount(&list) + return +} diff --git a/app/db/super/implement/admin_role_implement.go b/app/db/super/implement/admin_role_implement.go new file mode 100644 index 0000000..d189b2f --- /dev/null +++ b/app/db/super/implement/admin_role_implement.go @@ -0,0 +1,77 @@ +package implement + +import ( + "applet/app/db/dao" + "applet/app/db/model" + "applet/app/utils/logx" + "reflect" + "xorm.io/xorm" +) + +func NewAdminRoleDb(engine *xorm.Engine) dao.AdminRoleDao { + return &AdminRoleDb{Db: engine} +} + +type AdminRoleDb struct { + Db *xorm.Engine +} + +func (a AdminRoleDb) FindAdminRole(id int) (*[]model.AdminRole, error) { + var m []model.AdminRole + if err := a.Db.Where("adm_id =?", id).Find(&m); err != nil { + return nil, logx.Error(err) + } + return &m, nil +} + +func (a AdminRoleDb) FindAdminRoleByRoleId(id int) (*[]model.AdminRole, error) { + var m []model.AdminRole + if err := a.Db.Where("role_id =?", id).Find(&m); err != nil { + return nil, logx.Error(err) + } + return &m, nil +} + +func (a AdminRoleDb) AdminDeleteBySessionForAdmId(session *xorm.Session, admId interface{}) (int64, error) { + if reflect.TypeOf(admId).Kind() == reflect.Slice { + return session.In("adm_id", admId).Delete(model.AdminRole{}) + } else { + return session.Where("adm_id = ?", admId).Delete(model.AdminRole{}) + } +} + +func (a AdminRoleDb) GetAdminRoleByRole(id int) (m *model.AdminRole, err error) { + m = new(model.AdminRole) + has, err := a.Db.Where("role_id =?", id).Get(m) + if err != nil { + return nil, logx.Error(err) + } + if has == false { + return nil, nil + } + return m, nil +} + +func (a AdminRoleDb) AdminRoleDeleteForRoleBySession(session *xorm.Session, roleId interface{}) (int64, error) { + if reflect.TypeOf(roleId).Kind() == reflect.Slice { + return session.In("role_id", roleId).Delete(model.AdminRole{}) + } else { + return session.Where("role_id = ?", roleId).Delete(model.AdminRole{}) + } +} + +func (a AdminRoleDb) AdminRoleDeleteBySession(session *xorm.Session, id interface{}) (int64, error) { + if reflect.TypeOf(id).Kind() == reflect.Slice { + return session.In("adm_id", id).Delete(model.AdminRole{}) + } else { + return session.Where("adm_id = ?", id).Delete(model.AdminRole{}) + } +} + +func (a AdminRoleDb) BatchAddAdminRoleBySession(session *xorm.Session, mm []*model.AdminRole) (int64, error) { + affected, err := session.Insert(mm) + if err != nil { + return 0, err + } + return affected, nil +} diff --git a/app/db/super/implement/agent_list_implement.go b/app/db/super/implement/agent_list_implement.go new file mode 100644 index 0000000..e46b95c --- /dev/null +++ b/app/db/super/implement/agent_list_implement.go @@ -0,0 +1,44 @@ +package implement + +import ( + "applet/app/db/super/dao" + "applet/app/db/super/model" + "applet/app/utils/logx" + "xorm.io/xorm" +) + +func NewAgentListDb(engine *xorm.Engine) dao.AgentListDao { + return &AgentListDb{Db: engine} +} + +type AgentListDb struct { + Db *xorm.Engine +} + +func (a AgentListDb) GetAgentList(agentId int) (medium *model.AgentList, err error) { + medium = new(model.AgentList) + has, err := a.Db.Where("agent_id =?", agentId).Get(medium) + if err != nil { + return nil, logx.Error(err) + } + if has == false { + return nil, nil + } + return medium, nil +} + +func (a AgentListDb) AgentListInsert(m *model.AgentList) (int64, error) { + insertAffected, err := a.Db.InsertOne(m) + if err != nil { + return 0, err + } + return insertAffected, nil +} + +func (a AgentListDb) UpdateAgentList(m *model.AgentList, columns ...string) (int64, error) { + affected, err := a.Db.Where("agent_id =?", m.Id).Cols(columns...).Update(m) + if err != nil { + return 0, err + } + return affected, nil +} diff --git a/app/db/super/implement/medium_list_implement.go b/app/db/super/implement/medium_list_implement.go index b9eab0d..33c6ff2 100644 --- a/app/db/super/implement/medium_list_implement.go +++ b/app/db/super/implement/medium_list_implement.go @@ -2,6 +2,8 @@ import ( "applet/app/db/super/dao" + "applet/app/db/super/model" + "applet/app/utils/logx" "xorm.io/xorm" ) @@ -12,3 +14,31 @@ func NewMediumListDb(engine *xorm.Engine) dao.MediumListDao { type MediumListDb struct { Db *xorm.Engine } + +func (m MediumListDb) GetMediumList(mediumId int) (medium *model.MediumList, err error) { + medium = new(model.MediumList) + has, err := m.Db.Where("medium_id =?", mediumId).Get(medium) + if err != nil { + return nil, logx.Error(err) + } + if has == false { + return nil, nil + } + return medium, nil +} + +func (m MediumListDb) MediumListInsert(medium *model.MediumList) (int64, error) { + insertAffected, err := m.Db.InsertOne(medium) + if err != nil { + return 0, err + } + return insertAffected, nil +} + +func (m MediumListDb) UpdateMediumList(medium *model.MediumList, columns ...string) (int64, error) { + affected, err := m.Db.Where("medium_id =?", medium.Id).Cols(columns...).Update(m) + if err != nil { + return 0, err + } + return affected, nil +} diff --git a/app/db/super/implement/permission_group_implement.go b/app/db/super/implement/permission_group_implement.go new file mode 100644 index 0000000..b1126d1 --- /dev/null +++ b/app/db/super/implement/permission_group_implement.go @@ -0,0 +1,33 @@ +package implement + +import ( + "applet/app/db/dao" + "applet/app/db/model" + "applet/app/enum" + "applet/app/utils/logx" + "xorm.io/xorm" +) + +func NewPermissionGroupDb(engine *xorm.Engine) dao.PermissionGroupDao { + return &PermissionGroupDb{Db: engine} +} + +type PermissionGroupDb struct { + Db *xorm.Engine +} + +func (p PermissionGroupDb) FindPermissionGroup() (*[]model.PermissionGroup, error) { + var m []model.PermissionGroup + if err := p.Db.Where("state = ?", enum.PermissionGroupStateForNormal).Asc("id").Find(&m); err != nil { + return nil, logx.Error(err) + } + return &m, nil +} + +func (p PermissionGroupDb) FindPermissionGroupV2() (*[]model.PermissionGroup, error) { + var m []model.PermissionGroup + if err := p.Db.Asc("id").Find(&m); err != nil { + return nil, logx.Error(err) + } + return &m, nil +} diff --git a/app/db/super/implement/permission_group_permission_implement.go b/app/db/super/implement/permission_group_permission_implement.go new file mode 100644 index 0000000..1bd1f48 --- /dev/null +++ b/app/db/super/implement/permission_group_permission_implement.go @@ -0,0 +1,14 @@ +package implement + +import ( + "applet/app/db/dao" + "xorm.io/xorm" +) + +type PermissionGroupPermissionDb struct { + Db *xorm.Engine +} + +func NewPermissionGroupPermissionDb(engine *xorm.Engine) dao.PermissionGroupPermissionDao { + return &PermissionGroupPermissionDb{Db: engine} +} diff --git a/app/db/super/implement/permission_implement.go b/app/db/super/implement/permission_implement.go new file mode 100644 index 0000000..0cfad56 --- /dev/null +++ b/app/db/super/implement/permission_implement.go @@ -0,0 +1,14 @@ +package implement + +import ( + "applet/app/db/dao" + "xorm.io/xorm" +) + +type PermissionDb struct { + Db *xorm.Engine +} + +func NewPermissionDb(engine *xorm.Engine) dao.PermissionDao { + return &PermissionDb{Db: engine} +} diff --git a/app/db/super/implement/role_implement.go b/app/db/super/implement/role_implement.go new file mode 100644 index 0000000..8dd9020 --- /dev/null +++ b/app/db/super/implement/role_implement.go @@ -0,0 +1,73 @@ +package implement + +import ( + "applet/app/db/dao" + "applet/app/db/model" + "applet/app/utils/logx" + "reflect" + "xorm.io/xorm" +) + +func NewRoleDb(engine *xorm.Engine, id int) dao.RoleDao { + return &RoleDb{ + Db: engine, + Id: id, + } +} + +type RoleDb struct { + Db *xorm.Engine + Id int `json:"id"` +} + +func (r RoleDb) FindRole() (*[]model.Role, error) { + var m []model.Role + if err := r.Db.Desc("id").Find(&m); err != nil { + return nil, logx.Error(err) + } + return &m, nil +} + +func (r RoleDb) GetRole() (m *model.Role, err error) { + m = new(model.Role) + has, err := r.Db.Where("id = ?", r.Id).Get(m) + if err != nil { + return nil, logx.Error(err) + } + if has == false { + return nil, nil + } + return m, nil +} + +func (r RoleDb) UpdateRole(m *model.Role, columns ...string) (int64, error) { + affected, err := r.Db.Where("id =?", m.Id).Cols(columns...).Update(m) + if err != nil { + return 0, err + } + return affected, nil +} + +func (r RoleDb) RoleDeleteBySession(session *xorm.Session, id interface{}) (int64, error) { + if reflect.TypeOf(id).Kind() == reflect.Slice { + return session.In("id", id).Delete(model.Role{}) + } else { + return session.Where("id = ?", id).Delete(model.Role{}) + } +} + +func (r RoleDb) RoleInsert(m *model.Role) (int, error) { + _, err := r.Db.InsertOne(m) + if err != nil { + return 0, err + } + return m.Id, nil +} + +func (r RoleDb) FindPermissionGroupByRole(roleId int) (list []*dao.RolePermissionGroup, total int64, err error) { + total, err = r.Db.Where("role.id =?", roleId). + Join("LEFT", "role_permission_group", "role_permission_group.role_id = role.id"). + Join("LEFT", "permission_group", "permission_group.id = role_permission_group.group_id"). + FindAndCount(&list) + return +} diff --git a/app/db/super/implement/role_permission_group_implement.go b/app/db/super/implement/role_permission_group_implement.go new file mode 100644 index 0000000..b9aeb70 --- /dev/null +++ b/app/db/super/implement/role_permission_group_implement.go @@ -0,0 +1,32 @@ +package implement + +import ( + "applet/app/db/dao" + "applet/app/db/model" + "reflect" + "xorm.io/xorm" +) + +func NewRolePermissionGroupDb(engine *xorm.Engine) dao.RolePermissionGroupDao { + return &RolePermissionGroupDb{Db: engine} +} + +type RolePermissionGroupDb struct { + Db *xorm.Engine +} + +func (r RolePermissionGroupDb) RolePermissionGroupDeleteForRoleBySession(session *xorm.Session, roleId interface{}) (int64, error) { + if reflect.TypeOf(roleId).Kind() == reflect.Slice { + return session.In("role_id", roleId).Delete(model.RolePermissionGroup{}) + } else { + return session.Where("role_id = ?", roleId).Delete(model.RolePermissionGroup{}) + } +} + +func (r RolePermissionGroupDb) BatchAddRolePermissionGroupBySession(session *xorm.Session, mm []*model.RolePermissionGroup) (int64, error) { + affected, err := session.Insert(mm) + if err != nil { + return 0, err + } + return affected, nil +} diff --git a/app/db/super/model/admin.go b/app/db/super/model/admin.go new file mode 100644 index 0000000..125ae65 --- /dev/null +++ b/app/db/super/model/admin.go @@ -0,0 +1,12 @@ +package model + +type Admin struct { + AdmId int `json:"adm_id" xorm:"not null comment('管理员id') INT(11)"` + Username string `json:"username" xorm:"not null default '' comment('用户名') VARCHAR(255)"` + Password string `json:"password" xorm:"not null default '' comment('密码') VARCHAR(255)"` + State int `json:"state" xorm:"not null default 1 comment('状态(1:正常 2:冻结)') TINYINT(1)"` + IsSuperAdministrator int `json:"is_super_administrator" xorm:"not null default 0 comment('是否为超级管理员(0:否 1:是)') 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/db/super/model/admin_role.go b/app/db/super/model/admin_role.go new file mode 100644 index 0000000..5a35baa --- /dev/null +++ b/app/db/super/model/admin_role.go @@ -0,0 +1,10 @@ +package model + +type AdminRole struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + AdmId int `json:"adm_id" xorm:"not null default 0 comment('管理员id') INT(11)"` + RoleId int `json:"role_id" xorm:"not null default 0 comment('角色id') INT(11)"` + State int `json:"state" xorm:"not null default 1 comment('状态(1:正常 2:冻结)') TINYINT(1)"` + 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/super/model/agent_list.go b/app/db/super/model/agent_list.go new file mode 100644 index 0000000..3c2debf --- /dev/null +++ b/app/db/super/model/agent_list.go @@ -0,0 +1,25 @@ +package model + +type AgentList struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + Uuid int `json:"uuid" xorm:"not null comment('站长id') index unique(IDX_UUID_TYPE) INT(11)"` + AgentId int `json:"agent_id" xorm:"not null comment('代理id') unique(IDX_UUID_TYPE) INT(11)"` + Kind int `json:"kind" xorm:"not null default 1 comment('类型(1:企业 2:个人)') TINYINT(1)"` + CompanyName string `json:"company_name" xorm:"not null default '' comment('公司名称') VARCHAR(255)"` + CompanyAbbreviation string `json:"company_abbreviation" xorm:"not null default '' comment('公司简称') VARCHAR(255)"` + UnifiedSocialCreditCode string `json:"unified_social_credit_code" xorm:"not null default '' comment('统一社会信用代码') VARCHAR(255)"` + CertificateType int `json:"certificate_type" xorm:"not null default 1 comment('证件类型') TINYINT(1)"` + BusinessLicenseImgUrl string `json:"business_license_img_url" xorm:"not null default '' comment('营业执照照片') VARCHAR(255)"` + LegalRepresentative string `json:"legal_representative" xorm:"not null default '' comment('法定代表人') CHAR(50)"` + CountryRegionId int `json:"country_region_id" xorm:"not null default 1 comment('国家地区id') TINYINT(3)"` + CountryRegion string `json:"country_region" xorm:"not null default '' comment('国家地区') CHAR(50)"` + RegisteredAddressProvinceId int `json:"registered_address_province_id" xorm:"not null default 0 comment('注册地址-省份id') INT(11)"` + RegisteredAddressCityId int `json:"registered_address_city_id" xorm:"not null default 0 comment('注册地址-市id') INT(11)"` + RegisteredAddressCountyId int `json:"registered_address_county_id" xorm:"not null default 0 comment('注册地址-县/区id') INT(11)"` + RegisteredAddress string `json:"registered_address" xorm:"not null default '' comment('注册地址') VARCHAR(255)"` + BusinessLicenseAddress string `json:"business_license_address" xorm:"not null default '' comment('营业执照地址') VARCHAR(255)"` + CertificateValidity string `json:"certificate_validity" xorm:"not null default '0000-00-00' comment('证件有效期') CHAR(50)"` + State int `json:"state" xorm:"not null default 0 comment('状态(0:待审核 1:审核通过 2:审核拒绝)') TINYINT(1)"` + 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/super/model/permission.go b/app/db/super/model/permission.go new file mode 100644 index 0000000..82e00e2 --- /dev/null +++ b/app/db/super/model/permission.go @@ -0,0 +1,10 @@ +package model + +type Permission struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + Name string `json:"name" xorm:"not null default '' comment('名称') VARCHAR(255)"` + Action string `json:"action" xorm:"not null default '' comment('路由') unique VARCHAR(255)"` + State int `json:"state" xorm:"not null default 1 comment('状态(1:正常 2:废弃)') TINYINT(1)"` + 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/super/model/permission_group.go b/app/db/super/model/permission_group.go new file mode 100644 index 0000000..ac927e3 --- /dev/null +++ b/app/db/super/model/permission_group.go @@ -0,0 +1,11 @@ +package model + +type PermissionGroup struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + ParentId int `json:"parent_id" xorm:"not null default 0 comment('父级id') INT(11)"` + Key string `json:"key" xorm:"not null default '' VARCHAR(255)"` + Name string `json:"name" xorm:"not null default '' comment('名称') VARCHAR(255)"` + State int `json:"state" xorm:"not null default 1 comment('状态(1:正常 2:废弃)') TINYINT(1)"` + 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/super/model/permission_group_permission.go b/app/db/super/model/permission_group_permission.go new file mode 100644 index 0000000..7d1bad7 --- /dev/null +++ b/app/db/super/model/permission_group_permission.go @@ -0,0 +1,9 @@ +package model + +type PermissionGroupPermission struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + GroupId int `json:"group_id" xorm:"not null default 0 comment('权限组id') INT(11)"` + PermissionId int `json:"permission_id" xorm:"not null default 0 comment('权限id') 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/super/model/role.go b/app/db/super/model/role.go new file mode 100644 index 0000000..4b46b20 --- /dev/null +++ b/app/db/super/model/role.go @@ -0,0 +1,10 @@ +package model + +type Role struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + Name string `json:"name" xorm:"not null default '' comment('名称') VARCHAR(255)"` + State int `json:"state" xorm:"not null default 1 comment('状态(1:正常 2:冻结)') TINYINT(1)"` + Memo string `json:"memo" xorm:"not null default '' comment('备注') VARCHAR(255)"` + 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/super/model/role_permission_group.go b/app/db/super/model/role_permission_group.go new file mode 100644 index 0000000..b9d04a1 --- /dev/null +++ b/app/db/super/model/role_permission_group.go @@ -0,0 +1,9 @@ +package model + +type RolePermissionGroup struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + RoleId int `json:"role_id" xorm:"not null default 0 comment('角色id') INT(11)"` + GroupId int `json:"group_id" xorm:"not null default 0 comment('权限组id') 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/hdl/hdl_login.go b/app/hdl/hdl_login.go index cd33878..e1a01b4 100644 --- a/app/hdl/hdl_login.go +++ b/app/hdl/hdl_login.go @@ -2,7 +2,7 @@ package hdl import ( "applet/app/db" - "applet/app/db/implement" + "applet/app/db/super/implement" "applet/app/e" "applet/app/lib/validate" "applet/app/md" @@ -14,13 +14,13 @@ import ( // Login 登陆 // @Summary 登陆 -// @Tags ADMIN +// @Tags 登录注册 // @Description 登入 // @Accept json // @Produce json -// @Param req body md2.LoginReq true "用户名密码" -// @Success 200 {object} md2.LoginResponse "token" -// @Failure 400 {object} md2.Response "具体错误" +// @Param req body md.LoginReq true "用户名密码" +// @Success 200 {object} md.LoginResponse "token" +// @Failure 400 {object} md.Response "具体错误" // @Router /admin/login [post] func Login(c *gin.Context) { var req md.LoginReq @@ -31,7 +31,7 @@ func Login(c *gin.Context) { e.OutErr(c, err1.Code, err1.Error()) return } - engine := db.DBs[svc.GetMasterId(c)] + engine := db.Db adminDb := implement.NewAdminDb(engine) admin, err := adminDb.GetAdminByUserName(req.UserName) if err != nil { diff --git a/app/hdl/hdl_role.go b/app/hdl/hdl_role.go index 2dc9add..805e1be 100644 --- a/app/hdl/hdl_role.go +++ b/app/hdl/hdl_role.go @@ -16,15 +16,15 @@ import ( // PermissionGroupList // @Summary 权限组列表 -// @Tags ADMIN-权限管理 -// @Description 权限组列表 +// @Tags 权限管理 +// @Description 权限管理-权限组列表 // @param Authorization header string true "验证参数Bearer和token空格拼接" // @Accept json // @Produce json // @param adm_id query string true "管理员id" // @Success 200 {string} "具体看返回内容" // @Failure 400 {object} md.Response "具体错误" -// @Router /admin/role/permissionGroupList [GET] +// @Router /role/permissionGroupList [GET] func PermissionGroupList(c *gin.Context) { roleId := c.DefaultQuery("role_id", "") engine := db.DBs[svc.GetMasterId(c)] @@ -101,14 +101,14 @@ func PermissionGroupList(c *gin.Context) { // RoleList // @Summary 角色列表 -// @Tags ADMIN-权限管理 -// @Description 角色列表 +// @Tags 权限管理 +// @Description 权限管理-角色列表 // @param Authorization header string true "验证参数Bearer和token空格拼接" // @Accept json // @Produce json // @Success 200 {string} "具体看返回内容" // @Failure 400 {object} md.Response "具体错误" -// @Router /admin/role/roleList [GET] +// @Router /role/roleList [GET] func RoleList(c *gin.Context) { engine := db.DBs[svc.GetMasterId(c)] roleDb := implement.NewRoleDb(engine, 0) @@ -161,15 +161,15 @@ func RoleList(c *gin.Context) { // AddRole // @Summary 添加角色 -// @Tags ADMIN-权限管理 -// @Description 添加角色 +// @Tags 权限管理 +// @Description 权限管理-添加角色 // @param Authorization header string true "验证参数Bearer和token空格拼接" // @Accept json // @Produce json // @Param args body md.AddRoleReq true "请求参数" // @Success 200 {string} "success" // @Failure 400 {object} md.Response "具体错误" -// @Router /admin/role/addRole [POST] +// @Router /role/addRole [POST] func AddRole(c *gin.Context) { var req md.AddRoleReq err := c.ShouldBindJSON(&req) @@ -200,15 +200,15 @@ func AddRole(c *gin.Context) { // UpdateRole // @Summary 修改角色 -// @Tags ADMIN-权限管理 -// @Description 修改角色 +// @Tags 权限管理 +// @Description 权限管理-修改角色 // @param Authorization header string true "验证参数Bearer和token空格拼接" // @Accept json // @Produce json // @Param args body md.UpdateRoleReq true "请求参数" // @Success 200 {string} "success" // @Failure 400 {object} md.Response "具体错误" -// @Router /admin/role/updateRole [POST] +// @Router /role/updateRole [POST] func UpdateRole(c *gin.Context) { var req md.UpdateRoleReq err := c.ShouldBindJSON(&req) @@ -242,15 +242,15 @@ func UpdateRole(c *gin.Context) { // RoleBindPermissionGroup // @Summary 角色绑定权限组 -// @Tags ADMIN-权限管理 -// @Description 角色绑定权限组 +// @Tags 权限管理 +// @Description 权限管理-角色绑定权限组 // @param Authorization header string true "验证参数Bearer和token空格拼接" // @Accept json // @Produce json // @Param args body md.RoleBindPermissionGroupReq true "请求参数" // @Success 200 {string} "success" // @Failure 400 {object} md.Response "具体错误" -// @Router /admin/role/roleBindPermissionGroup [POST] +// @Router /role/roleBindPermissionGroup [POST] func RoleBindPermissionGroup(c *gin.Context) { var req md.RoleBindPermissionGroupReq err := c.ShouldBindJSON(&req) @@ -272,15 +272,15 @@ func RoleBindPermissionGroup(c *gin.Context) { // UpdateRoleState // @Summary 修改角色状态 -// @Tags ADMIN-权限管理 -// @Description 修改角色状态 +// @Tags 权限管理 +// @Description 权限管理-修改角色状态 // @param Authorization header string true "验证参数Bearer和token空格拼接" // @Accept json // @Produce json // @Param args body md.UpdateRoleStateReq true "请求参数" // @Success 200 {string} "success" // @Failure 400 {object} md.Response "具体错误" -// @Router /admin/role/updateRole [POST] +// @Router /role/updateRole [POST] func UpdateRoleState(c *gin.Context) { var req md.UpdateRoleStateReq err := c.ShouldBindJSON(&req) @@ -313,15 +313,15 @@ func UpdateRoleState(c *gin.Context) { // DeleteRole // @Summary 删除角色 -// @Tags ADMIN-权限管理 -// @Description 删除角色 +// @Tags 权限管理 +// @Description 权限管理-删除角色 // @param Authorization header string true "验证参数Bearer和token空格拼接" // @Accept json // @Produce json // @Param args body md.UpdateRoleStateReq true "请求参数" // @Success 200 {string} "success" // @Failure 400 {object} md.Response "具体错误" -// @Router /admin/role/deleteRole/{$id} [DELETE] +// @Router /role/deleteRole/{$id} [DELETE] func DeleteRole(c *gin.Context) { id := c.Param("id") engine := db.DBs[svc.GetMasterId(c)] @@ -348,15 +348,15 @@ func DeleteRole(c *gin.Context) { // AdminList // @Summary 管理员列表 -// @Tags ADMIN-权限管理 -// @Description 管理员列表 +// @Tags 权限管理 +// @Description 权限管理-管理员列表 // @param Authorization header string true "验证参数Bearer和token空格拼接" // @Accept json // @Produce json // @Param args body md.AdminListReq true "请求参数" // @Success 200 {string} "具体看返回内容" // @Failure 400 {object} md.Response "具体错误" -// @Router /admin/role/adminList [POST] +// @Router /role/adminList [POST] func AdminList(c *gin.Context) { var req md.AdminListReq err := c.ShouldBindJSON(&req) @@ -422,15 +422,15 @@ func AdminList(c *gin.Context) { // UpdateAdminState // @Summary 修改管理员状态 -// @Tags ADMIN-权限管理 -// @Description 修改管理员状态 +// @Tags 权限管理 +// @Description 权限管理-修改管理员状态 // @param Authorization header string true "验证参数Bearer和token空格拼接" // @Accept json // @Produce json // @Param args body md.UpdateAdminStateReq true "请求参数" // @Success 200 {string} "success" // @Failure 400 {object} md.Response "具体错误" -// @Router /admin/role/updateAdminState [POST] +// @Router /role/updateAdminState [POST] func UpdateAdminState(c *gin.Context) { var req md.UpdateAdminStateReq err := c.ShouldBindJSON(&req) @@ -464,15 +464,15 @@ func UpdateAdminState(c *gin.Context) { // UpdateAdmin // @Summary 修改管理员信息 -// @Tags ADMIN-权限管理 -// @Description 修改管理员信息 +// @Tags 权限管理 +// @Description 权限管理-修改管理员信息 // @param Authorization header string true "验证参数Bearer和token空格拼接" // @Accept json // @Produce json // @Param args body md.UpdateAdminReq true "请求参数" // @Success 200 {string} "success" // @Failure 400 {object} md.Response "具体错误" -// @Router /admin/role/updateAdmin [POST] +// @Router /role/updateAdmin [POST] func UpdateAdmin(c *gin.Context) { var req md.UpdateAdminReq err := c.ShouldBindJSON(&req) @@ -507,15 +507,15 @@ func UpdateAdmin(c *gin.Context) { // AddAdmin // @Summary 新增管理员 -// @Tags ADMIN-权限管理 -// @Description 新增管理员 +// @Tags 权限管理 +// @Description 权限管理-新增管理员 // @param Authorization header string true "验证参数Bearer和token空格拼接" // @Accept json // @Produce json // @Param args body md.AddAdminReq true "请求参数" // @Success 200 {string} "success" // @Failure 400 {object} md.Response "具体错误" -// @Router /admin/role/addAdmin [POST] +// @Router /role/addAdmin [POST] func AddAdmin(c *gin.Context) { var req md.AddAdminReq err := c.ShouldBindJSON(&req) @@ -563,14 +563,14 @@ func AddAdmin(c *gin.Context) { // DeleteAdmin // @Summary 删除管理员 -// @Tags ADMIN-权限管理 -// @Description 删除管理员 +// @Tags 权限管理 +// @Description 权限管理-删除管理员 // @param Authorization header string true "验证参数Bearer和token空格拼接" // @Accept json // @Produce json // @Success 200 {string} "success" // @Failure 400 {object} md.Response "具体错误" -// @Router /admin/role/deleteAdmin/{$adm_id} [DELETE] +// @Router /role/deleteAdmin/{$adm_id} [DELETE] func DeleteAdmin(c *gin.Context) { admId := c.Param("adm_id") err := svc.AdminDelete(c, []int{utils.StrToInt(admId)}) @@ -584,15 +584,15 @@ func DeleteAdmin(c *gin.Context) { // BindAdminRole // @Summary 管理员绑定角色 -// @Tags ADMIN-权限管理 -// @Description 管理员绑定角色 +// @Tags 权限管理 +// @Description 权限管理-管理员绑定角色 // @param Authorization header string true "验证参数Bearer和token空格拼接" // @Accept json // @Produce json // @Param args body md.BindAdminRoleReq true "请求参数" // @Success 200 {string} "success" // @Failure 400 {object} md.Response "具体错误" -// @Router /admin/role/bindAdminRole/ [POST] +// @Router /role/bindAdminRole/ [POST] func BindAdminRole(c *gin.Context) { var req md.BindAdminRoleReq err := c.ShouldBindJSON(&req) @@ -613,15 +613,15 @@ func BindAdminRole(c *gin.Context) { // AdminInfo // @Summary 管理员信息 -// @Tags ADMIN-权限管理 -// @Description 管理员信息 +// @Tags 权限管理 +// @Description 权限管理-管理员信息 // @param Authorization header string true "验证参数Bearer和token空格拼接" // @Accept json // @Produce json // @param adm_id query string true "管理员id" // @Success 200 {string} "具体看返回内容" // @Failure 400 {object} md.Response "具体错误" -// @Router /admin/role/adminInfo [GET] +// @Router /role/adminInfo [GET] func AdminInfo(c *gin.Context) { admId := c.DefaultQuery("adm_id", "") engine := db.DBs[svc.GetMasterId(c)] diff --git a/app/md/md_api_response.go b/app/md/md_api_response.go new file mode 100644 index 0000000..9460e3b --- /dev/null +++ b/app/md/md_api_response.go @@ -0,0 +1,7 @@ +package md + +type Response struct { + Code string `json:"code" example:"响应码"` + Data interface{} `json:"data" ` //内容 + Msg string `json:"msg" example:"具体错误原因"` +} diff --git a/app/router/router.go b/app/router/router.go index 34ea96c..e3c7689 100644 --- a/app/router/router.go +++ b/app/router/router.go @@ -6,6 +6,8 @@ import ( "applet/app/mw" _ "applet/docs" "github.com/gin-gonic/gin" + swaggerFiles "github.com/swaggo/files" + ginSwagger "github.com/swaggo/gin-swagger" ) // 初始化路由 @@ -18,6 +20,11 @@ func Init() *gin.Engine { gin.SetMode(mode) //创建一个新的启动器 r := gin.New() + r.GET("/api/swagger/*any", func(c *gin.Context) { + //r.Use(mw.SwagAuth()) + ginSwagger.DisablingWrapHandler(swaggerFiles.Handler, "SWAGGER")(c) + }) + r.Use(mw.ChangeHeader) // 是否打印访问日志, 在非正式环境都打印 diff --git a/docs/docs.go b/docs/docs.go index 3e7d945..4e0edb9 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -1,35 +1,33 @@ -// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// This file was generated by swaggo/swag +// Code generated by swaggo/swag. DO NOT EDIT. package docs -import ( - "bytes" - "encoding/json" - "strings" +import "github.com/swaggo/swag" - "github.com/alecthomas/template" - "github.com/swaggo/swag" -) - -var doc = `{ +const docTemplate = `{ "schemes": {{ marshal .Schemes }}, "swagger": "2.0", "info": { - "description": "{{.Description}}", + "description": "{{escape .Description}}", "title": "{{.Title}}", - "termsOfService": "智莺生活后端组", + "termsOfService": "http://swagger.io/terms/", "contact": { - "name": "sherlockwhite" + "name": "dengbiao", + "url": "http://www.swagger.io/support", + "email": "1239118001@qq.com" + }, + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.html" }, "version": "{{.Version}}" }, "host": "{{.Host}}", "basePath": "{{.BasePath}}", "paths": { - "/api/v1/acq/fix": { - "get": { - "description": "拉新活动--fix", + "/admin/login": { + "post": { + "description": "登入", "consumes": [ "application/json" ], @@ -37,68 +35,39 @@ var doc = `{ "application/json" ], "tags": [ - "拉新活动" + "登录注册" ], - "summary": "拉新活动--fix", - "responses": { - "200": { - "description": "ok", + "summary": "登陆", + "parameters": [ + { + "description": "用户名密码", + "name": "req", + "in": "body", + "required": true, "schema": { - "type": "string" + "$ref": "#/definitions/md.LoginReq" } } - } - } - }, - "/api/v1/acquisition/home": { - "post": { - "description": "本期榜单/上期榜单/我的邀请人数和奖励/任务列表", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "拉新活动" ], - "summary": "拉新--首页数据", "responses": { "200": { - "description": "ok", + "description": "token", "schema": { - "type": "string" + "$ref": "#/definitions/md.LoginResponse" } - } - } - } - }, - "/api/v1/acquisition/qrcode": { - "get": { - "description": "二维码", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "拉新活动" - ], - "summary": "拉新--邀请二维码", - "responses": { - "200": { - "description": "ok", + }, + "400": { + "description": "具体错误", "schema": { - "type": "string" + "$ref": "#/definitions/md.Response" } } } } }, - "/api/v1/acquisition/reward/detail": { + "/role/addAdmin": { "post": { - "description": "拉新活动--我的奖励明细", + "description": "权限管理-新增管理员", "consumes": [ "application/json" ], @@ -106,33 +75,46 @@ var doc = `{ "application/json" ], "tags": [ - "拉新活动" + "权限管理" ], - "summary": "拉新活动--我的奖励明细", + "summary": "新增管理员", "parameters": [ { - "description": "1为以发放,2为待发放,3为失效", - "name": "state", + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "请求参数", + "name": "args", "in": "body", "required": true, "schema": { - "type": "string" + "$ref": "#/definitions/md.AddAdminReq" } } ], "responses": { "200": { - "description": "ok", + "description": "success", "schema": { "type": "string" } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } } } } }, - "/api/v1/acquisition/reward_receive": { + "/role/addRole": { "post": { - "description": "拉新活动--领取奖励", + "description": "权限管理-添加角色", "consumes": [ "application/json" ], @@ -140,33 +122,46 @@ var doc = `{ "application/json" ], "tags": [ - "拉新活动" + "权限管理" ], - "summary": "拉新活动--领取奖励", + "summary": "添加角色", "parameters": [ { - "description": "任务ID", - "name": "job_id", + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "请求参数", + "name": "args", "in": "body", "required": true, "schema": { - "type": "string" + "$ref": "#/definitions/md.AddRoleReq" } } ], "responses": { "200": { - "description": "ok", + "description": "success", "schema": { "type": "string" } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } } } } }, - "/api/v1/credit/card/config": { + "/role/adminInfo": { "get": { - "description": "获取信用卡配置", + "description": "权限管理-管理员信息", "consumes": [ "application/json" ], @@ -174,22 +169,44 @@ var doc = `{ "application/json" ], "tags": [ - "信用卡" + "权限管理" + ], + "summary": "管理员信息", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "type": "string", + "description": "管理员id", + "name": "adm_id", + "in": "query", + "required": true + } ], - "summary": "获取信用卡配置", "responses": { "200": { - "description": "ok", + "description": "具体看返回内容", "schema": { "type": "string" } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } } } } }, - "/api/v1/duomai/mall/detail": { + "/role/adminList": { "post": { - "description": "多麦商城--商城详情", + "description": "权限管理-管理员列表", "consumes": [ "application/json" ], @@ -197,56 +214,46 @@ var doc = `{ "application/json" ], "tags": [ - "多麦商城" + "权限管理" ], - "summary": "多麦商城--商城详情", + "summary": "管理员列表", "parameters": [ { - "description": "商城id", - "name": "brand_id", + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "请求参数", + "name": "args", "in": "body", "required": true, "schema": { - "type": "string" + "$ref": "#/definitions/md.AdminListReq" } } ], "responses": { "200": { - "description": "ok", + "description": "具体看返回内容", "schema": { "type": "string" } - } - } - } - }, - "/api/v1/duomai/mall/home": { - "get": { - "description": "多麦商城--首页数据", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "多麦商城" - ], - "summary": "多麦商城--首页数据", - "responses": { - "200": { - "description": "ok", + }, + "400": { + "description": "具体错误", "schema": { - "type": "string" + "$ref": "#/definitions/md.Response" } } } } }, - "/api/v1/duomai/mall/search": { + "/role/bindAdminRole/": { "post": { - "description": "多麦商城--搜索", + "description": "权限管理-管理员绑定角色", "consumes": [ "application/json" ], @@ -254,33 +261,46 @@ var doc = `{ "application/json" ], "tags": [ - "多麦商城" + "权限管理" ], - "summary": "多麦商城--搜索", + "summary": "管理员绑定角色", "parameters": [ { - "description": "搜索关键词", - "name": "key", + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "请求参数", + "name": "args", "in": "body", "required": true, "schema": { - "type": "string" + "$ref": "#/definitions/md.BindAdminRoleReq" } } ], "responses": { "200": { - "description": "ok", + "description": "success", "schema": { "type": "string" } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } } } } }, - "/api/v1/duomai/mall/update": { - "get": { - "description": "多麦商城--更新数据", + "/role/deleteAdmin/{$adm_id}": { + "delete": { + "description": "权限管理-删除管理员", "consumes": [ "application/json" ], @@ -288,21 +308,37 @@ var doc = `{ "application/json" ], "tags": [ - "多麦商城" + "权限管理" + ], + "summary": "删除管理员", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + } ], - "summary": "多麦商城--更新数据", "responses": { "200": { - "description": "ok", + "description": "success", "schema": { "type": "string" } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } } } } }, - "/api/v1/logistic/query": { - "post": { + "/role/deleteRole/{$id}": { + "delete": { + "description": "权限管理-删除角色", "consumes": [ "application/json" ], @@ -310,39 +346,46 @@ var doc = `{ "application/json" ], "tags": [ - "物流" + "权限管理" ], - "summary": "快递100物流查询", + "summary": "删除角色", "parameters": [ { - "description": "logisticQueryReq", - "name": "req", + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "请求参数", + "name": "args", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/hdl.logisticQueryReq" + "$ref": "#/definitions/md.UpdateRoleStateReq" } } ], "responses": { "200": { - "description": "ok", + "description": "success", "schema": { "type": "string" } }, "400": { - "description": "{\"code\":400000,\"data\":[],\"msg\":\"该快递公司不支持查询\"}", + "description": "具体错误", "schema": { - "type": "string" + "$ref": "#/definitions/md.Response" } } } } }, - "/api/v1/mod/pub.flutter.duomai.mall.detail.page": { + "/role/permissionGroupList": { "get": { - "description": "多麦商城详情页样式", + "description": "权限管理-权限组列表", "consumes": [ "application/json" ], @@ -350,68 +393,44 @@ var doc = `{ "application/json" ], "tags": [ - "多麦商城" + "权限管理" ], - "summary": "多麦商城详情页样式", - "responses": { - "200": { - "description": "ok", - "schema": { - "type": "string" - } + "summary": "权限组列表", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "type": "string", + "description": "管理员id", + "name": "adm_id", + "in": "query", + "required": true } - } - } - }, - "/api/v1/mod/pub.flutter.duomai.mall.home.page": { - "get": { - "description": "多麦商城首页样式", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "多麦商城" ], - "summary": "多麦商城首页样式", "responses": { "200": { - "description": "ok", + "description": "具体看返回内容", "schema": { "type": "string" } - } - } - } - }, - "/api/v1/mod/pub.flutter.duomai.mall.search.page": { - "get": { - "description": "多麦商城搜索页样式", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "多麦商城" - ], - "summary": "多麦商城搜索页样式", - "responses": { - "200": { - "description": "ok", + }, + "400": { + "description": "具体错误", "schema": { - "type": "string" + "$ref": "#/definitions/md.Response" } } } } }, - "/api/v1/privilege/card/activation": { + "/role/roleBindPermissionGroup": { "post": { - "description": "权益卡激活", + "description": "权限管理-角色绑定权限组", "consumes": [ "application/json" ], @@ -419,32 +438,46 @@ var doc = `{ "application/json" ], "tags": [ - "权益卡" + "权限管理" ], - "summary": "权益卡激活", + "summary": "角色绑定权限组", "parameters": [ { - "description": "json", - "name": "body", + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "请求参数", + "name": "args", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/hdl.privilegeOpenCardCheckReq" + "$ref": "#/definitions/md.RoleBindPermissionGroupReq" } } ], "responses": { "200": { - "description": "ok", + "description": "success", "schema": { "type": "string" } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } } } } }, - "/api/v1/privilege/open_card/check": { + "/role/roleList": { "get": { + "description": "权限管理-角色列表", "consumes": [ "application/json" ], @@ -452,136 +485,131 @@ var doc = `{ "application/json" ], "tags": [ - "权益卡" + "权限管理" ], - "summary": "权益卡卡号卡密检测", + "summary": "角色列表", "parameters": [ { - "description": "json", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/hdl.privilegeOpenCardCheckReq" - } + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true } ], "responses": { "200": { - "description": "0:不存在 1:已经被使用 2:可用", + "description": "具体看返回内容", "schema": { "type": "string" } - } - } - } - }, - "/api/v1/privilege/open_card/order_query": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "权益卡" - ], - "summary": "权益卡开卡订单查询页面", - "responses": { - "200": { - "description": "ok", - "schema": { - "$ref": "#/definitions/hdl.PrivilegeOpenCardOrdQueryPageResp" - } }, "400": { - "description": "{\"code\":400000,\"data\":[],\"msg\":\"验证码错误\"}", + "description": "具体错误", "schema": { - "type": "string" + "$ref": "#/definitions/md.Response" } } } - }, + } + }, + "/role/updateAdmin": { "post": { + "description": "权限管理-修改管理员信息", + "consumes": [ + "application/json" + ], "produces": [ "application/json" ], "tags": [ - "权益卡" + "权限管理" ], - "summary": "权益卡开卡订单查询", + "summary": "修改管理员信息", "parameters": [ { - "description": "json", - "name": "body", + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "请求参数", + "name": "args", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/hdl.PrivilegeOpenCardOrdQueryReq" + "$ref": "#/definitions/md.UpdateAdminReq" } } ], "responses": { "200": { - "description": "ok", + "description": "success", "schema": { - "$ref": "#/definitions/model.PrivilegeOpenCardOrd" + "type": "string" } }, "400": { - "description": "{\"code\":400000,\"data\":[],\"msg\":\"验证码错误\"}", + "description": "具体错误", "schema": { - "type": "string" + "$ref": "#/definitions/md.Response" } } } } }, - "/api/v1/privilege/open_card/order_suc": { - "get": { + "/role/updateAdminState": { + "post": { + "description": "权限管理-修改管理员状态", + "consumes": [ + "application/json" + ], "produces": [ "application/json" ], "tags": [ - "权益卡" + "权限管理" ], - "summary": "订单支付成功页面", - "responses": { - "200": { - "description": "ok", + "summary": "修改管理员状态", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "请求参数", + "name": "args", + "in": "body", + "required": true, "schema": { - "$ref": "#/definitions/model.PrivilegeOpenCardOrd" + "$ref": "#/definitions/md.UpdateAdminStateReq" } } - } - } - }, - "/api/v1/privilege/open_card/pay_page": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "权益卡" ], - "summary": "权益卡开卡支付页面", "responses": { "200": { - "description": "ok", + "description": "success", "schema": { - "$ref": "#/definitions/hdl.privilegeOpenCardPayPageResp" + "type": "string" } }, "400": { - "description": "{\"code\":400000,\"data\":[],\"msg\":\"权益卡配置缺失\"}", + "description": "具体错误", "schema": { - "type": "string" + "$ref": "#/definitions/md.Response" } } } } }, - "/api/v1/shake_ticket/:goods_id/:type": { - "get": { - "description": "收藏/领券买/分享赚", + "/role/updateRole": { + "post": { + "description": "权限管理-修改角色状态", "consumes": [ "application/json" ], @@ -589,687 +617,71 @@ var doc = `{ "application/json" ], "tags": [ - "抖券" + "权限管理" ], - "summary": "抖券商品收藏/领券买/分享赚", + "summary": "修改角色状态", "parameters": [ { "type": "string", - "description": "商品id", - "name": "goods_id", - "in": "path", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", "required": true }, { - "type": "string", - "description": "类型(0取消收藏,1收藏,2点击 领券买,3点击分享赚)", - "name": "type", - "in": "path", - "required": true + "description": "请求参数", + "name": "args", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.UpdateRoleStateReq" + } } ], "responses": { "200": { - "description": "ok", + "description": "success", "schema": { "type": "string" } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } } } } - }, - "/api/v1/shake_ticket_list": { - "get": { - "description": "定向计划/高佣专场/精选低价包邮/偏远地区包邮/抖货商品/各大榜单商品/今日值得买", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "抖券" - ], - "summary": "抖券商品推荐列表", - "parameters": [ - { - "type": "string", - "description": "页码", - "name": "page", - "in": "query", - "required": true - }, - { - "type": "string", - "description": "页数", - "name": "page_size", - "in": "query", - "required": true - }, - { - "type": "string", - "description": "分类id(3定向计划/4高佣专场/5精选低价包邮/6偏远地区包邮/7抖货商品/8各大榜单商品/9今日值得买)", - "name": "category_id", - "in": "query", - "required": true - }, - { - "type": "string", - "description": "渠道", - "name": "pvd", - "in": "query", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/md.IndexRecommendList" - } - } - } - } - }, - "/api/v1/sign/fast/in": { - "post": { - "produces": [ - "application/json" - ], - "tags": [ - "登录、注册" - ], - "summary": "用户手机快速登录", - "parameters": [ - { - "description": "json", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/md.FastLoginRequestBody" - } - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "$ref": "#/definitions/md.LoginResponse" - } - }, - "400": { - "description": "{\"code\":400001,\"data\":[],\"msg\":\"请求参数错误\"}", - "schema": { - "type": "string" - } - } - } - } - }, - "/api/v1/sub_region_list": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "地址" - ], - "summary": "获取区域id下的区域", - "parameters": [ - { - "type": "string", - "description": "上级地区类型:root(查询省级列表)、province(省级ID下的城市)、city(市级id下的区域)", - "name": "parent", - "in": "query", - "required": true - }, - { - "type": "string", - "description": "上级地区id", - "name": "id", - "in": "query" - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/hdl.resultItem" - } - } - }, - "400": { - "description": "{\"code\":400001,\"data\":[],\"msg\":\"请求参数错误\"}", - "schema": { - "type": "string" - } - } - } - } - }, - "/api/v1/user/address/:id": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "地址" - ], - "summary": "用户地址详情", - "parameters": [ - { - "type": "string", - "description": "地址id", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "$ref": "#/definitions/model.UserAddress" - } - }, - "400": { - "description": "{\"code\":400000,\"data\":[],\"msg\":\"地址不存在\"}", - "schema": { - "type": "string" - } - } - } - } - }, - "/api/v1/user/address/delete/:id": { - "post": { - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "地址" - ], - "summary": "用户地址删除", - "parameters": [ - { - "type": "string", - "description": "ID", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "type": "string" - } - }, - "400": { - "description": "{\"code\":400000,\"data\":[],\"msg\":\"地址不存在\"}", - "schema": { - "type": "string" - } - } - } - } - }, - "/api/v1/user/address/update": { - "post": { - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "地址" - ], - "summary": "用户地址新增、编辑", - "parameters": [ - { - "description": "json参数,Id不传为新增", - "name": "\"\"", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/hdl.updateAddressReq" - } - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "type": "string" - } - }, - "400": { - "description": "{\"code\":400000,\"data\":[],\"msg\":\"地址不存在\"}", - "schema": { - "type": "string" - } - } - } - } - }, - "/api/v1/user/addresses": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "地址" - ], - "summary": "用户地址列表", - "responses": { - "200": { - "description": "ok", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/model.UserAddress" - } - } - }, - "500": { - "description": "{\"code\":500000,\"data\":[],\"msg\":\"数据库操作失败\"}", - "schema": { - "type": "string" - } - } - } - } - } - }, - "definitions": { - "hdl.PrivilegeOpenCardOrdQueryPageResp": { - "type": "object", - "properties": { - "btn_bg_color_1": { - "type": "string" - }, - "btn_bg_color_2": { - "type": "string" - }, - "btn_text": { - "type": "string" - }, - "btn_text_color": { - "type": "string" - }, - "header_img": { - "type": "string" - }, - "logistic_company": { - "type": "array", - "items": { - "$ref": "#/definitions/model.LogisticCompany" - } - } - } - }, - "hdl.PrivilegeOpenCardOrdQueryReq": { - "type": "object", - "required": [ - "com", - "num" - ], - "properties": { - "com": { - "description": "快递公司名称", - "type": "string" - }, - "num": { - "description": "快递单号", - "type": "string" - } - } - }, - "hdl.logisticQueryReq": { - "type": "object", - "required": [ - "com", - "num" - ], - "properties": { - "com": { - "description": "快递公司名称", - "type": "string" - }, - "num": { - "description": "快递单号", - "type": "string" - } - } - }, - "hdl.privilegeOpenCardCheckReq": { - "type": "object", - "required": [ - "key", - "num" - ], - "properties": { - "key": { - "description": "卡密", - "type": "string" - }, - "num": { - "description": "卡号", - "type": "string" - } - } - }, - "hdl.privilegeOpenCardPayPageResp": { - "type": "object", - "properties": { - "amount": { - "description": "付费金额", - "type": "string" - }, - "card_type": { - "description": "卡的类型:\"1\"实体卡 \"2\"虚拟卡", - "type": "string" - }, - "date_type": { - "description": "日期类型:month:月 season:季 year:年 forever:永久", - "type": "string" - }, - "page_style": { - "description": "页面样式", - "$ref": "#/definitions/hdl.privilegeOpenCardPayStyle" - } - } - }, - "hdl.privilegeOpenCardPayStyle": { - "type": "object", - "properties": { - "exclusive_privilege": { - "description": "专属特权", - "type": "array", - "items": { - "type": "object", - "properties": { - "brand_id": { - "type": "string" - }, - "brand_img": { - "type": "string" - }, - "brand_img_url": { - "type": "string" - }, - "brand_name": { - "type": "string" - }, - "is_show": { - "type": "string" - }, - "sub_title": { - "type": "string" - } - } - } - }, - "payment_btn": { - "description": "底部支付按钮", - "type": "array", - "items": { - "type": "object", - "properties": { - "bg_img": { - "type": "string" - }, - "bg_img_url": { - "type": "string" - }, - "func": { - "type": "string" - }, - "name": { - "type": "string" - }, - "text": { - "type": "string" - }, - "text_color": { - "type": "string" - }, - "type": { - "type": "string" - } - } - } - }, - "payment_choose_icon": { - "description": "支付方式选中、未选中图标", - "type": "array", - "items": { - "type": "object", - "properties": { - "icon": { - "type": "string" - }, - "icon_url": { - "type": "string" - }, - "type": { - "type": "string" - } - } - } - }, - "payment_style": { - "description": "支付方式", - "type": "array", - "items": { - "type": "object", - "properties": { - "icon": { - "type": "string" - }, - "icon_url": { - "type": "string" - }, - "type": { - "type": "string" - } - } - } - }, - "style": { - "description": "头部样式", - "type": "object", - "properties": { - "header_bg_img": { - "type": "string" - }, - "header_bg_img_url": { - "type": "string" - }, - "special_deals_img": { - "type": "string" - }, - "special_deals_img_url": { - "type": "string" - }, - "special_deals_text": { - "type": "string" - } - } - } - } - }, - "hdl.resultItem": { - "type": "object", - "properties": { - "id": { - "type": "string", - "example": "440100000000" - }, - "name": { - "type": "string", - "example": "city" - } - } - }, - "hdl.updateAddressReq": { - "type": "object", - "required": [ - "city_id", - "county_id", - "detail", - "phone", - "province_id", - "receiver" - ], - "properties": { - "city_id": { - "type": "string" - }, - "county_id": { - "type": "string" - }, - "detail": { - "type": "string" - }, - "id": { - "type": "integer" - }, - "phone": { - "type": "string" - }, - "post_code": { - "type": "string" - }, - "province_id": { - "type": "string" - }, - "receiver": { - "type": "string" - }, - "tag": { - "type": "string" - } - } - }, - "md.Apple": { - "type": "object", - "properties": { - "token": { - "type": "string" - } - } - }, - "md.FastLoginRequestBody": { - "type": "object", - "properties": { - "apple": { - "$ref": "#/definitions/md.Apple" - }, - "captcha": { - "type": "string" - }, - "is_not_create": { - "type": "string" - }, - "mobile": { - "type": "string" - }, - "parent_uid": { - "type": "string" - }, - "qq": { - "$ref": "#/definitions/md.QQLogin" - }, - "return_user_msg": { - "type": "string" - }, - "taobao": { - "$ref": "#/definitions/md.TaobaoLogin" - }, - "wechat": { - "$ref": "#/definitions/md.WeChat" - }, - "wechat_mini": { - "$ref": "#/definitions/md.WeChatMiniApp" - }, - "zone": { - "type": "string" - } - } - }, - "md.IndexRecommendList": { - "type": "object", - "properties": { - "good": { - "type": "array", - "items": { - "$ref": "#/definitions/md.RecommendGood" - } - }, - "provider": { - "description": "BarTitleList []BarTitle ` + "`" + `json:\"bar_title_list\"` + "`" + `", - "type": "string" - } - } - }, - "md.LoginResponse": { + } + }, + "definitions": { + "md.AddAdminReq": { "type": "object", + "required": [ + "password", + "username" + ], "properties": { - "bind_phone_enable": { - "type": "string" - }, - "is_pid": { - "type": "string" - }, - "perms": { - "type": "array", - "items": { - "type": "string" - } - }, - "phone": { - "type": "string" - }, - "register_invite_code_enable": { - "type": "string" - }, - "register_popup_condition": { - "description": "弹出类型设置", - "$ref": "#/definitions/md.RegisterPopupCondition" - }, - "token": { + "memo": { "type": "string" }, - "user_id": { + "password": { "type": "string" }, "username": { "type": "string" - }, - "wechat_applet_open_id": { - "type": "string" - }, - "wechat_union_id": { - "type": "string" } } }, - "md.Marquee": { + "md.AddRoleReq": { "type": "object", + "required": [ + "memo", + "name" + ], "properties": { - "avatar_url": { - "type": "string" - }, - "content": { + "memo": { "type": "string" }, "name": { @@ -1277,375 +689,163 @@ var doc = `{ } } }, - "md.ProductDetailResponse": { + "md.AdminListReq": { "type": "object", "properties": { - "commission": { - "type": "string" - }, - "coupon_price": { - "type": "string" - }, - "good_id": { - "type": "string" - }, - "mod_list": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": true - } + "limit": { + "type": "integer" }, - "provider": { - "type": "string" + "page": { + "type": "integer" }, - "provider_name": { - "type": "string" + "state": { + "type": "integer" }, - "shop_avatar": { + "username": { "type": "string" } } }, - "md.QQLogin": { + "md.BindAdminRoleReq": { "type": "object", + "required": [ + "adm_id" + ], "properties": { - "access_token": { - "type": "string" - }, - "avatar_url": { - "type": "string" - }, - "city": { - "type": "string" - }, - "expires_in": { - "type": "string" - }, - "gender": { - "type": "string" - }, - "nickname": { - "type": "string" - }, - "open_id": { - "type": "string" - }, - "pay_token": { - "type": "string" - }, - "pf": { - "type": "string" - }, - "pf_key": { - "type": "string" - }, - "province": { - "type": "string" - }, - "ret": { - "type": "string" + "adm_id": { + "type": "integer" }, - "unionid": { - "type": "string" + "role_ids": { + "type": "array", + "items": { + "type": "integer" + } } } }, - "md.RecommendGood": { + "md.LoginReq": { "type": "object", + "required": [ + "password", + "username" + ], "properties": { - "commission": { - "type": "string" - }, - "coupon": { - "type": "string" - }, - "current_price": { - "type": "string" - }, - "detail_data": { - "$ref": "#/definitions/md.ProductDetailResponse" - }, - "good_id": { - "type": "string" - }, - "good_image": { - "type": "string" - }, - "good_title": { - "type": "string" - }, - "inorder_count": { - "type": "string" - }, - "is_collect": { - "type": "integer" - }, - "is_coupons": { - "type": "integer" - }, - "is_share": { - "type": "integer" - }, - "market_price": { - "type": "string" - }, - "marquee_list": { - "type": "array", - "items": { - "$ref": "#/definitions/md.Marquee" - } - }, - "provider": { - "type": "string" - }, - "provider_name": { - "type": "string" - }, - "pvd": { + "password": { "type": "string" }, - "shop_avatar": { - "type": "string" - }, - "shop_name": { - "type": "string" - }, - "video": { + "username": { "type": "string" } } }, - "md.RegisterPopupCondition": { + "md.LoginResponse": { "type": "object", "properties": { - "invite_code": { - "description": "邀请码设置:弹出类型是激活码的时候起作用", - "type": "object", - "properties": { - "popup": { - "description": "是否弹出 “0”否 “1”是", - "type": "string" - }, - "should_input": { - "description": "是否必填 “0”否 “1”是", - "type": "string" - } - } - }, - "popup_type": { - "description": "弹出类型:“0”关闭 ”1”激活码 “2”邀请码", - "type": "string" - }, - "should_input": { - "description": "是否必填 “0”否 “1”是", + "token": { "type": "string" } } }, - "md.TaobaoLogin": { + "md.Response": { "type": "object", "properties": { - "access_token": { - "type": "string" - }, - "auth_code": { - "type": "string" - }, - "avatar_url": { - "type": "string" - }, - "nick_name": { - "type": "string" + "code": { + "type": "string", + "example": "响应码" }, - "open_id": { - "type": "string" + "data": { + "description": "内容" }, - "sid": { - "type": "string" + "msg": { + "type": "string", + "example": "具体错误原因" } } }, - "md.WeChat": { + "md.RoleBindPermissionGroupReq": { "type": "object", + "required": [ + "role_id" + ], "properties": { - "access_token": { - "type": "string" - }, - "avatar_url": { - "type": "string" - }, - "city": { - "type": "string" - }, - "expires_in": { - "type": "string" - }, - "gender": { - "type": "string" - }, - "nickname": { - "type": "string" - }, - "open_id": { - "type": "string" - }, - "pay_token": { - "type": "string" - }, - "pf": { - "type": "string" - }, - "pf_key": { - "type": "string" - }, - "province": { - "type": "string" - }, - "ret": { - "type": "string" + "permission_ids": { + "type": "array", + "items": { + "type": "integer" + } }, - "unionid": { - "type": "string" + "role_id": { + "type": "integer" } } }, - "md.WeChatMiniApp": { + "md.UpdateAdminReq": { "type": "object", + "required": [ + "adm_id", + "password", + "username" + ], "properties": { - "avatar": { - "type": "string" - }, - "code": { - "type": "string" + "adm_id": { + "type": "integer" }, - "nickname": { + "memo": { "type": "string" }, - "open_id": { + "password": { "type": "string" }, - "unionid": { + "username": { "type": "string" } } }, - "model.LogisticCompany": { + "md.UpdateAdminStateReq": { "type": "object", + "required": [ + "adm_id", + "state" + ], "properties": { - "code": { - "type": "string" + "adm_id": { + "type": "integer" }, - "name": { - "type": "string" + "state": { + "type": "integer" } } }, - "model.PrivilegeOpenCardOrd": { + "md.UpdateRoleReq": { "type": "object", + "required": [ + "memo", + "name", + "role_id" + ], "properties": { - "address": { - "type": "string" - }, - "after_sale_id": { - "type": "integer" - }, - "card_key": { - "type": "string" - }, - "card_num": { - "type": "string" - }, - "card_type": { - "type": "integer" - }, - "cost_price": { - "type": "string" - }, - "create_time": { - "type": "string" - }, - "date_type": { - "type": "integer" - }, - "given_data": { - "type": "string" - }, - "logistic_company": { - "type": "string" - }, - "logistic_num": { - "type": "string" - }, - "ord_id": { - "type": "integer" - }, - "pay_channel": { - "type": "integer" - }, - "pay_time": { - "type": "string" - }, - "phone": { + "memo": { "type": "string" }, - "receiver": { + "name": { "type": "string" }, - "settle_at": { + "role_id": { "type": "integer" - }, - "state": { - "type": "integer" - }, - "uid": { - "type": "integer" - }, - "update_time": { - "type": "string" } } }, - "model.UserAddress": { + "md.UpdateRoleStateReq": { "type": "object", + "required": [ + "role_id", + "state" + ], "properties": { - "city_id": { - "type": "string" - }, - "city_name": { - "type": "string" - }, - "county_id": { - "type": "string" - }, - "county_name": { - "type": "string" - }, - "detail": { - "type": "string" - }, - "id": { + "role_id": { "type": "integer" }, - "phone": { - "type": "string" - }, - "post_code": { - "type": "string" - }, - "province_id": { - "type": "string" - }, - "province_name": { - "type": "string" - }, - "receiver": { - "type": "string" - }, - "tag": { - "type": "string" - }, - "uid": { + "state": { "type": "integer" } } @@ -1660,49 +860,18 @@ var doc = `{ } }` -type swaggerInfo struct { - Version string - Host string - BasePath string - Schemes []string - Title string - Description string -} - // SwaggerInfo holds exported Swagger Info so clients can modify it -var SwaggerInfo = swaggerInfo{ - Version: "1.0", - Host: "localhost:5000", - BasePath: "/", - Schemes: []string{}, - Title: "智莺生活移动端接口", - Description: "移动端接口", -} - -type s struct{} - -func (s *s) ReadDoc() string { - sInfo := SwaggerInfo - sInfo.Description = strings.Replace(sInfo.Description, "\n", "\\n", -1) - - t, err := template.New("swagger_info").Funcs(template.FuncMap{ - "marshal": func(v interface{}) string { - a, _ := json.Marshal(v) - return string(a) - }, - }).Parse(doc) - if err != nil { - return doc - } - - var tpl bytes.Buffer - if err := t.Execute(&tpl, sInfo); err != nil { - return doc - } - - return tpl.String() +var SwaggerInfo = &swag.Spec{ + Version: "1.0", + Host: "localhost:1001 or advertisement.dengbiao.top", + BasePath: "", + Schemes: []string{}, + Title: "广告联盟-总站长平台", + Description: "总站长后台接口", + InfoInstanceName: "swagger", + SwaggerTemplate: docTemplate, } func init() { - swag.Register(swag.Name, &s{}) + swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo) } diff --git a/docs/swagger.json b/docs/swagger.json index 527c14e..d20acc0 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -1,20 +1,25 @@ { "swagger": "2.0", "info": { - "description": "移动端接口", - "title": "智莺生活移动端接口", - "termsOfService": "智莺生活后端组", + "description": "总站长后台接口", + "title": "广告联盟-总站长平台", + "termsOfService": "http://swagger.io/terms/", "contact": { - "name": "sherlockwhite" + "name": "dengbiao", + "url": "http://www.swagger.io/support", + "email": "1239118001@qq.com" + }, + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.html" }, "version": "1.0" }, - "host": "localhost:5000", - "basePath": "/", + "host": "localhost:1001 or advertisement.dengbiao.top", "paths": { - "/api/v1/acq/fix": { - "get": { - "description": "拉新活动--fix", + "/admin/login": { + "post": { + "description": "登入", "consumes": [ "application/json" ], @@ -22,68 +27,39 @@ "application/json" ], "tags": [ - "拉新活动" + "登录注册" ], - "summary": "拉新活动--fix", - "responses": { - "200": { - "description": "ok", + "summary": "登陆", + "parameters": [ + { + "description": "用户名密码", + "name": "req", + "in": "body", + "required": true, "schema": { - "type": "string" + "$ref": "#/definitions/md.LoginReq" } } - } - } - }, - "/api/v1/acquisition/home": { - "post": { - "description": "本期榜单/上期榜单/我的邀请人数和奖励/任务列表", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" ], - "tags": [ - "拉新活动" - ], - "summary": "拉新--首页数据", "responses": { "200": { - "description": "ok", + "description": "token", "schema": { - "type": "string" + "$ref": "#/definitions/md.LoginResponse" } - } - } - } - }, - "/api/v1/acquisition/qrcode": { - "get": { - "description": "二维码", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "拉新活动" - ], - "summary": "拉新--邀请二维码", - "responses": { - "200": { - "description": "ok", + }, + "400": { + "description": "具体错误", "schema": { - "type": "string" + "$ref": "#/definitions/md.Response" } } } } }, - "/api/v1/acquisition/reward/detail": { + "/role/addAdmin": { "post": { - "description": "拉新活动--我的奖励明细", + "description": "权限管理-新增管理员", "consumes": [ "application/json" ], @@ -91,33 +67,46 @@ "application/json" ], "tags": [ - "拉新活动" + "权限管理" ], - "summary": "拉新活动--我的奖励明细", + "summary": "新增管理员", "parameters": [ { - "description": "1为以发放,2为待发放,3为失效", - "name": "state", + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "请求参数", + "name": "args", "in": "body", "required": true, "schema": { - "type": "string" + "$ref": "#/definitions/md.AddAdminReq" } } ], "responses": { "200": { - "description": "ok", + "description": "success", "schema": { "type": "string" } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } } } } }, - "/api/v1/acquisition/reward_receive": { + "/role/addRole": { "post": { - "description": "拉新活动--领取奖励", + "description": "权限管理-添加角色", "consumes": [ "application/json" ], @@ -125,33 +114,46 @@ "application/json" ], "tags": [ - "拉新活动" + "权限管理" ], - "summary": "拉新活动--领取奖励", + "summary": "添加角色", "parameters": [ { - "description": "任务ID", - "name": "job_id", + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "请求参数", + "name": "args", "in": "body", "required": true, "schema": { - "type": "string" + "$ref": "#/definitions/md.AddRoleReq" } } ], "responses": { "200": { - "description": "ok", + "description": "success", "schema": { "type": "string" } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } } } } }, - "/api/v1/credit/card/config": { + "/role/adminInfo": { "get": { - "description": "获取信用卡配置", + "description": "权限管理-管理员信息", "consumes": [ "application/json" ], @@ -159,22 +161,44 @@ "application/json" ], "tags": [ - "信用卡" + "权限管理" + ], + "summary": "管理员信息", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "type": "string", + "description": "管理员id", + "name": "adm_id", + "in": "query", + "required": true + } ], - "summary": "获取信用卡配置", "responses": { "200": { - "description": "ok", + "description": "具体看返回内容", "schema": { "type": "string" } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } } } } }, - "/api/v1/duomai/mall/detail": { + "/role/adminList": { "post": { - "description": "多麦商城--商城详情", + "description": "权限管理-管理员列表", "consumes": [ "application/json" ], @@ -182,56 +206,46 @@ "application/json" ], "tags": [ - "多麦商城" + "权限管理" ], - "summary": "多麦商城--商城详情", + "summary": "管理员列表", "parameters": [ { - "description": "商城id", - "name": "brand_id", + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "请求参数", + "name": "args", "in": "body", "required": true, "schema": { - "type": "string" + "$ref": "#/definitions/md.AdminListReq" } } ], "responses": { "200": { - "description": "ok", + "description": "具体看返回内容", "schema": { "type": "string" } - } - } - } - }, - "/api/v1/duomai/mall/home": { - "get": { - "description": "多麦商城--首页数据", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "多麦商城" - ], - "summary": "多麦商城--首页数据", - "responses": { - "200": { - "description": "ok", + }, + "400": { + "description": "具体错误", "schema": { - "type": "string" + "$ref": "#/definitions/md.Response" } } } } }, - "/api/v1/duomai/mall/search": { + "/role/bindAdminRole/": { "post": { - "description": "多麦商城--搜索", + "description": "权限管理-管理员绑定角色", "consumes": [ "application/json" ], @@ -239,33 +253,46 @@ "application/json" ], "tags": [ - "多麦商城" + "权限管理" ], - "summary": "多麦商城--搜索", + "summary": "管理员绑定角色", "parameters": [ { - "description": "搜索关键词", - "name": "key", + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "请求参数", + "name": "args", "in": "body", "required": true, "schema": { - "type": "string" + "$ref": "#/definitions/md.BindAdminRoleReq" } } ], "responses": { "200": { - "description": "ok", + "description": "success", "schema": { "type": "string" } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } } } } }, - "/api/v1/duomai/mall/update": { - "get": { - "description": "多麦商城--更新数据", + "/role/deleteAdmin/{$adm_id}": { + "delete": { + "description": "权限管理-删除管理员", "consumes": [ "application/json" ], @@ -273,21 +300,37 @@ "application/json" ], "tags": [ - "多麦商城" + "权限管理" + ], + "summary": "删除管理员", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + } ], - "summary": "多麦商城--更新数据", "responses": { "200": { - "description": "ok", + "description": "success", "schema": { "type": "string" } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } } } } }, - "/api/v1/logistic/query": { - "post": { + "/role/deleteRole/{$id}": { + "delete": { + "description": "权限管理-删除角色", "consumes": [ "application/json" ], @@ -295,39 +338,46 @@ "application/json" ], "tags": [ - "物流" + "权限管理" ], - "summary": "快递100物流查询", + "summary": "删除角色", "parameters": [ { - "description": "logisticQueryReq", - "name": "req", + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "请求参数", + "name": "args", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/hdl.logisticQueryReq" + "$ref": "#/definitions/md.UpdateRoleStateReq" } } ], "responses": { "200": { - "description": "ok", + "description": "success", "schema": { "type": "string" } }, "400": { - "description": "{\"code\":400000,\"data\":[],\"msg\":\"该快递公司不支持查询\"}", + "description": "具体错误", "schema": { - "type": "string" + "$ref": "#/definitions/md.Response" } } } } }, - "/api/v1/mod/pub.flutter.duomai.mall.detail.page": { + "/role/permissionGroupList": { "get": { - "description": "多麦商城详情页样式", + "description": "权限管理-权限组列表", "consumes": [ "application/json" ], @@ -335,68 +385,44 @@ "application/json" ], "tags": [ - "多麦商城" + "权限管理" ], - "summary": "多麦商城详情页样式", - "responses": { - "200": { - "description": "ok", - "schema": { - "type": "string" - } + "summary": "权限组列表", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "type": "string", + "description": "管理员id", + "name": "adm_id", + "in": "query", + "required": true } - } - } - }, - "/api/v1/mod/pub.flutter.duomai.mall.home.page": { - "get": { - "description": "多麦商城首页样式", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" ], - "tags": [ - "多麦商城" - ], - "summary": "多麦商城首页样式", "responses": { "200": { - "description": "ok", + "description": "具体看返回内容", "schema": { "type": "string" } - } - } - } - }, - "/api/v1/mod/pub.flutter.duomai.mall.search.page": { - "get": { - "description": "多麦商城搜索页样式", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "多麦商城" - ], - "summary": "多麦商城搜索页样式", - "responses": { - "200": { - "description": "ok", + }, + "400": { + "description": "具体错误", "schema": { - "type": "string" + "$ref": "#/definitions/md.Response" } } } } }, - "/api/v1/privilege/card/activation": { + "/role/roleBindPermissionGroup": { "post": { - "description": "权益卡激活", + "description": "权限管理-角色绑定权限组", "consumes": [ "application/json" ], @@ -404,32 +430,46 @@ "application/json" ], "tags": [ - "权益卡" + "权限管理" ], - "summary": "权益卡激活", + "summary": "角色绑定权限组", "parameters": [ { - "description": "json", - "name": "body", + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "请求参数", + "name": "args", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/hdl.privilegeOpenCardCheckReq" + "$ref": "#/definitions/md.RoleBindPermissionGroupReq" } } ], "responses": { "200": { - "description": "ok", + "description": "success", "schema": { "type": "string" } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } } } } }, - "/api/v1/privilege/open_card/check": { + "/role/roleList": { "get": { + "description": "权限管理-角色列表", "consumes": [ "application/json" ], @@ -437,136 +477,131 @@ "application/json" ], "tags": [ - "权益卡" + "权限管理" ], - "summary": "权益卡卡号卡密检测", + "summary": "角色列表", "parameters": [ { - "description": "json", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/hdl.privilegeOpenCardCheckReq" - } + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true } ], "responses": { "200": { - "description": "0:不存在 1:已经被使用 2:可用", + "description": "具体看返回内容", "schema": { "type": "string" } - } - } - } - }, - "/api/v1/privilege/open_card/order_query": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "权益卡" - ], - "summary": "权益卡开卡订单查询页面", - "responses": { - "200": { - "description": "ok", - "schema": { - "$ref": "#/definitions/hdl.PrivilegeOpenCardOrdQueryPageResp" - } }, "400": { - "description": "{\"code\":400000,\"data\":[],\"msg\":\"验证码错误\"}", + "description": "具体错误", "schema": { - "type": "string" + "$ref": "#/definitions/md.Response" } } } - }, + } + }, + "/role/updateAdmin": { "post": { + "description": "权限管理-修改管理员信息", + "consumes": [ + "application/json" + ], "produces": [ "application/json" ], "tags": [ - "权益卡" + "权限管理" ], - "summary": "权益卡开卡订单查询", + "summary": "修改管理员信息", "parameters": [ { - "description": "json", - "name": "body", + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "请求参数", + "name": "args", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/hdl.PrivilegeOpenCardOrdQueryReq" + "$ref": "#/definitions/md.UpdateAdminReq" } } ], "responses": { "200": { - "description": "ok", + "description": "success", "schema": { - "$ref": "#/definitions/model.PrivilegeOpenCardOrd" + "type": "string" } }, "400": { - "description": "{\"code\":400000,\"data\":[],\"msg\":\"验证码错误\"}", + "description": "具体错误", "schema": { - "type": "string" + "$ref": "#/definitions/md.Response" } } } } }, - "/api/v1/privilege/open_card/order_suc": { - "get": { + "/role/updateAdminState": { + "post": { + "description": "权限管理-修改管理员状态", + "consumes": [ + "application/json" + ], "produces": [ "application/json" ], "tags": [ - "权益卡" + "权限管理" ], - "summary": "订单支付成功页面", - "responses": { - "200": { - "description": "ok", + "summary": "修改管理员状态", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + }, + { + "description": "请求参数", + "name": "args", + "in": "body", + "required": true, "schema": { - "$ref": "#/definitions/model.PrivilegeOpenCardOrd" + "$ref": "#/definitions/md.UpdateAdminStateReq" } } - } - } - }, - "/api/v1/privilege/open_card/pay_page": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "权益卡" ], - "summary": "权益卡开卡支付页面", "responses": { "200": { - "description": "ok", + "description": "success", "schema": { - "$ref": "#/definitions/hdl.privilegeOpenCardPayPageResp" + "type": "string" } }, "400": { - "description": "{\"code\":400000,\"data\":[],\"msg\":\"权益卡配置缺失\"}", + "description": "具体错误", "schema": { - "type": "string" + "$ref": "#/definitions/md.Response" } } } } }, - "/api/v1/shake_ticket/:goods_id/:type": { - "get": { - "description": "收藏/领券买/分享赚", + "/role/updateRole": { + "post": { + "description": "权限管理-修改角色状态", "consumes": [ "application/json" ], @@ -574,687 +609,71 @@ "application/json" ], "tags": [ - "抖券" + "权限管理" ], - "summary": "抖券商品收藏/领券买/分享赚", + "summary": "修改角色状态", "parameters": [ { "type": "string", - "description": "商品id", - "name": "goods_id", - "in": "path", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", "required": true }, { - "type": "string", - "description": "类型(0取消收藏,1收藏,2点击 领券买,3点击分享赚)", - "name": "type", - "in": "path", - "required": true + "description": "请求参数", + "name": "args", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/md.UpdateRoleStateReq" + } } ], "responses": { "200": { - "description": "ok", + "description": "success", "schema": { "type": "string" } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } } } } - }, - "/api/v1/shake_ticket_list": { - "get": { - "description": "定向计划/高佣专场/精选低价包邮/偏远地区包邮/抖货商品/各大榜单商品/今日值得买", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "抖券" - ], - "summary": "抖券商品推荐列表", - "parameters": [ - { - "type": "string", - "description": "页码", - "name": "page", - "in": "query", - "required": true - }, - { - "type": "string", - "description": "页数", - "name": "page_size", - "in": "query", - "required": true - }, - { - "type": "string", - "description": "分类id(3定向计划/4高佣专场/5精选低价包邮/6偏远地区包邮/7抖货商品/8各大榜单商品/9今日值得买)", - "name": "category_id", - "in": "query", - "required": true - }, - { - "type": "string", - "description": "渠道", - "name": "pvd", - "in": "query", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/md.IndexRecommendList" - } - } - } - } - }, - "/api/v1/sign/fast/in": { - "post": { - "produces": [ - "application/json" - ], - "tags": [ - "登录、注册" - ], - "summary": "用户手机快速登录", - "parameters": [ - { - "description": "json", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/md.FastLoginRequestBody" - } - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "$ref": "#/definitions/md.LoginResponse" - } - }, - "400": { - "description": "{\"code\":400001,\"data\":[],\"msg\":\"请求参数错误\"}", - "schema": { - "type": "string" - } - } - } - } - }, - "/api/v1/sub_region_list": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "地址" - ], - "summary": "获取区域id下的区域", - "parameters": [ - { - "type": "string", - "description": "上级地区类型:root(查询省级列表)、province(省级ID下的城市)、city(市级id下的区域)", - "name": "parent", - "in": "query", - "required": true - }, - { - "type": "string", - "description": "上级地区id", - "name": "id", - "in": "query" - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/hdl.resultItem" - } - } - }, - "400": { - "description": "{\"code\":400001,\"data\":[],\"msg\":\"请求参数错误\"}", - "schema": { - "type": "string" - } - } - } - } - }, - "/api/v1/user/address/:id": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "地址" - ], - "summary": "用户地址详情", - "parameters": [ - { - "type": "string", - "description": "地址id", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "$ref": "#/definitions/model.UserAddress" - } - }, - "400": { - "description": "{\"code\":400000,\"data\":[],\"msg\":\"地址不存在\"}", - "schema": { - "type": "string" - } - } - } - } - }, - "/api/v1/user/address/delete/:id": { - "post": { - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "地址" - ], - "summary": "用户地址删除", - "parameters": [ - { - "type": "string", - "description": "ID", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "type": "string" - } - }, - "400": { - "description": "{\"code\":400000,\"data\":[],\"msg\":\"地址不存在\"}", - "schema": { - "type": "string" - } - } - } - } - }, - "/api/v1/user/address/update": { - "post": { - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "地址" - ], - "summary": "用户地址新增、编辑", - "parameters": [ - { - "description": "json参数,Id不传为新增", - "name": "\"\"", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/hdl.updateAddressReq" - } - } - ], - "responses": { - "200": { - "description": "ok", - "schema": { - "type": "string" - } - }, - "400": { - "description": "{\"code\":400000,\"data\":[],\"msg\":\"地址不存在\"}", - "schema": { - "type": "string" - } - } - } - } - }, - "/api/v1/user/addresses": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "地址" - ], - "summary": "用户地址列表", - "responses": { - "200": { - "description": "ok", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/model.UserAddress" - } - } - }, - "500": { - "description": "{\"code\":500000,\"data\":[],\"msg\":\"数据库操作失败\"}", - "schema": { - "type": "string" - } - } - } - } - } - }, - "definitions": { - "hdl.PrivilegeOpenCardOrdQueryPageResp": { - "type": "object", - "properties": { - "btn_bg_color_1": { - "type": "string" - }, - "btn_bg_color_2": { - "type": "string" - }, - "btn_text": { - "type": "string" - }, - "btn_text_color": { - "type": "string" - }, - "header_img": { - "type": "string" - }, - "logistic_company": { - "type": "array", - "items": { - "$ref": "#/definitions/model.LogisticCompany" - } - } - } - }, - "hdl.PrivilegeOpenCardOrdQueryReq": { - "type": "object", - "required": [ - "com", - "num" - ], - "properties": { - "com": { - "description": "快递公司名称", - "type": "string" - }, - "num": { - "description": "快递单号", - "type": "string" - } - } - }, - "hdl.logisticQueryReq": { - "type": "object", - "required": [ - "com", - "num" - ], - "properties": { - "com": { - "description": "快递公司名称", - "type": "string" - }, - "num": { - "description": "快递单号", - "type": "string" - } - } - }, - "hdl.privilegeOpenCardCheckReq": { - "type": "object", - "required": [ - "key", - "num" - ], - "properties": { - "key": { - "description": "卡密", - "type": "string" - }, - "num": { - "description": "卡号", - "type": "string" - } - } - }, - "hdl.privilegeOpenCardPayPageResp": { - "type": "object", - "properties": { - "amount": { - "description": "付费金额", - "type": "string" - }, - "card_type": { - "description": "卡的类型:\"1\"实体卡 \"2\"虚拟卡", - "type": "string" - }, - "date_type": { - "description": "日期类型:month:月 season:季 year:年 forever:永久", - "type": "string" - }, - "page_style": { - "description": "页面样式", - "$ref": "#/definitions/hdl.privilegeOpenCardPayStyle" - } - } - }, - "hdl.privilegeOpenCardPayStyle": { - "type": "object", - "properties": { - "exclusive_privilege": { - "description": "专属特权", - "type": "array", - "items": { - "type": "object", - "properties": { - "brand_id": { - "type": "string" - }, - "brand_img": { - "type": "string" - }, - "brand_img_url": { - "type": "string" - }, - "brand_name": { - "type": "string" - }, - "is_show": { - "type": "string" - }, - "sub_title": { - "type": "string" - } - } - } - }, - "payment_btn": { - "description": "底部支付按钮", - "type": "array", - "items": { - "type": "object", - "properties": { - "bg_img": { - "type": "string" - }, - "bg_img_url": { - "type": "string" - }, - "func": { - "type": "string" - }, - "name": { - "type": "string" - }, - "text": { - "type": "string" - }, - "text_color": { - "type": "string" - }, - "type": { - "type": "string" - } - } - } - }, - "payment_choose_icon": { - "description": "支付方式选中、未选中图标", - "type": "array", - "items": { - "type": "object", - "properties": { - "icon": { - "type": "string" - }, - "icon_url": { - "type": "string" - }, - "type": { - "type": "string" - } - } - } - }, - "payment_style": { - "description": "支付方式", - "type": "array", - "items": { - "type": "object", - "properties": { - "icon": { - "type": "string" - }, - "icon_url": { - "type": "string" - }, - "type": { - "type": "string" - } - } - } - }, - "style": { - "description": "头部样式", - "type": "object", - "properties": { - "header_bg_img": { - "type": "string" - }, - "header_bg_img_url": { - "type": "string" - }, - "special_deals_img": { - "type": "string" - }, - "special_deals_img_url": { - "type": "string" - }, - "special_deals_text": { - "type": "string" - } - } - } - } - }, - "hdl.resultItem": { - "type": "object", - "properties": { - "id": { - "type": "string", - "example": "440100000000" - }, - "name": { - "type": "string", - "example": "city" - } - } - }, - "hdl.updateAddressReq": { - "type": "object", - "required": [ - "city_id", - "county_id", - "detail", - "phone", - "province_id", - "receiver" - ], - "properties": { - "city_id": { - "type": "string" - }, - "county_id": { - "type": "string" - }, - "detail": { - "type": "string" - }, - "id": { - "type": "integer" - }, - "phone": { - "type": "string" - }, - "post_code": { - "type": "string" - }, - "province_id": { - "type": "string" - }, - "receiver": { - "type": "string" - }, - "tag": { - "type": "string" - } - } - }, - "md.Apple": { - "type": "object", - "properties": { - "token": { - "type": "string" - } - } - }, - "md.FastLoginRequestBody": { - "type": "object", - "properties": { - "apple": { - "$ref": "#/definitions/md.Apple" - }, - "captcha": { - "type": "string" - }, - "is_not_create": { - "type": "string" - }, - "mobile": { - "type": "string" - }, - "parent_uid": { - "type": "string" - }, - "qq": { - "$ref": "#/definitions/md.QQLogin" - }, - "return_user_msg": { - "type": "string" - }, - "taobao": { - "$ref": "#/definitions/md.TaobaoLogin" - }, - "wechat": { - "$ref": "#/definitions/md.WeChat" - }, - "wechat_mini": { - "$ref": "#/definitions/md.WeChatMiniApp" - }, - "zone": { - "type": "string" - } - } - }, - "md.IndexRecommendList": { - "type": "object", - "properties": { - "good": { - "type": "array", - "items": { - "$ref": "#/definitions/md.RecommendGood" - } - }, - "provider": { - "description": "BarTitleList []BarTitle `json:\"bar_title_list\"`", - "type": "string" - } - } - }, - "md.LoginResponse": { + } + }, + "definitions": { + "md.AddAdminReq": { "type": "object", + "required": [ + "password", + "username" + ], "properties": { - "bind_phone_enable": { - "type": "string" - }, - "is_pid": { - "type": "string" - }, - "perms": { - "type": "array", - "items": { - "type": "string" - } - }, - "phone": { - "type": "string" - }, - "register_invite_code_enable": { - "type": "string" - }, - "register_popup_condition": { - "description": "弹出类型设置", - "$ref": "#/definitions/md.RegisterPopupCondition" - }, - "token": { + "memo": { "type": "string" }, - "user_id": { + "password": { "type": "string" }, "username": { "type": "string" - }, - "wechat_applet_open_id": { - "type": "string" - }, - "wechat_union_id": { - "type": "string" } } }, - "md.Marquee": { + "md.AddRoleReq": { "type": "object", + "required": [ + "memo", + "name" + ], "properties": { - "avatar_url": { - "type": "string" - }, - "content": { + "memo": { "type": "string" }, "name": { @@ -1262,375 +681,163 @@ } } }, - "md.ProductDetailResponse": { + "md.AdminListReq": { "type": "object", "properties": { - "commission": { - "type": "string" - }, - "coupon_price": { - "type": "string" - }, - "good_id": { - "type": "string" - }, - "mod_list": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": true - } + "limit": { + "type": "integer" }, - "provider": { - "type": "string" + "page": { + "type": "integer" }, - "provider_name": { - "type": "string" + "state": { + "type": "integer" }, - "shop_avatar": { + "username": { "type": "string" } } }, - "md.QQLogin": { + "md.BindAdminRoleReq": { "type": "object", + "required": [ + "adm_id" + ], "properties": { - "access_token": { - "type": "string" - }, - "avatar_url": { - "type": "string" - }, - "city": { - "type": "string" - }, - "expires_in": { - "type": "string" - }, - "gender": { - "type": "string" - }, - "nickname": { - "type": "string" - }, - "open_id": { - "type": "string" - }, - "pay_token": { - "type": "string" - }, - "pf": { - "type": "string" - }, - "pf_key": { - "type": "string" - }, - "province": { - "type": "string" - }, - "ret": { - "type": "string" + "adm_id": { + "type": "integer" }, - "unionid": { - "type": "string" + "role_ids": { + "type": "array", + "items": { + "type": "integer" + } } } }, - "md.RecommendGood": { + "md.LoginReq": { "type": "object", + "required": [ + "password", + "username" + ], "properties": { - "commission": { - "type": "string" - }, - "coupon": { - "type": "string" - }, - "current_price": { - "type": "string" - }, - "detail_data": { - "$ref": "#/definitions/md.ProductDetailResponse" - }, - "good_id": { + "password": { "type": "string" }, - "good_image": { - "type": "string" - }, - "good_title": { - "type": "string" - }, - "inorder_count": { - "type": "string" - }, - "is_collect": { - "type": "integer" - }, - "is_coupons": { - "type": "integer" - }, - "is_share": { - "type": "integer" - }, - "market_price": { - "type": "string" - }, - "marquee_list": { - "type": "array", - "items": { - "$ref": "#/definitions/md.Marquee" - } - }, - "provider": { - "type": "string" - }, - "provider_name": { - "type": "string" - }, - "pvd": { - "type": "string" - }, - "shop_avatar": { - "type": "string" - }, - "shop_name": { - "type": "string" - }, - "video": { + "username": { "type": "string" } } }, - "md.RegisterPopupCondition": { + "md.LoginResponse": { "type": "object", "properties": { - "invite_code": { - "description": "邀请码设置:弹出类型是激活码的时候起作用", - "type": "object", - "properties": { - "popup": { - "description": "是否弹出 “0”否 “1”是", - "type": "string" - }, - "should_input": { - "description": "是否必填 “0”否 “1”是", - "type": "string" - } - } - }, - "popup_type": { - "description": "弹出类型:“0”关闭 ”1”激活码 “2”邀请码", - "type": "string" - }, - "should_input": { - "description": "是否必填 “0”否 “1”是", + "token": { "type": "string" } } }, - "md.TaobaoLogin": { + "md.Response": { "type": "object", "properties": { - "access_token": { - "type": "string" - }, - "auth_code": { - "type": "string" - }, - "avatar_url": { - "type": "string" - }, - "nick_name": { - "type": "string" + "code": { + "type": "string", + "example": "响应码" }, - "open_id": { - "type": "string" + "data": { + "description": "内容" }, - "sid": { - "type": "string" + "msg": { + "type": "string", + "example": "具体错误原因" } } }, - "md.WeChat": { + "md.RoleBindPermissionGroupReq": { "type": "object", + "required": [ + "role_id" + ], "properties": { - "access_token": { - "type": "string" - }, - "avatar_url": { - "type": "string" - }, - "city": { - "type": "string" - }, - "expires_in": { - "type": "string" - }, - "gender": { - "type": "string" - }, - "nickname": { - "type": "string" - }, - "open_id": { - "type": "string" - }, - "pay_token": { - "type": "string" - }, - "pf": { - "type": "string" - }, - "pf_key": { - "type": "string" - }, - "province": { - "type": "string" - }, - "ret": { - "type": "string" + "permission_ids": { + "type": "array", + "items": { + "type": "integer" + } }, - "unionid": { - "type": "string" + "role_id": { + "type": "integer" } } }, - "md.WeChatMiniApp": { + "md.UpdateAdminReq": { "type": "object", + "required": [ + "adm_id", + "password", + "username" + ], "properties": { - "avatar": { - "type": "string" - }, - "code": { - "type": "string" + "adm_id": { + "type": "integer" }, - "nickname": { + "memo": { "type": "string" }, - "open_id": { + "password": { "type": "string" }, - "unionid": { + "username": { "type": "string" } } }, - "model.LogisticCompany": { + "md.UpdateAdminStateReq": { "type": "object", + "required": [ + "adm_id", + "state" + ], "properties": { - "code": { - "type": "string" + "adm_id": { + "type": "integer" }, - "name": { - "type": "string" + "state": { + "type": "integer" } } }, - "model.PrivilegeOpenCardOrd": { + "md.UpdateRoleReq": { "type": "object", + "required": [ + "memo", + "name", + "role_id" + ], "properties": { - "address": { - "type": "string" - }, - "after_sale_id": { - "type": "integer" - }, - "card_key": { - "type": "string" - }, - "card_num": { - "type": "string" - }, - "card_type": { - "type": "integer" - }, - "cost_price": { - "type": "string" - }, - "create_time": { - "type": "string" - }, - "date_type": { - "type": "integer" - }, - "given_data": { - "type": "string" - }, - "logistic_company": { - "type": "string" - }, - "logistic_num": { - "type": "string" - }, - "ord_id": { - "type": "integer" - }, - "pay_channel": { - "type": "integer" - }, - "pay_time": { - "type": "string" - }, - "phone": { + "memo": { "type": "string" }, - "receiver": { + "name": { "type": "string" }, - "settle_at": { + "role_id": { "type": "integer" - }, - "state": { - "type": "integer" - }, - "uid": { - "type": "integer" - }, - "update_time": { - "type": "string" } } }, - "model.UserAddress": { + "md.UpdateRoleStateReq": { "type": "object", + "required": [ + "role_id", + "state" + ], "properties": { - "city_id": { - "type": "string" - }, - "city_name": { - "type": "string" - }, - "county_id": { - "type": "string" - }, - "county_name": { - "type": "string" - }, - "detail": { - "type": "string" - }, - "id": { + "role_id": { "type": "integer" }, - "phone": { - "type": "string" - }, - "post_code": { - "type": "string" - }, - "province_id": { - "type": "string" - }, - "province_name": { - "type": "string" - }, - "receiver": { - "type": "string" - }, - "tag": { - "type": "string" - }, - "uid": { + "state": { "type": "integer" } } diff --git a/docs/swagger.yaml b/docs/swagger.yaml index ca2a7a9..882b7d7 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -1,1081 +1,562 @@ -basePath: / definitions: - hdl.PrivilegeOpenCardOrdQueryPageResp: + md.AddAdminReq: properties: - btn_bg_color_1: + memo: type: string - btn_bg_color_2: + password: type: string - btn_text: - type: string - btn_text_color: - type: string - header_img: - type: string - logistic_company: - items: - $ref: '#/definitions/model.LogisticCompany' - type: array - type: object - hdl.PrivilegeOpenCardOrdQueryReq: - properties: - com: - description: 快递公司名称 - type: string - num: - description: 快递单号 - type: string - required: - - com - - num - type: object - hdl.logisticQueryReq: - properties: - com: - description: 快递公司名称 - type: string - num: - description: 快递单号 + username: type: string required: - - com - - num + - password + - username type: object - hdl.privilegeOpenCardCheckReq: + md.AddRoleReq: properties: - key: - description: 卡密 + memo: type: string - num: - description: 卡号 + name: type: string required: - - key - - num + - memo + - name type: object - hdl.privilegeOpenCardPayPageResp: + md.AdminListReq: properties: - amount: - description: 付费金额 - type: string - card_type: - description: 卡的类型:"1"实体卡 "2"虚拟卡 - type: string - date_type: - description: 日期类型:month:月 season:季 year:年 forever:永久 + limit: + type: integer + page: + type: integer + state: + type: integer + username: type: string - page_style: - $ref: '#/definitions/hdl.privilegeOpenCardPayStyle' - description: 页面样式 type: object - hdl.privilegeOpenCardPayStyle: + md.BindAdminRoleReq: properties: - exclusive_privilege: - description: 专属特权 - items: - properties: - brand_id: - type: string - brand_img: - type: string - brand_img_url: - type: string - brand_name: - type: string - is_show: - type: string - sub_title: - type: string - type: object - type: array - payment_btn: - description: 底部支付按钮 - items: - properties: - bg_img: - type: string - bg_img_url: - type: string - func: - type: string - name: - type: string - text: - type: string - text_color: - type: string - type: - type: string - type: object - type: array - payment_choose_icon: - description: 支付方式选中、未选中图标 - items: - properties: - icon: - type: string - icon_url: - type: string - type: - type: string - type: object - type: array - payment_style: - description: 支付方式 + adm_id: + type: integer + role_ids: items: - properties: - icon: - type: string - icon_url: - type: string - type: - type: string - type: object + type: integer type: array - style: - description: 头部样式 - properties: - header_bg_img: - type: string - header_bg_img_url: - type: string - special_deals_img: - type: string - special_deals_img_url: - type: string - special_deals_text: - type: string - type: object - type: object - hdl.resultItem: - properties: - id: - example: "440100000000" - type: string - name: - example: city - type: string - type: object - hdl.updateAddressReq: - properties: - city_id: - type: string - county_id: - type: string - detail: - type: string - id: - type: integer - phone: - type: string - post_code: - type: string - province_id: - type: string - receiver: - type: string - tag: - type: string required: - - city_id - - county_id - - detail - - phone - - province_id - - receiver + - adm_id type: object - md.Apple: + md.LoginReq: properties: - token: - type: string - type: object - md.FastLoginRequestBody: - properties: - apple: - $ref: '#/definitions/md.Apple' - captcha: - type: string - is_not_create: - type: string - mobile: - type: string - parent_uid: + password: type: string - qq: - $ref: '#/definitions/md.QQLogin' - return_user_msg: - type: string - taobao: - $ref: '#/definitions/md.TaobaoLogin' - wechat: - $ref: '#/definitions/md.WeChat' - wechat_mini: - $ref: '#/definitions/md.WeChatMiniApp' - zone: - type: string - type: object - md.IndexRecommendList: - properties: - good: - items: - $ref: '#/definitions/md.RecommendGood' - type: array - provider: - description: BarTitleList []BarTitle `json:"bar_title_list"` + username: type: string + required: + - password + - username type: object md.LoginResponse: properties: - bind_phone_enable: - type: string - is_pid: - type: string - perms: - items: - type: string - type: array - phone: - type: string - register_invite_code_enable: - type: string - register_popup_condition: - $ref: '#/definitions/md.RegisterPopupCondition' - description: 弹出类型设置 token: type: string - user_id: - type: string - username: - type: string - wechat_applet_open_id: - type: string - wechat_union_id: - type: string type: object - md.Marquee: + md.Response: properties: - avatar_url: - type: string - content: + code: + example: 响应码 type: string - name: + data: + description: 内容 + msg: + example: 具体错误原因 type: string type: object - md.ProductDetailResponse: + md.RoleBindPermissionGroupReq: properties: - commission: - type: string - coupon_price: - type: string - good_id: - type: string - mod_list: + permission_ids: items: - additionalProperties: true - type: object + type: integer type: array - provider: - type: string - provider_name: - type: string - shop_avatar: - type: string + role_id: + type: integer + required: + - role_id type: object - md.QQLogin: + md.UpdateAdminReq: properties: - access_token: - type: string - avatar_url: - type: string - city: - type: string - expires_in: - type: string - gender: - type: string - nickname: - type: string - open_id: - type: string - pay_token: - type: string - pf: - type: string - pf_key: - type: string - province: + adm_id: + type: integer + memo: type: string - ret: + password: type: string - unionid: + username: type: string + required: + - adm_id + - password + - username type: object - md.RecommendGood: + md.UpdateAdminStateReq: properties: - commission: - type: string - coupon: - type: string - current_price: - type: string - detail_data: - $ref: '#/definitions/md.ProductDetailResponse' - good_id: - type: string - good_image: - type: string - good_title: - type: string - inorder_count: - type: string - is_collect: + adm_id: type: integer - is_coupons: - type: integer - is_share: + state: type: integer - market_price: - type: string - marquee_list: - items: - $ref: '#/definitions/md.Marquee' - type: array - provider: - type: string - provider_name: - type: string - pvd: - type: string - shop_avatar: - type: string - shop_name: - type: string - video: - type: string - type: object - md.RegisterPopupCondition: - properties: - invite_code: - description: 邀请码设置:弹出类型是激活码的时候起作用 - properties: - popup: - description: 是否弹出 “0”否 “1”是 - type: string - should_input: - description: 是否必填 “0”否 “1”是 - type: string - type: object - popup_type: - description: 弹出类型:“0”关闭 ”1”激活码 “2”邀请码 - type: string - should_input: - description: 是否必填 “0”否 “1”是 - type: string - type: object - md.TaobaoLogin: - properties: - access_token: - type: string - auth_code: - type: string - avatar_url: - type: string - nick_name: - type: string - open_id: - type: string - sid: - type: string - type: object - md.WeChat: - properties: - access_token: - type: string - avatar_url: - type: string - city: - type: string - expires_in: - type: string - gender: - type: string - nickname: - type: string - open_id: - type: string - pay_token: - type: string - pf: - type: string - pf_key: - type: string - province: - type: string - ret: - type: string - unionid: - type: string - type: object - md.WeChatMiniApp: - properties: - avatar: - type: string - code: - type: string - nickname: - type: string - open_id: - type: string - unionid: - type: string + required: + - adm_id + - state type: object - model.LogisticCompany: + md.UpdateRoleReq: properties: - code: + memo: type: string name: type: string - type: object - model.PrivilegeOpenCardOrd: - properties: - address: - type: string - after_sale_id: - type: integer - card_key: - type: string - card_num: - type: string - card_type: - type: integer - cost_price: - type: string - create_time: - type: string - date_type: - type: integer - given_data: - type: string - logistic_company: - type: string - logistic_num: - type: string - ord_id: - type: integer - pay_channel: - type: integer - pay_time: - type: string - phone: - type: string - receiver: - type: string - settle_at: + role_id: type: integer - state: - type: integer - uid: - type: integer - update_time: - type: string + required: + - memo + - name + - role_id type: object - model.UserAddress: + md.UpdateRoleStateReq: properties: - city_id: - type: string - city_name: - type: string - county_id: - type: string - county_name: - type: string - detail: - type: string - id: + role_id: type: integer - phone: - type: string - post_code: - type: string - province_id: - type: string - province_name: - type: string - receiver: - type: string - tag: - type: string - uid: + state: type: integer + required: + - role_id + - state type: object -host: localhost:5000 +host: localhost:1001 or advertisement.dengbiao.top info: contact: - name: sherlockwhite - description: 移动端接口 - termsOfService: 智莺生活后端组 - title: 智莺生活移动端接口 + email: 1239118001@qq.com + name: dengbiao + url: http://www.swagger.io/support + description: 总站长后台接口 + license: + name: Apache 2.0 + url: http://www.apache.org/licenses/LICENSE-2.0.html + termsOfService: http://swagger.io/terms/ + title: 广告联盟-总站长平台 version: "1.0" paths: - /api/v1/acq/fix: - get: - consumes: - - application/json - description: 拉新活动--fix - produces: - - application/json - responses: - "200": - description: ok - schema: - type: string - summary: 拉新活动--fix - tags: - - 拉新活动 - /api/v1/acquisition/home: + /admin/login: post: consumes: - application/json - description: 本期榜单/上期榜单/我的邀请人数和奖励/任务列表 - produces: - - application/json - responses: - "200": - description: ok - schema: - type: string - summary: 拉新--首页数据 - tags: - - 拉新活动 - /api/v1/acquisition/qrcode: - get: - consumes: - - application/json - description: 二维码 - produces: - - application/json - responses: - "200": - description: ok - schema: - type: string - summary: 拉新--邀请二维码 - tags: - - 拉新活动 - /api/v1/acquisition/reward/detail: - post: - consumes: - - application/json - description: 拉新活动--我的奖励明细 + description: 登入 parameters: - - description: 1为以发放,2为待发放,3为失效 + - description: 用户名密码 in: body - name: state + name: req required: true schema: - type: string + $ref: '#/definitions/md.LoginReq' produces: - application/json responses: "200": - description: ok + description: token schema: - type: string - summary: 拉新活动--我的奖励明细 + $ref: '#/definitions/md.LoginResponse' + "400": + description: 具体错误 + schema: + $ref: '#/definitions/md.Response' + summary: 登陆 tags: - - 拉新活动 - /api/v1/acquisition/reward_receive: + - 登录注册 + /role/addAdmin: post: consumes: - application/json - description: 拉新活动--领取奖励 + description: 权限管理-新增管理员 parameters: - - description: 任务ID + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization + required: true + type: string + - description: 请求参数 in: body - name: job_id + name: args required: true schema: - type: string + $ref: '#/definitions/md.AddAdminReq' produces: - application/json responses: "200": - description: ok + description: success schema: type: string - summary: 拉新活动--领取奖励 - tags: - - 拉新活动 - /api/v1/credit/card/config: - get: - consumes: - - application/json - description: 获取信用卡配置 - produces: - - application/json - responses: - "200": - description: ok + "400": + description: 具体错误 schema: - type: string - summary: 获取信用卡配置 + $ref: '#/definitions/md.Response' + summary: 新增管理员 tags: - - 信用卡 - /api/v1/duomai/mall/detail: + - 权限管理 + /role/addRole: post: consumes: - application/json - description: 多麦商城--商城详情 + description: 权限管理-添加角色 parameters: - - description: 商城id + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization + required: true + type: string + - description: 请求参数 in: body - name: brand_id + name: args required: true schema: - type: string + $ref: '#/definitions/md.AddRoleReq' produces: - application/json responses: "200": - description: ok + description: success schema: type: string - summary: 多麦商城--商城详情 - tags: - - 多麦商城 - /api/v1/duomai/mall/home: - get: - consumes: - - application/json - description: 多麦商城--首页数据 - produces: - - application/json - responses: - "200": - description: ok + "400": + description: 具体错误 schema: - type: string - summary: 多麦商城--首页数据 + $ref: '#/definitions/md.Response' + summary: 添加角色 tags: - - 多麦商城 - /api/v1/duomai/mall/search: - post: + - 权限管理 + /role/adminInfo: + get: consumes: - application/json - description: 多麦商城--搜索 + description: 权限管理-管理员信息 parameters: - - description: 搜索关键词 - in: body - name: key + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization required: true - schema: - type: string + type: string + - description: 管理员id + in: query + name: adm_id + required: true + type: string produces: - application/json responses: "200": - description: ok + description: 具体看返回内容 schema: type: string - summary: 多麦商城--搜索 - tags: - - 多麦商城 - /api/v1/duomai/mall/update: - get: - consumes: - - application/json - description: 多麦商城--更新数据 - produces: - - application/json - responses: - "200": - description: ok + "400": + description: 具体错误 schema: - type: string - summary: 多麦商城--更新数据 + $ref: '#/definitions/md.Response' + summary: 管理员信息 tags: - - 多麦商城 - /api/v1/logistic/query: + - 权限管理 + /role/adminList: post: consumes: - application/json + description: 权限管理-管理员列表 parameters: - - description: logisticQueryReq + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization + required: true + type: string + - description: 请求参数 in: body - name: req + name: args required: true schema: - $ref: '#/definitions/hdl.logisticQueryReq' + $ref: '#/definitions/md.AdminListReq' produces: - application/json responses: "200": - description: ok + description: 具体看返回内容 schema: type: string "400": - description: '{"code":400000,"data":[],"msg":"该快递公司不支持查询"}' - schema: - type: string - summary: 快递100物流查询 - tags: - - 物流 - /api/v1/mod/pub.flutter.duomai.mall.detail.page: - get: - consumes: - - application/json - description: 多麦商城详情页样式 - produces: - - application/json - responses: - "200": - description: ok - schema: - type: string - summary: 多麦商城详情页样式 - tags: - - 多麦商城 - /api/v1/mod/pub.flutter.duomai.mall.home.page: - get: - consumes: - - application/json - description: 多麦商城首页样式 - produces: - - application/json - responses: - "200": - description: ok - schema: - type: string - summary: 多麦商城首页样式 - tags: - - 多麦商城 - /api/v1/mod/pub.flutter.duomai.mall.search.page: - get: - consumes: - - application/json - description: 多麦商城搜索页样式 - produces: - - application/json - responses: - "200": - description: ok + description: 具体错误 schema: - type: string - summary: 多麦商城搜索页样式 + $ref: '#/definitions/md.Response' + summary: 管理员列表 tags: - - 多麦商城 - /api/v1/privilege/card/activation: + - 权限管理 + /role/bindAdminRole/: post: consumes: - application/json - description: 权益卡激活 + description: 权限管理-管理员绑定角色 parameters: - - description: json + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization + required: true + type: string + - description: 请求参数 in: body - name: body + name: args required: true schema: - $ref: '#/definitions/hdl.privilegeOpenCardCheckReq' + $ref: '#/definitions/md.BindAdminRoleReq' produces: - application/json responses: "200": - description: ok + description: success schema: type: string - summary: 权益卡激活 + "400": + description: 具体错误 + schema: + $ref: '#/definitions/md.Response' + summary: 管理员绑定角色 tags: - - 权益卡 - /api/v1/privilege/open_card/check: - get: + - 权限管理 + /role/deleteAdmin/{$adm_id}: + delete: consumes: - application/json + description: 权限管理-删除管理员 parameters: - - description: json - in: body - name: body + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization required: true - schema: - $ref: '#/definitions/hdl.privilegeOpenCardCheckReq' + type: string produces: - application/json responses: "200": - description: 0:不存在 1:已经被使用 2:可用 + description: success schema: type: string - summary: 权益卡卡号卡密检测 - tags: - - 权益卡 - /api/v1/privilege/open_card/order_query: - get: - produces: - - application/json - responses: - "200": - description: ok - schema: - $ref: '#/definitions/hdl.PrivilegeOpenCardOrdQueryPageResp' "400": - description: '{"code":400000,"data":[],"msg":"验证码错误"}' + description: 具体错误 schema: - type: string - summary: 权益卡开卡订单查询页面 + $ref: '#/definitions/md.Response' + summary: 删除管理员 tags: - - 权益卡 - post: + - 权限管理 + /role/deleteRole/{$id}: + delete: + consumes: + - application/json + description: 权限管理-删除角色 parameters: - - description: json + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization + required: true + type: string + - description: 请求参数 in: body - name: body + name: args required: true schema: - $ref: '#/definitions/hdl.PrivilegeOpenCardOrdQueryReq' + $ref: '#/definitions/md.UpdateRoleStateReq' produces: - application/json responses: "200": - description: ok - schema: - $ref: '#/definitions/model.PrivilegeOpenCardOrd' - "400": - description: '{"code":400000,"data":[],"msg":"验证码错误"}' + description: success schema: type: string - summary: 权益卡开卡订单查询 - tags: - - 权益卡 - /api/v1/privilege/open_card/order_suc: - get: - produces: - - application/json - responses: - "200": - description: ok - schema: - $ref: '#/definitions/model.PrivilegeOpenCardOrd' - summary: 订单支付成功页面 - tags: - - 权益卡 - /api/v1/privilege/open_card/pay_page: - get: - produces: - - application/json - responses: - "200": - description: ok - schema: - $ref: '#/definitions/hdl.privilegeOpenCardPayPageResp' "400": - description: '{"code":400000,"data":[],"msg":"权益卡配置缺失"}' + description: 具体错误 schema: - type: string - summary: 权益卡开卡支付页面 + $ref: '#/definitions/md.Response' + summary: 删除角色 tags: - - 权益卡 - /api/v1/shake_ticket/:goods_id/:type: + - 权限管理 + /role/permissionGroupList: get: consumes: - application/json - description: 收藏/领券买/分享赚 + description: 权限管理-权限组列表 parameters: - - description: 商品id - in: path - name: goods_id + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization required: true type: string - - description: 类型(0取消收藏,1收藏,2点击 领券买,3点击分享赚) - in: path - name: type + - description: 管理员id + in: query + name: adm_id required: true type: string produces: - application/json responses: "200": - description: ok + description: 具体看返回内容 schema: type: string - summary: 抖券商品收藏/领券买/分享赚 + "400": + description: 具体错误 + schema: + $ref: '#/definitions/md.Response' + summary: 权限组列表 tags: - - 抖券 - /api/v1/shake_ticket_list: - get: + - 权限管理 + /role/roleBindPermissionGroup: + post: consumes: - application/json - description: 定向计划/高佣专场/精选低价包邮/偏远地区包邮/抖货商品/各大榜单商品/今日值得买 + description: 权限管理-角色绑定权限组 parameters: - - description: 页码 - in: query - name: page - required: true - type: string - - description: 页数 - in: query - name: page_size - required: true - type: string - - description: 分类id(3定向计划/4高佣专场/5精选低价包邮/6偏远地区包邮/7抖货商品/8各大榜单商品/9今日值得买) - in: query - name: category_id - required: true - type: string - - description: 渠道 - in: query - name: pvd + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization required: true type: string - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/md.IndexRecommendList' - summary: 抖券商品推荐列表 - tags: - - 抖券 - /api/v1/sign/fast/in: - post: - parameters: - - description: json + - description: 请求参数 in: body - name: body + name: args required: true schema: - $ref: '#/definitions/md.FastLoginRequestBody' + $ref: '#/definitions/md.RoleBindPermissionGroupReq' produces: - application/json responses: "200": - description: ok + description: success schema: - $ref: '#/definitions/md.LoginResponse' + type: string "400": - description: '{"code":400001,"data":[],"msg":"请求参数错误"}' + description: 具体错误 schema: - type: string - summary: 用户手机快速登录 + $ref: '#/definitions/md.Response' + summary: 角色绑定权限组 tags: - - 登录、注册 - /api/v1/sub_region_list: + - 权限管理 + /role/roleList: get: + consumes: + - application/json + description: 权限管理-角色列表 parameters: - - description: 上级地区类型:root(查询省级列表)、province(省级ID下的城市)、city(市级id下的区域) - in: query - name: parent + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization required: true type: string - - description: 上级地区id - in: query - name: id - type: string produces: - application/json responses: "200": - description: ok + description: 具体看返回内容 schema: - items: - $ref: '#/definitions/hdl.resultItem' - type: array + type: string "400": - description: '{"code":400001,"data":[],"msg":"请求参数错误"}' + description: 具体错误 schema: - type: string - summary: 获取区域id下的区域 + $ref: '#/definitions/md.Response' + summary: 角色列表 tags: - - 地址 - /api/v1/user/address/:id: - get: + - 权限管理 + /role/updateAdmin: + post: + consumes: + - application/json + description: 权限管理-修改管理员信息 parameters: - - description: 地址id - in: path - name: id + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization required: true type: string + - description: 请求参数 + in: body + name: args + required: true + schema: + $ref: '#/definitions/md.UpdateAdminReq' produces: - application/json responses: "200": - description: ok + description: success schema: - $ref: '#/definitions/model.UserAddress' + type: string "400": - description: '{"code":400000,"data":[],"msg":"地址不存在"}' + description: 具体错误 schema: - type: string - summary: 用户地址详情 + $ref: '#/definitions/md.Response' + summary: 修改管理员信息 tags: - - 地址 - /api/v1/user/address/delete/:id: + - 权限管理 + /role/updateAdminState: post: consumes: - application/json + description: 权限管理-修改管理员状态 parameters: - - description: ID - in: path - name: id + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization required: true type: string + - description: 请求参数 + in: body + name: args + required: true + schema: + $ref: '#/definitions/md.UpdateAdminStateReq' produces: - application/json responses: "200": - description: ok + description: success schema: type: string "400": - description: '{"code":400000,"data":[],"msg":"地址不存在"}' + description: 具体错误 schema: - type: string - summary: 用户地址删除 + $ref: '#/definitions/md.Response' + summary: 修改管理员状态 tags: - - 地址 - /api/v1/user/address/update: + - 权限管理 + /role/updateRole: post: consumes: - application/json + description: 权限管理-修改角色状态 parameters: - - description: json参数,Id不传为新增 + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization + required: true + type: string + - description: 请求参数 in: body - name: '""' + name: args required: true schema: - $ref: '#/definitions/hdl.updateAddressReq' + $ref: '#/definitions/md.UpdateRoleStateReq' produces: - application/json responses: "200": - description: ok + description: success schema: type: string "400": - description: '{"code":400000,"data":[],"msg":"地址不存在"}' - schema: - type: string - summary: 用户地址新增、编辑 - tags: - - 地址 - /api/v1/user/addresses: - get: - produces: - - application/json - responses: - "200": - description: ok - schema: - items: - $ref: '#/definitions/model.UserAddress' - type: array - "500": - description: '{"code":500000,"data":[],"msg":"数据库操作失败"}' + description: 具体错误 schema: - type: string - summary: 用户地址列表 + $ref: '#/definitions/md.Response' + summary: 修改角色状态 tags: - - 地址 + - 权限管理 securityDefinitions: MasterID: in: header diff --git a/go.mod b/go.mod index ae20d24..1cd6d3d 100644 --- a/go.mod +++ b/go.mod @@ -4,18 +4,17 @@ go 1.18 require ( github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 - github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 github.com/boombuler/barcode v1.0.1 github.com/dchest/uniuri v0.0.0-20200228104902-7aecb25e1fe5 github.com/dgrijalva/jwt-go v3.2.0+incompatible github.com/forgoer/openssl v0.0.0-20201023062029-c3112b0c8700 github.com/gin-contrib/sessions v0.0.3 - github.com/gin-gonic/gin v1.6.3 - github.com/go-playground/locales v0.13.0 - github.com/go-playground/universal-translator v0.17.0 - github.com/go-playground/validator/v10 v10.4.2 + github.com/gin-gonic/gin v1.9.0 + github.com/go-playground/locales v0.14.1 + github.com/go-playground/universal-translator v0.18.1 + github.com/go-playground/validator/v10 v10.11.2 github.com/go-redis/redis v6.15.9+incompatible - github.com/go-sql-driver/mysql v1.6.0 + github.com/go-sql-driver/mysql v1.8.1 github.com/gocolly/colly v1.2.0 github.com/gomodule/redigo v2.0.0+incompatible github.com/iGoogle-ink/gopay v1.5.36 @@ -23,16 +22,20 @@ require ( github.com/qiniu/api.v7/v7 v7.8.2 github.com/robfig/cron/v3 v3.0.1 github.com/sony/sonyflake v1.0.0 - github.com/swaggo/swag v1.7.0 - github.com/syyongx/php2go v0.9.4 + github.com/swaggo/files v1.0.1 + github.com/swaggo/gin-swagger v1.6.0 + github.com/swaggo/swag v1.8.12 + github.com/syyongx/php2go v0.9.8 github.com/tidwall/gjson v1.7.4 go.uber.org/zap v1.16.0 - gopkg.in/natefinch/lumberjack.v2 v2.0.0 + gopkg.in/natefinch/lumberjack.v2 v2.2.1 gopkg.in/yaml.v2 v2.4.0 - xorm.io/xorm v1.0.7 + xorm.io/xorm v1.3.1 ) require ( + code.fnuoos.com/zhimeng/model.git v0.0.2-0.20240816125909-16531d9c66f9 // indirect + filippo.io/edwards25519 v1.1.0 // indirect github.com/KyleBanks/depth v1.2.1 // indirect github.com/PuerkitoBio/goquery v1.5.1 // indirect github.com/PuerkitoBio/purell v1.1.1 // indirect @@ -41,50 +44,57 @@ require ( github.com/antchfx/htmlquery v1.3.2 // indirect github.com/antchfx/xmlquery v1.4.1 // indirect github.com/antchfx/xpath v1.3.1 // indirect + github.com/bytedance/sonic v1.8.0 // indirect + github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect github.com/gin-contrib/sse v0.1.0 // indirect github.com/go-openapi/jsonpointer v0.19.5 // indirect - github.com/go-openapi/jsonreference v0.19.5 // indirect - github.com/go-openapi/spec v0.20.3 // indirect + github.com/go-openapi/jsonreference v0.19.6 // indirect + github.com/go-openapi/spec v0.20.4 // indirect github.com/go-openapi/swag v0.19.15 // indirect github.com/gobwas/glob v0.2.3 // indirect + github.com/goccy/go-json v0.10.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.2 // indirect - github.com/golang/snappy v0.0.3 // indirect + github.com/golang/snappy v0.0.4 // indirect github.com/gookit/color v1.3.8 // indirect github.com/gorilla/context v1.1.1 // indirect github.com/gorilla/securecookie v1.1.1 // indirect github.com/gorilla/sessions v1.2.1 // indirect github.com/josharian/intern v1.0.0 // indirect - github.com/json-iterator/go v1.1.10 // indirect + github.com/json-iterator/go v1.1.12 // indirect github.com/kennygrant/sanitize v1.2.4 // indirect + github.com/klauspost/cpuid/v2 v2.0.9 // indirect github.com/leodido/go-urn v1.2.1 // indirect github.com/mailru/easyjson v0.7.7 // indirect - github.com/mattn/go-isatty v0.0.12 // indirect + github.com/mattn/go-isatty v0.0.19 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect - github.com/modern-go/reflect2 v1.0.1 // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect github.com/onsi/ginkgo v1.15.0 // indirect github.com/onsi/gomega v1.10.5 // indirect + github.com/pelletier/go-toml/v2 v2.0.6 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/saintfish/chardet v0.0.0-20230101081208-5e3ef4b5456d // indirect - github.com/smartystreets/goconvey v1.6.4 // indirect - github.com/stretchr/testify v1.7.0 // indirect + github.com/stretchr/testify v1.8.3 // indirect github.com/syndtr/goleveldb v1.0.0 // indirect github.com/temoto/robotstxt v1.1.2 // indirect github.com/tidwall/match v1.0.3 // indirect github.com/tidwall/pretty v1.1.0 // indirect - github.com/ugorji/go/codec v1.2.5 // indirect + github.com/twitchyliquid64/golang-asm v0.15.1 // indirect + github.com/ugorji/go/codec v1.2.9 // indirect go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.6.0 // indirect - golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect + golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect + golang.org/x/crypto v0.5.0 // indirect golang.org/x/lint v0.0.0-20200302205851-738671d3881b // indirect - golang.org/x/net v0.7.0 // indirect - golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect - golang.org/x/sys v0.5.0 // indirect - golang.org/x/text v0.7.0 // indirect - golang.org/x/tools v0.1.12 // indirect + golang.org/x/net v0.10.0 // indirect + golang.org/x/sync v0.1.0 // indirect + golang.org/x/sys v0.8.0 // indirect + golang.org/x/text v0.9.0 // indirect + golang.org/x/tools v0.7.0 // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect google.golang.org/appengine v1.6.1 // indirect - google.golang.org/protobuf v1.26.0 // indirect + google.golang.org/protobuf v1.28.1 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect honnef.co/go/tools v0.0.1-2020.1.4 // indirect - xorm.io/builder v0.3.9 // indirect + xorm.io/builder v0.3.11-0.20220531020008-1bd24a7dc978 // indirect ) diff --git a/main.go b/main.go index 0974be1..15e3513 100644 --- a/main.go +++ b/main.go @@ -16,7 +16,7 @@ import ( "applet/app/utils" ) -//系统初始化 +// 系统初始化 func init() { cfg.InitCfg() //配置初始化 cfg.InitLog() //日志初始化 @@ -33,16 +33,23 @@ func init() { } -// @title 智莺生活移动端接口 +// @title 广告联盟-总站长平台 // @version 1.0 -// @description 移动端接口 -// @termsOfService 智莺生活后端组 -// @contact.name sherlockwhite -// @host localhost:5000 +// @description 总站长后台接口 +// @termsOfService http://swagger.io/terms/ + +// @contact.name dengbiao +// @contact.url http://www.swagger.io/support +// @contact.email 1239118001@qq.com + +// @license.name Apache 2.0 +// @license.url http://www.apache.org/licenses/LICENSE-2.0.html + +// @host localhost:1001 or advertisement.dengbiao.top // @securityDefinitions.apikey MasterID // @in header // @name MasterID -// @BasePath / +// @BasePath /api func main() { // 启动获取所有品牌 //go taoke.GetAllBrand()