where($where)->find(); return $success; } /* * 查询某个字段 * @param $where 条件 * @param $field 查询的字段 * @param $state 单个还是数组 */ public function getFindField($where,$field,$state=false) { $field = $field?$field:'id'; $success = $this->where($where)->getField($field,$state); return $success; } /* * 查询某些字段 * @param $where 条件 * @param $fields 查询的字段 */ public function getFindFields($where,$fields) { $fields = $fields?$fields:'*'; $success = $this->field($fields)->where($where)->select(); return $success; } /* * 查询信息 */ public function getSelect($where,$limit,$field,$order) { $field = $field?$field:"*"; $order = $order?$order:'addtime desc'; if(!$limit || $limit == ''){ $success = $this->field($field)->where($where)->order($order)->select(); }else{ $success = $this->field($field)->where($where)->limit($limit)->order($order)->select(); } return $success; } /** * 统计数量(count) * @param $where 查询条件 * */ public function getCount($where) { $success = $this->where($where)->count(); return $success; } /* * 添加 * @param $data 添加的信息 */ public function addData($data) { if(!$data){ $res['status'] = 0; $res['msg'] = '添加信息缺失'; }else{ $success = $this->add($data); if($success){ $res['status'] = 1; $res['data'] = $success; $res['msg'] = '操作成功'; }else{ $res['status'] = 0; $res['msg'] = '操作失败'; } } return $res; } }