|
@@ -40,6 +40,25 @@ func UpdateResourceData(sourceId int, source, publishDate string) (err error) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+// 修改
|
|
|
+func UpdateResourceDataByItem(item *CygxResourceData) (err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ updateParams := make(map[string]interface{})
|
|
|
+ updateParams["PublishDate"] = item.PublishDate
|
|
|
+ updateParams["SearchTag"] = item.SearchTag
|
|
|
+ ptrStructOrTableName := "cygx_resource_data"
|
|
|
+ whereParam := map[string]interface{}{"source_id": item.SourceId, "source": item.Source}
|
|
|
+ qs := o.QueryTable(ptrStructOrTableName)
|
|
|
+ for expr, exprV := range whereParam {
|
|
|
+ qs = qs.Filter(expr, exprV)
|
|
|
+ }
|
|
|
+ _, err = qs.Update(updateParams)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
// 获取数量
|
|
|
func GetCygxReportSelectionBySourceAndId(sourceId int, source string) (count int, err error) {
|
|
|
o := orm.NewOrm()
|