コード例 #1
0
 public function memberYear()
 {
     $Member = D("Member");
     $year_solt = get_year_solt($this->year_start, $this->year_end);
     $map['status'] = ['in', '2,3,4'];
     foreach ($year_solt as $k => $v) {
         $map['regtime'] = [['gt', $v['start']['ts']], ['lt', $v['end']['ts']]];
         $x = $Member->field('userid')->where($map)->select();
         $member_year_data[$k]['year_name'] = date("Y", $v['start']['ts']);
         $member_year_data[$k]['count'] = count($x);
     }
     $xAxis_data = Tools::arr2str(Tools::getCols($member_year_data, 'year_name', true));
     $series_data_information = Tools::arr2str(Tools::getCols($member_year_data, 'count'));
     $this->assign(['xAxis_data' => $xAxis_data, 'series_data_information' => $series_data_information]);
     $this->display();
 }
コード例 #2
0
 /**
  *  公用查询时间
  */
 private function getRange()
 {
     if (I('day_start') && I('day_end')) {
         $this->day_start = strtotime(I('day_start') . " 00:00:00");
         $this->day_end = strtotime(I('day_end') . " 23:59:59");
     } else {
         $this->day_start = strtotime('-1 week');
         $this->day_end = time();
     }
     $this->day_solt = get_day_solt($this->day_start, $this->day_end);
     $this->assign(['day_start' => $this->day_start, 'day_end' => $this->day_end]);
     $this->mapDayRange = [['gt', $this->day_start], ['lt', $this->day_end]];
     if (I('month_start') && I('month_end')) {
         $this->month_start = strtotime(I('month_start') . "-01 00:00:00");
         $this->month_end = strtotime(I('month_end') . "-01 23:59:59");
     } else {
         $this->month_start = strtotime($this->now_Y . "-01-01 00:00:00");
         $this->month_end = time();
     }
     $this->month_solt = get_month_solt($this->month_start, $this->month_end);
     $this->assign(['month_start' => $this->month_start, 'month_end' => $this->month_end]);
     $this->mapMonthRange = [['gt', $this->month_start], ['lt', $this->month_end]];
     if (I('year_start') && I('year_end')) {
         $this->year_start = strtotime(I('year_start') . "-01-01 00:00:00");
         $this->year_end = strtotime(I('year_end') . "-12-31 23:59:59");
     } else {
         $this->year_start = strtotime($this->now_Y - 1 . "-01-01 00:00:00");
         $this->year_end = time();
     }
     $this->year_solt = get_year_solt($this->year_start, $this->year_end);
     $this->assign(['year_start' => $this->year_start, 'year_end' => $this->year_end]);
     $this->mapYearRange = [['gt', $this->year_start], ['lt', $this->year_end]];
 }
コード例 #3
0
 /**
  * 月付款同期对比
  * @author wodrow
  */
 public function sameMouthAnnually()
 {
     $Trade = D('Trade');
     $map['paytime'] = $this->mapYearRange;
     $map['status'] = ['in', '2,3,4'];
     $trades = $Trade->where($map)->field("paytime,amount")->select();
     for ($i = 1; $i <= 12; $i++) {
         $xAxis[] = $i;
     }
     $xAxis_data = "'" . implode("','", $xAxis) . "'";
     $year_solt = get_year_solt($this->year_start, $this->year_end);
     foreach ($year_solt as $k => $v) {
         $legend[] = $v['start']['year'];
     }
     $legend_data = "'" . implode("','", $legend) . "'";
     foreach ($year_solt as $k => $v) {
         foreach ($xAxis as $k1 => $v1) {
             foreach ($trades as $k2 => $v2) {
                 if (date("m", $v2['paytime']) == $v1) {
                     if ($v2['paytime'] > $v['start']['ts'] && $v2['paytime'] < $v['end']['ts']) {
                         $same_year_trades[$v['start']['year']][$v1]['mouth_name'] = $v1;
                         $same_year_trades[$v['start']['year']][$v1]['mouth_trades'][] = $v2;
                     }
                 }
             }
         }
     }
     foreach ($same_year_trades as $k => $v) {
         unset($x);
         foreach ($v as $k1 => $v1) {
             $same_year_trades[$k][$k1]['mouth_amount'] = get_arr_k_amount($v1['mouth_trades'], 'amount');
             $x[$k1] = $same_year_trades[$k][$k1]['mouth_amount'];
             unset($same_year_trades[$k][$k1]);
         }
         foreach ($xAxis as $k2 => $v2) {
             if (!$x[$v2]) {
                 $x[$v2] = '';
             }
         }
         ksort($x);
         $same_year_trades[$k]['year_data'] = "'" . implode("','", $x) . "'";
     }
     $this->assign(['xAxis' => $xAxis, 'xAxis_data' => $xAxis_data, 'legend' => $legend, 'legend_data' => $legend_data, 'same_year_trades' => $same_year_trades]);
     $this->display();
 }