asJson([ 'code' => 0, 'data' => [ 'list' => RefundAddress::find() ->where(['is_delete' => 0, 'store_id' => get_store_id(), 'mch_id' => get_mch_id()]) ->orderBy(['id' => SORT_DESC])->all(), ] ]); } /** * 获取详情 */ public function actionEdit($id = null) { return $this->asJson([ 'code' => 0, 'data' => [ 'model' => RefundAddress::findOne($id) ] ]); } /** * 保存 */ public function actionSave() { $form = new RefundAddressForm(); $form->attributes = post_params(); if(get_mch_id()){ $form->mch_id = get_mch_id(); } return $this->asJson($form->save()); } /** * 删除 * @param $id * @return \yii\web\Response */ public function actionDel($id) { $model = RefundAddress::findOne($id); if (empty($model)) { $res = ['code' => 1, 'msg' => '参数错误']; } else { $model->is_delete = 1; $res = $model->save() ? ['code' => 0, 'msg' => '保存成功'] : ['code' => 1, 'msg' => '保存失败']; } return $this->asJson($res); } }