|
@@ -16,6 +16,7 @@ import lombok.Builder;
|
|
import lombok.Data;
|
|
import lombok.Data;
|
|
import lombok.NoArgsConstructor;
|
|
import lombok.NoArgsConstructor;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
+import org.apache.commons.collections4.CollectionUtils;
|
|
import org.apache.commons.lang3.ArrayUtils;
|
|
import org.apache.commons.lang3.ArrayUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.nutz.dao.Cnd;
|
|
import org.nutz.dao.Cnd;
|
|
@@ -32,7 +33,6 @@ import org.springframework.beans.BeanWrapper;
|
|
import org.springframework.beans.BeanWrapperImpl;
|
|
import org.springframework.beans.BeanWrapperImpl;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
-import org.springframework.util.CollectionUtils;
|
|
|
|
import reactor.util.function.Tuple2;
|
|
import reactor.util.function.Tuple2;
|
|
import reactor.util.function.Tuples;
|
|
import reactor.util.function.Tuples;
|
|
|
|
|
|
@@ -196,7 +196,7 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
@Override
|
|
@Override
|
|
public Page<GameDataDayVO> getGameDataDay(GameDataDayDTO dto) {
|
|
public Page<GameDataDayVO> getGameDataDay(GameDataDayDTO dto) {
|
|
com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo(dto.getSourceSystem());
|
|
com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo(dto.getSourceSystem());
|
|
- List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
|
|
|
|
|
|
+ List<Long> gameIds = CollectionUtils.isEmpty(dto.getGameId()) ? poerInfo.second : dto.getGameId();
|
|
|
|
|
|
//默认查询 total 总量数据
|
|
//默认查询 total 总量数据
|
|
if (StringUtils.isBlank(dto.getTableTypes())) {
|
|
if (StringUtils.isBlank(dto.getTableTypes())) {
|
|
@@ -208,7 +208,7 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
//拼接游戏名称查询条件
|
|
//拼接游戏名称查询条件
|
|
cri.where().andEquals("game_name", dto.getGameName());
|
|
cri.where().andEquals("game_name", dto.getGameName());
|
|
}
|
|
}
|
|
- if (gameIds != null) {
|
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(gameIds)) {
|
|
//拼接游戏id查询条件
|
|
//拼接游戏id查询条件
|
|
cri.where().andInList("game_id", gameIds);
|
|
cri.where().andInList("game_id", gameIds);
|
|
}
|
|
}
|
|
@@ -223,6 +223,8 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
//拼接SDK来源
|
|
//拼接SDK来源
|
|
cri.where().andEquals("source_system", dto.getSourceSystem());
|
|
cri.where().andEquals("source_system", dto.getSourceSystem());
|
|
}
|
|
}
|
|
|
|
+ //按时间分组
|
|
|
|
+ cri.getGroupBy().groupBy("dt", "source_system");
|
|
//拼接排序条件
|
|
//拼接排序条件
|
|
if (StringUtils.isBlank(dto.getSortType())) {
|
|
if (StringUtils.isBlank(dto.getSortType())) {
|
|
dto.setSortType(OrderByEnum.DESC.getOrderType());
|
|
dto.setSortType(OrderByEnum.DESC.getOrderType());
|
|
@@ -234,7 +236,7 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
cri.getOrderBy().orderBy(CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, dto.getSortFiled()), dto.getSortType());
|
|
cri.getOrderBy().orderBy(CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, dto.getSortFiled()), dto.getSortType());
|
|
}
|
|
}
|
|
//编写sql语句 拼接查询条件
|
|
//编写sql语句 拼接查询条件
|
|
- Sql sql = Sqls.create(gameDataDaySql(dto.getTableTypes()) + cri);
|
|
|
|
|
|
+ Sql sql = Sqls.create(gameDataDayGroupByDtSql(dto.getTableTypes()) + cri);
|
|
//设置自定义回显对象
|
|
//设置自定义回显对象
|
|
sql.setCallback(Sqls.callback.entities());
|
|
sql.setCallback(Sqls.callback.entities());
|
|
sql.setEntity(dao.getEntity(GameDataDayVO.class));
|
|
sql.setEntity(dao.getEntity(GameDataDayVO.class));
|
|
@@ -246,7 +248,21 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
//得到结果集list
|
|
//得到结果集list
|
|
List<GameDataDayVO> list = sql.getList(GameDataDayVO.class);
|
|
List<GameDataDayVO> list = sql.getList(GameDataDayVO.class);
|
|
//设置查询总数
|
|
//设置查询总数
|
|
- pager.setRecordCount(dao.count(AdsGameDay.class, cri));
|
|
|
|
|
|
+ Sql sqlCount = Sqls.create(
|
|
|
|
+ """
|
|
|
|
+ SELECT
|
|
|
|
+ COUNT(1)
|
|
|
|
+ FROM (
|
|
|
|
+ SELECT
|
|
|
|
+ COUNT(1)
|
|
|
|
+ FROM game_ads.ads_game_day
|
|
|
|
+ """ + cri +
|
|
|
|
+ """
|
|
|
|
+ ) a;
|
|
|
|
+ """);
|
|
|
|
+ sqlCount.setCallback(Sqls.callback.integer());
|
|
|
|
+ dao.execute(sqlCount);
|
|
|
|
+ pager.setRecordCount(sqlCount.getInt());
|
|
|
|
|
|
List<GameDataDayVO> gameDataDayVOList = list.stream().map(vo -> {
|
|
List<GameDataDayVO> gameDataDayVOList = list.stream().map(vo -> {
|
|
formatDayN(vo);
|
|
formatDayN(vo);
|
|
@@ -2034,6 +2050,175 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
""";
|
|
""";
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 游戏每日数据总计sql
|
|
|
|
+ *
|
|
|
|
+ * @param tableType 查询的类型
|
|
|
|
+ * @return String
|
|
|
|
+ */
|
|
|
|
+ private String gameDataDayGroupByDtSql(String tableType) {
|
|
|
|
+ if ("buy".equals(tableType)) {
|
|
|
|
+ return """
|
|
|
|
+ SELECT
|
|
|
|
+ dt as cost_date,
|
|
|
|
+ source_system,
|
|
|
|
+ GROUP_CONCAT(game_name) as game_name,
|
|
|
|
+ IFNULL(SUM(cost), 0) cost,
|
|
|
|
+ IFNULL(SUM(buy_reg_num), 0) reg_num,
|
|
|
|
+ """
|
|
|
|
+ + amountDay("buy_") +
|
|
|
|
+ """
|
|
|
|
+ IFNULL(SUM(buy_first_new_user_amount_count), 0) first_new_user_amount_count,
|
|
|
|
+ IFNULL(SUM(buy_first_new_user_amount_num), 0) first_new_user_amount_num,
|
|
|
|
+ IFNULL(SUM(buy_first_new_user_amount), 0) first_new_user_amount,
|
|
|
|
+ IFNULL(SUM(buy_old_user_count), 0) old_user_count,
|
|
|
|
+ IFNULL(SUM(buy_old_user_num), 0) old_user_num,
|
|
|
|
+ IFNULL(SUM(buy_old_user_amount), 0) old_user_amount,
|
|
|
|
+ IFNULL(SUM(buy_amount_count), 0) amount_count,
|
|
|
|
+ IFNULL(SUM(buy_amount_num), 0) amount_num,
|
|
|
|
+ IFNULL(SUM(buy_amount), 0) amount,
|
|
|
|
+ IFNULL(SUM(buy_new_user_total_amount_count), 0) new_user_total_amount_count,
|
|
|
|
+ IFNULL(SUM(buy_new_user_total_amount_num), 0) new_user_total_amount_num,
|
|
|
|
+ IFNULL(SUM(buy_new_user_total_amount), 0) new_user_total_amount,
|
|
|
|
+ round(if(SUM(cost) > 0 , SUM(buy_first_new_user_amount) / SUM(cost) ,0), 4) first_roi,
|
|
|
|
+ round(if(SUM(buy_reg_num) > 0 , SUM(buy_first_new_user_amount_num) / SUM(buy_reg_num) ,0), 4) first_amount_rate,
|
|
|
|
+ round(if(SUM(buy_reg_num) > 0, SUM(buy_new_user_total_amount_num) / SUM(buy_reg_num), 0) ,4) today_amount_rate,
|
|
|
|
+ round(if(SUM(buy_amount_num) > 0 , SUM(buy_first_new_user_amount_num) / SUM(buy_amount_num) ,0), 4) new_user_rate,
|
|
|
|
+ round(if(SUM(buy_first_new_user_amount_count) > 0, SUM(buy_first_new_user_amount) / SUM(buy_first_new_user_amount_count), 0), 2) first_avg_amount,
|
|
|
|
+ round(if(SUM(buy_new_user_total_amount_count) > 0, SUM(buy_new_user_total_amount) / SUM(buy_new_user_total_amount_count), 0), 2) today_avg_amount,
|
|
|
|
+ round(if(SUM(buy_amount_count) > 0, SUM(buy_amount) / SUM(buy_amount_count), 0), 2) avg_amount,
|
|
|
|
+ round(if(SUM(buy_new_user_total_amount_num) > 0, SUM(buy_reg_order_user_again) / SUM(buy_new_user_total_amount_num), 0), 4) user_again_rate,
|
|
|
|
+ round(if(SUM(buy_reg_num) > 0, SUM(buy_new_user_total_amount) / SUM(buy_reg_num), 0), 2) reg_user_arpu,
|
|
|
|
+ round(if(SUM(buy_first_new_user_amount_num) > 0 , SUM(buy_first_new_user_amount) / SUM(buy_first_new_user_amount_num), 0), 2) first_amount_arpu,
|
|
|
|
+ round(if(SUM(buy_new_user_total_amount_num) > 0 , SUM(buy_new_user_total_amount) / SUM(buy_new_user_total_amount_num), 0), 2) today_amount_arpu,
|
|
|
|
+ round(if(SUM(buy_amount_num) > 0, SUM(buy_amount) / SUM(buy_amount_num), 0), 2) amount_arpu,
|
|
|
|
+ round(if(SUM(buy_reg_num) > 0, SUM(cost) / SUM(buy_reg_num), 0), 2) reg_cost,
|
|
|
|
+ round(if(SUM(buy_first_new_user_amount_num) > 0, SUM(cost) / SUM(buy_first_new_user_amount_num), 0), 2) first_new_user_recharge_cost,
|
|
|
|
+ round(if(SUM(buy_new_user_total_amount_num) > 0, SUM(cost) / SUM(buy_new_user_total_amount_num), 0), 2) total_recharge_cost,
|
|
|
|
+ round(if(SUM(cost) > 0, SUM(buy_new_user_total_amount) / SUM(cost), 0), 4) total_roi,
|
|
|
|
+ IFNULL(SUM(buy_hundred_user_num), 0) hundred_user_num,
|
|
|
|
+ round(IF(SUM(buy_hundred_user_num) > 0, SUM(cost) / SUM(buy_hundred_user_num), 0), 2) hundred_user_num_cost,
|
|
|
|
+ IFNULL(SUM(buy_first_role_num), 0) first_role_num,
|
|
|
|
+ IFNULL(SUM(buy_role_num), 0) role_num,
|
|
|
|
+ IFNULL(SUM(buy_new_user_total_role_num), 0) new_user_total_role_num,
|
|
|
|
+ round(IF(SUM(buy_first_role_num) > 0, SUM(cost) / SUM(buy_first_role_num), 0), 2) first_role_num_cost,
|
|
|
|
+ round(IF(SUM(buy_role_num) > 0, SUM(cost) / SUM(buy_role_num), 0), 2) role_num_cost,
|
|
|
|
+ round(IF(SUM(buy_new_user_total_role_num) >0, SUM(cost) / SUM(buy_new_user_total_role_num), 0), 2) new_user_total_role_num_cost,
|
|
|
|
+ round(IF(SUM(buy_reg_num) >0, SUM(buy_first_role_num) / SUM(buy_reg_num), 0), 4) first_role_num_rate,
|
|
|
|
+ round(IF(SUM(buy_reg_num) >0, SUM(buy_role_num) / SUM(buy_reg_num), 0), 4) role_num_rate,
|
|
|
|
+ round(IF(SUM(buy_reg_num) >0, SUM(buy_new_user_total_role_num) / SUM(buy_reg_num), 0), 4) new_user_total_role_num_rate
|
|
|
|
+ FROM
|
|
|
|
+ ads_game_day
|
|
|
|
+ """;
|
|
|
|
+ } else if ("nature".equals(tableType)) {
|
|
|
|
+ return """
|
|
|
|
+ SELECT
|
|
|
|
+ dt as cost_date,
|
|
|
|
+ source_system,
|
|
|
|
+ GROUP_CONCAT(game_name) as game_name,
|
|
|
|
+ IFNULL(SUM(cost), 0) cost,
|
|
|
|
+ IFNULL(SUM(nature_reg_num), 0) reg_num,
|
|
|
|
+ """
|
|
|
|
+ + amountDay("nature_") +
|
|
|
|
+ """
|
|
|
|
+ IFNULL(SUM(nature_first_new_user_amount_count), 0) first_new_user_amount_count,
|
|
|
|
+ IFNULL(SUM(nature_first_new_user_amount_num), 0) first_new_user_amount_num,
|
|
|
|
+ IFNULL(SUM(nature_first_new_user_amount), 0) first_new_user_amount,
|
|
|
|
+ IFNULL(SUM(nature_old_user_count), 0) old_user_count,
|
|
|
|
+ IFNULL(SUM(nature_old_user_num), 0) old_user_num,
|
|
|
|
+ IFNULL(SUM(nature_old_user_amount), 0) old_user_amount,
|
|
|
|
+ IFNULL(SUM(nature_amount_count), 0) amount_count,
|
|
|
|
+ IFNULL(SUM(nature_amount_num), 0) amount_num,
|
|
|
|
+ IFNULL(SUM(nature_amount), 0) amount,
|
|
|
|
+ IFNULL(SUM(nature_new_user_total_amount_count), 0) new_user_total_amount_count,
|
|
|
|
+ IFNULL(SUM(nature_new_user_total_amount_num), 0) new_user_total_amount_num,
|
|
|
|
+ IFNULL(SUM(nature_new_user_total_amount), 0) new_user_total_amount,
|
|
|
|
+ round(if(SUM(cost) > 0 , SUM(nature_first_new_user_amount) / SUM(cost) ,0), 4) first_roi,
|
|
|
|
+ round(if(SUM(nature_reg_num) > 0 , SUM(nature_first_new_user_amount_num) / SUM(nature_reg_num) ,0), 4) first_amount_rate,
|
|
|
|
+ round(if(SUM(nature_reg_num) > 0, SUM(nature_new_user_total_amount_num) / SUM(nature_reg_num), 0) ,4) today_amount_rate,
|
|
|
|
+ round(if(SUM(nature_amount_num) > 0 , SUM(nature_first_new_user_amount_num) / SUM(nature_amount_num) ,0), 4) new_user_rate,
|
|
|
|
+ round(if(SUM(nature_first_new_user_amount_count) > 0, SUM(nature_first_new_user_amount) / SUM(nature_first_new_user_amount_count), 0), 2) first_avg_amount,
|
|
|
|
+ round(if(SUM(nature_new_user_total_amount_count) > 0, SUM(nature_new_user_total_amount) / SUM(nature_new_user_total_amount_count), 0), 2) today_avg_amount,
|
|
|
|
+ round(if(SUM(nature_amount_count) > 0, SUM(nature_amount) / SUM(nature_amount_count), 0), 2) avg_amount,
|
|
|
|
+ round(if(SUM(nature_new_user_total_amount_num) > 0, SUM(nature_reg_order_user_again) / SUM(nature_new_user_total_amount_num), 0), 4) user_again_rate,
|
|
|
|
+ round(if(SUM(nature_reg_num) > 0, SUM(nature_new_user_total_amount) / SUM(nature_reg_num), 0), 2) reg_user_arpu,
|
|
|
|
+ round(if(SUM(nature_first_new_user_amount_num) > 0 , SUM(nature_first_new_user_amount) / SUM(nature_first_new_user_amount_num), 0), 2) first_amount_arpu,
|
|
|
|
+ round(if(SUM(nature_new_user_total_amount_num) > 0 , SUM(nature_new_user_total_amount) / SUM(nature_new_user_total_amount_num), 0), 2) today_amount_arpu,
|
|
|
|
+ round(if(SUM(nature_amount_num) > 0, SUM(nature_amount) / SUM(nature_amount_num), 0), 2) amount_arpu,
|
|
|
|
+ round(if(SUM(nature_reg_num) > 0, SUM(cost) / SUM(nature_reg_num), 0), 2) reg_cost,
|
|
|
|
+ round(if(SUM(nature_first_new_user_amount_num) > 0, SUM(cost) / SUM(nature_first_new_user_amount_num), 0), 2) first_new_user_recharge_cost,
|
|
|
|
+ round(if(SUM(nature_new_user_total_amount_num) > 0, SUM(cost) / SUM(nature_new_user_total_amount_num), 0), 2) total_recharge_cost,
|
|
|
|
+ round(if(SUM(cost) > 0, SUM(nature_new_user_total_amount) / SUM(cost), 0), 4) total_roi,
|
|
|
|
+ SUM(nature_hundred_user_num) hundred_user_num,
|
|
|
|
+ round(IF(SUM(nature_hundred_user_num) > 0, SUM(cost) / SUM(nature_hundred_user_num), 0), 2) hundred_user_num_cost,
|
|
|
|
+ SUM(nature_first_role_num) first_role_num,
|
|
|
|
+ SUM(nature_role_num) role_num,
|
|
|
|
+ SUM(nature_new_user_total_role_num) new_user_total_role_num,
|
|
|
|
+ round(IF(SUM(nature_first_role_num) > 0, SUM(cost) / SUM(nature_first_role_num), 0), 2) first_role_num_cost,
|
|
|
|
+ round(IF(SUM(nature_role_num) > 0, SUM(cost) / SUM(nature_role_num), 0), 2) role_num_cost,
|
|
|
|
+ round(IF(SUM(nature_new_user_total_role_num) >0, SUM(cost) / SUM(nature_new_user_total_role_num), 0), 2) new_user_total_role_num_cost,
|
|
|
|
+ round(IF(SUM(nature_reg_num) >0, SUM(nature_first_role_num) / SUM(nature_reg_num), 0), 4) first_role_num_rate,
|
|
|
|
+ round(IF(SUM(nature_reg_num) >0, SUM(nature_role_num) / SUM(nature_reg_num), 0), 4) role_num_rate,
|
|
|
|
+ round(IF(SUM(nature_reg_num) >0, SUM(nature_new_user_total_role_num) / SUM(nature_reg_num), 0), 4) new_user_total_role_num_rate
|
|
|
|
+ FROM
|
|
|
|
+ ads_game_day
|
|
|
|
+ """;
|
|
|
|
+ }
|
|
|
|
+ //总量数据
|
|
|
|
+ return """
|
|
|
|
+ SELECT
|
|
|
|
+ dt as cost_date,
|
|
|
|
+ source_system,
|
|
|
|
+ GROUP_CONCAT(game_name) as game_name,
|
|
|
|
+ IFNULL(SUM(cost), 0) cost,
|
|
|
|
+ IFNULL(SUM(reg_num), 0) reg_num,
|
|
|
|
+ """
|
|
|
|
+ + amountDay("") +
|
|
|
|
+ """
|
|
|
|
+ IFNULL(SUM(first_new_user_amount_count), 0) first_new_user_amount_count,
|
|
|
|
+ IFNULL(SUM(first_new_user_amount_num), 0) first_new_user_amount_num,
|
|
|
|
+ IFNULL(SUM(first_new_user_amount), 0) first_new_user_amount,
|
|
|
|
+ IFNULL(SUM(old_user_count), 0) old_user_count,
|
|
|
|
+ IFNULL(SUM(old_user_num), 0) old_user_num,
|
|
|
|
+ IFNULL(SUM(old_user_amount), 0) old_user_amount,
|
|
|
|
+ IFNULL(SUM(amount_count), 0) amount_count,
|
|
|
|
+ IFNULL(SUM(amount_num), 0) amount_num,
|
|
|
|
+ IFNULL(SUM(amount), 0) amount,
|
|
|
|
+ IFNULL(SUM(new_user_total_amount_count), 0) new_user_total_amount_count,
|
|
|
|
+ IFNULL(SUM(new_user_total_amount_num), 0) new_user_total_amount_num,
|
|
|
|
+ IFNULL(SUM(new_user_total_amount), 0) new_user_total_amount,
|
|
|
|
+ round(if(SUM(cost) > 0 , SUM(first_new_user_amount) / SUM(cost) ,0), 4) first_roi,
|
|
|
|
+ round(if(SUM(reg_num) > 0 , SUM(first_new_user_amount_num) / SUM(reg_num) ,0), 4) first_amount_rate,
|
|
|
|
+ round(if(SUM(reg_num) > 0, SUM(new_user_total_amount_num) / SUM(reg_num), 0) ,4) today_amount_rate,
|
|
|
|
+ round(if(SUM(amount_num) > 0 , SUM(first_new_user_amount_num) / SUM(amount_num) ,0), 4) new_user_rate,
|
|
|
|
+ round(if(SUM(first_new_user_amount_count) > 0, SUM(first_new_user_amount) / SUM(first_new_user_amount_count), 0), 2) first_avg_amount,
|
|
|
|
+ round(if(SUM(new_user_total_amount_count) > 0, SUM(new_user_total_amount) / SUM(new_user_total_amount_count), 0), 2) today_avg_amount,
|
|
|
|
+ round(if(SUM(amount_count) > 0, SUM(amount) / SUM(amount_count), 0), 2) avg_amount,
|
|
|
|
+ round(if(SUM(new_user_total_amount_num) > 0, SUM(reg_order_user_again) / SUM(new_user_total_amount_num), 0), 4) user_again_rate,
|
|
|
|
+ round(if(SUM(reg_num) > 0, SUM(new_user_total_amount) / SUM(reg_num), 0), 2) reg_user_arpu,
|
|
|
|
+ round(if(SUM(first_new_user_amount_num) > 0 , SUM(first_new_user_amount) / SUM(first_new_user_amount_num), 0), 2) first_amount_arpu,
|
|
|
|
+ round(if(SUM(new_user_total_amount_num) > 0 , SUM(new_user_total_amount) / SUM(new_user_total_amount_num), 0), 2) today_amount_arpu,
|
|
|
|
+ round(if(SUM(amount_num) > 0, SUM(amount) / SUM(amount_num), 0), 2) amount_arpu,
|
|
|
|
+ round(if(SUM(reg_num) > 0, SUM(cost) / SUM(reg_num), 0), 2) reg_cost,
|
|
|
|
+ round(if(SUM(first_new_user_amount_num) > 0, SUM(cost) / SUM(first_new_user_amount_num), 0), 2) first_new_user_recharge_cost,
|
|
|
|
+ round(if(SUM(new_user_total_amount_num) > 0, SUM(cost) / SUM(new_user_total_amount_num), 0), 2) total_recharge_cost,
|
|
|
|
+ round(if(SUM(cost) > 0, SUM(new_user_total_amount) / SUM(cost), 0), 4) total_roi,
|
|
|
|
+ SUM(hundred_user_num) hundred_user_num,
|
|
|
|
+ round(IF(SUM(hundred_user_num) > 0, SUM(cost) / SUM(hundred_user_num), 0), 2) hundred_user_num_cost,
|
|
|
|
+ SUM(first_role_num) first_role_num,
|
|
|
|
+ SUM(role_num) role_num,
|
|
|
|
+ SUM(new_user_total_role_num) new_user_total_role_num,
|
|
|
|
+ round(IF(SUM(first_role_num) > 0, SUM(cost) / SUM(first_role_num), 0), 2) first_role_num_cost,
|
|
|
|
+ round(IF(SUM(role_num) > 0, SUM(cost) / SUM(role_num), 0), 2) role_num_cost,
|
|
|
|
+ round(IF(SUM(new_user_total_role_num) >0, SUM(cost) / SUM(new_user_total_role_num), 0), 2) new_user_total_role_num_cost,
|
|
|
|
+ round(IF(SUM(reg_num) >0, SUM(first_role_num) / SUM(reg_num), 0), 4) first_role_num_rate,
|
|
|
|
+ round(IF(SUM(reg_num) >0, SUM(role_num) / SUM(reg_num), 0), 4) role_num_rate,
|
|
|
|
+ round(IF(SUM(reg_num) >0, SUM(new_user_total_role_num) / SUM(reg_num), 0), 4) new_user_total_role_num_rate
|
|
|
|
+ FROM
|
|
|
|
+ ads_game_day
|
|
|
|
+ """;
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 游戏每日数据总计sql
|
|
* 游戏每日数据总计sql
|
|
*
|
|
*
|