作者 李铮

新增退出登录功能

@@ -315,4 +315,17 @@ class User extends Frontend @@ -315,4 +315,17 @@ class User extends Frontend
315 Db::commit(); 315 Db::commit();
316 $this->success('SUCCESS','',['token'=>$token]); 316 $this->success('SUCCESS','',['token'=>$token]);
317 } 317 }
  318 +
  319 + /**
  320 + * 注销登录
  321 + */
  322 + public function logout()
  323 + {
  324 + //注销本站
  325 + $this->auth->logout();
  326 + session('token',null);
  327 + Cookie::delete('token');
  328 + $this->redirect(url('index/index'));
  329 +// $this->success(__('Logout successful'), url('index/index'));
  330 + }
318 } 331 }
@@ -31,6 +31,11 @@ @@ -31,6 +31,11 @@
31 </a> 31 </a>
32 {/if} 32 {/if}
33 {/notempty} 33 {/notempty}
  34 + {notempty name="$token"}
  35 + <a href="{:url('index/user/logout')}" class="btn">
  36 + 退出
  37 + </a>
  38 + {/notempty}
34 </div> 39 </div>
35 </div> 40 </div>
36 </header> 41 </header>