/** * Displays a single UcenterMember model. * @param integer $id * @return mixed */ public function actionView($id) { $sinabank = SinaBank::find()->andWhere(['uid' => $id])->andWhere(['status' => SinaBank::STATUS_BINGING])->asArray()->one(); $sina = new sina(); if ($sinabank['identity_id']) { $sinabank['sinamoney'] = $sina->query_balance($sinabank['identity_id'])['available_balance']; } return $this->render('view', ['model' => $this->findModel($id), 'sinabank' => $sinabank]); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = SinaBank::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, 'status' => $this->status, 'create_at' => $this->create_at, 'update_at' => $this->update_at]); $query->andFilterWhere(['like', 'identity_id', $this->identity_id])->andFilterWhere(['like', 'request_no', $this->request_no])->andFilterWhere(['like', 'bank_code', $this->bank_code])->andFilterWhere(['like', 'bank_name', $this->bank_name])->andFilterWhere(['like', 'bank_account_no', $this->bank_account_no])->andFilterWhere(['like', 'card_type', $this->card_type])->andFilterWhere(['like', 'card_attribute', $this->card_attribute])->andFilterWhere(['like', 'phone_no', $this->phone_no])->andFilterWhere(['like', 'province', $this->province])->andFilterWhere(['like', 'city', $this->city])->andFilterWhere(['like', 'bank_branch', $this->bank_branch])->andFilterWhere(['like', 'ticket', $this->ticket])->andFilterWhere(['like', 'valid_code', $this->valid_code])->andFilterWhere(['like', 'card_id', $this->card_id])->andFilterWhere(['like', 'msg', $this->msg]); return $dataProvider; }
<?php use yii\helpers\Html; use yii\grid\GridView; /* @var $this yii\web\View */ /* @var $searchModel common\models\sinapay\SinaBankSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = Yii::t('app', '新浪绑卡记录'); $this->params['breadcrumbs'][] = $this->title; ?> <div class="sina-bank-index"> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'uid', 'identity_id', 'bank_code', 'bank_name', 'bank_account_no', 'phone_no', 'province', 'city', ['attribute' => 'status', 'format' => 'html', 'value' => function ($model) { if ($model->status === 2) { $class = 'label-success'; } elseif ($model->status === 1) { $class = 'label-warning'; } else { $class = 'label-danger'; } return '<span class="label ' . $class . '">' . $model->statusLabel . '</span>'; }, 'filter' => Html::activeDropDownList($searchModel, 'status', \common\models\sinapay\SinaBank::labels(), ['class' => 'form-control', 'prompt' => '请筛选'])], 'msg', ['attribute' => 'create_at', 'format' => ['date', 'php:Y-m-d H:i:s'], 'headerOptions' => ['width' => '100']]]]); ?> </div>
/** * Finds the SinaBank model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return SinaBank the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = SinaBank::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * 创建绑定银行卡操作 * @param $uid * @param $identity_id * @param $request_no * @param $bank_code * @param $bank_name * @param $bank_account_no * @param $card_type * @param $card_attribute * @param $phone_no * @param $province * @param $city * @param $bank_branch * @param $ticket * @param $status * @param $msg * @return bool */ private static function bankLog($uid, $identity_id, $request_no, $bank_code, $bank_name, $bank_account_no, $card_type, $card_attribute, $phone_no, $province, $city, $bank_branch, $ticket, $status, $msg) { $log = new SinaBank(); $log->uid = $uid; $log->identity_id = $identity_id; $log->request_no = $request_no; $log->bank_code = $bank_code; $log->bank_name = $bank_name; $log->bank_account_no = $bank_account_no; $log->card_type = $card_type; $log->card_attribute = $card_attribute; $log->phone_no = $phone_no; $log->province = $province; $log->city = $city; $log->bank_branch = $bank_branch; $log->ticket = $ticket; $log->status = $status; $log->msg = $msg; return $log->save(); }