Cherry 2 年之前
父节点
当前提交
e764735a34
共有 3 个文件被更改,包括 217 次插入214 次删除
  1. 28 0
      application/api/controller/Join.php
  2. 0 25
      application/api/controller/User.php
  3. 189 189
      public/api.html

+ 28 - 0
application/api/controller/Join.php

@@ -287,4 +287,32 @@ class Join extends Api
 
     }
 
+    /**
+     * 账户注销-提交
+     * @ApiMethod (POST)
+     * @ApiParams (name=logout_reason,type="string", required=true,description="账户注销理由")
+     * @ApiParams (name=logout_type,type="string", required=true,description="类型:1=塘主,2=渔场主")
+     */
+    public function user_logout()
+    {
+        $logout_reason = $this->request->post('logout_reason');
+        $logout_type = $this->request->post('logout_type');
+        if ($logout_reason == "" || $logout_type == '') {
+            $this->error(__('Invalid parameters'));
+        }
+
+        $suppliers_model = new Fishery();
+        // 检查申请信息
+        $info = $suppliers_model::get(['user_id' => $this->auth->id, 'type' => $logout_type, 'status' => 2]);
+        if (!$info) {
+            $this->error('申请信息不存在');
+        }
+
+        $info->logout = 1;
+        $info->logout_reason = $logout_reason;
+        $info->logout_status = 1;
+        $info->save();
+
+        $this->success('成功');
+    }
 }

+ 0 - 25
application/api/controller/User.php

@@ -614,31 +614,6 @@ class User extends Api
     }
 
     /**
-     * 账户注销-提交
-     * @ApiMethod (POST)
-     * @ApiParams (name=logout_reason,type="string", required=true,description="账户注销理由")
-     */
-    public function user_logout()
-    {
-        $logout_reason = $this->request->post('logout_reason');
-        if ($logout_reason == "") {
-            $this->error(__('Invalid parameters'));
-        }
-
-        $model = new ModelUser();
-        $user = $model::get($this->auth->id);
-        if (!$user) {
-            $this->error(__('Invalid parameters'));
-        }
-
-        $user->logout = 1;
-        $user->logout_reason = $logout_reason;
-        $user->save();
-
-        $this->success('成功');
-    }
-
-    /**
      * 子账户创建
      *
      * @ApiMethod (POST)

文件差异内容过多而无法显示
+ 189 - 189
public/api.html


部分文件因为文件数量过多而无法显示