소스 검색

Merge branch 'feature/v2.3.5'

123456 2 년 전
부모
커밋
1d569130f0
1개의 변경된 파일6개의 추가작업 그리고 6개의 파일을 삭제
  1. 6 6
      pushsubscribe/src/report/statistic/job/statisticjob.go

+ 6 - 6
pushsubscribe/src/report/statistic/job/statisticjob.go

@@ -67,7 +67,7 @@ func (s *StatisticJob) Execute(now time.Time) {
 				}
 				todayPushCount := Mysql.CountBySql("select count(1) from pushsubscribe where userid=? and date>=? and date<=? and isvip=1", baseUserId, s.today_start, s.today_end_ymdhms)
 				//toptype
-				toptype := Mysql.SelectBySql("SELECT b.name,SUM(1) AS SUM FROM (SELECT b.toptype_code FROM pushsubscribe a INNER JOIN global_common_data.dws_f_bid_baseinfo b ON (a.infoid=b.infoid) WHERE a.userid=? AND a.date>=? AND a.date<=? AND a.isvip=1) AS a INNER JOIN global_common_data.code_bidtopsubtype b ON (a.toptype_code=b.code) GROUP BY b.name", baseUserId, s.today_start, s.today_end_ymdhms)
+				toptype := Mysql.SelectBySql("SELECT c.name,SUM(1) AS SUM FROM pushsubscribe a STRAIGHT_JOIN global_common_data.dws_f_bid_baseinfo b ON (a.userid=? AND a.date>=? AND a.date<=? AND a.isvip=1 and a.infoid=b.infoid) STRAIGHT_JOIN global_common_data.code_bidtopsubtype c ON (b.toptype_code=c.code) GROUP BY c.name", baseUserId, s.today_start, s.today_end_ymdhms)
 				todayToptype := map[string]int{}
 				for _, v := range *toptype {
 					name := util.ObjToString(v["name"])
@@ -77,12 +77,12 @@ func (s *StatisticJob) Execute(now time.Time) {
 					todayToptype[name] = util.IntAll(v["sum"])
 				}
 				//subtype统计
-				subtype := Mysql.SelectBySql("SELECT b.name,SUM(1) AS SUM FROM (SELECT b.subtype_code FROM pushsubscribe a INNER JOIN global_common_data.dws_f_bid_baseinfo b ON (a.infoid=b.infoid) WHERE a.userid=? AND a.date>=? AND a.date<=? AND b.toptype_code='01' AND isvip=1) AS a INNER JOIN global_common_data.code_bidtopsubtype b ON (a.subtype_code=b.code) GROUP BY b.name", baseUserId, s.today_start, s.today_end_ymdhms)
+				subtype := Mysql.SelectBySql("SELECT c.name,SUM(1) AS SUM FROM pushsubscribe a STRAIGHT_JOIN global_common_data.dws_f_bid_baseinfo b ON (a.userid=? AND a.date>=? AND a.date<=? AND a.isvip=1 AND a.infoid=b.infoid AND b.toptype_code='01') STRAIGHT_JOIN global_common_data.code_bidtopsubtype c ON (b.subtype_code=c.code) GROUP BY c.name", baseUserId, s.today_start, s.today_end_ymdhms)
 				todaySubtype := map[string]int{}
 				for _, v := range *subtype {
 					todaySubtype[util.ObjToString(v["name"])] = util.IntAll(v["sum"])
 				}
-				datas := Mysql.SelectBySql("SELECT a.infoid FROM pushsubscribe a INNER JOIN global_common_data.dws_f_bid_baseinfo b ON (a.infoid=b.infoid) WHERE a.userid=? AND a.date>=? AND a.date<=? AND b.toptype_code='03' AND isvip=1", baseUserId, s.today_start, s.today_end_ymdhms)
+				datas := Mysql.SelectBySql("SELECT a.infoid FROM pushsubscribe a STRAIGHT_JOIN global_common_data.dws_f_bid_baseinfo b ON a.userid=? AND a.date>=? AND a.date<=? AND a.isvip=1 AND a.infoid=b.infoid AND b.toptype_code='03'", baseUserId, s.today_start, s.today_end_ymdhms)
 				if datas != nil {
 					projectSubtypes := s.SearchProject(datas)
 					for _, v := range projectSubtypes {
@@ -90,19 +90,19 @@ func (s *StatisticJob) Execute(now time.Time) {
 					}
 				}
 				//关键词统计
-				matchkeys := Mysql.SelectBySql("select a.matchkeys,sum(1) as sum from (select matchkeys from pushsubscribe where userid=? and date>=? and date<=? and isvip=1 and matchkeys is not null) as a group by a.matchkeys", baseUserId, s.today_start, s.today_end_ymdhms)
+				matchkeys := Mysql.SelectBySql("select matchkeys,sum(1) as sum from pushsubscribe where userid=? and date>=? and date<=? and isvip=1 and matchkeys is not null group by matchkeys", baseUserId, s.today_start, s.today_end_ymdhms)
 				todayMatchkeys := map[string]int{}
 				for _, v := range *matchkeys {
 					todayMatchkeys[util.ObjToString(v["matchkeys"])] = util.IntAll(v["sum"])
 				}
 				//省统计
-				area := Mysql.SelectBySql("SELECT c.area,SUM(1) AS SUM FROM pushsubscribe AS a INNER JOIN global_common_data.dws_f_bid_baseinfo b ON (a.infoid=b.infoid) INNER JOIN global_common_data.code_area c ON (b.area_code=c.code) WHERE a.userid=? AND a.date>=? AND a.date<=? AND isvip=1 GROUP BY c.area", baseUserId, s.today_start, s.today_end_ymdhms)
+				area := Mysql.SelectBySql("SELECT c.area,SUM(1) AS SUM FROM pushsubscribe AS a STRAIGHT_JOIN global_common_data.dws_f_bid_baseinfo b ON (a.userid=? AND a.date>=? AND a.date<=? AND a.isvip=1 AND a.infoid=b.infoid) STRAIGHT_JOIN global_common_data.code_area c ON (b.area_code=c.code) GROUP BY c.area", baseUserId, s.today_start, s.today_end_ymdhms)
 				todayArea := map[string]int{}
 				for _, v := range *area {
 					todayArea[util.ObjToString(v["name"])] = util.IntAll(v["sum"])
 				}
 				//市统计
-				city := Mysql.SelectBySql("SELECT d.area AS AREA,c.name AS city,c.sum FROM (SELECT b.area_code,c.city AS NAME,SUM(1) AS SUM FROM pushsubscribe AS a INNER JOIN global_common_data.dws_f_bid_baseinfo b ON (a.infoid=b.infoid) INNER JOIN global_common_data.code_area c ON (b.city_code=c.code) WHERE a.userid=? AND a.date>=? AND a.date<=? AND isvip=1 GROUP BY b.city_code,b.area_code) AS c INNER JOIN global_common_data.code_area d ON (c.area_code=d.code)", baseUserId, s.today_start, s.today_end_ymdhms)
+				city := Mysql.SelectBySql("SELECT d.area AS area,c.name AS city,c.sum FROM (SELECT b.area_code,c.city AS NAME,SUM(1) AS SUM FROM pushsubscribe AS a STRAIGHT_JOIN global_common_data.dws_f_bid_baseinfo b ON (a.userid=? AND a.date>=? AND a.date<=? AND a.isvip=1 AND a.infoid=b.infoid) STRAIGHT_JOIN global_common_data.code_area c ON (b.city_code=c.code) GROUP BY b.area_code,c.city) AS c STRAIGHT_JOIN global_common_data.code_area d ON (c.area_code=d.code)", baseUserId, s.today_start, s.today_end_ymdhms)
 				todayCity := map[string]map[string]int{}
 				for _, v := range *city {
 					if todayCity[util.ObjToString(v["area"])] == nil {