|
@@ -14,16 +14,17 @@ type CygxResourceData struct {
|
|
CreateTime time.Time `description:"创建时间"`
|
|
CreateTime time.Time `description:"创建时间"`
|
|
PublishDate string `description:"发布时间"`
|
|
PublishDate string `description:"发布时间"`
|
|
Abstract string `description:"摘要"`
|
|
Abstract string `description:"摘要"`
|
|
|
|
+ SearchTag string `description:"搜索标签"`
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
+
|
|
func AddCygxResourceData(item *CygxResourceData) (lastId int64, err error) {
|
|
func AddCygxResourceData(item *CygxResourceData) (lastId int64, err error) {
|
|
o := orm.NewOrm()
|
|
o := orm.NewOrm()
|
|
lastId, err = o.Insert(item)
|
|
lastId, err = o.Insert(item)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
+
|
|
func DeleteResourceData(sourceId int, source string) (err error) {
|
|
func DeleteResourceData(sourceId int, source string) (err error) {
|
|
o := orm.NewOrm()
|
|
o := orm.NewOrm()
|
|
sql := ` DELETE FROM cygx_resource_data WHERE source_id = ? AND source =? `
|
|
sql := ` DELETE FROM cygx_resource_data WHERE source_id = ? AND source =? `
|
|
@@ -31,10 +32,18 @@ func DeleteResourceData(sourceId int, source string) (err error) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
+
|
|
func UpdateResourceData(sourceId int, source, publishDate string) (err error) {
|
|
func UpdateResourceData(sourceId int, source, publishDate string) (err error) {
|
|
o := orm.NewOrm()
|
|
o := orm.NewOrm()
|
|
sql := `UPDATE cygx_resource_data SET publish_date=? WHERE source_id=? AND source =? `
|
|
sql := `UPDATE cygx_resource_data SET publish_date=? WHERE source_id=? AND source =? `
|
|
_, err = o.Raw(sql, publishDate, sourceId, source).Exec()
|
|
_, err = o.Raw(sql, publishDate, sourceId, source).Exec()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func GetCygxReportSelectionBySourceAndId(sourceId int, source string) (count int, err error) {
|
|
|
|
+ o := orm.NewOrm()
|
|
|
|
+ sqlCount := ` SELECT COUNT(1) AS count FROM cygx_resource_data WHERE source_id = ? AND source =? `
|
|
|
|
+ err = o.Raw(sqlCount, sourceId, source).QueryRow(&count)
|
|
|
|
+ return
|
|
|
|
+}
|