PAID = 0; $searchModel->RUN_DATE = date('Y-m-d'); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('index', [ 'searchModel' => $searchModel, 'dataProvider' => $dataProvider, ]); } /** * Displays a single BusProtocolFee model. * @param integer $id * @return mixed */ public function actionView($id) { return $this->render('view', [ 'model' => $this->findModel($id), ]); } /** * Creates a new BusProtocolFee model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new BusProtocolFee(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->ID]); } else { return $this->render('create', [ 'model' => $model, ]); } } /** * Deletes an existing BusProtocolFee model. * If deletion is successful, the browser will be redirected to the 'index' page. * @param integer $id * @return mixed */ public function actionDelete($id) { $this->findModel($id)->delete(); return $this->redirect(['index']); } /** * Finds the BusProtocolFee model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return BusProtocolFee the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = BusProtocolFee::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } } /** * 批量确认收取挂靠协议费用 */ public function actionMultiPaid() { $id_str = Yii::$app->request->post('id'); $count = BusProtocolFee::updateAll(['PAID' => 1], 'ID in (' . $id_str . ')'); if ($count > 0) { $result = ['code' => 0, 'msg' => '确认成功!']; } else { $result = ['code' => 1, 'msg' => '确认失败!']; } return json_encode($result); } /** * 确认收取费用. * @param integer $id * @return mixed */ public function actionPaid($id) { $model = $this->findModel($id); $function = "$.pjax.reload({container:'#protocol-pjax', timeout: false, replace: false, url: '" . Url::to(['index']) . "'})"; if ($model !== null) { $model->PAID = 1; $model->save(false); $result = ['code' => 0, 'msg' => '确认收取成功!', 'callback' => $function]; } else { $result = ['code' => 1, 'msg' => '确认失败!', 'callback' => $function]; } return json_encode($result); } }