Documentation ¶
Index ¶
- func AddTag(name string, state int, createdBy string) error
- func CheckAuth(username, password string) (bool, error)
- func CleanAllTag() (bool, error)
- func CloseDB()
- func DeleteTag(id int) error
- func DeleteUser(id int) error
- func EditTag(id int, data interface{}) error
- func ExistRoleByID(id int) (bool, error)
- func ExistTagByID(id int) (bool, error)
- func ExistTagByName(name string) (bool, error)
- func ExistUserByID(id int) (bool, error)
- func ExistUserByUserName(username string) (bool, error)
- func GetRoleName(id int) (string, error)
- func GetTagTotal(maps interface{}) (int, error)
- func GetUserTotal(search string) (int, error)
- func Setup()
- func UpdateUser(id int, data interface{}) error
- type AddUserParam
- type Area
- type Auth
- type BaseModel
- type Device
- type EditUserParam
- type Role
- type RoleDetails
- type Tag
- type UserDetails
- type Userprofile
- type Userslist
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExistUserByUserName ¶
ExistUserByID根据该ID确定是否存在标记
Types ¶
type AddUserParam ¶
type AddUserParam struct { UserName string `valid:"required,length(3|36)~仅允许3-36个字符的用户名"` Password string `valid:"required,length(3|36)~仅允许3-36个字符的密码"` Name string `valid:"runelength(2|36)~仅允许2-36个字符的姓名"` Phone string `valid:"phone~电话号码格式不正确"` Remarks string `valid:"runelength(0|200)"` Role int `valid:"required~角色ID不能为空"` }
type BaseModel ¶
type BaseModel struct { ID int `gorm:"column:id;primary_key;AUTO_INCREMENT" json:"id"` Status int8 `gorm:"column:status;default:1" json:"status"` IsDel bool `gorm:"column:is_del;default:false" json:"is_del"` CreateTime util.JSONTime `gorm:"column:create_time" json:"create_time"` UpdateTime util.JSONTime `gorm:"column:update_time" json:"update_time"` DelTime time.Time `gorm:"column:del_time;default:null" json:"del_time"` }
type Device ¶
type Device struct { BaseModel Name string `gorm:"column:name;not null;unique;type:varchar(47);index" json:"name"` Description string `gorm:"column:description;default:'';type:text(200)" json:"description"` GatherType string `gorm:"column:gather_type;not null;type:varchar(64)" json:"gather_type"` AreaID uint `gorm:"column:gather_type;not null;" json:"area_id"` GatherWay string `gorm:"column:gather_way;not null;type:varchar(64)" json:"gather_way"` GatewayID uint `gorm:"column:gather_type;not null;" json:"gateway_id"` DeviceID string `gorm:"column:device_id;not null;type:varchar(36)" json:"device_id"` DeviceIntId int32 `gorm:"column:device_int_id;not null;default:0" json:"device_int_id"` // # 最大负载(告警负载)(不于小零的整数,为0表示不告警) MaxLoad float32 `gorm:"column:max_load;not null;default:0;" json:"max_load"` WaitLoad bool `gorm:"column:wait_load;not null;default:false;not null;" json:"wait_load"` IsHeadMeter bool `gorm:"column:is_head_meter;not null;default:false" json:"is_head_meter"` Type string `gorm:"column:type;not null;type:varchar(64)" json:"type"` ProductId string `gorm:"column:product_id;not null;default:'';type:varchar(64)" json:"product_id"` IsShow bool `gorm:"column:is_show;not null;default:true" json:"is_show"` ManualReadmeterThreshold float32 `gorm:"column:manual_readmeter_threshold;not null;default:0;" json:"manual_readmeter_threshold"` BusinessRulesId int32 `gorm:"column:business_rules_id;not null;default:0" json:"business_rules_id"` ModbusIndex int32 `gorm:"column:modbus_index;default:0" json:"modbus_index"` RxcelLocation string `gorm:"column:excel_location;default:'';unique;type:varchar(32)" json:"excel_location"` WorkLoad int32 `gorm:"column:work_load;not null;default:0" json:"work_load"` LoadValue float32 `gorm:"column:load_value;not null;default:0" json:"load_value"` Magnification float32 `gorm:"column:magnification;not null;default:1" json:"magnification"` Blocked int32 `gorm:"column:sort_num;not null;default:0" json:"sort_num" valid:"Range(0,1)"` SortNum int32 `gorm:"column:blocked;default:0" json:"blocked"` NormalLoad float32 `gorm:"column:normal_load;default:0" json:"normal_load"` }
Device 仪表model
type EditUserParam ¶
type Role ¶
type Role struct { BaseModel Name string `gorm:"column:name;not null;unique;type:varchar(47);" json:"name"` Remarks string `gorm:"column:remarks;type:varchar(200);" json:"remarks"` Menus string `gorm:"column:menus;not null;type:varchar(200);" json:"menus"` IsSystemRole bool `gorm:"column:is_system_role;default:false;" json:"is_system_role"` IsAppletLogin bool `gorm:"column:is_applet_login;default:false;" json:"is_applet_login"` // 区域为空时,默认是所有区域 Area string `gorm:"column:areas;" json:"areas"` Devices string `gorm:"column:devices;" json:"devices"` }
type RoleDetails ¶
type RoleDetails struct { ID int `json:"id"` Name string `json:"name"` Remarks string `json:"remarks"` Menus []string `json:"menus"` IsSystemRole bool `json:"is_system_role"` IsAppletLogin bool `json:"is_applet_login"` // 区域为空时,默认是所有区域 Area []map[string]interface{} `json:"areas"` Devices []int `json:"devices"` CreateTime util.JSONTime `json:"create_time"` UpdateTime util.JSONTime `json:"update_time“` }
type Tag ¶
type UserDetails ¶
type UserDetails struct { ID int `json:"id"` Username string `json:"username"` Name string `json:"name"` Phone string `json:"phone"` IsSuperuser bool `json:"is_superuser"` Remarks string `json:"remarks"` Role int `json:"role"` RoleName string `json:"role_name"` CreateTime util.JSONTime `json:"create_time"` UpdateTime util.JSONTime `json:"update_time"` }
User 用户详情
type Userprofile ¶
type Userprofile struct { BaseModel Username string `gorm:"column:username;not null;unique;type:varchar(47)" json:"username"` Password string `gorm:"column:password;not null;type:varchar(128)" json:"password"` FirstName string `gorm:"column:first_name;not null;type:varchar(30)" json:"-"` LastName string `gorm:"column:last_name;not null;type:varchar(150)" json:"-"` Email string `gorm:"column:email;not null;type:varchar(254)" json:"email"` IsSuperuser bool `gorm:"column:is_superuser;not null;" json:"is_superuser"` IsStaff bool `gorm:"column:is_staff;not null;" json:"-"` IsActive bool `gorm:"column:is_active;default:true;not null;" json:"-"` LastLogin util.JSONTime `gorm:"column:last_login" json:"-"` DateJoined util.JSONTime `gorm:"column:date_joined";not null; json:"-"` Name string `gorm:"column:name;not null;type:varchar(47)" json:"name"` Phone string `gorm:"column:phone;not null;type:varchar(18)" json:"phone"` Remarks string `gorm:"column:remarks;type:varchar(200)" json:"remarks"` RoleID int `gorm:"column:role_id;not null;default:1" json:"role_id"` }
func AddUser ¶
func AddUser(user AddUserParam) (*Userprofile, error)
AddUser 添加用户 func AddUser(username, password, name, phone, remarks string, role int) (*Userprofile, error) {
Click to show internal directories.
Click to hide internal directories.