| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <?php
- namespace hd\controllers;
- use bizHd\admin\classes\AddressClass;
- use Yii;
- use common\components\util;
- class AddressController extends BaseController
- {
- //删除地址 ssh 202201003
- public function actionDel()
- {
- $get = Yii::$app->request->get();
- $id = $get['id'] ?? 0;
- $address = AddressClass::getById($id, true);
- if (empty($address)) {
- util::fail('没有找到地址');
- }
- if ($address->mainId != $this->mainId) {
- util::fail('没有权限');
- }
- $address->delete();
- util::complete();
- }
- //地址列表 ssh 20221003
- public function actionList()
- {
- //$get = Yii::$app->request->get();
- $where = ['adminId' => $this->adminId];
- $list = AddressClass::getAddressList($where);
- util::success($list);
- }
- //地址列表 ssh 20221003
- public function actionAdd()
- {
- $post = Yii::$app->request->post();
- $post['sjId'] = $this->sjId;
- $post['mainId'] = $this->mainId;
- $post['shopId'] = $this->shopId;
- $post['adminId'] = $this->adminId;
- AddressClass::addData($post);
- util::complete();
- }
- //修改地址 ssh 20221003
- public function actionUpdate()
- {
- $post = Yii::$app->request->post();
- $id = $post['id'] ?? 0;
- unset($post['id']);
- $address = AddressClass::getById($id, true);
- if ($address->mainId != $this->mainId) {
- util::fail('没有权限修改');
- }
- AddressClass::updateById($id, $post);
- util::complete();
- }
- }
|