model

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 13, 2024 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NUmStr  = "0123456789"
	CharStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
	SpecStr = "+=-@#~,.[]()!%^*$"
)

Variables

View Source
var DefaultPwd = "ABC123def"

Functions

func APIToPB

func APIToPB(in *API) *apipb.APIInfo

func APIsToPB

func APIsToPB(in []API) []*apipb.APIInfo

func AddMenu

func AddMenu(menu *Menu) error

func Authenticate

func Authenticate(t, method, url string, checkAuth bool) (*apipb.CurrentUser, int, error)

func AutoMigrate

func AutoMigrate() error

AutoMigrate 自动生成表

func BindPhone

func BindPhone(userID string, phoneNuber string) error

func CheckRegisterWithWechat

func CheckRegisterWithWechat(openID string) (string, error)

func ClearCasbin

func ClearCasbin(v int, p ...string) (bool, error)

@author: [guoxf](https://github.com/guoxf) @function: ClearCasbin @description: 清除匹配的权限 @param: v int, p ...string @return: bool

func ConditionsToGormQuery

func ConditionsToGormQuery(db *gorm.DB, conditions []string, combineType CombineType) *gorm.DB

ConditionsToGormQuery is a function that converts multiple query conditions into a GORM query statement You can use the GetAllowedObjectConditions() API of Casbin to get conditions, and choose the way of combining conditions through combineType.

func CopyTenant

func CopyTenant(id string) error

func CreateAPI

func CreateAPI(api *API) error

func CreateAPP

func CreateAPP(md *APP) error

func CreateDictionaries

func CreateDictionaries(m *Dictionaries) (string, error)

func CreateFormComponent

func CreateFormComponent(m *FormComponent) (string, error)

func CreateLanguage

func CreateLanguage(m *Language) (string, error)

func CreateProject

func CreateProject(m *Project) (string, error)

func CreateRole

func CreateRole(newRole *Role) error

func CreateSystemConfig

func CreateSystemConfig(m *SystemConfig) (string, error)

func CreateTenant

func CreateTenant(m *Tenant) error

func CreateUser

func CreateUser(user *User, isCreateFromWechat bool) error

@author: [guoxf](https://github.com/guoxf) @function: CreateUser @description: 新增User @param: user User @return: err error

func CreateWebSite

func CreateWebSite(m *WebSite) (string, error)

func CreateWechatConfig

func CreateWechatConfig(m *WechatConfig) (string, error)

func DeleteAPP

func DeleteAPP(id string) (err error)

func DeleteApi

func DeleteApi(id string) (err error)

func DeleteDictionaries

func DeleteDictionaries(id string) (err error)

func DeleteFormComponent

func DeleteFormComponent(id string) (err error)

func DeleteLanguage

func DeleteLanguage(id string) (err error)

func DeleteMenu

func DeleteMenu(id string) (err error)

func DeleteProject

func DeleteProject(id string) (err error)

func DeleteRole

func DeleteRole(roleID string) (err error)

func DeleteSystemConfig

func DeleteSystemConfig(id string) (err error)

func DeleteTenant

func DeleteTenant(id string) (err error)

func DeleteUser

func DeleteUser(id string) (err error)

@author: [guoxf](https://github.com/guoxf) @function: DeleteUser @description: 删除User @param: user User @return: err error

func DeleteWebSite

func DeleteWebSite(id string) (err error)

func DeleteWechatConfig

func DeleteWechatConfig(id string) (err error)

func DictionariesArrayToPB

func DictionariesArrayToPB(in []*Dictionaries) []*apipb.DictionariesInfo

func DictionariesToPB

func DictionariesToPB(in *Dictionaries) *apipb.DictionariesInfo

func EnableAPI

func EnableAPI(id string, enable bool) error

func EnableTenant

func EnableTenant(id string, enable bool) error

func EnableUser

func EnableUser(id string, enable bool) error

func EncryptedPassword

func EncryptedPassword(password string) (string, error)

EncryptedPassword 对密码进行加密

func ExportAllAPPs

func ExportAllAPPs(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse)

func ExportAllApis

func ExportAllApis(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse)

func ExportAllDictionaries

func ExportAllDictionaries(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse)

func ExportAllLanguages

func ExportAllLanguages(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse)

func ExportAllMenus

func ExportAllMenus(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse)

func ExportAllProjects

func ExportAllProjects(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse)

func ExportAllRoles

func ExportAllRoles(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse)

func ExportAllSystemConfigs

func ExportAllSystemConfigs(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse)

func ExportAllTenants

func ExportAllTenants(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse)

func ExportAllUsers

func ExportAllUsers(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse)

func ExportAllWebSites

func ExportAllWebSites(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse)

func ExportAllWechatConfigs

func ExportAllWechatConfigs(req *apipb.CommonExportRequest, resp *apipb.CommonExportResponse)

func FormComponentToPB

func FormComponentToPB(in *FormComponent) *apipb.FormComponentInfo

func FormComponentsToPB

func FormComponentsToPB(in []*FormComponent) []*apipb.FormComponentInfo

func GetOpenIDByUserIDAndConfigID

func GetOpenIDByUserIDAndConfigID(userID, wechatConfigID string) (string, error)

func GetUserProfile

func GetUserProfile(id string, needMenu bool) (*apipb.UserProfile, error)

func Init

func Init(connStr string, debug bool)

Init Init

func InitCasbin

func InitCasbin()

func InitDB

func InitDB(client db.DBClientInterface, debug bool)

func InitSqlite

func InitSqlite(database string, debug bool)

func LanguageToPB

func LanguageToPB(in *Language) *apipb.LanguageInfo

func LanguagesToPB

func LanguagesToPB(in []*Language) []*apipb.LanguageInfo

func Login

func Login(req *apipb.LoginRequest, resp *apipb.LoginResponse)

func LoginByWechat

func LoginByWechat(register bool, req *User, resp *apipb.LoginResponse)

func Logout

func Logout(t string) error

func LogoutByUserName

func LogoutByUserName(req *apipb.LogoutByUserNameRequest, resp *apipb.CommonResponse)
func MenuFuncApisToPB(params []MenuFuncApi) []*apipb.MenuFuncApi
func MenuFuncsToPB(params []*MenuFunc) []*apipb.MenuFunc
func MenuParametersToPB(params []*MenuParameter) []*apipb.MenuParameter
func MenuToPB(in *Menu) *apipb.MenuInfo
func MenusToPB(in []*Menu) []*apipb.MenuInfo

func NewEnforcer

func NewEnforcer() *casbin.Enforcer

@author: [guoxf](https://github.com/guoxf) @function: NewEnforcer @description: 持久化到数据库 引入自定义规则 @return: *casbin.Enforcer

func ParamsMatch

func ParamsMatch(fullNameKey1 string, key2 string) bool

@author: [guoxf](https://github.com/guoxf) @function: ParamsMatch @description: 自定义规则函数 @param: fullNameKey1 string, key2 string @return: bool

func ParamsMatchFunc

func ParamsMatchFunc(args ...interface{}) (interface{}, error)

@author: [guoxf](https://github.com/guoxf) @function: ParamsMatchFunc @description: 自定义规则函数 @param: args ...interface{} @return: interface{}, error

func ProjectFormComponentsToPB

func ProjectFormComponentsToPB(in []*ProjectFormComponent) []*apipb.ProjectFormComponent

func ProjectToPB

func ProjectToPB(in *Project) *apipb.ProjectInfo

func ProjectsToPB

func ProjectsToPB(in []*Project) []*apipb.ProjectInfo

func QueryAPI

func QueryAPI(req *apipb.QueryAPIRequest, resp *apipb.QueryAPIResponse)

@author: [guoxf](https://github.com/guoxf) @function: GetAPIInfoList @description: 分页查询API @param: api API, info PageInfo, order string, desc bool @return: list []*API, total int64 , err error

func QueryAPP

func QueryAPP(req *QueryAPPRequest, resp *QueryAPPResponse)

func QueryDictionaries

func QueryDictionaries(req *apipb.QueryDictionariesRequest, resp *apipb.QueryDictionariesResponse, preload bool)

func QueryFormComponent

func QueryFormComponent(req *apipb.QueryFormComponentRequest, resp *apipb.QueryFormComponentResponse, preload bool)

func QueryLanguage

func QueryLanguage(req *apipb.QueryLanguageRequest, resp *apipb.QueryLanguageResponse, preload bool)

func QueryMenu

func QueryMenu(req *apipb.QueryMenuRequest, resp *apipb.QueryMenuResponse, preload bool)

func QueryProject

func QueryProject(req *apipb.QueryProjectRequest, resp *apipb.QueryProjectResponse, preload bool)

func QueryRole

func QueryRole(req *apipb.QueryRoleRequest, resp *apipb.QueryRoleResponse, preload bool)

func QuerySystemConfig

func QuerySystemConfig(req *apipb.QuerySystemConfigRequest, resp *apipb.QuerySystemConfigResponse, preload bool)

func QueryTenant

func QueryTenant(req *apipb.QueryTenantRequest, resp *apipb.QueryTenantResponse)

func QueryUser

func QueryUser(req *apipb.QueryUserRequest, resp *apipb.QueryUserResponse, preload bool)

@author: [guoxf](https://github.com/guoxf) @function: GetUserInfoList @description: 分页查询User @param: user User, info PageInfo, order string, desc bool @return: list []*User, total int64 , err error

func QueryWebSite

func QueryWebSite(req *apipb.QueryWebSiteRequest, resp *apipb.QueryWebSiteResponse, preload bool)

func QueryWechatConfig

func QueryWechatConfig(req *apipb.QueryWechatConfigRequest, resp *apipb.QueryWechatConfigResponse, preload bool)

func ResetPwd

func ResetPwd(id string, pwd string) error

func RoleMenusToPB

func RoleMenusToPB(roleMenus []*RoleMenu) []*apipb.RoleMenu

func RoleToPB

func RoleToPB(in *Role) *apipb.RoleInfo

func RolesToPB

func RolesToPB(in []*Role) []*apipb.RoleInfo

func SetDefaultPwd

func SetDefaultPwd(defaultPwd string)

func StatisticRoleCount

func StatisticRoleCount(tenantID string) (int64, error)

func StatisticTenantCount

func StatisticTenantCount() (int64, error)

func StatisticUserCount

func StatisticUserCount(t int, tenantID, group string) (int64, error)

func SystemConfigToPB

func SystemConfigToPB(in *SystemConfig) *apipb.SystemConfigInfo

func SystemConfigsToPB

func SystemConfigsToPB(in []*SystemConfig) []*apipb.SystemConfigInfo

func TenantCertificateToPB

func TenantCertificateToPB(in *TenantCertificate) *apipb.TenantCertificate

func TenantMenusToPB

func TenantMenusToPB(tenantMenus []*TenantMenu) []*apipb.TenantMenu

func TenantToPB

func TenantToPB(in *Tenant) *apipb.TenantInfo

func TenantsToPB

func TenantsToPB(in []*Tenant) []*apipb.TenantInfo

func TurnOffAutoMigrate

func TurnOffAutoMigrate(db *gorm.DB)

func UpdateAPI

func UpdateAPI(api *API) error

func UpdateAPP

func UpdateAPP(md *APP) error

func UpdateBasics

func UpdateBasics(m *User) error

func UpdateCasbin

func UpdateCasbin(roleID string, casbinInfos []*CasbinRule) error

@author: [guoxf](https://github.com/guoxf) @function: UpdateCasbin @description: 更新casbin权限 @param: roleID string, casbinInfos []CasbinRule @return: error

func UpdateCasbinApi

func UpdateCasbinApi(oldPath string, newPath string, oldMethod string, newMethod string) error

@author: [guoxf](https://github.com/guoxf) @function: UpdateCasbinApi @description: API更新随动 @param: oldPath string, newPath string, oldMethod string, newMethod string @return: error

func UpdateDictionaries

func UpdateDictionaries(m *Dictionaries) error

func UpdateFormComponent

func UpdateFormComponent(m *FormComponent) error

func UpdateLanguage

func UpdateLanguage(m *Language) error

func UpdateMenu

func UpdateMenu(menu *Menu) (err error)

func UpdateProfile

func UpdateProfile(m *User, updateUserName bool) error

UpdateProfile 更新个人信息

func UpdateProfileAndUserName

func UpdateProfileAndUserName(m *User) error

func UpdateProject

func UpdateProject(m *Project) error

func UpdateProjectAll

func UpdateProjectAll(m *Project) error

func UpdatePwd

func UpdatePwd(id string, oldPwd, newPwd string) error

func UpdateRole

func UpdateRole(newRole *Role) error

func UpdateSystemConfig

func UpdateSystemConfig(m *SystemConfig) error

func UpdateTenant

func UpdateTenant(newTenant *Tenant) error

func UpdateUser

func UpdateUser(user *User) error

@author: [guoxf](https://github.com/guoxf) @function: UpdateUser @description: 根据id更新user @param: user User @return: err error

func UpdateUserAgeHeightWeight

func UpdateUserAgeHeightWeight(m *User) error

func UpdateWebSite

func UpdateWebSite(m *WebSite) error

func UpdateWechatConfig

func UpdateWechatConfig(m *WechatConfig) error

func UserRolesToPB

func UserRolesToPB(userRoles []*UserRole) []*apipb.UserRole

func UserToPB

func UserToPB(in *User) *apipb.UserInfo

func UserWechatOpenIDMapsToPB

func UserWechatOpenIDMapsToPB(maps []*UserWechatOpenIDMap) []*apipb.UserWechatOpenIDMap

func UsersToPB

func UsersToPB(in []*User) []*apipb.UserInfo

func ValidPasswdStrength

func ValidPasswdStrength(str string) bool

func WebSiteToPB

func WebSiteToPB(in *WebSite) *apipb.WebSiteInfo

func WebSitesToPB

func WebSitesToPB(in []*WebSite) []*apipb.WebSiteInfo

func WechatConfigToPB

func WechatConfigToPB(in *WechatConfig) *apipb.WechatConfigInfo

func WechatConfigsToPB

func WechatConfigsToPB(in []*WechatConfig) []*apipb.WechatConfigInfo

Types

type API

type API struct {
	commonmodel.Model
	TenantID    string `json:"tenantID" gorm:"index;size:36"`
	ProjectID   string `json:"projectID" gorm:"index;size:36"`
	Path        string `json:"path" gorm:"size:200;index;comment:路径"`
	Group       string `json:"group" gorm:"size:50;index;comment:分组"`
	Method      string `json:"method" gorm:"size:50;index;default:POST;comment:方法"`
	Description string `json:"description" gorm:"size:200;index;comment:中文描述"`
	Enable      bool   `json:"enable" gorm:"index;comment:是否启用API"`
	//如果不开启权限校验,那么在每个角色都加上casbin rule
	//1. 不需要登录就可以直接访问
	//2. 需要登录但不需要校验权限,也就是所有人都可以访问
	//3. 需要登录并且校验权限
	CheckAuth  bool `json:"checkAuth" gorm:"index;comment:是否校验权限"`
	CheckLogin bool `json:"checkLogin" gorm:"index;comment:是否校验登录"`
	IsMust     bool `json:"isMust" gorm:"index;comment:系统必须要有的数据"`
}

func GetAPIById

func GetAPIById(id string) (api API, err error)

func GetAllAPIs

func GetAllAPIs(req *apipb.QueryAPIRequest) (apis []API, err error)

func PBToAPI

func PBToAPI(in *apipb.APIInfo) *API

func (API) TableName

func (API) TableName() string

type APP

type APP struct {
	model.Model
	TenantID    string    `json:"tenantID" gorm:"size:36;index" `
	ProjectID   string    `json:"projectID" gorm:"index;size:36"`
	Name        string    `json:"name" gorm:"size:200;index"`
	Entry       string    `json:"entry" gorm:"size:200;"`
	DevEntry    string    `json:"devEntry" gorm:"size:200;"`
	TestEntry   string    `json:"testEntry" gorm:"size:200;"`
	PreEntry    string    `json:"preEntry" gorm:"size:200;"`
	DisplayName string    `json:"displayName" gorm:"size:100;comment:显示名字"`
	Credentials bool      `json:"credentials"`
	Description string    `json:"description" gorm:"size:200;"`
	Props       []APPProp `json:"props"`
	Container   string    `json:"container" gorm:"size:100"`
	ActiveRule  string    `json:"activeRule" gorm:"size:200"`
	Enable      bool      `json:"enable"`
	IsMust      bool      `json:"isMust" gorm:"index;comment:系统必须要有的数据"`
}

func GetAPPById

func GetAPPById(id string) (md APP, err error)

func GetAllAPPs

func GetAllAPPs() (mds []*APP, err error)

type APPProp

type APPProp struct {
	gorm.Model
	APPID uint   `json:"appID"`
	Key   string `json:"key" gorm:"size:50;"`
	Value string `json:"value" gorm:"size:200;"`
}

type Adapter

type Adapter struct {
	// contains filtered or unexported fields
}

Adapter represents the Gorm adapter for policy storage.

func NewAdapter

func NewAdapter(driverName string, dataSourceName string, params ...interface{}) (*Adapter, error)

NewAdapter is the constructor for Adapter. Params : databaseName,tableName,dbSpecified

databaseName,{tableName/dbSpecified}
{database/dbSpecified}

databaseName and tableName are user defined. Their default value are "casbin" and "casbin_rule"

dbSpecified is an optional bool parameter. The default value is false. It's up to whether you have specified an existing DB in dataSourceName. If dbSpecified == true, you need to make sure the DB in dataSourceName exists. If dbSpecified == false, the adapter will automatically create a DB named databaseName.

func NewAdapterByDB

func NewAdapterByDB(db *gorm.DB) (*Adapter, error)

NewAdapterByDB creates gorm-adapter by an existing Gorm instance

func NewAdapterByDBUseTableName

func NewAdapterByDBUseTableName(db *gorm.DB, prefix string, tableName string) (*Adapter, error)

NewAdapterByDBUseTableName creates gorm-adapter by an existing Gorm instance and the specified table prefix and table name Example: gormadapter.NewAdapterByDBUseTableName(&db, "cms", "casbin") Automatically generate table name like this "cms_casbin"

func NewAdapterByDBWithCustomTable

func NewAdapterByDBWithCustomTable(db *gorm.DB, t interface{}, tableName ...string) (*Adapter, error)

func NewAdapterByMulDb

func NewAdapterByMulDb(dbPool DbPool, dbName string, prefix string, tableName string) (*Adapter, error)

func NewFilteredAdapter

func NewFilteredAdapter(driverName string, dataSourceName string, params ...interface{}) (*Adapter, error)

NewFilteredAdapter is the constructor for FilteredAdapter. Casbin will not automatically call LoadPolicy() for a filtered adapter.

func NewFilteredAdapterByDB

func NewFilteredAdapterByDB(db *gorm.DB, prefix string, tableName string) (*Adapter, error)

NewFilteredAdapterByDB is the constructor for FilteredAdapter. Casbin will not automatically call LoadPolicy() for a filtered adapter.

func (*Adapter) AddLogger

func (a *Adapter) AddLogger(l logger.Interface)

AddLogger adds logger to db

func (*Adapter) AddPolicies

func (a *Adapter) AddPolicies(sec string, ptype string, rules [][]string) error

AddPolicies adds multiple policy rules to the storage.

func (*Adapter) AddPolicy

func (a *Adapter) AddPolicy(sec string, ptype string, rule []string) error

AddPolicy adds a policy rule to the storage.

func (*Adapter) AddPolicyCtx

func (a *Adapter) AddPolicyCtx(ctx context.Context, sec string, ptype string, rule []string) error

AddPolicyCtx adds a policy rule to the storage.

func (*Adapter) Close

func (a *Adapter) Close() error

func (*Adapter) GetDb

func (a *Adapter) GetDb() *gorm.DB

func (*Adapter) IsFiltered

func (a *Adapter) IsFiltered() bool

IsFiltered returns true if the loaded policy has been filtered.

func (*Adapter) LoadFilteredPolicy

func (a *Adapter) LoadFilteredPolicy(model model.Model, filter interface{}) error

LoadFilteredPolicy loads only policy rules that match the filter.

func (*Adapter) LoadPolicy

func (a *Adapter) LoadPolicy(model model.Model) error

LoadPolicy loads policy from database.

func (*Adapter) LoadPolicyCtx

func (a *Adapter) LoadPolicyCtx(ctx context.Context, model model.Model) error

LoadPolicyCtx loads policy from database.

func (*Adapter) Open

func (a *Adapter) Open() error

func (*Adapter) Preview

func (a *Adapter) Preview(rules *[]CasbinRule, model model.Model) error

Preview Pre-checking to avoid causing partial load success and partial failure deep

func (*Adapter) RemoveFilteredPolicy

func (a *Adapter) RemoveFilteredPolicy(sec string, ptype string, fieldIndex int, fieldValues ...string) error

RemoveFilteredPolicy removes policy rules that match the filter from the storage.

func (*Adapter) RemoveFilteredPolicyCtx

func (a *Adapter) RemoveFilteredPolicyCtx(ctx context.Context, sec string, ptype string, fieldIndex int, fieldValues ...string) error

RemoveFilteredPolicyCtx removes policy rules that match the filter from the storage.

func (*Adapter) RemovePolicies

func (a *Adapter) RemovePolicies(sec string, ptype string, rules [][]string) error

RemovePolicies removes multiple policy rules from the storage.

func (*Adapter) RemovePoliciesCtx

func (a *Adapter) RemovePoliciesCtx(ctx context.Context, sec string, ptype string, rules [][]string) error

RemovePoliciesCtx removes multiple policy rules from the storage.

func (*Adapter) RemovePolicy

func (a *Adapter) RemovePolicy(sec string, ptype string, rule []string) error

RemovePolicy removes a policy rule from the storage.

func (*Adapter) RemovePolicyCtx

func (a *Adapter) RemovePolicyCtx(ctx context.Context, sec string, ptype string, rule []string) error

RemovePolicyCtx removes a policy rule from the storage.

func (*Adapter) SavePolicy

func (a *Adapter) SavePolicy(model model.Model) error

SavePolicy saves policy to database.

func (*Adapter) SavePolicyCtx

func (a *Adapter) SavePolicyCtx(ctx context.Context, model model.Model) error

SavePolicyCtx saves policy to database.

func (*Adapter) Transaction

func (a *Adapter) Transaction(e casbin.IEnforcer, fc func(casbin.IEnforcer) error, opts ...*sql.TxOptions) error

Transaction perform a set of operations within a transaction

func (*Adapter) UpdateFilteredPolicies

func (a *Adapter) UpdateFilteredPolicies(sec string, ptype string, newPolicies [][]string, fieldIndex int, fieldValues ...string) ([][]string, error)

func (*Adapter) UpdatePolicies

func (a *Adapter) UpdatePolicies(sec string, ptype string, oldRules, newRules [][]string) error

func (*Adapter) UpdatePolicy

func (a *Adapter) UpdatePolicy(sec string, ptype string, oldRule, newPolicy []string) error

UpdatePolicy updates a new policy rule to DB.

type BatchFilter

type BatchFilter struct {
	// contains filtered or unexported fields
}

type CasbinRule

type CasbinRule struct {
	ID        uint   `gorm:"primaryKey;autoIncrement"`
	Ptype     string `json:"ptype" gorm:"column:ptype;size:8;uniqueIndex:unique_index"`
	RoleID    string `json:"roleID" gorm:"column:v0;size:36;uniqueIndex:unique_index"`
	Path      string `json:"path" gorm:"column:v1;size:200;uniqueIndex:unique_index"`
	Method    string `json:"method" gorm:"column:v2;size:10;uniqueIndex:unique_index"`
	CheckAuth string `gorm:"column:v3;size:10;uniqueIndex:unique_index"`
	V4        string `gorm:"size:128;uniqueIndex:unique_index"`
	V5        string `gorm:"size:128;uniqueIndex:unique_index"`
}

func GetPolicyPathByRoleID

func GetPolicyPathByRoleID(roleID string) (pathMaps []*CasbinRule)

@author: [guoxf](https://github.com/guoxf) @function: GetPolicyPathByRoleID @description: 获取权限列表 @param: roleID string @return: pathMaps []CasbinRule

func (CasbinRule) TableName

func (CasbinRule) TableName() string

type CheckRegisterWithWechatResp

type CheckRegisterWithWechatResp struct {
	model.CommonResponse
	Data bool `json:"data"`
}

type CombineType

type CombineType uint32

CombineType represents different types of condition combining strategies

const (
	CombineTypeOr  CombineType = iota // Combine conditions with OR operator
	CombineTypeAnd                    // Combine conditions with AND operator
)

type DbPool

type DbPool struct {
	// contains filtered or unexported fields
}

func InitDbResolver

func InitDbResolver(dbArr []gorm.Dialector, dbNames []string) (DbPool, error)

InitDbResolver multiple databases support Example usage: dbPool,err := InitDbResolver([]gorm.Dialector{mysql.Open(dsn),mysql.Open(dsn2)},[]string{"casbin1","casbin2"}) a := initAdapterWithGormInstanceByMulDb(t,dbPool,"casbin1","","casbin_rule1") a = initAdapterWithGormInstanceByMulDb(t,dbPool,"casbin2","","casbin_rule2")/*

type Dictionaries

type Dictionaries struct {
	commonmodel.Model
	//Description
	Description string `json:"description" gorm:"size:200" `
	//Name
	Name string `json:"name" gorm:"size:100" `
	//Type
	Type string `json:"type" gorm:"size:100" `
	//Value
	Value string `json:"value" gorm:"" `
	//租户ID
	TenantID  string `json:"tenantID" gorm:"size:36;index" `
	ProjectID string `json:"projectID" gorm:"index;size:36"`
	IsMust    bool   `json:"isMust" gorm:"index;comment:系统必须要有的数据"`
}

func GetAllDictionaries

func GetAllDictionaries() (list []*Dictionaries, err error)

func GetDictionariesByID

func GetDictionariesByID(id string) (*Dictionaries, error)

func GetDictionariesByIDs

func GetDictionariesByIDs(ids []string) ([]*Dictionaries, error)

func PBToDictionaries

func PBToDictionaries(in []*apipb.DictionariesInfo) []*Dictionaries

func PBToDictionariesArray

func PBToDictionariesArray(in *apipb.DictionariesInfo) *Dictionaries

type Filter

type Filter struct {
	Ptype []string
	V0    []string
	V1    []string
	V2    []string
	V3    []string
	V4    []string
	V5    []string
}

type FormComponent

type FormComponent struct {
	commonmodel.Model
	Name            string `json:"name" gorm:"size:200;index"`
	Title           string `gorm:"size:200"`
	Group           string `gorm:"size:100;index"`
	Index           int32
	Description     string `gorm:"size:1000"`
	Extends         string `gorm:"size:200"`
	Selector        string `gorm:"size:200"`
	DesignerProps   string
	DesignerLocales string
	Resource        *FormComponentResource
	Byo             bool `gorm:"comment:formily自带"`
}

func GetFormComponentByID

func GetFormComponentByID(id string) (*FormComponent, error)

func PBToFormComponent

func PBToFormComponent(in *apipb.FormComponentInfo) *FormComponent

func PBToFormComponents

func PBToFormComponents(in []*apipb.FormComponentInfo) []*FormComponent

type FormComponentResource

type FormComponentResource struct {
	commonmodel.Model
	FormComponentID string `gorm:"size:36;index"`
	Icon            string `gorm:"size:500"`
	Thumb           string `gorm:"size:500"`
	Title           string `gorm:"size:200"`
	Description     string `gorm:"size:1000"`
	Span            int32
	Elements        string
}

type Language

type Language struct {
	commonmodel.Model
	//Chinese
	Chinese string `json:"chinese" gorm:"size:200" `
	//Description
	Description string `json:"description" gorm:"size:400" `
	//English
	English string `json:"english" gorm:"size:200" `
	//Group
	Group string `json:"group" gorm:"size:100" `
	//Japan
	Japan string `json:"japan" gorm:"size:200" `
	//Name
	Name string `json:"name" gorm:"size:100" `
	//System Admin-管理后台 APP
	System string `json:"system" gorm:"size:50;comment:Admin-管理后台 APP" `
	//所属站点
	WebSiteID string `json:"webSiteID" gorm:"size:36;index" `
	TenantID  string `json:"tenantID" gorm:"size:36;index" `
	ProjectID string `json:"projectID" gorm:"index;size:36"`
	IsMust    bool   `json:"isMust" gorm:"index;comment:系统必须要有的数据"`
}

func GetAllLanguages

func GetAllLanguages() (list []*Language, err error)

func GetLanguageByID

func GetLanguageByID(id string) (*Language, error)

func GetLanguageByIDs

func GetLanguageByIDs(ids []string) ([]*Language, error)

func PBToLanguage

func PBToLanguage(in *apipb.LanguageInfo) *Language

func PBToLanguages

func PBToLanguages(in []*apipb.LanguageInfo) []*Language
type Menu struct {
	model.Model
	TenantID    string           `json:"tenantID" gorm:"size:36;index" `
	ProjectID   string           `json:"projectID" gorm:"index;size:36"`
	Level       uint32           `json:"level"`
	ParentID    string           `json:"parentID" gorm:"comment:父菜单ID"`
	Path        string           `json:"path" gorm:"size:200;comment:路由path"`
	Name        string           `json:"name" gorm:"size:100;comment:路由name"`
	Hidden      bool             `json:"hidden" gorm:"comment:是否在列表隐藏"`
	Component   string           `json:"component" gorm:"size:200;comment:对应前端文件路径"`
	Sort        int32            `json:"sort" gorm:"comment:排序标记"`
	Cache       bool             `json:"cache" gorm:"comment:是否缓存"`
	DefaultMenu bool             `json:"defaultMenu" gorm:"comment:是否是基础路由(开发中)"`
	Title       string           `json:"title" gorm:"size:100;comment:菜单名"`
	Icon        string           `json:"icon" gorm:"size:100;comment:菜单图标"`
	CloseTab    bool             `json:"closeTab" gorm:"comment:自动关闭tab"`
	IsMust      bool             `json:"isMust" gorm:"index;comment:系统必须要有的数据"`
	Children    []*Menu          `json:"children" gorm:"-"`
	Parameters  []*MenuParameter `json:"parameters"`
	MenuFuncs   []*MenuFunc      `json:"menuFuncs"`
}

func GetAllMenus

func GetAllMenus(req *apipb.QueryMenuRequest) (menus []*Menu, err error)

func GetAuthorizedMenu

func GetAuthorizedMenu[T interface {
	GetMenuID() string
	GetFuncs() []string
	GetShow() bool
	*RoleMenu | *TenantMenu
}](tx *gorm.DB, authiruzedMenu map[string]T, hidden bool) ([]*Menu, error)

GetAuthorizedMenu 获取有权限的菜单 hidden为True时,隐藏在菜单中不显示的数据

func GetAuthorizedMenuTree

func GetAuthorizedMenuTree(tenantID string) (list []*Menu, total int64, err error)

func GetBaseMenuTree

func GetBaseMenuTree() (menus []*Menu, err error)

func GetMenuByID

func GetMenuByID(id string) (*Menu, error)

func GetMenuTreeByRoleID

func GetMenuTreeByRoleID(roleID string) (menus []*Menu, err error)

func PBToMenu

func PBToMenu(in *apipb.MenuInfo) *Menu
type MenuFunc struct {
	model.Model
	MenuID       string        `json:"menuID" gorm:"index"`
	Name         string        `json:"name" gorm:"size:100;comment:功能名称"`
	Title        string        `json:"title" gorm:"size:100;comment:显示名称"`
	Hidden       bool          `json:"hidden" gorm:"comment:是否隐藏"`
	MenuFuncApis []MenuFuncApi `json:"menuFuncApis"`
}

func PBToMenuFuncs

func PBToMenuFuncs(params []*apipb.MenuFunc) []*MenuFunc
type MenuFuncApi struct {
	model.Model
	MenuFuncID string `json:"menuFuncID" gorm:"index"`
	APIID      string `json:"apiID" gorm:"column:api_id"`
	API        *API   `json:"apiInfo"`
}

func PBToMenuFuncApis

func PBToMenuFuncApis(params []*apipb.MenuFuncApi) []MenuFuncApi
type MenuParameter struct {
	model.Model
	MenuID string `json:"menuID" gorm:"index"`
	Type   string `json:"type" gorm:"size:50;comment:地址栏携带参数为params还是query"`
	Key    string `json:"key" gorm:"size:100;comment:地址栏携带参数的key"`
	Value  string `json:"value" gorm:"size:200;comment:地址栏携带参数的值"`
}

func PBToMenuParameters

func PBToMenuParameters(params []*apipb.MenuParameter) []*MenuParameter

type Project

type Project struct {
	commonmodel.Model
	TenantID       string                  `json:"tenantID" gorm:"size:36;index" `
	Name           string                  `json:"name" gorm:"size:200;index" `
	FormCount      int32                   `json:"formCount" gorm:"comment:可以创建的表单数量,-1为不限制" `
	PageCount      int32                   `json:"pageCount" gorm:"comment:可以创建的页面数量,-1为不限制" `
	Expired        time.Time               `json:"expired" gorm:"comment:项目继续维护表单和页面的过期时间" `
	Description    string                  `json:"description" gorm:"size:500" `
	CellCount      int32                   `json:"cellCount" gorm:"" `
	FormComponents []*ProjectFormComponent `json:"formComponents" gorm:"size:36" `
	IsMust         bool                    `json:"isMust" gorm:"index;comment:系统必须要有的数据"`
}

func GetAllProjects

func GetAllProjects() (list []*Project, err error)

func GetProjectByID

func GetProjectByID(id string) (*Project, error)

func PBToProject

func PBToProject(in *apipb.ProjectInfo) *Project

func PBToProjects

func PBToProjects(in []*apipb.ProjectInfo) []*Project

type ProjectFormComponent

type ProjectFormComponent struct {
	commonmodel.Model
	ProjectID string `json:"projectID" gorm:"size:36;index" `
	Name      string `json:"name" gorm:"size:200;index" `
}

func PBToProjectFormComponents

func PBToProjectFormComponents(in []*apipb.ProjectFormComponent) []*ProjectFormComponent

type PwdStrength

type PwdStrength int
const (
	PwdStrengthOnliyNumber PwdStrength = iota
	PwdStrengthOnliyChar
	PwdStrengthMix
	PwdStrengthAdvance
)

type QueryAPIRequest

type QueryAPIRequest struct {
	commonmodel.CommonRequest
	Path       string `json:"path" form:"path" path:"path"`
	Method     string `json:"method" form:"method" path:"method"`
	Group      string `json:"group" form:"group" path:"group"`
	CheckAuth  int    `json:"checkAuth" form:"checkAuth" path:"checkAuth"`
	CheckLogin int    `json:"checkLogin" form:"checkLogin" path:"checkLogin"`
}

type QueryAPIResponse

type QueryAPIResponse struct {
	commonmodel.CommonResponse
	Data []API `json:"data"`
}

type QueryAPPRequest

type QueryAPPRequest struct {
	model.CommonRequest
	Name       string `json:"name" form:"name" uri:"name"`
	Enable     int    `json:"enable" form:"enable" uri:"enable"`
	IsMust     bool   `json:"isMust" form:"isMust" uri:"isMust"`
	SortConfig string `json:"sortConfig" form:"sortConfig" uri:"sortConfig"`
}

type QueryAPPResponse

type QueryAPPResponse struct {
	model.CommonResponse
	Data []*APP `json:"data"`
}

type QueryUserRequest

type QueryUserRequest struct {
	model.CommonRequest
	UserName  string `json:"userName" form:"userName" uri:"userName"`
	Nickname  string `json:"nickname" form:"nickname" uri:"nickname"`
	IDCard    string `json:"idCard" form:"idCard" uri:"idCard"`
	Mobile    string `json:"mobile" form:"mobile" uri:"mobile"`
	WechatID  string `json:"wechatID" form:"wechatID" uri:"wechatID"`
	Title     string `json:"title" form:"title" uri:"title"`
	UserNames string `json:"userNames" form:"userNames" uri:"userNames"`
}

type QueryUserResponse

type QueryUserResponse struct {
	model.CommonResponse
	Data []*User `json:"data"`
}

type Role

type Role struct {
	model.Model
	TenantID      string      `gorm:"index;size:36"`
	ProjectID     string      `gorm:"index;size:36"`
	Name          string      `json:"name" gorm:"size:100;comment:角色名"`
	ParentID      string      `json:"parentID" gorm:"comment:父角色ID"`
	Children      []*Role     `json:"children" gorm:"-"`
	RoleMenus     []*RoleMenu `json:"roleMenus"`
	DefaultRouter string      `json:"defaultRouter" gorm:"size:100;comment:默认菜单;default:dashboard"`
	Description   string      `json:"description" gorm:"size:200;"`
	CanDel        bool        `json:"canDel" gorm:"default:1"`
	Tenant        *Tenant     `json:"tenant"`
	Public        bool        `gorm:"comment:是否是公共角色;default:0"`
	IsMust        bool        `json:"isMust" gorm:"index;comment:系统必须要有的数据"`
}

func CopyRole

func CopyRole(copyInfo RoleCopyResponse) (*Role, error)

func GetAllRole

func GetAllRole(tenantID string, containerCommon bool) (roles []*Role, err error)

GetAllRole 获取所有用户 containerCommon true-包含公共角色 false-不包含公共角色 公共角色定义:不设置租户的角色

func GetFullRoleByID

func GetFullRoleByID(id string) (*Role, error)

func GetRoleByID

func GetRoleByID(id string) (*Role, error)

func PBToRole

func PBToRole(in *apipb.RoleInfo) *Role

type RoleCopyResponse

type RoleCopyResponse struct {
	Role      Role   `json:"role"`
	OldRoleID string `json:"oldRoleID"`
}

type RoleMenu

type RoleMenu struct {
	model.Model
	RoleID string `json:"roleID" gorm:"index;comment:角色ID"`
	MenuID string `json:"menuID" gorm:"index;comment:菜单ID"`
	Funcs  string `json:"funcs" gorm:"size:500;comment:功能名称,多个以逗号隔开"`
	Show   bool
	Menu   *Menu `json:"menu"`
}

func GetMenuRole

func GetMenuRole(roleID string) (menus []RoleMenu, err error)

func PBToRoleMenus

func PBToRoleMenus(roleMenus []*apipb.RoleMenu) []*RoleMenu

func (*RoleMenu) GetFuncs

func (r *RoleMenu) GetFuncs() []string

func (*RoleMenu) GetMenuID

func (r *RoleMenu) GetMenuID() string

func (*RoleMenu) GetShow

func (r *RoleMenu) GetShow() bool

type RoleResponse

type RoleResponse struct {
	Role Role `json:"role"`
}

type SystemConfig

type SystemConfig struct {
	commonmodel.Model
	//加密key
	Key string `json:"key" gorm:"size:36" `
	//Redis地址
	RedisAddr string `json:"redisAddr" gorm:"size:100" `
	//Redis用户名
	RedisName string `json:"redisName" gorm:"size:100" `
	//Redis密码
	RedisPwd string `json:"redisPwd" gorm:"size:36" `
	//Token过期时间 单位分钟
	Expired string `json:"expired" gorm:"size:36;comment:单位分钟" `
	//重置默认密码
	DefaultPwd string `json:"defaultPwd" gorm:"size:36" `
	//超级管理员角色
	SuperAdminRoleID string `json:"superAdminRoleID" gorm:"size:36" `
	//平台租户
	PlatformTenantID string `json:"platformTenantID" gorm:"size:36" `
	//启用租户
	EnableTenant bool   `json:"enableTenant" gorm:"" `
	TenantID     string `json:"tenantID" gorm:"size:36;index" `
	ProjectID    string `json:"projectID" gorm:"index;size:36"`
	IsMust       bool   `json:"isMust" gorm:"index;comment:系统必须要有的数据"`
}

func GetAllSystemConfigs

func GetAllSystemConfigs() (list []*SystemConfig, err error)

func GetSystemConfigByID

func GetSystemConfigByID(id string) (*SystemConfig, error)

func GetSystemConfigByIDs

func GetSystemConfigByIDs(ids []string) ([]*SystemConfig, error)

func PBToSystemConfig

func PBToSystemConfig(in *apipb.SystemConfigInfo) *SystemConfig

func PBToSystemConfigs

func PBToSystemConfigs(in []*apipb.SystemConfigInfo) []*SystemConfig

type Tenant

type Tenant struct {
	model.Model
	// 租户名称
	// required: true
	// @inject_tag: validate:"required"
	Name string `json:"name" validate:"required" gorm:"index;size:200"`
	// 联系人
	Contact string `json:"contact" gorm:"size:100"`
	// 联系人电话
	CellPhone string `json:"cellPhone" gorm:"size:50"`
	// 地址
	Address string `json:"address" gorm:"size:200"`
	// 业务范围
	BusinessScope string `json:"businessScope" gorm:"size:200"`
	// 占地面积
	AreaCovered string `json:"areaCovered" gorm:"size:100"`
	// 人员规模
	StaffSize int32 `json:"staffSize"`
	Enable    bool  `json:"enable" gorm:"index"`
	//省份
	Province string `gorm:"index;size:12"`
	//城市
	City string `gorm:"index;size:12"`
	//区/县
	Area string `gorm:"index;size:12"`
	//街道/镇
	Town         string `gorm:"index;size:12"`
	UserCount    int32
	RoleCount    int32
	ProjectCount int32
	Expired      time.Time
	TenantMenus  []*TenantMenu
	Certificate  *TenantCertificate
	IsMust       bool `json:"isMust" gorm:"index;comment:系统必须要有的数据"`
}

func GetAllTenant

func GetAllTenant() (list []*Tenant, err error)

func GetTenantByID

func GetTenantByID(id string) (*Tenant, error)

func PBToTenant

func PBToTenant(in *apipb.TenantInfo) *Tenant

type TenantCertificate

type TenantCertificate struct {
	model.Model
	TenantID   string `json:"tenantID" gorm:"index;comment:租户ID"`
	PrivateKey string `gorm:"size:1000"`
	PublicKey  string `gorm:"size:1000"`
}

func PBToTenantCertificate

func PBToTenantCertificate(in *apipb.TenantCertificate) *TenantCertificate

type TenantMenu

type TenantMenu struct {
	model.Model
	TenantID string `json:"tenantID" gorm:"index;comment:租户ID"`
	MenuID   string `json:"menuID" gorm:"index;comment:菜单ID"`
	Funcs    string `json:"funcs" gorm:"size:500;comment:功能名称,多个以逗号隔开"`
	Menu     *Menu  `json:"menu"`
}

func PBToTenantMenus

func PBToTenantMenus(tenantMenus []*apipb.TenantMenu) []*TenantMenu

func (*TenantMenu) GetFuncs

func (r *TenantMenu) GetFuncs() []string

func (*TenantMenu) GetMenuID

func (r *TenantMenu) GetMenuID() string

func (*TenantMenu) GetShow

func (r *TenantMenu) GetShow() bool

type User

type User struct {
	model.TenantModel
	ProjectID string `json:"projectID" gorm:"index;size:36"`
	//账号信息
	UserName       string      `json:"userName"  validate:"required" gorm:"size:50;index;comment:用户登录名"`
	Password       string      `json:"password"  gorm:"size:200;comment:用户登录密码"`
	Nickname       string      `json:"nickname"  validate:"required" gorm:"size:100;index;default:未设置;comment:用户昵称" `
	UserRoles      []*UserRole `json:"userRoles"`
	RoleIDs        []string    `json:"roleIDs" gorm:"-"`
	WechatUnionID  string      `json:"wechatUnionID" gorm:"size:36;index;comment:微信UionID"`
	WechatOpenID   string      `json:"wechatOpenID" gorm:"size:36;index;comment:微信OpenID"`
	WechatConfigID string      `json:"wechatConfigID" gorm:"size:36;index;comment:微信配置ID"`
	//用户类型
	Type  int32  `json:"type" gorm:"index"`
	Group string `json:"group" gorm:"index;size:50"`
	//启用账号后可以登录系统
	Enable bool `json:"enable" gorm:"index"`
	// 用户名/密码错误次数
	ErrNumber int32 `json:"errNumber"`
	// 随着密码/用户名错误次数增加,用户被锁定的时间也就越长,一天最多错误5次
	LockedExpired int64 `json:"lockedExpired"`
	// 强制修改密码
	ForceChangePwd bool `json:"forceChangePwd"`
	// 用户过期时间
	Expired                int64 `json:"expired"`
	ChangePwdErrNum        int32 `json:"changePwdErrNum"`
	ChangePwdLockedExpired int64 `json:"changePwdLockedExpired"`

	CanDel bool `json:"canDel"`

	//基本信息
	Email       string  `json:"email" gorm:"size:100;"`
	Mobile      string  `json:"mobile" gorm:"size:20;index;comment:手机号"`
	IDCard      string  `json:"idCard"  gorm:"size:18;index;comment:身份证号"`
	Avatar      string  `json:"avatar" gorm:"size:200;comment:用户头像"`
	EID         string  `json:"eid" gorm:"size:50;"`
	Title       string  `json:"title" gorm:"size:100;comment:职位"`
	Description string  `json:"description" gorm:"size:200;"`
	RealName    string  `json:"realName" gorm:"index;size:50;"`
	Gender      bool    `json:"gender"`         //性别 true=男
	Age         int32   `json:"age" gorm:"" `   //年龄
	Height      float32 `json:"height" gorm:""` //身高
	Weight      float32 `json:"weight" gorm:""` //体重

	ChineseName string `json:"chineseName" gorm:"size:50"`
	EnglishName string `json:"englishName" gorm:"size:50"`
	StaffNo     string `json:"staffNo" gorm:"index;size:50"`

	Country    string    `json:"country" gorm:"size:100;"`  //国家
	Province   string    `json:"province" gorm:"size:100;"` //省份
	City       string    `json:"city" gorm:"size:100;"`     //城市
	County     string    `json:"county" gorm:"size:100;"`   //区县
	Birthday   int64     `json:"birthday"`                  //公历出生日期包含时分
	IsVip      bool      `json:"isVip"`
	VipExpired time.Time `json:"vipExpired"`

	Tenant           *Tenant                `json:"tenant"`
	IsMust           bool                   `json:"isMust" gorm:"index;comment:系统必须要有的数据"`
	WechatOpenIDMaps []*UserWechatOpenIDMap `json:"wechatOpenIDMaps"`
}

func GetAllUsers

func GetAllUsers(req *apipb.GetAllUsersRequest) (users []*User, err error)

@author: [guoxf](https://github.com/guoxf) @function: GetAllUsers @description: 获取所有User @return: users []User , err error

func GetUserById

func GetUserById(id string) (user User, err error)

@author: [guoxf](https://github.com/guoxf) @function: GetUserById @description: 根据id获取user @param: id uint @return: user User , err error

func PBToUser

func PBToUser(in *apipb.UserInfo) *User

func UserProfileToUser

func UserProfileToUser(in *apipb.UserProfile) *User

func (User) GetRoleIDs

func (u User) GetRoleIDs() []string

type UserProfile

type UserProfile struct {
	apipb.UserProfile
	Menus []*Menu `json:"menus"`
}

type UserRole

type UserRole struct {
	model.Model
	UserID string `json:"userID" gorm:"index"`
	RoleID string `json:"roleID" gorm:"index"`
	Role   *Role
}

func PBToUserRoles

func PBToUserRoles(userRoles []*apipb.UserRole) []*UserRole

type UserWechatOpenIDMap

type UserWechatOpenIDMap struct {
	model.Model
	UserID         string `json:"userID" gorm:"index"`
	UnionID        string `json:"unionID" gorm:"size:36;index;comment:微信UionID"`
	OpenID         string `json:"openID" gorm:"size:36;index;comment:微信OpenID"`
	WechatConfigID string `json:"wechatConfigID" gorm:"size:36;index;comment:微信配置ID"`
}

func PBToUserWechatOpenIDMaps

func PBToUserWechatOpenIDMaps(maps []*apipb.UserWechatOpenIDMap) []*UserWechatOpenIDMap

type WebSite

type WebSite struct {
	commonmodel.Model
	//网站名称
	Name string `json:"name" gorm:"size:200;index" `
	//网站编号
	Code string `json:"code" gorm:"size:100;uniqueindex:WebSite_uidx1" `
	Logo string `json:"logo" gorm:"size:36" `
	//所属项目
	ProjectID string `json:"projectID" gorm:"size:36" `
	//租户ID
	TenantID string `json:"tenantID" gorm:"size:36;index" `
	IsMust   bool   `json:"isMust" gorm:"index;comment:系统必须要有的数据"`
}

func GetAllWebSites

func GetAllWebSites() (list []*WebSite, err error)

func GetWebSiteByID

func GetWebSiteByID(id string) (*WebSite, error)

func GetWebSiteByIDs

func GetWebSiteByIDs(ids []string) ([]*WebSite, error)

func PBToWebSite

func PBToWebSite(in *apipb.WebSiteInfo) *WebSite

func PBToWebSites

func PBToWebSites(in []*apipb.WebSiteInfo) []*WebSite

type WechatConfig

type WechatConfig struct {
	commonmodel.Model
	//APP ID
	AppID string `json:"appID" gorm:"size:36" `
	//APP名称
	AppName string `json:"appName" gorm:"size:100;uniqueindex:wechatconfig_uidx1" `
	//显示名称
	DisplayName string `json:"displayName" gorm:"size:100" `
	//秘钥
	Secret string `json:"secret" gorm:"size:512" `
	//租户ID
	TenantID string `json:"tenantID" gorm:"size:36;index" `
	//类型 1-微信小程序 2-微信公众号 3-微信APP应用 4-微信网站应用
	AppType int32 `json:"appType" gorm:"index;comment:1-微信小程序 2-微信公众号 3-微信APP应用 4-微信网站应用" `
	//默认角色 用户通过微信注册时赋予默认角色
	DefaultRoleID  string `json:"defaultRoleID" gorm:"size:36;comment:用户通过微信注册时赋予默认角色" `
	RedirectUrl    string
	Token          string `json:"token" gorm:"size:32;"`
	EncodingAESKey string `json:"encodingAESKey" gorm:"size:43;"`
	EncodingMethod int32  `json:"encodingMethod" gorm:"comment:1-明文模式 2-兼容模式 3-安全模式" `
	ProjectID      string `json:"projectID" gorm:"index;size:36"`
	IsMust         bool   `json:"isMust" gorm:"index;comment:系统必须要有的数据"`
}

func GetAllWechatConfigs

func GetAllWechatConfigs() (list []*WechatConfig, err error)

func GetWechatConfigByID

func GetWechatConfigByID(id string) (*WechatConfig, error)

func GetWechatConfigByIDs

func GetWechatConfigByIDs(ids []string) ([]*WechatConfig, error)

func PBToWechatConfig

func PBToWechatConfig(in *apipb.WechatConfigInfo) *WechatConfig

func PBToWechatConfigs

func PBToWechatConfigs(in []*apipb.WechatConfigInfo) []*WechatConfig

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL