attributes = get_params(); $form->store_id = get_store_id(); return $this->asJson($form->search()); } public function actionInfo($id = null) { return $this->asJson([ 'code' => 0, 'data' => [ 'model' => IntegralRecharge::findOne($id) ] ]); } public function actionEdit() { $id = post_params('id'); $model = IntegralRecharge::findOne(['id' => $id, 'is_delete' => 0, 'store_id' => get_store_id()]); if (!$model) { $model = new IntegralRecharge(); } if (\Yii::$app->request->isPost) { $form = new IntegralRechargeForm(); $form->model = $model; $form->store_id = get_store_id(); $form->attributes = post_params(); return $this->asJson($form->save()); } } public function actionState($id = null, $state = 1) { $id = json_decode($id, true); foreach ($id as $v) { $model = IntegralRecharge::findOne($v); if (!$model) { return $this->asJson([ 'code' => 1, 'msg' => '请刷新重试' ]); } $model->state = $state; $model->save(); } return $this->asJson([ 'code' => 0, 'msg' => '成功' ]); } public function actionDel($id = null) { $model = IntegralRecharge::findOne(['id' => $id, 'is_delete' => 0, 'store_id' => get_store_id()]); if (!$model) { return $this->asJson([ 'code' => 1, 'msg' => '请刷新重试' ]); } $model->is_delete = 1; if ($model->save()) { return $this->asJson([ 'code' => 0, 'msg' => '成功' ]); } else { foreach ($model->errors as $errors) { return $this->asJson([ 'code' => 1, 'msg' => $errors[0], ]); } } } public function actionIntegralRechargeOrder() { $param = get_params(); $form = new IntegralReOrderForm(); $form->attributes = $param; $form->store_id = get_store_id(); return $this->asJson($form->search()); } }