Пример #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = SinaWithdraw::find()->orderBy('id DESC');
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 10]]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'uid' => $this->uid, 'site_balance' => $this->site_balance, 'sina_balance' => $this->sina_balance, 'money' => $this->money, 'money_fund' => $this->money_fund, 'money_site' => $this->money_site, 'money_sina' => $this->money_sina, 'type' => $this->type, 'status' => $this->status, 'create_at' => $this->create_at, 'update_at' => $this->update_at]);
     $query->andFilterWhere(['like', 'out_trade_no', $this->out_trade_no])->andFilterWhere(['like', 'identity_id', $this->identity_id])->andFilterWhere(['like', 'card_id', $this->card_id])->andFilterWhere(['like', 'msg', $this->msg]);
     return $dataProvider;
 }
Пример #2
0
 public function actionAjaxdata()
 {
     $betime = strtotime(date('Y-m-d' . ' 00:00:00', time()));
     $endtime = strtotime(date('Y-m-d' . ' 23:59:59', time()));
     $now = strftime('%Y-%m-%d', time());
     list($wstart, $wend) = Utils::lastNWeek(time(), 1);
     list($mstart, $mend) = Utils::lastMonth(time());
     list($qstart, $qend) = Utils::lastQuarter(time());
     $beginThismonth = mktime(0, 0, 0, date('m'), 1, date('Y'));
     $endThismonth = mktime(23, 59, 59, date('m'), date('t'), date('Y'));
     $today = [];
     $week = [];
     $month = [];
     $quart = [];
     $payment = SinaDeposit::find()->select('sum(amount) as smoney')->andWhere(['status' => SinaDeposit::STATUS_SUCCESS])->andWhere(['between', 'create_at', $betime, $endtime])->asArray()->one();
     $withdraw = SinaWithdraw::find()->select('sum(money) as smoney')->andWhere(['status' => SinaWithdraw::STATUS_SINA_SUCCESS])->andWhere(['between', 'create_at', $betime, $endtime])->asArray()->one();
     $wpayment = SinaDeposit::find()->select('sum(amount) as smoney')->andWhere(['status' => SinaDeposit::STATUS_SUCCESS])->andWhere(['between', 'create_at', strtotime($wstart), strtotime($wend)])->asArray()->one();
     $wwithdraw = SinaWithdraw::find()->select('sum(money) as smoney')->andWhere(['status' => SinaWithdraw::STATUS_SINA_SUCCESS])->andWhere(['between', 'create_at', strtotime($wstart), strtotime($wend)])->asArray()->one();
     $mpayment = SinaDeposit::find()->select('sum(amount) as smoney')->andWhere(['status' => SinaDeposit::STATUS_SUCCESS])->andWhere(['between', 'create_at', strtotime($mstart), strtotime($mend)])->asArray()->one();
     $mwithdraw = SinaWithdraw::find()->select('sum(money) as smoney')->andWhere(['status' => SinaWithdraw::STATUS_SINA_SUCCESS])->andWhere(['between', 'create_at', strtotime($mstart), strtotime($mend)])->asArray()->one();
     $qpayment = SinaDeposit::find()->select('sum(amount) as smoney')->andWhere(['status' => SinaDeposit::STATUS_SUCCESS])->andWhere(['between', 'create_at', strtotime($qstart), strtotime($qend)])->asArray()->one();
     $qwithdraw = SinaWithdraw::find()->select('sum(money) as smoney')->andWhere(['status' => SinaWithdraw::STATUS_SINA_SUCCESS])->andWhere(['between', 'create_at', strtotime($qstart), strtotime($qend)])->asArray()->one();
     $benpayment = SinaDeposit::find()->select('sum(amount) as smoney')->andWhere(['status' => SinaDeposit::STATUS_SUCCESS])->andWhere(['between', 'create_at', $beginThismonth, $endThismonth])->asArray()->one();
     $benwithdraw = SinaWithdraw::find()->select('sum(money) as smoney')->andWhere(['status' => SinaWithdraw::STATUS_SINA_SUCCESS])->andWhere(['between', 'create_at', $beginThismonth, $endThismonth])->asArray()->one();
     $oldpayment = SinaDeposit::find()->select('sum(amount) as smoney')->andWhere(['status' => SinaDeposit::STATUS_SUCCESS])->asArray()->one();
     $oldwithdraw = SinaWithdraw::find()->select('sum(money) as smoney')->andWhere(['status' => SinaWithdraw::STATUS_SINA_SUCCESS])->asArray()->one();
     $today = '今日提现' . ($withdraw['smoney'] ? $withdraw['smoney'] : '0') . '充值' . ($payment['smoney'] ? $payment['smoney'] : "0");
     $week = '上周提现' . ($wwithdraw['smoney'] ? $wwithdraw['smoney'] : '0') . '充值' . ($wpayment['smoney'] ? $wpayment['smoney'] : '0');
     $benmonth = '本月提现' . ($benwithdraw['smoney'] ? $benwithdraw['smoney'] : '0') . '充值' . ($benpayment['smoney'] ? $benpayment['smoney'] : "0");
     $month = '上月提现' . ($mwithdraw['smoney'] ? $mwithdraw['smoney'] : '0') . '充值' . ($mpayment['smoney'] ? $mpayment['smoney'] : "0");
     $quart = '上个季度提现' . ($qwithdraw['smoney'] ? $qwithdraw['smoney'] : '0') . '充值' . ($qpayment['smoney'] ? $qpayment['smoney'] : '0');
     $oldtotal = '总提现' . ($oldwithdraw['smoney'] ? $oldwithdraw['smoney'] : '0') . '充值' . ($oldpayment['smoney'] ? $oldpayment['smoney'] : '0');
     echo $today . ',' . $week . ',' . $benmonth . ',' . $month . ',' . $quart . ',' . $oldtotal;
 }