新增用户管理
This commit is contained in:
parent
e4273e5a1a
commit
20b3fd477f
@ -13,13 +13,85 @@ namespace catchAdmin\wechat\controller;
|
|||||||
use catcher\base\CatchController;
|
use catcher\base\CatchController;
|
||||||
use catcher\CatchResponse;
|
use catcher\CatchResponse;
|
||||||
use catcher\library\WeChat;
|
use catcher\library\WeChat;
|
||||||
|
use catcher\Utils;
|
||||||
|
|
||||||
class Users extends CatchController
|
class Users extends CatchController
|
||||||
{
|
{
|
||||||
public function index()
|
protected $user;
|
||||||
{
|
|
||||||
$response = WeChat::officialAccount()->base->getValidIps();
|
|
||||||
|
|
||||||
return CatchResponse::success($response);
|
public function __construct(WeChat $weChat)
|
||||||
|
{
|
||||||
|
$this->user = $weChat->officialAccount()->user;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列表
|
||||||
|
*
|
||||||
|
* @time 2020年06月19日
|
||||||
|
* @param null $nextOpenid
|
||||||
|
* @return \think\response\Json
|
||||||
|
*/
|
||||||
|
public function index($nextOpenid = null)
|
||||||
|
{
|
||||||
|
$openIds = $this->user->list($nextOpenid);
|
||||||
|
|
||||||
|
if ($openIds['count']) {
|
||||||
|
$users = $this->user->select($openIds['data']['openid']);
|
||||||
|
|
||||||
|
$openIds['users'] = $users;
|
||||||
|
|
||||||
|
return CatchResponse::success($openIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
return CatchResponse::success($openIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*
|
||||||
|
* @time 2020年06月19日
|
||||||
|
* @param $optionId
|
||||||
|
* @param $remark
|
||||||
|
* @return \think\response\Json
|
||||||
|
*/
|
||||||
|
public function remark($optionId, $remark)
|
||||||
|
{
|
||||||
|
return CatchResponse::success($this->user->remark($optionId, $remark));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拉黑
|
||||||
|
*
|
||||||
|
* @time 2020年06月19日
|
||||||
|
* @param $openId
|
||||||
|
* @return \think\response\Json
|
||||||
|
*/
|
||||||
|
public function block($openId)
|
||||||
|
{
|
||||||
|
return CatchResponse::success($this->user->block(Utils::stringToArrayBy($openId)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拉黑列表
|
||||||
|
*
|
||||||
|
* @time 2020年06月19日
|
||||||
|
* @param null $nextOpenid
|
||||||
|
* @return \think\response\Json
|
||||||
|
*/
|
||||||
|
public function blacklist($nextOpenid = null)
|
||||||
|
{
|
||||||
|
return CatchResponse::success($this->user->blacklist($nextOpenid));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消拉黑
|
||||||
|
*
|
||||||
|
* @time 2020年06月19日
|
||||||
|
* @param $openId
|
||||||
|
* @return \think\response\Json
|
||||||
|
*/
|
||||||
|
public function unblock($openId)
|
||||||
|
{
|
||||||
|
return CatchResponse::success($this->user->unblock(Utils::stringToArrayBy($openId)));
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -8,4 +8,14 @@
|
|||||||
* @copyright By CatchAdmin
|
* @copyright By CatchAdmin
|
||||||
* @license https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt
|
* @license https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt
|
||||||
*/
|
*/
|
||||||
$router->resource('official/users', '\catchAdmin\wechat\controller\Users');
|
|
||||||
|
$router->group('wechat', function () use ($router){
|
||||||
|
// 公众号粉丝
|
||||||
|
$router->group('official/users', function () use ($router){
|
||||||
|
$router->get('<nextOpenid?>', '\catchAdmin\wechat\controller\Users@index');
|
||||||
|
$router->put('remark/<openid>/<remark>', '\catchAdmin\wechat\controller\Users@remark');
|
||||||
|
$router->put('block/<openid>', '\catchAdmin\wechat\controller\Users@block');
|
||||||
|
$router->put('unblock/<openid>', '\catchAdmin\wechat\controller\Users@unblock');
|
||||||
|
$router->get('blacklist', '\catchAdmin\wechat\controller\Users@blacklist');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user