广东快乐十分

tp5 db对象clone会报错

浏览:59 发布日期:2019/11/05 分类:求助交流
代码一,我对clone的对象操作就会报错,代码二那么用就没事,咋回事啊。
代码一: $uid = 1213;
BonusLog::updateBonusState($uid);
if ($type == 1) {
$list = Db::table('tp_bonus_log')->where(['is_recive' => 1, 'uid' => $uid])->order("updatetime desc");

}
if ($type == 2) {
$list = Db::table('tp_bonus_log')->where(['is_recive' => 0, 'uid' => $uid, 'is_expire' => 0])->order("updatetime desc");


}
if ($type == 3) {
$list = Db::table('tp_bonus_log')->where(['is_recive' => 0, 'uid' => $uid, 'is_expire' => 1])->order("updatetime desc");

}
$list2 = clone $list;
$count = count($list->select());
$list2 = $list2->page($page, $limit)->select();

代码二: $list = Db::table('tp_bonus_log')->alias('bg')->join('tp_bonus_rule be', 'bg.rule_id=be.id', "LEFT")
->join('tp_users us', 'bg.uid=us.id', "LEFT");
$list = $list->field("bg.*,us.nickname,be.rule_name,us.id as uid")->order("bg.createtime DESC,bg.id DESC,bg.expire_time DESC");

if (trim($p['id']) != '') {
$list = $list->where('bg.id', '=', trim($p['id']));
}
$list1 = clone $list;
$list = $list->page($page, $limit)->select();
$total = count($list1->select());

报错信息:SQLSTATE[HY000]: General error: 2031
最佳答案
评论( 相关
后面还有条评论,点击查看>>