4 changed files with 38 additions and 3 deletions
@ -0,0 +1,34 @@ |
|||||
|
<?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'] |
||||
|
]); |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue