Logout.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace app\api\controller;
  3. /**
  4. * ============================================================================
  5. *
  6. * ============================================================================
  7. * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
  8. * 网站地址: https://www.valimart.net/
  9. * ----------------------------------------------------------------------------
  10. *
  11. * ============================================================================
  12. * 登出控制器
  13. */
  14. class Logout extends MobileMember
  15. {
  16. public function initialize()
  17. {
  18. parent::initialize(); // TODO: Change the autogenerated stub
  19. }
  20. /**
  21. * @api {POST} api/Logout/index 注销
  22. * @apiVersion 1.0.0
  23. * @apiGroup Logout
  24. *
  25. * @apiHeader {String} X-DS-KEY 用户授权token
  26. *
  27. * @apiParam {String} username 用户名
  28. * @apiParam {String} client 用户端 wap手机端
  29. *
  30. * @apiSuccess {String} code 返回码,10000为成功
  31. * @apiSuccess {String} message 返回消息
  32. */
  33. public function index(){
  34. if(empty(input('post.username')) || !in_array(input('post.client'), $this->client_type_array)) {
  35. ds_json_encode(10001,lang('param_error'));
  36. }
  37. $mbusertoken_model = model('mbusertoken');
  38. if ($this->member_info['member_name'] == trim(input('post.username'))) {
  39. $condition = array();
  40. $condition[] = array('member_id','=',$this->member_info['member_id']);
  41. $condition[] = array('member_clienttype','=',input('post.client'));
  42. $mbusertoken_model->delMbusertoken($condition);
  43. session(null); //删除session中的member_id下,因为次登录时要整合cookie中的商品到数据库中
  44. ds_json_encode(10000, '', '', '', false);
  45. } else {
  46. ds_json_encode(10001,lang('param_error'));
  47. }
  48. }
  49. }