models

package
v0.0.0-...-b5bcaee Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init()

初始化db,数据库连接,创建等

func TCreateuser

func TCreateuser()

func TSatisfactions

func TSatisfactions()

添加满意度

func Tkcreates

func Tkcreates()

创建工单

func Tsource

func Tsource()

添加工单来源

func Tuser

func Tuser()

分配工单给处理人员

Types

type Jwtuser

type Jwtuser struct {
	Username string
}

用于生成jwt信息

type Password

type Password struct {
	Password   string `json:"password" binding:"required"`   //密码
	RePassword string `json:"repassword" binding:"required"` //重复密码
	Salt       string //加盐字段
	Username   string //用户
}

为修改密码设计的结构

func (*Password) Update

func (this *Password) Update() error

修改密码

type Role

type Role struct {
	ID uint

	User []User `gorm:"many2many:user_role"`
	// contains filtered or unexported fields
}

type Satisfaction

type Satisfaction struct {
	Id      uint   //id
	Content string //内容
	Tickets Ticket //关联工单
}

工单满意度

func (*Satisfaction) Add

func (this *Satisfaction) Add() error

工单满意度

func (*Satisfaction) Update

func (this *Satisfaction) Update() error

更新满意度

type Ticket

type Ticket struct {
	gorm.Model
	Tkcontents     []Tkcontent //关联到跟进内容
	UserID         uint        //关联创建工单的用户
	Title          string      //工单主题
	Solveusers     []User      `gorm:"many2many:user_solvetikets"` //关联支持用户
	TksourceId     uint        //工单来源
	SatisfactionId uint        //工单满意度
	Status         int         `gorm:"default:'2'"` //状态 1.结案,2.新的,3跟进中,4.已解决,5.挂起

}

func (*Ticket) Detail

func (this *Ticket) Detail() *Tkbase

显示工单数据

func (*Ticket) List

func (this *Ticket) List(status int, search string) ([]Ticket, error)

显示所有工单 可以根据工单的状态来进行筛选

func (*Ticket) Update

func (this *Ticket) Update() error

更新工单

func (*Ticket) UserTicketClose

func (this *Ticket) UserTicketClose(username string) error

关闭工单

type TkCreate

type TkCreate struct {
	User     User   `json:"-" binding:"required"`        //哪个用户提起的工单
	Title    string `json:"title" binding:"required"`    //标题是什么
	Tksource uint   `json:"tksource" binding:"required"` //工单从哪里提交的
}

创建工单时所需要的数据

func (*TkCreate) Add

func (this *TkCreate) Add() error

新增工单

type TkSave

type TkSave struct {
	ID         int
	TksourceId uint   `json:"tksourceid" binding:"required"` //工单来源
	Status     int    `json:"Status" binding:"required"`     //工单状态
	Solveuser  []User `json:"solveuser"`                     //工单处理人
}

更新工单主体内容 包含工单的来源,处理人,状态

func (*TkSave) Update

func (this *TkSave) Update() error

更新工单信息

type Tkbase

type Tkbase struct {
	Ticket       Ticket
	Tksource     Tksource
	Satisfaction Satisfaction
	Tkcontent    Tkcontent
	User         User
	Solveuser    []User
}

用于保存得到了工单数据的表,这个没有和数据库关联,用于显示的

type Tkcontent

type Tkcontent struct {
	gorm.Model
	TicketID uint   //关联到的工单
	Content  string //跟进内容
	File     string //文件
	UserID   uint   //关联到跟进人
	Remarks  string //备注
}

工单跟进内容

func (*Tkcontent) Add

func (this *Tkcontent) Add() error

新增工单跟进内容

type Tksource

type Tksource struct {
	Id      uint   //id
	Content string //来源内容
	Tickets Ticket //关联到的工单
}

工单来源表

func (*Tksource) Add

func (this *Tksource) Add() error

新增工单来源

func (*Tksource) Update

func (this *Tksource) Update() error

更新工单来源

type User

type User struct {
	gorm.Model   `json:"-"`
	Username     string      //账户名称
	Password     string      `json:"-"` //密码
	Salt         string      `json:"-"` //密码加盐
	Nickname     string      //昵称
	Email        string      //邮箱
	Avatar       string      //头像
	Token        string      `json:"-"` //token
	Phone1       string      //电话1
	Phone2       string      //电话2
	LastTime     time.Time   `json:"-"`                                   //最后一次登录时间
	Lastip       string      `json:"-"`                                   //最后一次登录IP
	Tkcontents   []Tkcontent `json:"-"`                                   //关联工单内容
	Solvetickets []Ticket    `gorm:"many2many:user_solvetikets" json:"-"` //解决的工单
	Tickets      []Ticket    `json:"-"`                                   //创建的工单
	Role         []Role      `gorm:"many2many:user_role" json:"-"`
}

func IdUser

func IdUser(user int) (*User, error)

func (*User) Add

func (this *User) Add() error

新增用户

func (*User) Detail

func (this *User) Detail() (*User, error)

用户详情,只有基本的用户信息

func (*User) Update

func (this *User) Update() error

用户信息修改

func (*User) UserTickets

func (this *User) UserTickets(status int, search string) ([]Ticket, error)

用户工单 将这个函数进行复用,根据用户传入工单状态,返回工单信息

type VliUser

type VliUser struct {
	Username   string `json:"username"  binding:"required"` //账户名称
	Password   string `json:"password"  binding:"required"` //密码
	RePassword string `json:"repassword" gorm:"-"`          //重复密码
	Nickname   string `json:"nickname"`                     //昵称
	Email      string `json:"email"`                        //邮箱
	Phone1     string `json:"phone1"`                       //电话1
	Lastip     string //最后一次登录IP
}

为了避免密码暴露,在登录,注册验证的时候使用VliUser

func (*VliUser) Reg

func (this *VliUser) Reg() error

用户注册

func (*VliUser) Valid

func (this *VliUser) Valid() error

账号密码验证 先查询有没有这个用户,然后再将这个用户的salt拿出来和传过来的密码进行加密,最后再比对密码是否匹配

Jump to

Keyboard shortcuts

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