Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ae9d1ca

Browse files
committed
推荐 bugfix
1 parent fcdfe43 commit ae9d1ca

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

config/db.sql

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -375,26 +375,26 @@ CREATE TABLE IF NOT EXISTS `image` (
375375
KEY `created_at` (`created_at`)
376376
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='图片表';
377377

378-
CREATE TABLE IF NOT EXISTS `book` (
379-
`id` int unsigned NOT NULL AUTO_INCREMENT,
378+
CREATE TABLE `book` (
379+
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
380380
`name` varchar(63) NOT NULL DEFAULT '' COMMENT '书名',
381381
`ename` varchar(63) NOT NULL DEFAULT '' COMMENT '英文书名',
382-
`lang` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '语言:0-中文;1-英文',
383-
`author` varchar(15) NOT NULL DEFAULT '' COMMENT '作者',
384-
`translator` varchar(15) NOT NULL DEFAULT '' COMMENT '译者',
382+
`lang` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '语言:0-中文;1-英文',
383+
`author` varchar(63) NOT NULL DEFAULT '' COMMENT '作者',
384+
`translator` varchar(31) NOT NULL DEFAULT '' COMMENT '译者',
385385
`cover` varchar(127) NOT NULL DEFAULT '' COMMENT '封面',
386386
`pub_date` varchar(10) NOT NULL DEFAULT '' COMMENT '出版日期,2017-04-01',
387-
`desc` varchar(1022) NOT NULL DEFAULT '' COMMENT '简介',
388-
`catalogue` varchar(2046) NOT NULL DEFAULT '' COMMENT '目录',
389-
`is_free` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '是否免费;0-否;1-是',
387+
`desc` varchar(2046) NOT NULL DEFAULT '' COMMENT '简介',
388+
`catalogue` text NOT NULL COMMENT '目录',
389+
`is_free` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否免费;0-否;1-是',
390390
`online_url` varchar(127) NOT NULL DEFAULT '' COMMENT '在线阅读url',
391391
`download_url` varchar(127) NOT NULL DEFAULT '' COMMENT '下载url',
392392
`buy_url` varchar(127) NOT NULL DEFAULT '' COMMENT '购买url',
393-
`price` decimal(10,2) unsigned NOT NULL DEFAULT 0.0 COMMENT '参考价格',
394-
`viewnum` int unsigned NOT NULL DEFAULT 0 COMMENT '浏览数',
395-
`cmtnum` int unsigned NOT NULL DEFAULT 0 COMMENT '评论数',
396-
`likenum` int unsigned NOT NULL DEFAULT 0 COMMENT '赞数(推荐数)',
397-
`created_at` timestamp NOT NULL DEFAULT 0 COMMENT '创建时间',
393+
`price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '参考价格',
394+
`viewnum` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '浏览数',
395+
`cmtnum` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '评论数',
396+
`likenum` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '赞数(推荐数)',
397+
`created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '创建时间',
398398
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
399399
PRIMARY KEY (`id`),
400400
KEY `name` (`name`),

static/css/book.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
@media(min-width: 768px) {
44
.book .meta-num { max-width: 100px; margin-top: 10.5px; }
55
}
6-
.book h4 { color: #474747; }
6+
.book h4 { color: #474747; font-weight: bold; }
77
.book h4 a { color: #474747;text-decoration: none;overflow: hidden; }
88
.book h4 a:hover { color: #DB6D4C; }
99
.book .stats { background: #eeeeee; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; margin: 0; padding: 5px; text-align: center; }

template/books/detail.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
<div class="col-lg-2 col-md-2">
1717
<div class="book-cover-col">
1818
<div class="book-cover-box wide">
19-
<a href="{{.book.Cover}}" style="float: none;">
20-
<img src="{{.book.Cover}}" class="bookcover">
19+
<a href="{{if .book.Cover}}{{.book.Cover}}{{else}}http://studygolang.qiniudn.com/img/nocover.png{{end}}" style="float: none;">
20+
<img src="{{if .book.Cover}}{{.book.Cover}}{{else}}http://studygolang.qiniudn.com/img/nocover.png{{end}}" class="bookcover">
2121
</a>
2222
<span class="ebook"></span>
2323
</div>
@@ -28,7 +28,7 @@
2828
{{end}}
2929
<div class="book-like">
3030
<div class="like">
31-
<a class="share-btn like-btn {{if .likeflag}}hadlike{{end}}" href="javascript:;" title="{{if .likeflag}}取消推荐{{else}}推荐{{end}}" data-objid="{{.book.Id}}" data-objtype="1" data-flag="{{.likeflag}}">{{if .likeflag}}取消推荐{{else}}推荐{{end}}</a>
31+
<a class="share-btn like-btn {{if .likeflag}}hadlike{{end}}" href="javascript:;" title="{{if .likeflag}}取消推荐{{else}}推荐{{end}}" data-objid="{{.book.Id}}" data-objtype="5" data-flag="{{.likeflag}}">{{if .likeflag}}取消推荐{{else}}推荐{{end}}</a>
3232
<strong>{{.book.Likenum}}</strong>
3333
</div>
3434
</div>

template/books/list.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ <h4><a href="/book/{{.Id}}" target="_blank" title="{{.Name}}">{{.Name}}</a></h4>
3535
</div>
3636
<div class="col-md-2 col-sm-2 book-cover-box">
3737
<a href="/book/{{.Id}}" target="_blank" title="{{.Name}}">
38-
<img class="lazy" src="{{.Cover}}" alt="{{.Name}}" style="display: inline;">
38+
<img class="lazy" src="{{if .Cover}}{{.Cover}}{{else}}http://studygolang.qiniudn.com/img/nocover.png{{end}}" alt="{{.Name}}" style="display: inline;">
3939
</a>
4040
</div>
4141
</div>

0 commit comments

Comments
 (0)