2020-06-07 14:22:41 +08:00
|
|
|
<?php
|
|
|
|
/**
|
2020-06-21 14:41:22 +08:00
|
|
|
* @filename WechatUsersRepository.php
|
2020-06-07 14:22:41 +08:00
|
|
|
* @date 2020/6/7
|
|
|
|
* @project https://github.com/yanwenwu/catch-admin
|
|
|
|
* @document http://doc.catchadmin.com
|
|
|
|
* @author JaguarJack <njphper@gmail.com>
|
|
|
|
* @copyright By CatchAdmin
|
|
|
|
* @license https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt
|
|
|
|
*/
|
|
|
|
namespace catchAdmin\wechat\controller;
|
|
|
|
|
2020-07-19 16:55:38 +08:00
|
|
|
use catchAdmin\wechat\library\SyncWechatUsers;
|
2020-06-21 14:41:22 +08:00
|
|
|
use catchAdmin\wechat\repository\WechatUsersRepository;
|
2020-06-07 14:22:41 +08:00
|
|
|
use catcher\base\CatchController;
|
|
|
|
use catcher\CatchResponse;
|
2020-06-22 07:55:16 +08:00
|
|
|
use catcher\library\WeChat;
|
2020-06-19 19:29:21 +08:00
|
|
|
use catcher\Utils;
|
2020-06-21 18:04:30 +08:00
|
|
|
use think\facade\Console;
|
2020-06-22 07:55:16 +08:00
|
|
|
use think\Request;
|
2020-06-07 14:22:41 +08:00
|
|
|
|
|
|
|
class Users extends CatchController
|
|
|
|
{
|
2020-06-19 19:29:21 +08:00
|
|
|
protected $user;
|
|
|
|
|
2020-06-21 14:41:22 +08:00
|
|
|
public function __construct(WechatUsersRepository $users)
|
2020-06-07 14:22:41 +08:00
|
|
|
{
|
2020-06-21 10:48:55 +08:00
|
|
|
$this->user = $users;
|
2020-06-19 19:29:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 列表
|
|
|
|
*
|
|
|
|
* @time 2020年06月19日
|
|
|
|
* @return \think\response\Json
|
|
|
|
*/
|
2020-06-21 10:48:55 +08:00
|
|
|
public function index()
|
2020-06-19 19:29:21 +08:00
|
|
|
{
|
2020-06-21 10:48:55 +08:00
|
|
|
return CatchResponse::paginate($this->user->getList());
|
2020-06-19 19:29:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 备注
|
|
|
|
*
|
|
|
|
* @time 2020年06月19日
|
2020-06-21 14:41:22 +08:00
|
|
|
* @param $id
|
2020-06-19 19:29:21 +08:00
|
|
|
* @param $remark
|
|
|
|
* @return \think\response\Json
|
|
|
|
*/
|
2020-06-21 14:41:22 +08:00
|
|
|
public function remark($id, $remark)
|
2020-06-19 19:29:21 +08:00
|
|
|
{
|
2020-06-21 14:41:22 +08:00
|
|
|
return CatchResponse::success($this->user->remark($id, $remark));
|
2020-06-19 19:29:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 拉黑
|
|
|
|
*
|
|
|
|
* @time 2020年06月19日
|
2020-06-21 14:41:22 +08:00
|
|
|
* @param $id
|
2020-06-19 19:29:21 +08:00
|
|
|
* @return \think\response\Json
|
|
|
|
*/
|
2020-06-21 14:41:22 +08:00
|
|
|
public function block($id)
|
2020-06-19 19:29:21 +08:00
|
|
|
{
|
2020-06-21 14:41:22 +08:00
|
|
|
return CatchResponse::success($this->user->block($id));
|
2020-06-07 14:22:41 +08:00
|
|
|
}
|
2020-06-21 10:48:55 +08:00
|
|
|
|
2020-06-26 22:08:01 +08:00
|
|
|
/**
|
|
|
|
* 贴标签
|
|
|
|
*
|
|
|
|
* @time 2020年06月26日
|
|
|
|
* @param $id
|
|
|
|
* @param Request $request
|
|
|
|
* @return \think\response\Json
|
|
|
|
*/
|
2020-06-22 07:55:16 +08:00
|
|
|
public function tag($id, Request $request)
|
|
|
|
{
|
|
|
|
return CatchResponse::success($this->user->tag($id, $request->post()));
|
|
|
|
}
|
|
|
|
|
2020-06-26 22:08:01 +08:00
|
|
|
/**
|
|
|
|
* 用户同步
|
|
|
|
*
|
|
|
|
* @time 2020年06月26日
|
2020-07-19 16:55:38 +08:00
|
|
|
* @param SyncWechatUsers $users
|
2020-06-26 22:08:01 +08:00
|
|
|
* @return \think\response\Json
|
|
|
|
*/
|
2020-07-19 16:55:38 +08:00
|
|
|
public function sync(SyncWechatUsers $users)
|
2020-06-21 18:04:30 +08:00
|
|
|
{
|
2020-07-19 16:55:38 +08:00
|
|
|
return CatchResponse::success($users->start(), 'success');
|
2020-06-21 18:04:30 +08:00
|
|
|
}
|
|
|
|
|
2020-06-21 10:48:55 +08:00
|
|
|
public function subscribe()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public function unsubscribe()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
2020-06-07 14:22:41 +08:00
|
|
|
}
|