Explorar o código

删除和恢复花店

shish hai 4 meses
pai
achega
dcf3aa566a
Modificáronse 1 ficheiros con 19 adicións e 1 borrados
  1. 19 1
      app-mall/controllers/HdController.php

+ 19 - 1
app-mall/controllers/HdController.php

@@ -15,6 +15,22 @@ class HdController extends BaseController
 
     public $guestAccess = ['list', 'info'];
 
+    public function actionRecover()
+    {
+        $get = Yii::$app->request->get();
+        $id = $get['id'] ?? 0;
+        $hd = HdClass::getById($id,true);
+        if (empty($hd)) {
+            util::fail('没有花店信息');
+        }
+        if ($hd['userId'] != $this->userId) {
+            util::fail('不是你的店');
+        }
+        $hd->delStatus = 0;
+        $hd->save();
+        util::complete('已恢复');
+    }
+
     public function actionDel()
     {
         $get = Yii::$app->request->get();
@@ -103,9 +119,11 @@ class HdController extends BaseController
 
     public function actionList()
     {
+        $get = Yii::$app->request->get();
+        $delStatus = $get['delStatus'] ?? 0;
         $where = [];
         $where['userId'] = $this->userId;
-        $where['delStatus'] = 0;
+        $where['delStatus'] = $delStatus;
         $respond = HdClass::getHdList($where);
         util::success($respond);
     }