<?php
/**
 * File UserController.php
 *
 * @author Tuan Duong <bacduong@gmail.com>
 * @package Laravue
 * @version 1.0
 */

namespace App\Http\Controllers;

use App\Laravue\Models\wxUser;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Resources\Json\ResourceCollection;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Hash;
use Validator;

class WxuserController extends Controller
{
    //获取wx用户列表
    public function wxlist(Request $request){
        /*
         * get请求返回wx用户列表
         * */
        $pagenNum=$request->input('page')-1;//页数
        $limit = $request->input('limit');
        $Wxuser = Wxuser::select('nickname','id','sex','province','city','mobile','country','headimgurl','created_at','state')
            ->offset($pagenNum)
            ->orderBy('id', 'desc')
            ->limit($limit)
            ->get();
        if ($Wxuser){
            return $this->jsonSuccessData($Wxuser);
        }else{
            return $this->jsonErrorData('105','获取数据失败');
        }
    }
}