php取出数据后每隔几秒显示一条,为什么取出简单的十多条数据都要十多秒 应该如何优化代码结构 谢谢啦...

在多台服务器上测试,排除服务器性能原因

仅仅取出数十条数据都要等十多秒

应该是代码优化的原因

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();

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值