123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- include_once dirname(__FILE__) . '/../main.php';
- $post = query_paras();
- $platform = $post["platform"];
- $startTime = $post["startTime"];
- $endTime = $post["endTime"];
- $endDate = strtotime("$endTime");
- $array = array();
- $labels = array();
- $totalPrize = 0;
- for ($i = 0; $i <= 399; $i++) {
- $iday = strtotime("$startTime +$i day");
- $day = date("Y-m-d", $iday);
- if ($iday > $endDate) {
- break;
- }
- if ($platform != "") {
- $prize = daoInst()->select('sum(`amount`) as amt')->from('tpl_order_tab')
- ->where('status')->eq(1)
- ->andWhere('channel')->eq($platform)
- ->andWhere('close_ts')->ge($iday)
- ->andWhere('close_ts')->lt(intval($iday + 86400))
- ->fetch('amt');
- } else {
- $prize = daoInst()->select('sum(`amount`) as amt')->from('tpl_order_tab')
- ->where('status')->eq(1)
- ->andWhere('close_ts')->ge($iday)
- ->andWhere('close_ts')->lt(intval($iday + 86400))
- ->fetch('amt');
- }
- $prize = ((int) $prize) / 100;
- $prize = (float) sprintf("%.2f", $prize);
- $array[] = $prize;
- $labels[] = $day;
- $totalPrize += $prize;
- }
-
- $result = new stdClass();
- $result->data = $array;
- $result->labels = $labels;
- $result->totalPrize = $totalPrize;
- echo json_encode($result);
|