Membercancel.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <?php
  2. /**
  3. * Index.php
  4. * Niushop商城系统 - 团队十年电商经验汇集巨献!
  5. * =========================================================
  6. * Copy right 2015-2025 杭州牛之云科技有限公司, 保留所有权利。
  7. * ----------------------------------------------
  8. * 官方网址: https://www.niushop.com
  9. * =========================================================
  10. * @author : niuteam
  11. * @date : 2022.8.8
  12. * @version : v5.0.0.1
  13. */
  14. namespace addon\membercancel\api\controller;
  15. use app\api\controller\BaseApi;
  16. use addon\membercancel\model\MemberCancel as MemberCancelModel;
  17. use app\model\member\Config as ConfigModel;
  18. /**
  19. * 会员注销
  20. * Class MemberCancel
  21. * @package app\api\controller
  22. */
  23. class Membercancel extends BaseApi
  24. {
  25. /**
  26. * 获取注销信息
  27. */
  28. public function info()
  29. {
  30. $token = $this->checkToken();
  31. if ($token[ 'code' ] < 0) return $this->response($token);
  32. $member_cancel_model = new MemberCancelModel();
  33. $member_cancel_info = $member_cancel_model->getMemberCancelInfo(
  34. [
  35. [ 'member_id', '=', $this->member_id ], [ 'site_id', '=', $this->site_id ]
  36. ],
  37. 'status,reason,audit_time'
  38. );
  39. return $this->response($member_cancel_info);
  40. }
  41. /**
  42. * 账户信息
  43. */
  44. public function accountInfo()
  45. {
  46. $token = $this->checkToken();
  47. if ($token[ 'code' ] < 0) return $this->response($token);
  48. $member_cancel_model = new MemberCancelModel();
  49. $member_account_info = $member_cancel_model->getMemberAccountInfo($this->member_id, $this->site_id);
  50. return $this->response($member_account_info);
  51. }
  52. /**
  53. * 申请注销
  54. */
  55. public function apply()
  56. {
  57. $token = $this->checkToken();
  58. if ($token[ 'code' ] < 0) return $this->response($token);
  59. $member_cancel_model = new MemberCancelModel();
  60. $res = $member_cancel_model->applyMemberCancel([ 'site_id' => $this->site_id, 'member_id' => $this->member_id ]);
  61. return $this->response($res);
  62. }
  63. /**
  64. * 撤销申请
  65. */
  66. public function cancelApply()
  67. {
  68. $token = $this->checkToken();
  69. if ($token[ 'code' ] < 0) return $this->response($token);
  70. $member_cancel_model = new MemberCancelModel();
  71. $res = $member_cancel_model->cancelApplyMemberCancel($this->member_id, $this->site_id);
  72. return $this->response($res);
  73. }
  74. /**
  75. * 获取注销设置
  76. */
  77. public function config()
  78. {
  79. $config_model = new ConfigModel();
  80. $config_info = $config_model->getCancelConfig($this->site_id, 'shop');
  81. $value = $config_info[ 'data' ][ 'value' ];
  82. return $this->response($this->success($value));
  83. }
  84. /**
  85. * 获取注销协议
  86. */
  87. public function agreement()
  88. {
  89. $config_model = new ConfigModel();
  90. $document_info = $config_model->getCancelDocument($this->site_id, 'shop');
  91. return $this->response($document_info);
  92. }
  93. }