Skip to content

Commit

Permalink
话题列表,亮爷忽略了我的本意,我改回来了
Browse files Browse the repository at this point in the history
  • Loading branch information
ade951 committed Feb 14, 2014
1 parent 8727a3c commit 2dcffc3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions models/issue.js
Expand Up @@ -86,7 +86,9 @@ Issues = Issue.Set = syBookshelf.Collection.extend({
}
}, {
finder: function (qb, query) {
['id', 'userid', 'title', 'groupid'].forEach(function (k) {
var k = 'groupid';
query[k] ? qb.where(k, query[k]) : qb.whereNull(k);//如果groupid没有传值,就要给他取null

This comment has been minimized.

Copy link
@fritx

fritx Feb 15, 2014

Contributor

是这样的 我认为这里不应该如此

  1. 特别处理 - 麻烦
  2. 封住了获取所有话题的后路 因为groupid不传就转成null - 接口残缺
  3. 传groupid=0可以轻松解决你的本意
    你认为呢?

This comment has been minimized.

Copy link
@fritx

fritx Feb 15, 2014

Contributor

... 不过得把规则给改了 groupid=0 为没有范围的话题

This comment has been minimized.

Copy link
@fritx

fritx Feb 15, 2014

Contributor

不好意思 仔细想想 我说的道理不充分
就你那样吧 对这次的麻烦表示抱歉 :)

['id', 'userid', 'title'].forEach(function (k) {
if (k in query) {
qb.where(k, query[k]);
}
Expand All @@ -95,7 +97,9 @@ Issues = Issue.Set = syBookshelf.Collection.extend({

searcher: function (qb, query) {
var count = 0;
['userid', 'groupid'].forEach(function (k) {
var k = 'groupid';
query[k] ? qb.where(k, query[k]) : qb.whereNull(k);//如果groupid没有传值,就要给他取null
['userid'].forEach(function (k) {
if (k in query) {
count++;
qb.where(k, query[k]);
Expand Down

1 comment on commit 2dcffc3

@Jayin
Copy link
Contributor

@Jayin Jayin commented on 2dcffc3 Feb 14, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Fritz-Lium 鞭打亮爷 哈哈!

Please sign in to comment.