fix sql the table select error

This commit is contained in:
huangsimin 2018-12-18 16:02:23 +08:00
parent be2a590aa8
commit 0175fd27d2

View File

@ -93,7 +93,7 @@ func (logdb *LogDB) Connect() {
// ADInsert 插入数据
func (logdb *LogDB) ADInsert(uid, device, platform, area_cc, section_id, response string, spider_id, channel, media, catch_account_id, status, priority int, ts_crawl time.Time) {
_, err := logdb.driver.Exec("insert into "+logdb.DB+"(uid, spider_id, device, platform, channel, media, area_cc, catch_account_id, section_id, response, status, priority, ts_crawl) value(?, ?, ?, ?, ?, ?, ?, ?, ?, ? , ? ,? ,? ,?)", uid, spider_id, device, platform, channel, media, area_cc, catch_account_id, section_id, response, status, priority, ts_crawl)
_, err := logdb.driver.Exec("insert into log_spider (uid, spider_id, device, platform, channel, media, area_cc, catch_account_id, section_id, response, status, priority, ts_crawl) value(?, ?, ?, ?, ?, ?, ?, ?, ?, ? , ? ,? ,? ,?)", uid, spider_id, device, platform, channel, media, area_cc, catch_account_id, section_id, response, status, priority, ts_crawl)
if err != nil {
log.Println(err)
}
@ -110,7 +110,7 @@ func (logdb *LogDB) Select(query string, args ...interface{}) *sql.Rows {
// ADError 广告错误后更新
func (logdb *LogDB) ADError(uid, error_msg string) {
_, err := logdb.driver.Exec("update ? set status = status + 1000, error_msg=? where uid =?;", logdb.DB, error_msg, uid)
_, err := logdb.driver.Exec("update log_spider set status = status + 1000, error_msg=? where uid =?;", logdb.DB, error_msg, uid)
if err != nil {
log.Println(err)
}