|
@@ -63,12 +63,14 @@ func GetUserToArticleCount(uid, articleId int) (count int, err error) {
|
|
|
type AddStopTimeRep struct {
|
|
|
ArticleId int `description:"文章ID"`
|
|
|
StopTime int `description:"停留时间"`
|
|
|
+ OutType int `description:"退出方式,1正常退出,2强制关闭"`
|
|
|
}
|
|
|
|
|
|
type AddStopTimeNewRep struct {
|
|
|
Id int `description:"ID"`
|
|
|
ArticleId int `description:"文章ID"`
|
|
|
StopTime int `description:"停留时间"`
|
|
|
+ OutType int `description:"退出方式,1正常退出,2强制关闭"`
|
|
|
}
|
|
|
|
|
|
type ArticleDetailAddStopTimeRep struct {
|
|
@@ -78,21 +80,8 @@ type ArticleDetailAddStopTimeRep struct {
|
|
|
|
|
|
func AddArticleStopTime(item *AddStopTimeNewRep) (err error) {
|
|
|
o := orm.NewOrm()
|
|
|
- //o.Begin()
|
|
|
- //defer func() {
|
|
|
- // if err == nil {
|
|
|
- // o.Commit()
|
|
|
- // } else {
|
|
|
- // o.Rollback()
|
|
|
- // }
|
|
|
- //}()
|
|
|
- sql := `UPDATE cygx_article_history_record SET stop_time = ? WHERE id =?`
|
|
|
- _, err = o.Raw(sql, item.StopTime, item.Id).Exec()
|
|
|
- if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
- return
|
|
|
- }
|
|
|
- //sql = ` DELETE FROM cygx_article_history_record WHERE create_time > '2021-06-01 00:00:00' AND stop_time = 0`
|
|
|
- //_, err = o.Raw(sql).Exec()
|
|
|
+ sql := `UPDATE cygx_article_history_record SET stop_time = ?,out_type = ? WHERE id =?`
|
|
|
+ _, err = o.Raw(sql, item.StopTime, item.OutType, item.Id).Exec()
|
|
|
return
|
|
|
}
|
|
|
|