Jelajahi Sumber

删除地址

shish 3 tahun lalu
induk
melakukan
0580c4bb1a
1 mengubah file dengan 16 tambahan dan 0 penghapusan
  1. 16 0
      app-hd/controllers/AddressController.php

+ 16 - 0
app-hd/controllers/AddressController.php

@@ -9,6 +9,22 @@ 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()
     {