where($map)->find(); return $find; } /** * 查询所有小程序用户(select) * @param [array] $map 查询条件 * @param [int] $page 分页 * @param [int] $limit 数量 * @return [array|string] $xcx_user */ public function getSelect($map,$page = 0,$limit = 0) { if($page && $page != 0 && $limit && $limit != 0){ $xcx_user = $this->where($map)->page($page,$limit)->order('id desc')->select(); }else{ $xcx_user = $this->where($map)->order('id desc')->select(); } return $xcx_user; } /** * 修改(save) * @param [array] $map 搜索条件 * @param [array] $up 修改数据 * @return [bool] $save */ public function saveXcxVip($map,$up) { $save = $this->where($map)->save($up); return $save; } /** * 统计数据(count) * @param [array] $map 查询条件 * @return [array] $res */ public function total($map) { $total = $this->where($map)->count(); return (int)$total; } /** * 获取小程序用户 * @param [int] $storeid 门店id * @param [array] $seek_data 搜索条件 * @param [int] $page 分页 * @limit [limit] $limit 数量 * @return [array] $res */ public function getXcxUser($map,$page = 0,$limit = 0) { $xcx_user = $this->getSelect($map,$page,$limit); if(!$xcx_user){ $res = array('status'=>0,'msg'=>'暂无用户'); return $res; } $total = $this->total($map); $where['state'] = 0; $where['status'] = 1; foreach ($xcx_user as $key=>&$val){ $val['index'] = $key + 1; $val['ctime'] = date('Y-m-d H:i:s',$val['ctime']); $val['mobile_phone'] = $val['mobile_phone'] ? $val['mobile_phone'] : '无'; $val['link_name'] = $val['link_name'] ? $val['link_name'] : '无'; } $res = array('status'=>1,'xcx_user'=>$xcx_user,'total'=>(int)$total); return $res; } }