发票管理apiadmin
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.
 
 
 

44 lines
1.3 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
{
$param = $this->request->get();
$limit = $this->request->get('size', config('apiadmin.ADMIN_LIST_DEFAULT'));
$start = $this->request->get('page', 1);
$where = [];
if (isset($param['key']) && !empty($param['key'])) {
$where[] = ['phone', 'like', "%{$param['key']}%"];
}
$obj = new WechatUserModel();
$listObj = $obj->order('create_time', 'DESC')
->where($where)
->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", $item->last_login_time) : '';
})->toArray();
$listInfo = $listObj['data'];
return $this->buildSuccess([
'list' => $listInfo,
'count' => $listObj['total']
]);
}
}