在多台服务器上测试,排除服务器性能原因
仅仅取出数十条数据都要等十多秒
应该是代码优化的原因
Controller如下
$list=$CaipanOrderModel->getCaipanOrder(null,$orderno,$uid,$productno,
$play,$time,$winorlose,$type,'caipanorder_buytime desc',
$issimulate,$usercategory,$agent_class,
$createtime_starttime, $createtime_endtime,$closetime_starttime,$closetime_endtime);
foreach ($list as $key => $value) {
//倒计时
$shengyu_second = strtotime($value['caipanorder_expiredtime']) - time();
$list[$key]['daojishi'] = $shengyu_second;
}
Model
public function getCaipanOrder($id,$no,$uid,$productno,
$play,$time,$winorlose,$type,$order,
$issimulate,$usercategory,$agent_class,
$createtime_starttime, $createtime_endtime,$closetime_starttime,$closetime_endtime){
$m=M('caipan_order');
if($id){
$con['caipanorder_id']=$id;
}
if($no){
$con['caipanorder_no']=$no;
}
if($uid){
$con['caipanorder_uid']=$uid;
}
if($productno){
$con['caipanorder_productno']=$productno;
}
if($play){
$con['caipanorder_play']=$play;
}
if($time){
$con['caipanorder_time']=$time;
}
if($winorlose){
$con['caipanorder_winorlose']=$winorlose;
}
if($type!==null){
$con['caipanorder_type']=$type;
}
if($issimulate!==null){
$con['user_issimulate_user']=$issimulate;
}
if($usercategory!==null){
$con['user_catgoryid']=$usercategory;
}
if($agent_class!==null){
$con['user_agent_class']=$agent_class;
}
if($createtime_starttime){
$con['caipanorder_buytime']=array(array('egt',$createtime_starttime),
array('elt',$createtime_endtime),'and') ;
}
if($closetime_starttime){
$con['caipanorder_sellingtime']=array(array('egt',$closetime_starttime),
array('elt',$closetime_endtime),'and') ;
}
return $r=$m->where($con)->order($order)
->join("LEFT JOIN x_user ON x_user.user_id=x_caipan_order.caipanorder_uid")
->join("LEFT JOIN x_user_category ON x_user_category.usercategory_id=x_user.user_catgoryid")
->select();
}