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")
//}