/** * 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; }
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; }
/** * 用户提现记录 * @param $uid * @param $out_trade_no * @param $identity_id * @param $card_id * @param $site_balance * @param $sina_balance * @param $money * @param $money_fund * @param $money_site * @param $money_sina * @param $type * @param $status * @param $msg * @return bool */ private static function withdrawLog($uid, $out_trade_no, $identity_id, $card_id, $site_balance, $sina_balance, $money, $money_fund, $money_site, $money_sina, $type, $status, $msg) { $log = new SinaWithdraw(); $log->uid = $uid; $log->out_trade_no = $out_trade_no; $log->identity_id = $identity_id; $log->card_id = $card_id; $log->site_balance = $site_balance; $log->sina_balance = $sina_balance; $log->money = $money; $log->money_fund = $money_fund; $log->money_site = $money_site; $log->money_sina = $money_sina; $log->type = $type; $log->status = $status; $log->msg = $msg; return $log->save(); }
/** * Finds the SinaWithdraw model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return SinaWithdraw the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = SinaWithdraw::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }