where('status=1')->column('id'); foreach($novel as $k=>$v){ $chapter = db('chapter')->where('chaptertype=0 and articleid='.$v)->order('chapterorder DESC')->field('id,articleid,chaptername')->find(); db('novel')->where('id',$v)->update(['lastvolume' => $chapter['chaptername'],'lastvolumeid'=>$chapter['id']]); } return $this->success("操作成功!"); } $this->setMeta("批量更新书籍最后章节"); return $this->fetch(); } }