insertGetId($data); return empty($id) ? false : $id; } public function getInfo($where, $field = "*", $row = true) { $info = $this->field($field)->where($where); if ($row) { $info = $info->find(); } else { $info = $info->select(); } return empty($info) ? false : $info; } public function updateinfo($where, $updateData) { $row = $this->where($where)->update($updateData); return empty($row) ? false : $row; } public function deleteinfo($where) { $row = $this->where($where)->delete(); return empty($row) ? false : $row; } /* *20211003 * 根据ID获取头像和身份证信息,未来可再增加获取的 * steelxu5 */ public function selconinfobyid($id) { $where_arr['id'] = $id; $strfiled = 'telno,photourl,wage,wname,gender,sfzid,enterprisename'; $rlist = $this->where($where_arr)->field($strfiled)->find(); if (empty($rlist)) { return false; } if (empty($rlist['sfzid'])) { $rlist['is_realauth'] = false; } else { $rlist['is_realauth'] = true; } unset($rlist['sfzid']); return $rlist; } /* * 20211031 * steelxu5 * 更新信息,根据opoenid */ public function updateinfobyopenid($openid, $updatearr) { $where_arr['openid'] = $openid; $rec = $this->where($where_arr)->update($updatearr); return $rec; } /* * 202120110 * wj * 更新信息,根据id */ public function updateinfobyid($id, $updatearr) { $where_arr['id'] = $id; $rec = $this->where($where_arr)->update($updatearr); return $rec; } /* * 20200813 * 预检查是否有索引字段重复 * 改为用身份证查重 */ public function precheckindex($info) { $where_arr['sfzid'] = $info['sfzid']; $rec = $this->where($where_arr)->find(); if ($rec) { return false; } else { return true; } } /*** * 获取全部字段名 * 20211103 * wj */ public function gettablefields() { $sql = "desc " . $this->table; $fiekds = $this->query($sql); return $fiekds; } /** * 获取总数 * 20211117 * wj */ public function getcount() { $count = $this->where([])->count(); return $count; } /** * 获取分析数据 * 20211117 * wj */ public function statistics() { $sql = "select isactive,isright,count(*) as count from " . $this->table . " group by isactive,isright"; $list = $this->query("select * from (" . $sql . ") as t"); return $list; } public function getList($where = [], $field = "*", $page = 1, $size = 10, $order = "id desc", $group = "", $row = false) { $sqlObj = ''; if (isset($where['sfzid']) && 'NULL' == $where['sfzid']) { $sqlObj = $this->whereNull('sfzid'); unset($where['sfzid']); } if (isset($where['wname']) && 'NULL' == $where['wname']) { if ($sqlObj) { $sqlObj = $sqlObj->whereNull('wname'); } else { $sqlObj = $this->whereNull('wname'); } unset($where['wname']); } if ($sqlObj) { $sqlObj = $sqlObj->where($where); } else { $sqlObj = $this->where($where); } if ("count" != $field) { $sqlObj = $sqlObj->field($field)->order($order)->group($group)->page($page, $size); if ($row) { $data = $sqlObj->find(); } else { $data = $sqlObj->select(); } } else { $data = $sqlObj = $sqlObj->count(); } return $data; } /* * 20220111 * steelxu5 * 根据ID返回qrcode */ public function selqrcodebyuid($uid){ $where_arr['id']=$uid; $rec=$this->where($where_arr)->field('qrcode')->find(); return $rec; } }