This commit is contained in:
邹宗楠
2022-08-11 14:23:06 +08:00
parent 7efcd3a614
commit c845eabe69
32 changed files with 231 additions and 212 deletions

32
business/dao/common.go Normal file
View File

@@ -0,0 +1,32 @@
package dao
import (
"git.rosy.net.cn/jx-callback/business/model"
)
func GetDataResource(db *DaoDB, hashCode, fullURL string) (dataRes *model.DataResource, err error) {
sql := `
SELECT t1.*
FROM data_resource t1
WHERE 0 = 1`
sqlParams := []interface{}{}
if hashCode != "" {
sql += " OR t1.hash_code = ?"
sqlParams = append(sqlParams, hashCode)
}
if fullURL != "" {
sql += " OR t1.main_url = ? OR t1.qiniu_url = ? OR t1.ebai_url = ? OR t1.mtwm_url = ?"
sqlParams = append(sqlParams, fullURL, fullURL, fullURL, fullURL)
}
err = GetRow(db, &dataRes, sql, sqlParams...)
return dataRes, err
}
func GetNeedUploadDataResource(db *DaoDB) (dataResList []*model.DataResource, err error) {
sql := `
SELECT t1.*
FROM data_resource t1
WHERE t1.use_type <> 0 AND (t1.ebai_url = '' OR t1.mtwm_url = '')`
err = GetRows(db, &dataResList, sql)
return dataResList, err
}