php mysql书城_php在线书城 thinkphp源码(含数据库脚本)
【實例簡介】
【實例截圖】
【核心代碼】
// 本類由系統自動生成,僅供測試用途
class IndexAction extends PublicAction {
public function index(){
//公告板
$notice=M('Notice');
$notice=$notice->limit(8)->select();
$this->assign('notice',$notice);
$book=M('Book');
//強力推薦
$abook=$book->table('book_book as a,book_cats as b')->where("a.book_cat=b.cat_id and a.flags like '%a%'")->limit(7)->select();
$this->assign('abook',$abook);
//最新完本
$endbook=$book->table('book_book as a,book_cats as b')->order('a.public_time')->where('a.book_cat=b.cat_id and a.progress=59')->limit(7)->select();
$this->assign('endbook',$endbook);
//封面推薦
$bbook=$book->table('book_book as a,book_cats as b')->where("a.book_cat=b.cat_id and a.flags like '%b%'")->limit(3)->select();
$this->assign('bbook',$bbook);
//最新上架
$newbook=$book->table('book_book as a,book_cats as b')->order('a.public_time')->where('a.book_cat=b.cat_id')->limit(12)->select();
$this->assign('newbook',$newbook);
//編輯推薦
$bianji=$book->table('book_book as a,book_cats as b')->where("a.book_cat=b.cat_id and a.flags like '%c%'")->select();
$this->assign('bianji',$bianji);
//精品推薦
$jingpin=$book->table('book_book as a,book_cats as b')->where("a.book_cat=b.cat_id and a.flags like '%d%'")->select();
$this->assign('jingpin',$jingpin);
//最近更新
$book=D('Book');
$newUpdate=$book->relation(true)->select();
// dump($newUpdate);
$this->assign('newUpdate',$newUpdate);
//熱評榜
$book=M('Book');
$hots=$book->order('hits asc')->select();
$this->assign('hots',$hots);
//最新評論
$comment=D('Comment');
$comment=$comment->relation(true)->order('time desc')->select();
$this->assign('comment',$comment);
//會員積分排行榜
$user_info=M('User_info');
$user_info=$user_info->order('user_score desc')->select();
$this->assign('user_info',$user_info);
//友情鏈接
$link=M('Link');
$links=$link->where('status=1')->limit(32)->select();
$this->assign('links',$links);
//顯示模板
$this->display();
}
}
總結
以上是生活随笔為你收集整理的php mysql书城_php在线书城 thinkphp源码(含数据库脚本)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 0579是哪里的区号
- 下一篇: 热爱生活正能量的句子138个