瀏覽代碼

微信解绑

zhangxiaobin 1 年之前
父節點
當前提交
b833001fc9
共有 1 個文件被更改,包括 18 次插入0 次删除
  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());
+        }
+    }
 }