Browse Source

微信解绑

zhangxiaobin 1 year ago
parent
commit
b833001fc9
1 changed files with 18 additions and 0 deletions
  1. 18 0
      application/api/controller/User.php

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

@@ -1237,4 +1237,22 @@ class User extends Api
         }
         $this->success(__('success'),$info);
     }
+    
+    /**
+     * 微信解绑
+     * @return void
+     */
+    public function clearopenid()
+    {
+        try {
+            $userId = $this->auth->id;
+            $where['id'] = $userId;
+            $data['openid'] = '';
+            $user = model('User')->update($data,$where);
+            
+            $this->success('解绑成功');
+        } catch (Exception $e) {
+            $this->error($e->getMessage());
+        }
+    }
 }