|
@@ -1,9 +1,10 @@
|
|
|
package models
|
|
|
|
|
|
import (
|
|
|
+ "time"
|
|
|
+
|
|
|
"github.com/beego/beego/v2/client/orm"
|
|
|
"github.com/rdlucklib/rdluck_tools/paging"
|
|
|
- "time"
|
|
|
)
|
|
|
|
|
|
// EnglishReportEmailPV 英文研报-邮箱pv
|
|
@@ -30,6 +31,10 @@ type EnglishReportEmailPvPageListResp struct {
|
|
|
List []*EnglishReportEmailPvResp
|
|
|
Paging *paging.PagingItem `description:"分页数据"`
|
|
|
}
|
|
|
+type EnglishReportEmailUvPageListResp struct {
|
|
|
+ List []*EnglishReportEmailUvResp
|
|
|
+ Paging *paging.PagingItem `description:"分页数据"`
|
|
|
+}
|
|
|
|
|
|
// EnglishReportEmailPvResp 邮箱响应体
|
|
|
type EnglishReportEmailPvResp struct {
|
|
@@ -39,6 +44,12 @@ type EnglishReportEmailPvResp struct {
|
|
|
RecentClickTime string `description:"最近一次点击时间"`
|
|
|
}
|
|
|
|
|
|
+type EnglishReportEmailUvResp struct {
|
|
|
+ Name string `description:"客户名称"`
|
|
|
+ Email string `description:"邮箱地址"`
|
|
|
+ RecentClickTime string `description:"最近一次点击时间"`
|
|
|
+}
|
|
|
+
|
|
|
// GetEnglishReportEmailPageList 获取邮箱pv列表-分页
|
|
|
func GetEnglishReportEmailPvPageList(condition string, pars []interface{}, startSize, pageSize int) (total int, list []*EnglishReportEmailPvResp, err error) {
|
|
|
o := orm.NewOrmUsingDB("rddp")
|
|
@@ -66,6 +77,32 @@ func GetEnglishReportEmailPvPageList(condition string, pars []interface{}, start
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+// GetEnglishReportEmailUvPageList 获取邮箱uv列表-分页
|
|
|
+func GetEnglishReportEmailUvPageList(condition string, pars []interface{}, startSize, pageSize int) (total int, list []*EnglishReportEmailUvResp, err error) {
|
|
|
+ o := orm.NewOrmUsingDB("rddp")
|
|
|
+ sql := `SELECT
|
|
|
+ b.name,
|
|
|
+ b.email,
|
|
|
+ MAX(a.create_time) AS recent_click_time
|
|
|
+ FROM
|
|
|
+ english_report_email_pv AS a
|
|
|
+ JOIN english_report_email AS b ON a.email_id = b.id
|
|
|
+ WHERE 1 = 1 `
|
|
|
+ if condition != `` {
|
|
|
+ sql += condition
|
|
|
+ }
|
|
|
+ sql += ` GROUP BY a.email_id `
|
|
|
+
|
|
|
+ totalSQl := `SELECT COUNT(1) total FROM (` + sql + `) z`
|
|
|
+ if err = o.Raw(totalSQl, pars).QueryRow(&total); err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ sql += ` ORDER BY recent_click_time DESC LIMIT ?,?`
|
|
|
+
|
|
|
+ _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&list)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
// EnglishEmailViewPageListResp 邮箱/联系人阅读分页列表响应体
|
|
|
type EnglishEmailViewPageListResp struct {
|
|
|
List []*EnglishEmailViewResp
|