| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- <?php
- // +----------------------------------------------------------------------
- // | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
- // +----------------------------------------------------------------------
- // | 版权所有 2017~2021 LARAVEL研发中心
- // +----------------------------------------------------------------------
- // | 官方网站: http://www.laravel.cn
- // +----------------------------------------------------------------------
- // | Author: laravel开发员 <laravel.qq.com>
- // +----------------------------------------------------------------------
- namespace App\Http\Controllers\Admin;
- use App\Http\Validator\MemberValidator;
- use App\Services\Common\MemberService;
- /**
- * 会员管理-控制器
- * @author laravel开发员
- * @since 2020/11/11
- * Class MemberController
- * @package App\Http\Controllers
- */
- class MemberController extends Backend
- {
- /**
- * 构造函数
- * @author laravel开发员
- * @since 2020/11/11
- * MemberController constructor.
- */
- public function __construct()
- {
- parent::__construct();
- $this->service = new MemberService();
- }
- /**
- * 列表
- * @return array
- */
- public function index()
- {
- $result = $this->service->getList();
- return showJson($result['msg'], $result['code'] == 0, $result['data'] ?? [], $result['count'] ?? 0);
- }
- /**
- * 审核
- * @return array
- */
- public function confirm(MemberValidator $validator)
- {
- $params = request()->post();
- $params = $validator->check($params, 'confirm');
- if (!is_array($params)) {
- return message($params, false);
- }
- if(MemberService::make()->confirm($this->userId,$params)){
- return message(MemberService::make()->getError(), true);
- }else{
- return message(MemberService::make()->getError(), false);
- }
- }
- /**
- * 选项列表
- * @return mixed
- */
- public function options(){
- $result = $this->service->options();
- return message(1002,true, $result);
- }
- /**
- * 搜索用户(用于下拉选择)
- * @return array
- */
- public function search()
- {
- $keyword = request()->input('keyword', '');
- $accountType = request()->input('account_type', 1);
- $limit = request()->input('limit', 20);
-
- $result = $this->service->searchUsers($keyword, $accountType, $limit);
- return showJson($result['msg'], $result['code'] == 0, $result['data'] ?? []);
- }
- /**
- * 获取详情
- */
- public function read()
- {
- $result = $this->service->getInfo();
- return showJson($result['msg'], $result['code'] == 0, $result['data'] ?? []);
- }
- /**
- * 添加
- */
- public function add()
- {
- $result = $this->service->add();
- return showJson($result['msg'], $result['code'] == 0);
- }
- /**
- * 设置状态
- */
- public function status()
- {
- $result = $this->service->status();
- return showJson($result['msg'], $result['code'] == 0);
- }
- }
|