where($where)->order('id desc')->limit($p->firstRow, $p->listRows)->select(); return $list; } public function slectById($id){ $list = $this->where('id ='.$id)->select(); return $list; } public function getById($list){ header("Content-type: text/html; charset=utf-8"); $where = array(); $where['id'] = array('in',$list); $field = "sn,name,time,num,standard,inspector,batch_number,board_no,quality_no"; $data = $this->field($field)->where($where)->select(); $new = array(); foreach($data as $v){ $arr = array(); $arr = $v; $arr['custome_name'] = '湖北中烟工业有限公司'; $arr['date'] = date('Y',$v['time']).'年'.date('m',$v['time']).'月'.date('d',$v['time']).'日'; $arr['sn'] = preg_replace("/[\(\)]/","",$v['sn']); unset( $arr['time']); $new[]= $arr; } return $new; } /*保存产品信息*/ public function save1($data){ $id = $data['id']; if($id){ //执行更新 $return = $this->save($data); }else{ //执行增加 $return = $this->add($data); } if($return!==false){ return true; } return false; } }