MemberController.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2017~2021 LARAVEL研发中心
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: http://www.laravel.cn
  8. // +----------------------------------------------------------------------
  9. // | Author: laravel开发员 <laravel.qq.com>
  10. // +----------------------------------------------------------------------
  11. namespace App\Http\Controllers\Admin;
  12. use App\Http\Validator\MemberValidator;
  13. use App\Services\Common\MemberService;
  14. /**
  15. * 会员管理-控制器
  16. * @author laravel开发员
  17. * @since 2020/11/11
  18. * Class MemberController
  19. * @package App\Http\Controllers
  20. */
  21. class MemberController extends Backend
  22. {
  23. /**
  24. * 构造函数
  25. * @author laravel开发员
  26. * @since 2020/11/11
  27. * MemberController constructor.
  28. */
  29. public function __construct()
  30. {
  31. parent::__construct();
  32. $this->service = new MemberService();
  33. }
  34. /**
  35. * 列表
  36. * @return array
  37. */
  38. public function index()
  39. {
  40. $pageSize = request()->get('limit', 10);
  41. $list = $this->service->getDataList(request()->all(), $pageSize);
  42. $message = array(
  43. "msg" => '操作成功',
  44. "code" => 0,
  45. "data" => isset($list['list'])? $list['list']:[],
  46. "count" => isset($list['total'])? $list['total']:0,
  47. );
  48. return $message;
  49. }
  50. /**
  51. * 审核
  52. * @return array
  53. */
  54. public function confirm(MemberValidator $validator)
  55. {
  56. $params = request()->post();
  57. $params = $validator->check($params, 'confirm');
  58. if (!is_array($params)) {
  59. return message($params, false);
  60. }
  61. if(MemberService::make()->confirm($this->userId,$params)){
  62. return message(MemberService::make()->getError(), true);
  63. }else{
  64. return message(MemberService::make()->getError(), false);
  65. }
  66. }
  67. /**
  68. * 选项列表
  69. * @return mixed
  70. */
  71. public function options(){
  72. $result = $this->service->options();
  73. return message(1002,true, $result);
  74. }
  75. }