123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593 |
- package controllers
- import (
- "fmt"
- "hongze/hongze_api/models"
- "hongze/hongze_api/services"
- "hongze/hongze_api/utils"
- "strconv"
- "time"
- )
- //年度账单
- type BillController struct {
- BaseAuthController
- }
- // @Title 年度账单接口
- // @Description 年度账单接口
- // @Success 200 {object} models.BillDetailResp
- // @router /detail [get]
- func (this *BillController) Detail() {
- br := new(models.BaseResponse).Init()
- defer func() {
- this.Data["json"] = br
- this.ServeJSON()
- }()
- user := this.User
- if user == nil {
- br.Msg = "请登录"
- br.ErrMsg = "请登录,用户信息为空"
- br.Ret = 600
- return
- }
- uid := user.UserId
- userInfo, err := services.GetWxUserItemByUserId(uid,utils.WxPlatform)
- if err != nil {
- br.Ret = 600
- br.Msg = "登录失败"
- br.ErrMsg = "登录失败,判断权限失败:" + err.Error()
- return
- }
- permission, err := services.CheckUserPermission(uid)
- if err != nil {
- br.Msg = "登录失败"
- br.ErrMsg = "登录失败,判断权限失败:" + err.Error()
- return
- }
- if permission != 0 {
- br.Msg = "判断用户是否有权限失败"
- br.ErrMsg = "判断用户是否有权限失败:uid:" + strconv.Itoa(uid)
- br.Ret = 600
- br.IsSendEmail = false
- return
- }
- startDate := "2020-01-01 00:00:00"
- endDate := time.Now().Format(utils.FormatDate)
- var realName, togetherDay, createDate string
- resp := new(models.BillDetailResp)
- if user.RealName == "" {
- realName = user.NickName
- } else {
- realName = user.RealName
- }
- if !user.CreatedTime.IsZero() {
- sub := time.Now().Sub(user.CreatedTime)
- if sub <= 0 {
- sub = 1
- }
- expireDay := fmt.Sprintf("%v", int(sub.Hours()/24))
- togetherDay = expireDay
- createDate = user.CreatedTime.Format("2006年01月02日")
- } else {
- sub := time.Now().Sub(user.LastUpdatedTime)
- if sub <= 0 {
- sub = 1
- }
- expireDay := fmt.Sprintf("%v", int(sub.Hours()/24))
- togetherDay = expireDay
- createDate = user.LastUpdatedTime.Format("2006年01月02日")
- }
- if togetherDay == "0" {
- togetherDay = "1"
- }
- //uid = 41555
- firstReadReportType, firstReadReportTitle, err := models.GetFirstReportInfo(uid, startDate)
- if err != nil && err.Error() != utils.ErrNoRow() {
- br.Msg = "获取数据失败"
- br.ErrMsg = "获取数据失败GetFirstReportInfo,Err:" + err.Error()
- return
- }
- listenCount, listenVideoPlaySeconds, err := models.GetListenInfo(uid, startDate)
- if err != nil && err.Error() != utils.ErrNoRow() {
- br.Msg = "获取数据失败"
- br.ErrMsg = "获取数据失败GetListenInfo,Err:" + err.Error()
- return
- }
- maxReadReportCount, maxReadReportDate, err := models.GetMaxReadReportInfo(uid, startDate)
- if err != nil && err.Error() != utils.ErrNoRow() {
- br.Msg = "获取数据失败"
- br.ErrMsg = "获取数据失败GetMaxReadReportInfo,Err:" + err.Error()
- return
- }
- latestTime, latestCreateTime, err := models.GetLatestReadReportInfo(uid, startDate)
- if err != nil && err.Error() != utils.ErrNoRow() {
- br.Msg = "获取数据失败"
- br.ErrMsg = "获取数据失败GetLatestReadReportInfo,Err:" + err.Error()
- return
- }
- var lastestCreateDate string
- var VideoPlaySeconds float64
- if !latestCreateTime.IsZero() {
- lastestCreateDate = latestCreateTime.Format(utils.FormatDate)
- addCreateTime := latestCreateTime
- hour := latestCreateTime.Hour()
- if hour > 6 || hour <= 18 {
- rand := utils.GetRandInt(18, 23)
- addHour := rand - hour
- if addHour >= 0 {
- hh, _ := time.ParseDuration(strconv.Itoa(addHour) + "h")
- hh1 := addCreateTime.Add(hh)
- latestTime = hh1.Format("15:04:05")
- }
- }
- }
- if lastestCreateDate != "" {
- rddpReadCount, rddpVideoPlaySeconds, err := models.GetRddpReadReportCountByDate(uid, lastestCreateDate)
- if err != nil && err.Error() != utils.ErrNoRow() {
- br.Msg = "获取数据失败"
- br.ErrMsg = "获取数据失败GetRddpReadReportCountByDate,Err:" + err.Error()
- return
- }
- weekReadCount, err := models.GetWeekReadReportCountByDate(uid, lastestCreateDate)
- if err != nil && err.Error() != utils.ErrNoRow() {
- br.Msg = "获取数据失败"
- br.ErrMsg = "获取数据失败GetWeekReadReportCountByDate,Err:" + err.Error()
- return
- }
- var weekVideoPlaySeconds float64
- if rddpReadCount <= 0 {
- weekVideoPlaySeconds = float64(utils.GetRandInt(3, 300)) / float64(10.00)
- } else {
- weekVideoPlaySeconds = float64(weekReadCount) * (rddpVideoPlaySeconds / float64(rddpReadCount))
- }
- VideoPlaySeconds = utils.FixFloat(rddpVideoPlaySeconds+weekVideoPlaySeconds, 2)
- }
- maxOpenReportClassify, maxOpenReportCount, err := models.GetOpenReadReportInfo(uid, startDate)
- if err != nil && err.Error() != utils.ErrNoRow() {
- br.Msg = "获取数据失败"
- br.ErrMsg = "获取数据失败GetOpenReadReportInfo,Err:" + err.Error()
- return
- }
- rddpTotalPlaySeconds, rddpTotal, err := models.GetRddpTotalReadDuration(uid, startDate)
- if err != nil && err.Error() != utils.ErrNoRow() {
- br.Msg = "获取数据失败"
- br.ErrMsg = "获取数据失败GetRddpTotalReadDuration,Err:" + err.Error()
- return
- }
- weekTotal, err := models.GetWeekTotalRead(uid, startDate)
- if err != nil && err.Error() != utils.ErrNoRow() {
- br.Msg = "获取数据失败"
- br.ErrMsg = "获取数据失败GetRddpTotalReadDuration,Err:" + err.Error()
- return
- }
- totalReadDuration := 0.00
- if rddpTotal <= 0 {
- totalReadDuration = rddpTotalPlaySeconds + float64(weekTotal)*float64(120.00) //(float64(utils.GetRandInt(150, 155))/float64(10.00))
- } else {
- totalReadDuration = rddpTotalPlaySeconds + float64(weekTotal)*float64(120.00) //(rddpTotalPlaySeconds/float64(rddpTotal))*float64(weekTotal)
- }
- fmt.Println(uid, rddpTotalPlaySeconds, weekTotal, totalReadDuration)
- dayType := `day`
- dayTotal, err := models.GetWeekTotalReadByType(uid, dayType, startDate)
- if err != nil && err.Error() != utils.ErrNoRow() {
- br.Msg = "获取数据失败"
- br.ErrMsg = "获取数据失败GetWeekTotalReadByType,Err:" + err.Error() + ";report_type:" + dayType
- return
- }
- weekType := `week`
- weekReportReadTotal, err := models.GetWeekTotalReadByType(uid, weekType, startDate)
- if err != nil && err.Error() != utils.ErrNoRow() {
- br.Msg = "获取数据失败"
- br.ErrMsg = "获取数据失败GetWeekTotalReadByType,Err:" + err.Error() + ";report_type:" + weekType
- return
- }
- twoWeekType := `two_week`
- twoWeekTotal, err := models.GetWeekTotalReadByType(uid, twoWeekType, startDate)
- if err != nil && err.Error() != utils.ErrNoRow() {
- br.Msg = "获取数据失败"
- br.ErrMsg = "获取数据失败GetWeekTotalReadByType,Err:" + err.Error() + ";report_type:" + twoWeekType
- return
- }
- monthType := `month`
- monthTotal, err := models.GetWeekTotalReadByType(uid, dayType, startDate)
- if err != nil && err.Error() != utils.ErrNoRow() {
- br.Msg = "获取数据失败"
- br.ErrMsg = "获取数据失败GetWeekTotalReadByType,Err:" + err.Error() + ";report_type:" + monthType
- return
- }
- rddpReadTotal, err := models.GetRddpTotalReadByType(uid, startDate)
- if err != nil && err.Error() != utils.ErrNoRow() {
- br.Msg = "获取数据失败"
- br.ErrMsg = "获取数据失败GetRddpTotalReadByType,Err:" + err.Error() + ";report_type:" + monthType
- return
- }
- var learnDay int
- rddpLearnDay, err := models.GetRddpLearnDay(uid, startDate, endDate)
- if err != nil && err.Error() != utils.ErrNoRow() {
- br.Msg = "获取数据失败"
- br.ErrMsg = "获取数据失败GetRddpLearnDay,Err:" + err.Error() + ";report_type:" + monthType
- return
- }
- weekLearnDay, err := models.GetWeekpLearnDay(uid, startDate)
- if err != nil && err.Error() != utils.ErrNoRow() {
- br.Msg = "获取数据失败"
- br.ErrMsg = "获取数据失败GetWeekpLearnDay,Err:" + err.Error() + ";report_type:" + monthType
- return
- }
- if rddpLearnDay >= weekLearnDay {
- learnDay = rddpLearnDay
- } else {
- learnDay = weekLearnDay
- }
- if learnDay <= 0 {
- learnDay = 1
- }
- resp.RealName = realName
- resp.TogetherDay = togetherDay
- resp.CreateDate = createDate
- if firstReadReportType == "rddp" {
- resp.FirstReadReportType = "日度点评"
- } else if firstReadReportType == "day" {
- resp.FirstReadReportType = "晨报"
- } else if firstReadReportType == "week" {
- resp.FirstReadReportType = "周报"
- } else if firstReadReportType == "two_week" {
- resp.FirstReadReportType = "双周报"
- } else if firstReadReportType == "month" {
- resp.FirstReadReportType = "月报"
- } else {
- resp.FirstReadReportType = "其他"
- }
- resp.FirstReadReportTitle = firstReadReportTitle
- resp.ListenReportCount = listenCount
- resp.ListenReportDuration = utils.FixFloat((listenVideoPlaySeconds / 60.00), 2)
- resp.MaxReadReportCount = maxReadReportCount
- resp.MaxReadReportDate = maxReadReportDate.Format("2006年01月02日")
- if lastestCreateDate == "" {
- resp.LatestReadReportDate = ""
- } else {
- lastestDate, _ := time.Parse("2006-01-02", lastestCreateDate)
- resp.LatestReadReportDate = lastestDate.Format("2006年01月02日")
- }
- resp.LatestReadReportTime = latestTime
- resp.LatestReadReportDateDuration = VideoPlaySeconds
- resp.MaxOpenReportClassify = maxOpenReportClassify
- resp.MaxOpenReportCount = maxOpenReportCount
- resp.TotalReadDuration = totalReadDuration
- resp.TotalReportDayCount = dayTotal
- resp.TotalReportWeekCount = weekReportReadTotal
- resp.TotalReportTwoWeekCount = twoWeekTotal
- resp.TotalReportMonthCount = monthTotal
- resp.TotalReportRddpCount = rddpReadTotal
- resp.LearnDay = learnDay
- resp.TotalReport = dayTotal + weekReportReadTotal + twoWeekTotal + monthTotal + rddpReadTotal
- {
- annualReport := new(models.AnnualReport)
- annualReport.AnnualReportDate = "2020"
- annualReport.UserId = uid
- annualReport.Mobile = userInfo.Mobile
- annualReport.Email = userInfo.Email
- annualReport.CompanyId = userInfo.CompanyId
- annualReport.RealName = realName
- annualReport.TogetherDay = togetherDay
- annualReport.CreateDate = createDate
- annualReport.FirstReadReportType = firstReadReportType
- annualReport.FirstReadReportTitle = firstReadReportTitle
- annualReport.ListenReportCount = listenCount
- annualReport.ListenReportDuration = listenVideoPlaySeconds
- annualReport.MaxReadReportDate = resp.MaxReadReportDate
- annualReport.MaxReadReportCount = resp.MaxReadReportCount
- annualReport.LatestReadReportDate = resp.LatestReadReportDate
- annualReport.LatestReadReportTime = resp.LatestReadReportTime
- annualReport.LatestReadReportDateDuration = resp.LatestReadReportDateDuration
- annualReport.MaxOpenReportClassify = resp.MaxOpenReportClassify
- annualReport.MaxOpenReportCount = resp.MaxOpenReportCount
- annualReport.TotalReadDuration = resp.TotalReadDuration
- annualReport.TotalReportDayCount = resp.TotalReportDayCount
- annualReport.TotalReportWeekCount = resp.TotalReportWeekCount
- annualReport.TotalReportMonthCount = resp.TotalReportMonthCount
- annualReport.TotalReportTwoWeekCount = resp.TotalReportTwoWeekCount
- annualReport.TotalReportRddpCount = resp.TotalReportRddpCount
- annualReport.TotalReport = resp.TotalReport
- annualReport.LearnDay = resp.LearnDay
- annualReport.CreateTime = time.Now()
- go models.AddAnnualReport(annualReport)
- }
- br.Ret = 200
- br.Success = true
- br.Msg = "获取成功"
- br.Data = resp
- }
- //
- //func init123() {
- // fmt.Println("start")
- // msg := ""
- // defer func() {
- // if msg != "" {
- // fmt.Println("err:" + msg)
- // }
- // }()
- // list, err := models.GetWxUserAll()
- // if err != nil {
- // msg = "GetWxUserAll Err:" + err.Error()
- // return
- // }
- // for _, user := range list {
- // uid := user.UserId
- // existCount, err := models.GetAnnualReportCount(uid)
- // if err != nil {
- // msg = "GetAnnualReportCount Err:" + err.Error()
- // return
- // }
- // if existCount > 0 {
- // continue
- // }
- // userInfo, err := models.GetWxUserItemByUserId(uid)
- // if err != nil {
- // msg = "GetWxUserItemByUserId Err:" + err.Error()
- // return
- // }
- // permission, err := services.CheckUserPermission(uid)
- // if err != nil {
- // msg = "GetWxUserItemByUserId Err:" + err.Error()
- // return
- // }
- // if permission != 0 {
- // msg = "判断用户是否有权限失败"
- // return
- // }
- // startDate := "2020-01-01 00:00:00"
- // endDate := time.Now().Format(utils.FormatDate)
- // var realName, togetherDay, createDate string
- //
- // resp := new(models.BillDetailResp)
- // if user.RealName == "" {
- // realName = user.NickName
- // } else {
- // realName = user.RealName
- // }
- // if !user.CreatedTime.IsZero() {
- // sub := time.Now().Sub(user.CreatedTime)
- // if sub <= 0 {
- // sub = 1
- // }
- // expireDay := fmt.Sprintf("%v", int(sub.Hours()/24))
- // togetherDay = expireDay
- // createDate = user.CreatedTime.Format("2006年01月02日")
- // } else {
- // sub := time.Now().Sub(user.LastUpdatedTime)
- // if sub <= 0 {
- // sub = 1
- // }
- // expireDay := fmt.Sprintf("%v", int(sub.Hours()/24))
- // togetherDay = expireDay
- // createDate = user.LastUpdatedTime.Format("2006年01月02日")
- // }
- // if togetherDay == "0" {
- // togetherDay = "1"
- // }
- // //uid = 41555
- //
- // firstReadReportType, firstReadReportTitle, err := models.GetFirstReportInfo(uid, startDate)
- // if err != nil && err.Error() != utils.ErrNoRow() {
- // msg = "获取数据失败GetFirstReportInfo,Err:" + err.Error()
- // return
- // }
- // listenCount, listenVideoPlaySeconds, err := models.GetListenInfo(uid, startDate)
- // if err != nil && err.Error() != utils.ErrNoRow() {
- // msg = "获取数据失败GetListenInfo,Err:" + err.Error()
- // return
- // }
- // maxReadReportCount, maxReadReportDate, err := models.GetMaxReadReportInfo(uid, startDate)
- // if err != nil && err.Error() != utils.ErrNoRow() {
- // msg = "获取数据失败GetMaxReadReportInfo,Err:" + err.Error()
- // return
- // }
- //
- // latestTime, latestCreateTime, err := models.GetLatestReadReportInfo(uid, startDate)
- // if err != nil && err.Error() != utils.ErrNoRow() {
- // msg = "获取数据失败GetLatestReadReportInfo,Err:" + err.Error()
- // return
- // }
- //
- // var lastestCreateDate string
- // var VideoPlaySeconds float64
- // if !latestCreateTime.IsZero() {
- // lastestCreateDate = latestCreateTime.Format(utils.FormatDate)
- // addCreateTime := latestCreateTime
- // hour := latestCreateTime.Hour()
- // if hour > 6 || hour <= 18 {
- // rand := utils.GetRandInt(18, 23)
- // addHour := rand - hour
- // if addHour >= 0 {
- // hh, _ := time.ParseDuration(strconv.Itoa(addHour) + "h")
- // hh1 := addCreateTime.Add(hh)
- // latestTime = hh1.Format("15:04:05")
- // }
- // }
- // }
- // if lastestCreateDate != "" {
- // rddpReadCount, rddpVideoPlaySeconds, err := models.GetRddpReadReportCountByDate(uid, lastestCreateDate)
- // if err != nil && err.Error() != utils.ErrNoRow() {
- // msg = "获取数据失败GetRddpReadReportCountByDate,Err:" + err.Error()
- // return
- // }
- // weekReadCount, err := models.GetWeekReadReportCountByDate(uid, lastestCreateDate)
- // if err != nil && err.Error() != utils.ErrNoRow() {
- // msg = "获取数据失败GetWeekReadReportCountByDate,Err:" + err.Error()
- // return
- // }
- // var weekVideoPlaySeconds float64
- // if rddpReadCount <= 0 {
- // weekVideoPlaySeconds = float64(utils.GetRandInt(3, 300)) / float64(10.00)
- // } else {
- // weekVideoPlaySeconds = float64(weekReadCount) * (rddpVideoPlaySeconds / float64(rddpReadCount))
- // }
- // VideoPlaySeconds = utils.FixFloat(rddpVideoPlaySeconds+weekVideoPlaySeconds, 2)
- // }
- //
- // maxOpenReportClassify, maxOpenReportCount, err := models.GetOpenReadReportInfo(uid, startDate)
- // if err != nil && err.Error() != utils.ErrNoRow() {
- // msg = "获取数据失败GetOpenReadReportInfo,Err:" + err.Error()
- // return
- // }
- //
- // rddpTotalPlaySeconds, rddpTotal, err := models.GetRddpTotalReadDuration(uid, startDate)
- // if err != nil && err.Error() != utils.ErrNoRow() {
- // msg = "获取数据失败GetRddpTotalReadDuration,Err:" + err.Error()
- // return
- // }
- //
- // weekTotal, err := models.GetWeekTotalRead(uid, startDate)
- // if err != nil && err.Error() != utils.ErrNoRow() {
- // msg = "获取数据失败GetRddpTotalReadDuration,Err:" + err.Error()
- // return
- // }
- // totalReadDuration := 0.00
- // if rddpTotal <= 0 {
- // totalReadDuration = rddpTotalPlaySeconds + float64(weekTotal)*float64(120.00) //(float64(utils.GetRandInt(150, 155))/float64(10.00))
- // } else {
- // totalReadDuration = rddpTotalPlaySeconds + float64(weekTotal)*float64(120.00) //(rddpTotalPlaySeconds/float64(rddpTotal))*float64(weekTotal)
- // }
- // fmt.Println(uid, rddpTotalPlaySeconds, weekTotal, totalReadDuration)
- // dayType := `day`
- // dayTotal, err := models.GetWeekTotalReadByType(uid, dayType, startDate)
- // if err != nil && err.Error() != utils.ErrNoRow() {
- // msg = "获取数据失败GetWeekTotalReadByType,Err:" + err.Error()
- // return
- // }
- // weekType := `week`
- // weekReportReadTotal, err := models.GetWeekTotalReadByType(uid, weekType, startDate)
- // if err != nil && err.Error() != utils.ErrNoRow() {
- // msg = "获取数据失败GetWeekTotalReadByType,Err:" + err.Error()
- // return
- // }
- // twoWeekType := `two_week`
- // twoWeekTotal, err := models.GetWeekTotalReadByType(uid, twoWeekType, startDate)
- // if err != nil && err.Error() != utils.ErrNoRow() {
- // msg = "获取数据失败GetWeekTotalReadByType,Err:" + err.Error()
- // return
- // }
- // monthType := `month`
- // monthTotal, err := models.GetWeekTotalReadByType(uid, dayType, startDate)
- // if err != nil && err.Error() != utils.ErrNoRow() {
- // msg = "获取数据失败GetWeekTotalReadByType,Err:" + err.Error()
- // return
- // }
- //
- // rddpReadTotal, err := models.GetRddpTotalReadByType(uid, startDate)
- // if err != nil && err.Error() != utils.ErrNoRow() {
- // msg = "获取数据失败GetRddpTotalReadByType,Err:" + err.Error()
- // return
- // }
- //
- // var learnDay int
- // rddpLearnDay, err := models.GetRddpLearnDay(uid, startDate, endDate)
- // if err != nil && err.Error() != utils.ErrNoRow() {
- // msg = "获取数据失败GetRddpLearnDay,Err:" + err.Error()
- // return
- // }
- //
- // weekLearnDay, err := models.GetWeekpLearnDay(uid, startDate)
- // if err != nil && err.Error() != utils.ErrNoRow() {
- // msg = "获取数据失败GetWeekpLearnDay,Err:" + err.Error() + ";report_type:" + monthType
- // return
- // }
- // if rddpLearnDay >= weekLearnDay {
- // learnDay = rddpLearnDay
- // } else {
- // learnDay = weekLearnDay
- // }
- // if learnDay <= 0 {
- // learnDay = 1
- // }
- // resp.RealName = realName
- // resp.TogetherDay = togetherDay
- // resp.CreateDate = createDate
- // if firstReadReportType == "rddp" {
- // resp.FirstReadReportType = "日度点评"
- // } else if firstReadReportType == "day" {
- // resp.FirstReadReportType = "晨报"
- // } else if firstReadReportType == "week" {
- // resp.FirstReadReportType = "周报"
- // } else if firstReadReportType == "two_week" {
- // resp.FirstReadReportType = "双周报"
- // } else if firstReadReportType == "month" {
- // resp.FirstReadReportType = "月报"
- // } else {
- // resp.FirstReadReportType = "其他"
- // }
- // resp.FirstReadReportTitle = firstReadReportTitle
- // resp.ListenReportCount = listenCount
- // resp.ListenReportDuration = utils.FixFloat((listenVideoPlaySeconds / 60.00), 2)
- // resp.MaxReadReportCount = maxReadReportCount
- // resp.MaxReadReportDate = maxReadReportDate.Format("2006年01月02日")
- // if lastestCreateDate == "" {
- // resp.LatestReadReportDate = ""
- // } else {
- // lastestDate, _ := time.Parse("2006-01-02", lastestCreateDate)
- // resp.LatestReadReportDate = lastestDate.Format("2006年01月02日")
- // }
- // resp.LatestReadReportTime = latestTime
- // resp.LatestReadReportDateDuration = VideoPlaySeconds
- // resp.MaxOpenReportClassify = maxOpenReportClassify
- // resp.MaxOpenReportCount = maxOpenReportCount
- // resp.TotalReadDuration = totalReadDuration
- // resp.TotalReportDayCount = dayTotal
- // resp.TotalReportWeekCount = weekReportReadTotal
- // resp.TotalReportTwoWeekCount = twoWeekTotal
- // resp.TotalReportMonthCount = monthTotal
- // resp.TotalReportRddpCount = rddpReadTotal
- // resp.LearnDay = learnDay
- // resp.TotalReport = dayTotal + weekReportReadTotal + twoWeekTotal + monthTotal + rddpReadTotal
- //
- // {
- //
- // annualReport := new(models.AnnualReport)
- // annualReport.AnnualReportDate = "2020"
- // annualReport.UserId = uid
- // annualReport.Mobile = userInfo.Mobile
- // annualReport.Email = userInfo.Email
- // annualReport.CompanyId = userInfo.CompanyId
- // annualReport.RealName = realName
- // annualReport.TogetherDay = togetherDay
- // annualReport.CreateDate = createDate
- // annualReport.FirstReadReportType = firstReadReportType
- // annualReport.FirstReadReportTitle = firstReadReportTitle
- // annualReport.ListenReportCount = listenCount
- // annualReport.ListenReportDuration = listenVideoPlaySeconds
- // annualReport.MaxReadReportDate = resp.MaxReadReportDate
- // annualReport.MaxReadReportCount = resp.MaxReadReportCount
- // annualReport.LatestReadReportDate = resp.LatestReadReportDate
- // annualReport.LatestReadReportTime = resp.LatestReadReportTime
- // annualReport.LatestReadReportDateDuration = resp.LatestReadReportDateDuration
- // annualReport.MaxOpenReportClassify = resp.MaxOpenReportClassify
- // annualReport.MaxOpenReportCount = resp.MaxOpenReportCount
- // annualReport.TotalReadDuration = resp.TotalReadDuration
- // annualReport.TotalReportDayCount = resp.TotalReportDayCount
- // annualReport.TotalReportWeekCount = resp.TotalReportWeekCount
- // annualReport.TotalReportMonthCount = resp.TotalReportMonthCount
- // annualReport.TotalReportTwoWeekCount = resp.TotalReportTwoWeekCount
- // annualReport.TotalReportRddpCount = resp.TotalReportRddpCount
- // annualReport.TotalReport = resp.TotalReport
- // annualReport.LearnDay = resp.LearnDay
- // annualReport.CreateTime = time.Now()
- // models.AddAnnualReport(annualReport)
- // }
- // }
- // return
- // fmt.Println("end")
- //}
|