zcy 2021-12-31 00:39:11 +08:00
commit da8ae4eb1d
2 changed files with 77 additions and 56 deletions

View File

@ -94,8 +94,8 @@ func InitLogs() {
}
type WsHandle struct {
}
func (this WsHandle) OnDisConected(*network.ConnectionContext) {
}
@ -107,7 +107,6 @@ func (this WsHandle) OnDataRecv(p *network.ConnectionContext, dat []byte) {
logger.LogRealeaseInfo(string(dat))
}
func main() {
InitConfig()
InitLogs()
@ -190,7 +189,6 @@ func main() {
api.GET("/memo", controller.GetMemo) // 单独读取备忘录
api.GET("/memocnt", controller.GetMemoCnt) // 单独读取备忘录
api.GET("doc_groups", controller.GetDocGroup) // 获取所有的文章分组
api.POST("type_group", controller.GetDocTypeGroup) // 获取类所在的组
api.POST("group_type", controller.GetDoGroupcType) // 获取类所在的组

View File

@ -12,6 +12,7 @@ import (
)
type Doc struct {
<<<<<<< .merge_file_a12396
ID int64 `json:"id" gorm:"column:id" sql:"id"`
Title string `json:"title" gorm:"column:title" sql:"title"`
Type int32 `json:"type" gorm:"column:type" sql:"type"`
@ -24,6 +25,20 @@ type Doc struct {
IsPublic int32 `json:"is_public" gorm:"column:is_public" sql:"is_public"`
Deleted int32 `json:"deleted" gorm:"column:deleted" sql:"deleted"`
OriginUrl string `json:"origin_url" gorm:"column:origin_url" sql:"origin_url"`
=======
ID int64 `json:"id" gorm:"column:id" sql:"id"`
Title string `json:"title" gorm:"column:title" sql:"title"`
Type int32 `json:"type" gorm:"column:type" sql:"type"`
Content string `json:"content" gorm:"column:content" sql:"content"`
Author string `json:"author" gorm:"column:author" sql:"author"`
CreateTime time.Time `json:"create_time" gorm:"column:create_time" sql:"create_time"`
UpdateTime time.Time `json:"update_time" gorm:"column:update_time" sql:"update_time"`
DeleteTime time.Time `json:"delete_time" gorm:"column:delete_time" sql:"delete_time"`
Version int32 `json:"version" gorm:"column:version" sql:"version"`
IsPublic int32 `json:"is_public" gorm:"column:is_public" sql:"is_public"`
Deleted int32 `json:"deleted" gorm:"column:deleted" sql:"deleted"`
OriginUrl string `json:"origin_url" gorm:"column:origin_url" sql:"origin_url"`
>>>>>>> .merge_file_a29080
}
type DocGroup struct {
@ -90,7 +105,11 @@ UpdateDoc 更新文档
func UpdateDoc(doc Doc) error {
sql := fmt.Sprintf(`update doc set doc.author = '%s' ,doc.title = '%s',doc.type = '%d',doc.content = '%s' ,doc.update_time = '%s' ,doc.version = '%d' where doc.id = '%d'; `,
doc.Author, doc.Title, doc.Type,
<<<<<<< .merge_file_a12396
strings.Replace(doc.Content, "'", "\\'", -1), time.Now().Format("2006-01-02 15:04:05"),doc.Version, doc.ID)
=======
strings.Replace(doc.Content, "'", "\\'", -1), time.Now().Format("2006-01-02 15:04:05"), doc.Version, doc.ID)
>>>>>>> .merge_file_a29080
_, e := db.GetMysqlClient().Query(sql)
if nil != e {
logs.Error(e.Error())
@ -153,6 +172,10 @@ func DeleteArticleType(id int32) error {
return nil
}
<<<<<<< .merge_file_a12396
=======
>>>>>>> .merge_file_a29080
func GetAllDocs() ([]Doc, error) {
ret := []Doc{}
sql := fmt.Sprintf("select * from doc")