/** * Finds the MUserAccount model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return MUserAccount the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = MUserAccount::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
public function actionQxchonghuafeiajax() { $uid = $_GET['uid']; $user_account = \app\models\MUserAccount::findOne(['id' => $uid]); if (empty($user_account)) { return json_encode(['code' => 0]); } if ($user_account->cat != \app\models\MUserAccount::CAT_CREDIT_CHARGE_MOBILE || $user_account->status != \app\models\MUserAccount::STATUS_CHARGE_REQUEST) { return json_encode(['code' => -1]); } $user_account->delete(); return json_encode(['code' => 0]); }