| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- package model
- import (
- "crawler/config"
- "crawler/service"
- )
- type G2AReportInterface interface {
- Insert(row G2AReport)
- }
- type G2AReportModel struct {
- G2AReport
- }
- type G2AReport struct {
- TotalCnt int
- InsertCnt int
- UpdateCnt int
- ProcessAt float64
- LastPage int
- CreatedAt string
- }
- func (this *G2AReportModel) Insert(row G2AReport) error {
- var (
- db = service.DB_PLAYR
- conn = db.SQLDB
- )
- sql := `
- INSERT INTO tb_g2a_report
- SET
- total_cnt = ?,
- insert_cnt = ?,
- update_cnt = ?,
- process_at = ?,
- last_page = ?,
- created_at = NOW();
- `
- _, err := conn.Exec(sql,
- row.TotalCnt, row.InsertCnt, row.UpdateCnt, row.ProcessAt, row.LastPage,
- )
- if err != nil {
- db.SetErrorLog(err, sql)
- return err
- }
- db.SetGeneralLog(config.GL_ACTION_WRITE, sql, "insert g2a report")
- return nil
- }
|