diff --git a/app/controller/admin/cms_menu.go b/app/controller/admin/cms_menu.go index 9edc8e4..df8b0b8 100644 --- a/app/controller/admin/cms_menu.go +++ b/app/controller/admin/cms_menu.go @@ -1,8 +1,13 @@ package admin import ( + "gfast/app/model/admin/cms_category" + "gfast/app/service/admin/cms_service" + "gfast/app/service/admin/dict_service" "gfast/library/response" + "github.com/gogf/gf/frame/g" "github.com/gogf/gf/net/ghttp" + "github.com/gogf/gf/util/gvalid" ) //cms栏目管理 @@ -11,3 +16,33 @@ type CmsMenu struct{} func (c *CmsMenu) MenuList(r *ghttp.Request) { response.SusJson(true, r, "栏目列表") } + +//添加栏目分类 +func (c *CmsMenu) MenuAdd(r *ghttp.Request) { + if r.Method == "POST" { + var req *cms_category.ReqAdd + //获取参数 + if err := r.Parse(&req); err != nil { + response.FailJson(true, r, err.(*gvalid.Error).FirstString()) + } + _, err := cms_service.AddSave(req) + if err != nil { + response.FailJson(true, r, err.Error()) + } + response.SusJson(true, r, "栏目添加成功") + } + //获取上级分类(频道) + menus, err := cms_service.GetMenuListChannel() + if err != nil { + response.FailJson(true, r, err.Error()) + } + typeChecker, err := dict_service.GetDictWithDataByType("cms_category_type") + if err != nil { + response.FailJson(true, r, err.Error()) + } + res := g.Map{ + "menus": menus, + "typeChecker": typeChecker, + } + response.SusJson(true, r, "添加栏目", res) +} diff --git a/app/model/admin/cms_category/cms_category.go b/app/model/admin/cms_category/cms_category.go new file mode 100644 index 0000000..0c54add --- /dev/null +++ b/app/model/admin/cms_category/cms_category.go @@ -0,0 +1,25 @@ +package cms_category + +// Fill with you ideas below. +const ( + ChannelCateType = 1 //频道类型 + PublishCateType = 2 //可发布栏目 + JumpCateType = 3 //跳转栏目 + SingleCateType = 4 //单页栏目 +) + +//添加请求参数 +type ReqAdd struct { + ParentId uint64 `p:"parent_id" v:"integer|min:0#父级ID不能为空|父级ID必须为大于等于0的整数"` + Name string `p:"name" v:"required#栏目名称不能为空"` + Alias string `p:"alias"` + CateType uint `p:"cate_type" v:"required|in:1,2,3,4#请选择栏目类型|栏目类型只能在1-4之间"` + Description string `p:"description"` + Thumbnail string `p:"thumbnail"` + InputSeoTitle string `p:"input_seo_title"` + InputSeoKeywords string `p:"input_seo_keywords"` + InputSeoDescription string `p:"input_seo_description"` + Status uint `p:"status" v:"in:0,1#状态只能包含0或1"` + CateAddress string `p:"cate_address"` + CateContent string `p:"content"` +} diff --git a/app/model/admin/cms_category/cms_category_entity.go b/app/model/admin/cms_category/cms_category_entity.go new file mode 100644 index 0000000..c0d1006 --- /dev/null +++ b/app/model/admin/cms_category/cms_category_entity.go @@ -0,0 +1,67 @@ +// ========================================================================== +// This is auto-generated by gf cli tool. You may not really want to edit it. +// ========================================================================== + +package cms_category + +import ( + "database/sql" + "github.com/gogf/gf/database/gdb" +) + +// Entity is the golang structure for table qxkj_cms_category. +type Entity struct { + Id uint64 `orm:"id,primary" json:"id"` // 分类id + ParentId uint64 `orm:"parent_id" json:"parent_id"` // 分类父id + Status uint `orm:"status" json:"status"` // 状态,1:发布,0:不发布 + DeleteTime uint `orm:"delete_time" json:"delete_time"` // 删除时间 + ListOrder float64 `orm:"list_order" json:"list_order"` // 排序 + Name string `orm:"name" json:"name"` // 分类名称 + Description string `orm:"description" json:"description"` // 分类描述 + SeoTitle string `orm:"seo_title" json:"seo_title"` // + SeoKeywords string `orm:"seo_keywords" json:"seo_keywords"` // + SeoDescription string `orm:"seo_description" json:"seo_description"` // + ListTpl string `orm:"list_tpl" json:"list_tpl"` // 分类列表模板 + OneTpl string `orm:"one_tpl" json:"one_tpl"` // 分类文章页模板 + More string `orm:"more" json:"more"` // 扩展属性 + CateType uint `orm:"cate_type" json:"cate_type"` // 分类类型 + CateAddress string `orm:"cate_address" json:"cate_address"` // 跳转地址 + CateContent string `orm:"cate_content" json:"cate_content"` // 单页内容 +} + +// OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers +// the data and where attributes for empty values. +func (r *Entity) OmitEmpty() *arModel { + return Model.Data(r).OmitEmpty() +} + +// Inserts does "INSERT...INTO..." statement for inserting current object into table. +func (r *Entity) Insert() (result sql.Result, err error) { + return Model.Data(r).Insert() +} + +// Replace does "REPLACE...INTO..." statement for inserting current object into table. +// If there's already another same record in the table (it checks using primary key or unique index), +// it deletes it and insert this one. +func (r *Entity) Replace() (result sql.Result, err error) { + return Model.Data(r).Replace() +} + +// Save does "INSERT...INTO..." statement for inserting/updating current object into table. +// It updates the record if there's already another same record in the table +// (it checks using primary key or unique index). +func (r *Entity) Save() (result sql.Result, err error) { + return Model.Data(r).Save() +} + +// Update does "UPDATE...WHERE..." statement for updating current object from table. +// It updates the record if there's already another same record in the table +// (it checks using primary key or unique index). +func (r *Entity) Update() (result sql.Result, err error) { + return Model.Data(r).Where(gdb.GetWhereConditionOfStruct(r)).Update() +} + +// Delete does "DELETE FROM...WHERE..." statement for deleting current object from table. +func (r *Entity) Delete() (result sql.Result, err error) { + return Model.Where(gdb.GetWhereConditionOfStruct(r)).Delete() +} diff --git a/app/model/admin/cms_category/cms_category_model.go b/app/model/admin/cms_category/cms_category_model.go new file mode 100644 index 0000000..f9e40db --- /dev/null +++ b/app/model/admin/cms_category/cms_category_model.go @@ -0,0 +1,367 @@ +// ========================================================================== +// This is auto-generated by gf cli tool. You may not really want to edit it. +// ========================================================================== + +package cms_category + +import ( + "database/sql" + "github.com/gogf/gf/database/gdb" + "github.com/gogf/gf/frame/g" + "time" +) + +// arModel is a active record design model for table qxkj_cms_category operations. +type arModel struct { + M *gdb.Model +} + +var ( + // Table is the table name of qxkj_cms_category. + Table = "qxkj_cms_category" + // Model is the model object of qxkj_cms_category. + Model = &arModel{g.DB("default").Table(Table).Safe()} +) + +// FindOne is a convenience method for Model.FindOne. +// See Model.FindOne. +func FindOne(where ...interface{}) (*Entity, error) { + return Model.FindOne(where...) +} + +// FindAll is a convenience method for Model.FindAll. +// See Model.FindAll. +func FindAll(where ...interface{}) ([]*Entity, error) { + return Model.FindAll(where...) +} + +// FindValue is a convenience method for Model.FindValue. +// See Model.FindValue. +func FindValue(fieldsAndWhere ...interface{}) (gdb.Value, error) { + return Model.FindValue(fieldsAndWhere...) +} + +// FindCount is a convenience method for Model.FindCount. +// See Model.FindCount. +func FindCount(where ...interface{}) (int, error) { + return Model.FindCount(where...) +} + +// Insert is a convenience method for Model.Insert. +func Insert(data ...interface{}) (result sql.Result, err error) { + return Model.Insert(data...) +} + +// Replace is a convenience method for Model.Replace. +func Replace(data ...interface{}) (result sql.Result, err error) { + return Model.Replace(data...) +} + +// Save is a convenience method for Model.Save. +func Save(data ...interface{}) (result sql.Result, err error) { + return Model.Save(data...) +} + +// Update is a convenience method for Model.Update. +func Update(dataAndWhere ...interface{}) (result sql.Result, err error) { + return Model.Update(dataAndWhere...) +} + +// Delete is a convenience method for Model.Delete. +func Delete(where ...interface{}) (result sql.Result, err error) { + return Model.Delete(where...) +} + +// As sets an alias name for current table. +func (m *arModel) As(as string) *arModel { + return &arModel{m.M.As(as)} +} + +// TX sets the transaction for current operation. +func (m *arModel) TX(tx *gdb.TX) *arModel { + return &arModel{m.M.TX(tx)} +} + +// Master marks the following operation on master node. +func (m *arModel) Master() *arModel { + return &arModel{m.M.Master()} +} + +// Slave marks the following operation on slave node. +// Note that it makes sense only if there's any slave node configured. +func (m *arModel) Slave() *arModel { + return &arModel{m.M.Slave()} +} + +// LeftJoin does "LEFT JOIN ... ON ..." statement on the model. +func (m *arModel) LeftJoin(joinTable string, on string) *arModel { + return &arModel{m.M.LeftJoin(joinTable, on)} +} + +// RightJoin does "RIGHT JOIN ... ON ..." statement on the model. +func (m *arModel) RightJoin(joinTable string, on string) *arModel { + return &arModel{m.M.RightJoin(joinTable, on)} +} + +// InnerJoin does "INNER JOIN ... ON ..." statement on the model. +func (m *arModel) InnerJoin(joinTable string, on string) *arModel { + return &arModel{m.M.InnerJoin(joinTable, on)} +} + +// Fields sets the operation fields of the model, multiple fields joined using char ','. +func (m *arModel) Fields(fields string) *arModel { + return &arModel{m.M.Fields(fields)} +} + +// FieldsEx sets the excluded operation fields of the model, multiple fields joined using char ','. +func (m *arModel) FieldsEx(fields string) *arModel { + return &arModel{m.M.FieldsEx(fields)} +} + +// Option sets the extra operation option for the model. +func (m *arModel) Option(option int) *arModel { + return &arModel{m.M.Option(option)} +} + +// OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers +// the data and where attributes for empty values. +func (m *arModel) OmitEmpty() *arModel { + return &arModel{m.M.OmitEmpty()} +} + +// Filter marks filtering the fields which does not exist in the fields of the operated table. +func (m *arModel) Filter() *arModel { + return &arModel{m.M.Filter()} +} + +// Where sets the condition statement for the model. The parameter can be type of +// string/map/gmap/slice/struct/*struct, etc. Note that, if it's called more than one times, +// multiple conditions will be joined into where statement using "AND". +// Eg: +// Where("uid=10000") +// Where("uid", 10000) +// Where("money>? AND name like ?", 99999, "vip_%") +// Where("uid", 1).Where("name", "john") +// Where("status IN (?)", g.Slice{1,2,3}) +// Where("age IN(?,?)", 18, 50) +// Where(User{ Id : 1, UserName : "john"}) +func (m *arModel) Where(where interface{}, args ...interface{}) *arModel { + return &arModel{m.M.Where(where, args...)} +} + +// And adds "AND" condition to the where statement. +func (m *arModel) And(where interface{}, args ...interface{}) *arModel { + return &arModel{m.M.And(where, args...)} +} + +// Or adds "OR" condition to the where statement. +func (m *arModel) Or(where interface{}, args ...interface{}) *arModel { + return &arModel{m.M.Or(where, args...)} +} + +// Group sets the "GROUP BY" statement for the model. +func (m *arModel) Group(groupBy string) *arModel { + return &arModel{m.M.Group(groupBy)} +} + +// Order sets the "ORDER BY" statement for the model. +func (m *arModel) Order(orderBy string) *arModel { + return &arModel{m.M.Order(orderBy)} +} + +// Limit sets the "LIMIT" statement for the model. +// The parameter can be either one or two number, if passed two number is passed, +// it then sets "LIMIT limit[0],limit[1]" statement for the model, or else it sets "LIMIT limit[0]" +// statement. +func (m *arModel) Limit(limit ...int) *arModel { + return &arModel{m.M.Limit(limit...)} +} + +// Offset sets the "OFFSET" statement for the model. +// It only makes sense for some databases like SQLServer, PostgreSQL, etc. +func (m *arModel) Offset(offset int) *arModel { + return &arModel{m.M.Offset(offset)} +} + +// Page sets the paging number for the model. +// The parameter is started from 1 for paging. +// Note that, it differs that the Limit function start from 0 for "LIMIT" statement. +func (m *arModel) Page(page, limit int) *arModel { + return &arModel{m.M.Page(page, limit)} +} + +// Batch sets the batch operation number for the model. +func (m *arModel) Batch(batch int) *arModel { + return &arModel{m.M.Batch(batch)} +} + +// Cache sets the cache feature for the model. It caches the result of the sql, which means +// if there's another same sql request, it just reads and returns the result from cache, it +// but not committed and executed into the database. +// +// If the parameter < 0, which means it clear the cache with given . +// If the parameter = 0, which means it never expires. +// If the parameter > 0, which means it expires after . +// +// The optional parameter is used to bind a name to the cache, which means you can later +// control the cache like changing the or clearing the cache with specified . +// +// Note that, the cache feature is disabled if the model is operating on a transaction. +func (m *arModel) Cache(expire time.Duration, name ...string) *arModel { + return &arModel{m.M.Cache(expire, name...)} +} + +// Data sets the operation data for the model. +// The parameter can be type of string/map/gmap/slice/struct/*struct, etc. +// Eg: +// Data("uid=10000") +// Data("uid", 10000) +// Data(g.Map{"uid": 10000, "name":"john"}) +// Data(g.Slice{g.Map{"uid": 10000, "name":"john"}, g.Map{"uid": 20000, "name":"smith"}) +func (m *arModel) Data(data ...interface{}) *arModel { + return &arModel{m.M.Data(data...)} +} + +// Insert does "INSERT INTO ..." statement for the model. +// The optional parameter is the same as the parameter of Model.Data function, +// see Model.Data. +func (m *arModel) Insert(data ...interface{}) (result sql.Result, err error) { + return m.M.Insert(data...) +} + +// Replace does "REPLACE INTO ..." statement for the model. +// The optional parameter is the same as the parameter of Model.Data function, +// see Model.Data. +func (m *arModel) Replace(data ...interface{}) (result sql.Result, err error) { + return m.M.Replace(data...) +} + +// Save does "INSERT INTO ... ON DUPLICATE KEY UPDATE..." statement for the model. +// It updates the record if there's primary or unique index in the saving data, +// or else it inserts a new record into the table. +// +// The optional parameter is the same as the parameter of Model.Data function, +// see Model.Data. +func (m *arModel) Save(data ...interface{}) (result sql.Result, err error) { + return m.M.Save(data...) +} + +// Update does "UPDATE ... " statement for the model. +// +// If the optional parameter is given, the dataAndWhere[0] is the updated +// data field, and dataAndWhere[1:] is treated as where condition fields. +// Also see Model.Data and Model.Where functions. +func (m *arModel) Update(dataAndWhere ...interface{}) (result sql.Result, err error) { + return m.M.Update(dataAndWhere...) +} + +// Delete does "DELETE FROM ... " statement for the model. +// The optional parameter is the same as the parameter of Model.Where function, +// see Model.Where. +func (m *arModel) Delete(where ...interface{}) (result sql.Result, err error) { + return m.M.Delete(where...) +} + +// Count does "SELECT COUNT(x) FROM ..." statement for the model. +// The optional parameter is the same as the parameter of Model.Where function, +// see Model.Where. +func (m *arModel) Count(where ...interface{}) (int, error) { + return m.M.Count(where...) +} + +// All does "SELECT FROM ..." statement for the model. +// It retrieves the records from table and returns the result as []*Entity. +// It returns nil if there's no record retrieved with the given conditions from table. +// +// The optional parameter is the same as the parameter of Model.Where function, +// see Model.Where. +func (m *arModel) All(where ...interface{}) ([]*Entity, error) { + all, err := m.M.All(where...) + if err != nil { + return nil, err + } + var entities []*Entity + if err = all.Structs(&entities); err != nil && err != sql.ErrNoRows { + return nil, err + } + return entities, nil +} + +// One retrieves one record from table and returns the result as *Entity. +// It returns nil if there's no record retrieved with the given conditions from table. +// +// The optional parameter is the same as the parameter of Model.Where function, +// see Model.Where. +func (m *arModel) One(where ...interface{}) (*Entity, error) { + one, err := m.M.One(where...) + if err != nil { + return nil, err + } + var entity *Entity + if err = one.Struct(&entity); err != nil && err != sql.ErrNoRows { + return nil, err + } + return entity, nil +} + +// Value retrieves a specified record value from table and returns the result as interface type. +// It returns nil if there's no record found with the given conditions from table. +// +// If the optional parameter is given, the fieldsAndWhere[0] is the selected fields +// and fieldsAndWhere[1:] is treated as where condition fields. +// Also see Model.Fields and Model.Where functions. +func (m *arModel) Value(fieldsAndWhere ...interface{}) (gdb.Value, error) { + return m.M.Value(fieldsAndWhere...) +} + +// FindOne retrieves and returns a single Record by Model.WherePri and Model.One. +// Also see Model.WherePri and Model.One. +func (m *arModel) FindOne(where ...interface{}) (*Entity, error) { + one, err := m.M.FindOne(where...) + if err != nil { + return nil, err + } + var entity *Entity + if err = one.Struct(&entity); err != nil && err != sql.ErrNoRows { + return nil, err + } + return entity, nil +} + +// FindAll retrieves and returns Result by by Model.WherePri and Model.All. +// Also see Model.WherePri and Model.All. +func (m *arModel) FindAll(where ...interface{}) ([]*Entity, error) { + all, err := m.M.FindAll(where...) + if err != nil { + return nil, err + } + var entities []*Entity + if err = all.Structs(&entities); err != nil && err != sql.ErrNoRows { + return nil, err + } + return entities, nil +} + +// FindValue retrieves and returns single field value by Model.WherePri and Model.Value. +// Also see Model.WherePri and Model.Value. +func (m *arModel) FindValue(fieldsAndWhere ...interface{}) (gdb.Value, error) { + return m.M.FindValue(fieldsAndWhere...) +} + +// FindCount retrieves and returns the record number by Model.WherePri and Model.Count. +// Also see Model.WherePri and Model.Count. +func (m *arModel) FindCount(where ...interface{}) (int, error) { + return m.M.FindCount(where...) +} + +// Chunk iterates the table with given size and callback function. +func (m *arModel) Chunk(limit int, callback func(entities []*Entity, err error) bool) { + m.M.Chunk(limit, func(result gdb.Result, err error) bool { + var entities []*Entity + err = result.Structs(&entities) + if err == sql.ErrNoRows { + return false + } + return callback(entities, err) + }) +} diff --git a/app/service/admin/auth_service/auth_rule.go b/app/service/admin/auth_service/auth_rule.go index b5dd64a..e939832 100644 --- a/app/service/admin/auth_service/auth_rule.go +++ b/app/service/admin/auth_service/auth_rule.go @@ -67,7 +67,7 @@ func GetMenuIsStatusList() ([]*auth_rule.Entity, error) { func GetMenuList() (list []*auth_rule.Entity, err error) { cache := cache_service.New() //从缓存获取 - iList := cache.Get(cache_service.AdminMenu) + iList := cache.Get(cache_service.AdminAuthMenu) if iList != nil { list = iList.([]*auth_rule.Entity) return @@ -78,7 +78,7 @@ func GetMenuList() (list []*auth_rule.Entity, err error) { return } //缓存菜单 - cache.Set(cache_service.AdminMenu, list, 0, cache_service.AdminAuthTag) + cache.Set(cache_service.AdminAuthMenu, list, 0, cache_service.AdminAuthTag) return } @@ -123,7 +123,7 @@ func EditMenu(req *auth_rule.MenuReq, id int) (err error, rows int64) { func GetRoleList() (list []*role.Entity, err error) { cache := cache_service.New() //从缓存获取 - iList := cache.Get(cache_service.AdminRole) + iList := cache.Get(cache_service.AdminAuthRole) if iList != nil { list = iList.([]*role.Entity) return @@ -131,7 +131,7 @@ func GetRoleList() (list []*role.Entity, err error) { //从数据库获取 list, err = role.Model.OrderBy("list_order asc,id asc").All() //缓存数据 - cache.Set(cache_service.AdminRole, list, 0, cache_service.AdminAuthTag) + cache.Set(cache_service.AdminAuthRole, list, 0, cache_service.AdminAuthTag) return } diff --git a/app/service/admin/cms_service/menu.go b/app/service/admin/cms_service/menu.go new file mode 100644 index 0000000..761c168 --- /dev/null +++ b/app/service/admin/cms_service/menu.go @@ -0,0 +1,70 @@ +package cms_service + +import ( + "gfast/app/model/admin/cms_category" + "gfast/app/service/cache_service" + "github.com/gogf/gf/errors/gerror" + "github.com/gogf/gf/frame/g" +) + +//获取频道列表 +func GetMenuListChannel() (list []*cms_category.Entity, err error) { + listAll, err := GetMenuList() + if err != nil { + return + } + list = make([]*cms_category.Entity, 0, len(listAll)) + for _, v := range listAll { + if v.Status == 1 && v.CateType == cms_category.ChannelCateType { + list = append(list, v) + } + } + return +} + +//获取菜单列表 +func GetMenuList() (list []*cms_category.Entity, err error) { + cache := cache_service.New() + //从缓存获取数据 + iList := cache.Get(cache_service.AdminCmsMenu) + if iList != nil { + list = iList.([]*cms_category.Entity) + return + } + list, err = cms_category.Model.Order("list_order ASC,id ASC").All() + if err != nil { + g.Log().Error() + err = gerror.New("获取菜单数据失败") + } + //缓存数据 + cache.Set(cache_service.AdminCmsMenu, list, 0, cache_service.AdminCmsTag) + return +} + +//保存栏目操作 +func AddSave(req *cms_category.ReqAdd) (id int64, err error) { + var entity cms_category.Entity + entity.ParentId = req.ParentId + entity.CateType = req.CateType + entity.Status = req.Status + entity.Name = req.Name + entity.Description = req.Description + entity.SeoTitle = req.InputSeoTitle + entity.SeoKeywords = req.InputSeoKeywords + entity.SeoDescription = req.InputSeoDescription + entity.CateAddress = req.CateAddress + entity.CateContent = req.CateContent + res, err := entity.Insert() + if err != nil { + g.Log().Error(err) + err = gerror.New("保存失败") + return + } + id, err = res.LastInsertId() + if err != nil { + g.Log().Error(err) + err = gerror.New("保存失败") + return + } + return +} diff --git a/app/service/admin/dict_service/dict_type.go b/app/service/admin/dict_service/dict_type.go index 2e34918..d937ffb 100644 --- a/app/service/admin/dict_service/dict_type.go +++ b/app/service/admin/dict_service/dict_type.go @@ -1,6 +1,7 @@ package dict_service import ( + "gfast/app/model/admin/sys_dict_data" "gfast/app/model/admin/sys_dict_type" "gfast/library/utils" "github.com/gogf/gf/errors/gerror" @@ -132,3 +133,37 @@ func GetDictById(id int) (dict *sys_dict_type.Entity, err error) { } return } + +//通过字典键类型获取选项 +func GetDictWithDataByType(dictType string) (dict g.Map, err error) { + dictEntity, err := sys_dict_type.Model.FindOne("dict_type", dictType) + if err != nil { + g.Log().Error(err) + err = gerror.New("获取字典选项失败") + return + } + var dictDataEntities []*sys_dict_data.Entity + if dictEntity != nil { + //获取字典数据 + dictDataEntities, err = sys_dict_data.Model.Where("dict_type", dictType). + Order("dict_sort ASC,dict_code ASC").All() + if err != nil { + g.Log().Error(err) + err = gerror.New("获取字典选项失败") + return + } + values := make(g.List, len(dictDataEntities)) + for k, v := range dictDataEntities { + values[k] = g.Map{ + "key": v.DictValue, + "value": v.DictLabel, + } + } + dict = g.Map{ + "dict_name": dictEntity.DictName, + "remark": dictEntity.Remark, + "values": values, + } + } + return +} diff --git a/app/service/cache_service/cache_values.go b/app/service/cache_service/cache_values.go index f8c7a1f..99f733f 100644 --- a/app/service/cache_service/cache_values.go +++ b/app/service/cache_service/cache_values.go @@ -2,8 +2,9 @@ package cache_service //缓存前缀KEY const ( - AdminMenu = iota - AdminRole + AdminAuthMenu = iota + AdminAuthRole + AdminCmsMenu ) //缓存TAG标签 diff --git a/data/db.sql b/data/db.sql index 8be92ce..7f1866c 100644 --- a/data/db.sql +++ b/data/db.sql @@ -39,7 +39,7 @@ CREATE TABLE `casbin_rule` ( LOCK TABLES `casbin_rule` WRITE; /*!40000 ALTER TABLE `casbin_rule` DISABLE KEYS */; -INSERT INTO `casbin_rule` VALUES ('p','g_2','r_5','All','','',''),('p','g_2','r_9','All','','',''),('p','g_2','r_41','All','','',''),('p','g_2','r_42','All','','',''),('p','g_2','r_43','All','','',''),('p','g_2','r_10','All','','',''),('p','g_2','r_11','All','','',''),('p','g_2','r_47','All','','',''),('p','g_2','r_48','All','','',''),('p','g_2','r_49','All','','',''),('p','g_2','r_12','All','','',''),('p','g_2','r_50','All','','',''),('p','g_2','r_51','All','','',''),('p','g_2','r_52','All','','',''),('p','g_2','r_53','All','','',''),('p','g_2','r_57','All','','',''),('p','g_2','r_58','All','','',''),('p','g_2','r_59','All','','',''),('p','g_2','r_60','All','','',''),('p','g_2','r_61','All','','',''),('p','g_2','r_62','All','','',''),('g','u_31','g_1','','','',''),('g','u_31','g_2','','','',''),('p','g_1','r_46','All','','',''),('p','g_1','r_63','All','','',''),('p','g_1','r_64','All','','',''),('p','g_1','r_65','All','','',''),('p','g_1','r_5','All','','',''),('p','g_1','r_9','All','','',''),('p','g_1','r_41','All','','',''),('p','g_1','r_42','All','','',''),('p','g_1','r_43','All','','',''),('p','g_1','r_10','All','','',''),('p','g_1','r_11','All','','',''),('p','g_1','r_47','All','','',''),('p','g_1','r_48','All','','',''),('p','g_1','r_49','All','','',''),('p','g_1','r_12','All','','',''),('p','g_1','r_50','All','','',''),('p','g_1','r_51','All','','',''),('p','g_1','r_52','All','','',''),('p','g_1','r_53','All','','',''),('p','g_1','r_57','All','','',''),('p','g_1','r_58','All','','',''),('p','g_1','r_59','All','','',''),('p','g_1','r_60','All','','',''),('p','g_1','r_61','All','','',''),('p','g_1','r_62','All','','',''); +INSERT INTO `casbin_rule` VALUES ('p','g_2','r_5','All','','',''),('p','g_2','r_9','All','','',''),('p','g_2','r_41','All','','',''),('p','g_2','r_42','All','','',''),('p','g_2','r_43','All','','',''),('p','g_2','r_10','All','','',''),('p','g_2','r_11','All','','',''),('p','g_2','r_47','All','','',''),('p','g_2','r_48','All','','',''),('p','g_2','r_49','All','','',''),('p','g_2','r_12','All','','',''),('p','g_2','r_50','All','','',''),('p','g_2','r_51','All','','',''),('p','g_2','r_52','All','','',''),('p','g_2','r_53','All','','',''),('p','g_2','r_57','All','','',''),('p','g_2','r_58','All','','',''),('p','g_2','r_59','All','','',''),('p','g_2','r_60','All','','',''),('p','g_2','r_61','All','','',''),('p','g_2','r_62','All','','',''),('g','u_31','g_1','','','',''),('g','u_31','g_2','','','',''),('p','g_1','r_46','All','','',''),('p','g_1','r_63','All','','',''),('p','g_1','r_64','All','','',''),('p','g_1','r_65','All','','',''),('p','g_1','r_5','All','','',''),('p','g_1','r_9','All','','',''),('p','g_1','r_41','All','','',''),('p','g_1','r_42','All','','',''),('p','g_1','r_43','All','','',''),('p','g_1','r_10','All','','',''),('p','g_1','r_11','All','','',''),('p','g_1','r_47','All','','',''),('p','g_1','r_48','All','','',''),('p','g_1','r_49','All','','',''),('p','g_1','r_12','All','','',''),('p','g_1','r_50','All','','',''),('p','g_1','r_51','All','','',''),('p','g_1','r_52','All','','',''),('p','g_1','r_53','All','','',''),('p','g_1','r_57','All','','',''),('p','g_1','r_58','All','','',''),('p','g_1','r_59','All','','',''),('p','g_1','r_60','All','','',''),('p','g_1','r_61','All','','',''),('p','g_1','r_62','All','','',''),('p','g_8','r_46','All','','',''); /*!40000 ALTER TABLE `casbin_rule` ENABLE KEYS */; UNLOCK TABLES; @@ -81,6 +81,44 @@ INSERT INTO `qxkj_auth_rule` VALUES (5,'file',0,'/system/auth','权限管理','f /*!40000 ALTER TABLE `qxkj_auth_rule` ENABLE KEYS */; UNLOCK TABLES; +-- +-- Table structure for table `qxkj_cms_category` +-- + +DROP TABLE IF EXISTS `qxkj_cms_category`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `qxkj_cms_category` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '分类id', + `parent_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '分类父id', + `status` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '状态,1:发布,0:不发布', + `delete_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '删除时间', + `list_order` float NOT NULL DEFAULT '10000' COMMENT '排序', + `name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '分类名称', + `description` varchar(255) NOT NULL DEFAULT '' COMMENT '分类描述', + `seo_title` varchar(100) NOT NULL DEFAULT '', + `seo_keywords` varchar(255) NOT NULL DEFAULT '', + `seo_description` varchar(255) NOT NULL DEFAULT '', + `list_tpl` varchar(50) NOT NULL DEFAULT '' COMMENT '分类列表模板', + `one_tpl` varchar(50) NOT NULL DEFAULT '' COMMENT '分类文章页模板', + `more` text COMMENT '扩展属性', + `cate_type` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '分类类型', + `cate_address` varchar(255) NOT NULL DEFAULT '' COMMENT '跳转地址', + `cate_content` text COMMENT '单页内容', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `qxkj_cms_category` +-- + +LOCK TABLES `qxkj_cms_category` WRITE; +/*!40000 ALTER TABLE `qxkj_cms_category` DISABLE KEYS */; +INSERT INTO `qxkj_cms_category` VALUES (1,0,1,0,0,'最新发布','最新发布','最新发布','最新发布','最新发布','','','',1,'',''); +/*!40000 ALTER TABLE `qxkj_cms_category` ENABLE KEYS */; +UNLOCK TABLES; + -- -- Table structure for table `qxkj_role` -- @@ -109,10 +147,111 @@ CREATE TABLE `qxkj_role` ( LOCK TABLES `qxkj_role` WRITE; /*!40000 ALTER TABLE `qxkj_role` DISABLE KEYS */; -INSERT INTO `qxkj_role` VALUES (1,0,1,1329633709,1582773740,0,'超级管理员','备注'),(2,0,1,1329633709,1582732392,0,'普通管理员','备注'),(3,0,1,0,0,0,'站点管理员','站点管理人员'),(4,0,1,0,0,0,'初级管理员','初级管理员'),(5,0,1,0,0,0,'高级管理员','高级管理员'),(6,0,1,0,0,0,'超级管理员','超级管理员'),(7,0,1,0,0,0,'系统管理员','包含所有系统设置权限'),(8,0,1,0,0,0,'区级管理员',''); +INSERT INTO `qxkj_role` VALUES (1,0,1,1329633709,1582773740,0,'超级管理员','备注'),(2,0,1,1329633709,1582732392,0,'普通管理员','备注'),(3,0,1,0,0,0,'站点管理员','站点管理人员'),(4,0,1,0,0,0,'初级管理员','初级管理员'),(5,0,1,0,0,0,'高级管理员','高级管理员'),(8,3,1,0,1582860212,0,'区级管理员',''); /*!40000 ALTER TABLE `qxkj_role` ENABLE KEYS */; UNLOCK TABLES; +-- +-- Table structure for table `qxkj_sys_config` +-- + +DROP TABLE IF EXISTS `qxkj_sys_config`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `qxkj_sys_config` ( + `config_id` int(5) unsigned NOT NULL AUTO_INCREMENT COMMENT '参数主键', + `config_name` varchar(100) DEFAULT '' COMMENT '参数名称', + `config_key` varchar(100) DEFAULT '' COMMENT '参数键名', + `config_value` varchar(500) DEFAULT '' COMMENT '参数键值', + `config_type` tinyint(1) DEFAULT '0' COMMENT '系统内置(Y是 N否)', + `create_by` int(64) unsigned DEFAULT '0' COMMENT '创建者', + `create_time` bigint(20) unsigned DEFAULT '0' COMMENT '创建时间', + `update_by` int(64) unsigned DEFAULT '0' COMMENT '更新者', + `update_time` bigint(20) unsigned DEFAULT '0' COMMENT '更新时间', + `remark` varchar(500) DEFAULT NULL COMMENT '备注', + PRIMARY KEY (`config_id`), + UNIQUE KEY `uni_config_key` (`config_key`) USING BTREE +) ENGINE=MyISAM AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `qxkj_sys_config` +-- + +LOCK TABLES `qxkj_sys_config` WRITE; +/*!40000 ALTER TABLE `qxkj_sys_config` DISABLE KEYS */; +INSERT INTO `qxkj_sys_config` VALUES (1,'文件上传-文件大小','sys.uploadFile.fileSize','50M',1,31,1582968376,0,0,'文件上传大小限制'),(2,'文件上传-文件类型','sys.uploadFile.fileType','doc,docx,zip,xls,xlsx,rar',1,31,1582968465,0,0,'文件上传后缀类型限制'),(3,'图片上传-图片类型','sys.uploadFile.imageType','jpg,jpeg,gif,npm,png',1,31,1582968519,0,0,'图片上传后缀类型限制'),(4,'图片上传-图片大小','sys.uploadFile.imageSize','50M',1,31,1582968538,31,1582991905,'图片上传大小限制'); +/*!40000 ALTER TABLE `qxkj_sys_config` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `qxkj_sys_dict_data` +-- + +DROP TABLE IF EXISTS `qxkj_sys_dict_data`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `qxkj_sys_dict_data` ( + `dict_code` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '字典编码', + `dict_sort` int(4) DEFAULT '0' COMMENT '字典排序', + `dict_label` varchar(100) DEFAULT '' COMMENT '字典标签', + `dict_value` varchar(100) DEFAULT '' COMMENT '字典键值', + `dict_type` varchar(100) DEFAULT '' COMMENT '字典类型', + `css_class` varchar(100) DEFAULT NULL COMMENT '样式属性(其他样式扩展)', + `list_class` varchar(100) DEFAULT NULL COMMENT '表格回显样式', + `is_default` tinyint(1) DEFAULT '0' COMMENT '是否默认(1是 0否)', + `status` tinyint(1) DEFAULT '0' COMMENT '状态(0正常 1停用)', + `create_by` bigint(64) unsigned DEFAULT '0' COMMENT '创建者', + `create_time` bigint(20) unsigned DEFAULT '0' COMMENT '创建时间', + `update_by` bigint(64) unsigned DEFAULT '0' COMMENT '更新者', + `update_time` bigint(20) unsigned DEFAULT '0' COMMENT '更新时间', + `remark` varchar(500) DEFAULT NULL COMMENT '备注', + PRIMARY KEY (`dict_code`) +) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8mb4 COMMENT='字典数据表'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `qxkj_sys_dict_data` +-- + +LOCK TABLES `qxkj_sys_dict_data` WRITE; +/*!40000 ALTER TABLE `qxkj_sys_dict_data` DISABLE KEYS */; +INSERT INTO `qxkj_sys_dict_data` VALUES (1,0,'男','0','sys_user_sex','','default',1,1,31,1582884113,0,0,'备注信息'),(2,0,'女','0','sys_user_sex','','default',1,1,31,1582884125,31,1582885784,'备注信息'),(3,0,'保密','0','sys_user_sex','','default',1,1,31,1582884871,31,1582885799,'备注信息'),(4,0,'男','0','sys_user_sex','','default',1,1,31,1582899746,0,0,'备注信息'),(5,0,'男','0','sys_user_sex','','default',1,1,31,1582899747,0,0,'备注信息'),(6,0,'男','0','sys_user_sex','','default',1,1,31,1582899748,0,0,'备注信息'),(7,0,'男','0','sys_user_sex','','default',1,1,31,1582899748,0,0,'备注信息'),(8,0,'男','0','sys_user_sex','','default',1,1,31,1582899749,0,0,'备注信息'),(9,0,'男','0','sys_user_sex','','default',1,1,31,1582899750,0,0,'备注信息'),(10,0,'男','0','sys_user_sex','','default',1,1,31,1582899751,0,0,'备注信息'),(11,0,'男','0','sys_user_sex','','default',1,1,31,1582899752,0,0,'备注信息'),(12,0,'男','0','sys_user_sex','','default',1,1,31,1582899752,0,0,'备注信息'),(24,0,'作为频道页,不可作为栏目发布文章,可添加下级分类','1','cms_category_type','','default',1,1,31,1583131942,0,0,'作为频道页,不可作为栏目发布文章,可添加下级分类'),(25,0,'作为发布栏目,可添加文章','2','cms_category_type','','default',0,1,31,1583132032,0,0,'作为发布栏目,可添加文章'),(26,0,'不直接发布内容,用于跳转页面','3','cms_category_type','','default',0,1,31,1583132125,0,0,'不直接发布内容,用于跳转页面'),(27,0,'单页面模式,分类直接显示为文章','4','cms_category_type','','default',0,1,31,1583132145,0,0,'单页面模式,分类直接显示为文章'); +/*!40000 ALTER TABLE `qxkj_sys_dict_data` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `qxkj_sys_dict_type` +-- + +DROP TABLE IF EXISTS `qxkj_sys_dict_type`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `qxkj_sys_dict_type` ( + `dict_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '字典主键', + `dict_name` varchar(100) DEFAULT '' COMMENT '字典名称', + `dict_type` varchar(100) DEFAULT '' COMMENT '字典类型', + `status` tinyint(1) unsigned DEFAULT '0' COMMENT '状态(0正常 1停用)', + `create_by` int(64) unsigned DEFAULT '0' COMMENT '创建者', + `create_time` bigint(20) unsigned DEFAULT '0' COMMENT '创建时间', + `update_by` int(64) unsigned DEFAULT '0' COMMENT '更新者', + `update_time` bigint(20) unsigned DEFAULT '0' COMMENT '更新时间', + `remark` varchar(500) DEFAULT NULL COMMENT '备注', + PRIMARY KEY (`dict_id`), + UNIQUE KEY `dict_type` (`dict_type`) +) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4 COMMENT='字典类型表'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `qxkj_sys_dict_type` +-- + +LOCK TABLES `qxkj_sys_dict_type` WRITE; +/*!40000 ALTER TABLE `qxkj_sys_dict_type` DISABLE KEYS */; +INSERT INTO `qxkj_sys_dict_type` VALUES (1,'用户性别','sys_user_sex',1,31,1582789177,0,0,'用于选择用户性别'),(2,'分类类型','cms_category_type',1,31,1582789253,31,1583131577,'文章分类类型'),(3,'菜单状态2','sys_show_hide2',1,31,1582789296,0,0,'菜单状态列表'),(4,'菜单状态3','sys_show_hide3',1,31,1582789303,0,0,'菜单状态列表'),(5,'菜单状态4','sys_show_hide4',1,31,1582789307,0,0,'菜单状态列表'),(6,'菜单状态5','sys_show_hide5',1,31,1582789313,0,0,'菜单状态列表'),(7,'菜单状态6','sys_show_hide6',1,31,1582789321,0,0,'菜单状态列表'),(8,'菜单状态7','sys_show_hide7',1,31,1582789326,0,0,'菜单状态列表'),(9,'菜单状态8','sys_show_hide8',1,31,1582789332,0,0,'菜单状态列表'),(10,'菜单状态9','sys_show_hide9',1,31,1582789337,0,0,'菜单状态列表'),(11,'菜单状态10','sys_show_hide10',1,31,1582789344,0,0,'菜单状态列表'),(12,'菜单状态11','sys_show_hide11',1,31,1582789349,0,0,'菜单状态列表'); +/*!40000 ALTER TABLE `qxkj_sys_dict_type` ENABLE KEYS */; +UNLOCK TABLES; + -- -- Table structure for table `qxkj_user` -- @@ -147,7 +286,7 @@ CREATE TABLE `qxkj_user` ( LOCK TABLES `qxkj_user` WRITE; /*!40000 ALTER TABLE `qxkj_user` DISABLE KEYS */; -INSERT INTO `qxkj_user` VALUES (1,'admin','18687460581','超级管理员',0,1557715675,'IJ1xz+Wve+ZONVMFfXJQMw==',1,'yxh669@qq.com',0,'',1581491047,'192.168.31.221'),(2,'yixiaohu','13699885599','易小虎',0,0,'IJ1xz+Wve+ZONVMFfXJQMw==',1,'yxh@qq.com',1,'',1582190234,'[::1]'),(3,'zs','16399669855','张三',0,0,'IJ1xz+Wve+ZONVMFfXJQMw==',1,'zs@qq.com',0,'',1559293160,'127.0.0.1'),(4,'qlgl','13758596696','测试',0,0,'IJ1xz+Wve+ZONVMFfXJQMw==',1,'qlgl@qq.com',0,'',1559293134,'127.0.0.1'),(5,'test','13845696696','测试2',0,0,'9OFlt5qzzvCiZWhe7ilcLA==',1,'123@qq.com',0,'',0,''),(6,'18999998889','13755866654','刘大大',0,0,'IJ1xz+Wve+ZONVMFfXJQMw==',1,'1223@qq.com',0,'',0,''),(7,'zmm','13788566696','张明明',0,0,'IJ1xz+Wve+ZONVMFfXJQMw==',1,'11123@qq.com',0,'',0,''),(8,'lxx','13756566696','李小小',0,0,'IJ1xz+Wve+ZONVMFfXJQMw==',1,'123333@qq.com',0,'',1571729563,'127.0.0.1'),(10,'xmm','13588999969','小秘密',0,0,'IJ1xz+Wve+ZONVMFfXJQMw==',1,'',0,'',0,''),(14,'cd_19','123154564','看金利科技',0,0,'IJ1xz+Wve+ZONVMFfXJQMw==',1,'',0,'',0,''),(15,'lmm','135877545454','刘敏敏',0,0,'IJ1xz+Wve+ZONVMFfXJQMw==',1,'',0,'',0,''),(16,'ldn','13899658874','李大牛',0,0,'IJ1xz+Wve+ZONVMFfXJQMw==',1,'',0,'',0,''),(20,'dbc','13877555566','大百词',0,0,'IJ1xz+Wve+ZONVMFfXJQMw==',1,'',0,'',0,''),(22,'yxfmlbb','15969423326','袁学飞',0,1557715675,'IJ1xz+Wve+ZONVMFfXJQMw==',1,'yxh6691@qq.com',0,'',1565059554,'127.0.0.1'),(23,'wangming','13699888855','王明',0,0,'IJ1xz+Wve+ZONVMFfXJQMw==',1,'',0,'',0,''),(24,'zhk','13699885591','综合科',0,0,'IZNU7Pn91/++830Pi6HAWA==',1,'',0,'',1569288069,'192.168.0.146'),(28,'demo3','18699888855','测试账号1',0,1581314035,'9OFlt5qzzvCiZWhe7ilcLA==',1,'',0,'',0,''),(31,'demo','18699888856','测试账号1',0,1581314770,'9OFlt5qzzvCiZWhe7ilcLA==',1,'56@qq.com',0,'',1582772787,'192.168.31.221'),(32,'demo100','18699888859','测试账号1',0,1582103659,'9OFlt5qzzvCiZWhe7ilcLA==',1,'',0,'',0,''),(33,'demo110','18699888853','测试账号1',0,1582109337,'9OFlt5qzzvCiZWhe7ilcLA==',1,'',0,'',0,''),(34,'demo101','13855774455','测试账号1',0,1582110232,'9OFlt5qzzvCiZWhe7ilcLA==',1,'',0,'',0,''),(38,'demo103','18699888833','测试账号103',0,1582188923,'9OFlt5qzzvCiZWhe7ilcLA==',1,'',0,'',1582188938,'[::1]'); +INSERT INTO `qxkj_user` VALUES (1,'admin','18687460581','超级管理员',0,1557715675,'IJ1xz+Wve+ZONVMFfXJQMw==',1,'yxh669@qq.com',0,'',1581491047,'192.168.31.221'),(2,'yixiaohu','13699885599','易小虎',0,0,'IJ1xz+Wve+ZONVMFfXJQMw==',1,'yxh@qq.com',1,'',1582190234,'[::1]'),(3,'zs','16399669855','张三',0,0,'IJ1xz+Wve+ZONVMFfXJQMw==',1,'zs@qq.com',0,'',1559293160,'127.0.0.1'),(4,'qlgl','13758596696','测试c',0,0,'IJ1xz+Wve+ZONVMFfXJQMw==',1,'qlgl@qq.com',0,'',1559293134,'127.0.0.1'),(5,'test','13845696696','测试2',0,0,'9OFlt5qzzvCiZWhe7ilcLA==',1,'123@qq.com',0,'',0,''),(6,'18999998889','13755866654','刘大大',0,0,'IJ1xz+Wve+ZONVMFfXJQMw==',1,'1223@qq.com',0,'',0,''),(7,'zmm','13788566696','张明明',0,0,'IJ1xz+Wve+ZONVMFfXJQMw==',1,'11123@qq.com',0,'',0,''),(8,'lxx','13756566696','李小小',0,0,'IJ1xz+Wve+ZONVMFfXJQMw==',1,'123333@qq.com',0,'',1571729563,'127.0.0.1'),(10,'xmm','13588999969','小秘密',0,0,'IJ1xz+Wve+ZONVMFfXJQMw==',1,'',0,'',0,''),(14,'cd_19','123154564','看金利科技',0,0,'IJ1xz+Wve+ZONVMFfXJQMw==',1,'',0,'',0,''),(15,'lmm','135877545454','刘敏敏',0,0,'IJ1xz+Wve+ZONVMFfXJQMw==',1,'',0,'',0,''),(16,'ldn','13899658874','李大牛',0,0,'IJ1xz+Wve+ZONVMFfXJQMw==',1,'',0,'',0,''),(20,'dbc','13877555566','大百词',0,0,'IJ1xz+Wve+ZONVMFfXJQMw==',1,'',0,'',0,''),(22,'yxfmlbb','15969423326','袁学飞',0,1557715675,'IJ1xz+Wve+ZONVMFfXJQMw==',1,'yxh6691@qq.com',0,'',1565059554,'127.0.0.1'),(23,'wangming','13699888855','王明',0,0,'IJ1xz+Wve+ZONVMFfXJQMw==',1,'',0,'',0,''),(24,'zhk','13699885591','综合科',0,0,'IZNU7Pn91/++830Pi6HAWA==',1,'',0,'',1569288069,'192.168.0.146'),(28,'demo3','18699888855','测试账号1',0,1581314035,'9OFlt5qzzvCiZWhe7ilcLA==',1,'',0,'',0,''),(31,'demo','18699888856','测试账号1',0,1581314770,'9OFlt5qzzvCiZWhe7ilcLA==',1,'56@qq.com',0,'',1583137440,'192.168.31.221'),(32,'demo100','18699888859','测试账号1',0,1582103659,'9OFlt5qzzvCiZWhe7ilcLA==',1,'',0,'',0,''),(33,'demo110','18699888853','测试账号1',0,1582109337,'9OFlt5qzzvCiZWhe7ilcLA==',1,'',0,'',0,''),(34,'demo101','13855774455','测试账号1',0,1582110232,'9OFlt5qzzvCiZWhe7ilcLA==',1,'',0,'',0,''),(38,'demo103','18699888833','测试账号103',0,1582188923,'9OFlt5qzzvCiZWhe7ilcLA==',1,'',0,'',1582188938,'[::1]'); /*!40000 ALTER TABLE `qxkj_user` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -160,4 +299,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2020-02-27 11:23:06 +-- Dump completed on 2020-03-03 9:43:41 diff --git a/test/demo2_test.go b/test/demo2_test.go index e0abe3d..b4b00cc 100644 --- a/test/demo2_test.go +++ b/test/demo2_test.go @@ -1,9 +1,8 @@ package test import ( - "fmt" - "github.com/gogf/gf/os/gtime" "testing" + "time" ) func TestDemo2(t *testing.T) { @@ -11,11 +10,19 @@ func TestDemo2(t *testing.T) { } func test21(t *testing.T) { - str := "2018.02.09 20:46:17" - tm, err := gtime.StrToTime(str) - if err != nil { - fmt.Println(err) - return - } - fmt.Println(tm.Timestamp()) + a := make(chan bool) + b := make(chan bool) + defer close(b) + go func() { + for { + select { + case <-a: + default: + <-b + } + } + + }() + time.Sleep(1 * time.Second) + a <- true }