| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?php
- /**
- * 重庆赤晓店信息科技有限公司
- * https://www.chixiaodian.com
- * Copyright (c) 2023 赤店商城 All rights reserved.
- */
- namespace app\modules\admin\controllers\setting;
- use app\models\RefundAddress;
- use app\modules\admin\controllers\BaseController;
- use app\modules\admin\models\RefundAddressForm;
- class RefundAddressController extends BaseController
- {
- /**
- * 获取云打印列表
- * @return \yii\web\Response
- */
- public function actionList()
- {
- return $this->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);
- }
- }
|