request->isAjax()) { list($where, $sort, $order, $offset, $limit) = $this->buildparams(); $data = $this->userRecentlyReadModel->setConnect($this->ids) ->where(['user_id' => $this->ids, 'flag' => 0]) ->where($where) ->limit($offset, $limit) ->order('updatetime desc') ->select(); $total = $this->userRecentlyReadModel->setConnect($this->ids) ->where(['user_id' => $this->ids, 'flag' => 0]) ->where($where) ->count(); if($data){ foreach ($data as $key => $item) { $bookName = model('Book')->where(['id'=>$item['book_id']])->find(); if($bookName){ $data[$key]['bookname'] = $bookName->name; }else{ $data[$key]['bookname'] = '未知'; } $data[$key]['updatetime'] = date('Y-m-d H:i:s', $item['updatetime']); } } $result = array("total" => $total, "rows" => $data); return json($result); } $this->view->assign('title', '已删除阅读记录'); $this->view->assign('type', 'userdelrecentreadcount'); return $this->view->fetch(); } }