{"action":"created","comment":{"url":"https://api.github.com/repos/miiixr/picklete/pulls/comments/42764892","id":42764892,"diff_hunk":"@@ -111,7 +111,18 @@ let ShopController = {\n         where: {id: productGm.BrandId}\n       });\n       productGm.pageView++;\n+\n+      let pageView;\n+      if(productGm.PageViewId){\n+        pageView = await db.PageView.findById(productGm.PageViewId);\n+        pageView.pageView ++;\n+        await pageView.save();\n+      }else{\n+        pageView = await db.PageView.create();\n+      }","path":"api/controllers/ShopController.js","position":12,"original_position":12,"commit_id":"4e65d8141f7fcbb77eb248aa29f6e596ae41b3ff","original_commit_id":"4e65d8141f7fcbb77eb248aa29f6e596ae41b3ff","user":{"login":"smlsunxie","id":1689227,"avatar_url":"https://avatars.githubusercontent.com/u/1689227?v=3","gravatar_id":"","url":"https://api.github.com/users/smlsunxie","html_url":"https://github.com/smlsunxie","followers_url":"https://api.github.com/users/smlsunxie/followers","following_url":"https://api.github.com/users/smlsunxie/following{/other_user}","gists_url":"https://api.github.com/users/smlsunxie/gists{/gist_id}","starred_url":"https://api.github.com/users/smlsunxie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smlsunxie/subscriptions","organizations_url":"https://api.github.com/users/smlsunxie/orgs","repos_url":"https://api.github.com/users/smlsunxie/repos","events_url":"https://api.github.com/users/smlsunxie/events{/privacy}","received_events_url":"https://api.github.com/users/smlsunxie/received_events","type":"User","site_admin":false},"body":"這一段應該可以用 findOrCreate 處理","created_at":"2015-10-22T15:40:18Z","updated_at":"2015-10-22T15:40:18Z","html_url":"https://github.com/miiixr/picklete/pull/273#discussion_r42764892","pull_request_url":"https://api.github.com/repos/miiixr/picklete/pulls/273","_links":{"self":{"href":"https://api.github.com/repos/miiixr/picklete/pulls/comments/42764892"},"html":{"href":"https://github.com/miiixr/picklete/pull/273#discussion_r42764892"},"pull_request":{"href":"https://api.github.com/repos/miiixr/picklete/pulls/273"}}},"pull_request":{"url":"https://api.github.com/repos/miiixr/picklete/pulls/273","id":48454997,"html_url":"https://github.com/miiixr/picklete/pull/273","diff_url":"https://github.com/miiixr/picklete/pull/273.diff","patch_url":"https://github.com/miiixr/picklete/pull/273.patch","issue_url":"https://api.github.com/repos/miiixr/picklete/issues/273","number":273,"state":"open","locked":false,"title":"add Top filter","user":{"login":"FuYaoDe","id":6357215,"avatar_url":"https://avatars.githubusercontent.com/u/6357215?v=3","gravatar_id":"","url":"https://api.github.com/users/FuYaoDe","html_url":"https://github.com/FuYaoDe","followers_url":"https://api.github.com/users/FuYaoDe/followers","following_url":"https://api.github.com/users/FuYaoDe/following{/other_user}","gists_url":"https://api.github.com/users/FuYaoDe/gists{/gist_id}","starred_url":"https://api.github.com/users/FuYaoDe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FuYaoDe/subscriptions","organizations_url":"https://api.github.com/users/FuYaoDe/orgs","repos_url":"https://api.github.com/users/FuYaoDe/repos","events_url":"https://api.github.com/users/FuYaoDe/events{/privacy}","received_events_url":"https://api.github.com/users/FuYaoDe/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-10-22T13:09:47Z","updated_at":"2015-10-22T15:40:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3751420178a9cf6a3b5b718d68ee8641dc81655a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/miiixr/picklete/pulls/273/commits","review_comments_url":"https://api.github.com/repos/miiixr/picklete/pulls/273/comments","review_comment_url":"https://api.github.com/repos/miiixr/picklete/pulls/comments{/number}","comments_url":"https://api.github.com/repos/miiixr/picklete/issues/273/comments","statuses_url":"https://api.github.com/repos/miiixr/picklete/statuses/4e65d8141f7fcbb77eb248aa29f6e596ae41b3ff","head":{"label":"FuYaoDe:master","ref":"master","sha":"4e65d8141f7fcbb77eb248aa29f6e596ae41b3ff","user":{"login":"FuYaoDe","id":6357215,"avatar_url":"https://avatars.githubusercontent.com/u/6357215?v=3","gravatar_id":"","url":"https://api.github.com/users/FuYaoDe","html_url":"https://github.com/FuYaoDe","followers_url":"https://api.github.com/users/FuYaoDe/followers","following_url":"https://api.github.com/users/FuYaoDe/following{/other_user}","gists_url":"https://api.github.com/users/FuYaoDe/gists{/gist_id}","starred_url":"https://api.github.com/users/FuYaoDe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FuYaoDe/subscriptions","organizations_url":"https://api.github.com/users/FuYaoDe/orgs","repos_url":"https://api.github.com/users/FuYaoDe/repos","events_url":"https://api.github.com/users/FuYaoDe/events{/privacy}","received_events_url":"https://api.github.com/users/FuYaoDe/received_events","type":"User","site_admin":false},"repo":{"id":40280782,"name":"picklete","full_name":"FuYaoDe/picklete","owner":{"login":"FuYaoDe","id":6357215,"avatar_url":"https://avatars.githubusercontent.com/u/6357215?v=3","gravatar_id":"","url":"https://api.github.com/users/FuYaoDe","html_url":"https://github.com/FuYaoDe","followers_url":"https://api.github.com/users/FuYaoDe/followers","following_url":"https://api.github.com/users/FuYaoDe/following{/other_user}","gists_url":"https://api.github.com/users/FuYaoDe/gists{/gist_id}","starred_url":"https://api.github.com/users/FuYaoDe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FuYaoDe/subscriptions","organizations_url":"https://api.github.com/users/FuYaoDe/orgs","repos_url":"https://api.github.com/users/FuYaoDe/repos","events_url":"https://api.github.com/users/FuYaoDe/events{/privacy}","received_events_url":"https://api.github.com/users/FuYaoDe/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/FuYaoDe/picklete","description":"","fork":true,"url":"https://api.github.com/repos/FuYaoDe/picklete","forks_url":"https://api.github.com/repos/FuYaoDe/picklete/forks","keys_url":"https://api.github.com/repos/FuYaoDe/picklete/keys{/key_id}","collaborators_url":"https://api.github.com/repos/FuYaoDe/picklete/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/FuYaoDe/picklete/teams","hooks_url":"https://api.github.com/repos/FuYaoDe/picklete/hooks","issue_events_url":"https://api.github.com/repos/FuYaoDe/picklete/issues/events{/number}","events_url":"https://api.github.com/repos/FuYaoDe/picklete/events","assignees_url":"https://api.github.com/repos/FuYaoDe/picklete/assignees{/user}","branches_url":"https://api.github.com/repos/FuYaoDe/picklete/branches{/branch}","tags_url":"https://api.github.com/repos/FuYaoDe/picklete/tags","blobs_url":"https://api.github.com/repos/FuYaoDe/picklete/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/FuYaoDe/picklete/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/FuYaoDe/picklete/git/refs{/sha}","trees_url":"https://api.github.com/repos/FuYaoDe/picklete/git/trees{/sha}","statuses_url":"https://api.github.com/repos/FuYaoDe/picklete/statuses/{sha}","languages_url":"https://api.github.com/repos/FuYaoDe/picklete/languages","stargazers_url":"https://api.github.com/repos/FuYaoDe/picklete/stargazers","contributors_url":"https://api.github.com/repos/FuYaoDe/picklete/contributors","subscribers_url":"https://api.github.com/repos/FuYaoDe/picklete/subscribers","subscription_url":"https://api.github.com/repos/FuYaoDe/picklete/subscription","commits_url":"https://api.github.com/repos/FuYaoDe/picklete/commits{/sha}","git_commits_url":"https://api.github.com/repos/FuYaoDe/picklete/git/commits{/sha}","comments_url":"https://api.github.com/repos/FuYaoDe/picklete/comments{/number}","issue_comment_url":"https://api.github.com/repos/FuYaoDe/picklete/issues/comments{/number}","contents_url":"https://api.github.com/repos/FuYaoDe/picklete/contents/{+path}","compare_url":"https://api.github.com/repos/FuYaoDe/picklete/compare/{base}...{head}","merges_url":"https://api.github.com/repos/FuYaoDe/picklete/merges","archive_url":"https://api.github.com/repos/FuYaoDe/picklete/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/FuYaoDe/picklete/downloads","issues_url":"https://api.github.com/repos/FuYaoDe/picklete/issues{/number}","pulls_url":"https://api.github.com/repos/FuYaoDe/picklete/pulls{/number}","milestones_url":"https://api.github.com/repos/FuYaoDe/picklete/milestones{/number}","notifications_url":"https://api.github.com/repos/FuYaoDe/picklete/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/FuYaoDe/picklete/labels{/name}","releases_url":"https://api.github.com/repos/FuYaoDe/picklete/releases{/id}","created_at":"2015-08-06T02:50:41Z","updated_at":"2015-09-07T02:25:33Z","pushed_at":"2015-10-22T14:00:07Z","git_url":"git://github.com/FuYaoDe/picklete.git","ssh_url":"git@github.com:FuYaoDe/picklete.git","clone_url":"https://github.com/FuYaoDe/picklete.git","svn_url":"https://github.com/FuYaoDe/picklete","homepage":null,"size":5148,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"miiixr:develop","ref":"develop","sha":"205880b1168cd6a8f64063d93d58efee778b68df","user":{"login":"miiixr","id":13635773,"avatar_url":"https://avatars.githubusercontent.com/u/13635773?v=3","gravatar_id":"","url":"https://api.github.com/users/miiixr","html_url":"https://github.com/miiixr","followers_url":"https://api.github.com/users/miiixr/followers","following_url":"https://api.github.com/users/miiixr/following{/other_user}","gists_url":"https://api.github.com/users/miiixr/gists{/gist_id}","starred_url":"https://api.github.com/users/miiixr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miiixr/subscriptions","organizations_url":"https://api.github.com/users/miiixr/orgs","repos_url":"https://api.github.com/users/miiixr/repos","events_url":"https://api.github.com/users/miiixr/events{/privacy}","received_events_url":"https://api.github.com/users/miiixr/received_events","type":"Organization","site_admin":false},"repo":{"id":40162704,"name":"picklete","full_name":"miiixr/picklete","owner":{"login":"miiixr","id":13635773,"avatar_url":"https://avatars.githubusercontent.com/u/13635773?v=3","gravatar_id":"","url":"https://api.github.com/users/miiixr","html_url":"https://github.com/miiixr","followers_url":"https://api.github.com/users/miiixr/followers","following_url":"https://api.github.com/users/miiixr/following{/other_user}","gists_url":"https://api.github.com/users/miiixr/gists{/gist_id}","starred_url":"https://api.github.com/users/miiixr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miiixr/subscriptions","organizations_url":"https://api.github.com/users/miiixr/orgs","repos_url":"https://api.github.com/users/miiixr/repos","events_url":"https://api.github.com/users/miiixr/events{/privacy}","received_events_url":"https://api.github.com/users/miiixr/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/miiixr/picklete","description":"","fork":false,"url":"https://api.github.com/repos/miiixr/picklete","forks_url":"https://api.github.com/repos/miiixr/picklete/forks","keys_url":"https://api.github.com/repos/miiixr/picklete/keys{/key_id}","collaborators_url":"https://api.github.com/repos/miiixr/picklete/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/miiixr/picklete/teams","hooks_url":"https://api.github.com/repos/miiixr/picklete/hooks","issue_events_url":"https://api.github.com/repos/miiixr/picklete/issues/events{/number}","events_url":"https://api.github.com/repos/miiixr/picklete/events","assignees_url":"https://api.github.com/repos/miiixr/picklete/assignees{/user}","branches_url":"https://api.github.com/repos/miiixr/picklete/branches{/branch}","tags_url":"https://api.github.com/repos/miiixr/picklete/tags","blobs_url":"https://api.github.com/repos/miiixr/picklete/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/miiixr/picklete/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/miiixr/picklete/git/refs{/sha}","trees_url":"https://api.github.com/repos/miiixr/picklete/git/trees{/sha}","statuses_url":"https://api.github.com/repos/miiixr/picklete/statuses/{sha}","languages_url":"https://api.github.com/repos/miiixr/picklete/languages","stargazers_url":"https://api.github.com/repos/miiixr/picklete/stargazers","contributors_url":"https://api.github.com/repos/miiixr/picklete/contributors","subscribers_url":"https://api.github.com/repos/miiixr/picklete/subscribers","subscription_url":"https://api.github.com/repos/miiixr/picklete/subscription","commits_url":"https://api.github.com/repos/miiixr/picklete/commits{/sha}","git_commits_url":"https://api.github.com/repos/miiixr/picklete/git/commits{/sha}","comments_url":"https://api.github.com/repos/miiixr/picklete/comments{/number}","issue_comment_url":"https://api.github.com/repos/miiixr/picklete/issues/comments{/number}","contents_url":"https://api.github.com/repos/miiixr/picklete/contents/{+path}","compare_url":"https://api.github.com/repos/miiixr/picklete/compare/{base}...{head}","merges_url":"https://api.github.com/repos/miiixr/picklete/merges","archive_url":"https://api.github.com/repos/miiixr/picklete/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/miiixr/picklete/downloads","issues_url":"https://api.github.com/repos/miiixr/picklete/issues{/number}","pulls_url":"https://api.github.com/repos/miiixr/picklete/pulls{/number}","milestones_url":"https://api.github.com/repos/miiixr/picklete/milestones{/number}","notifications_url":"https://api.github.com/repos/miiixr/picklete/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/miiixr/picklete/labels{/name}","releases_url":"https://api.github.com/repos/miiixr/picklete/releases{/id}","created_at":"2015-08-04T04:07:03Z","updated_at":"2015-10-20T02:11:45Z","pushed_at":"2015-10-22T14:00:07Z","git_url":"git://github.com/miiixr/picklete.git","ssh_url":"git@github.com:miiixr/picklete.git","clone_url":"https://github.com/miiixr/picklete.git","svn_url":"https://github.com/miiixr/picklete","homepage":null,"size":7372,"stargazers_count":4,"watchers_count":4,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":3,"forks":13,"open_issues":3,"watchers":4,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/miiixr/picklete/pulls/273"},"html":{"href":"https://github.com/miiixr/picklete/pull/273"},"issue":{"href":"https://api.github.com/repos/miiixr/picklete/issues/273"},"comments":{"href":"https://api.github.com/repos/miiixr/picklete/issues/273/comments"},"review_comments":{"href":"https://api.github.com/repos/miiixr/picklete/pulls/273/comments"},"review_comment":{"href":"https://api.github.com/repos/miiixr/picklete/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/miiixr/picklete/pulls/273/commits"},"statuses":{"href":"https://api.github.com/repos/miiixr/picklete/statuses/4e65d8141f7fcbb77eb248aa29f6e596ae41b3ff"}}}}