You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.0 KiB
34 lines
1.0 KiB
<?php
|
|
|
|
namespace app\controller\admin;
|
|
|
|
use app\model\WechatUser as WechatUserModel;
|
|
use think\Response;
|
|
|
|
class WechatUser extends Base
|
|
{
|
|
/**
|
|
* 获取微信用户列表
|
|
* @return Response
|
|
* @throws \think\db\exception\DbException
|
|
*/
|
|
public function index(): Response {
|
|
|
|
$limit = $this->request->get('size', config('apiadmin.ADMIN_LIST_DEFAULT'));
|
|
$start = $this->request->get('page', 1);
|
|
|
|
$obj = new WechatUserModel();
|
|
|
|
$listObj = $obj->order('create_time', 'DESC')
|
|
->field('id,openid,headimgurl,phone,create_time,status,last_login_time')
|
|
->paginate(['page' => $start, 'list_rows' => $limit])->each(function($item, $key) {
|
|
$item->last_login_time = $item->last_login_time ? date("Y-m-d H:i:s") :'';
|
|
})->toArray();
|
|
$listInfo = $listObj['data'];
|
|
|
|
return $this->buildSuccess([
|
|
'list' => $listInfo,
|
|
'count' => $listObj['total']
|
|
]);
|
|
}
|
|
}
|