{"action":"created","comment":{"url":"https://api.github.com/repos/YMFE/yicon/pulls/comments/70768944","id":70768944,"diff_hunk":"@@ -47,6 +47,89 @@ export function* getOneProject(next) {\n   yield next;\n }\n \n+export function* addProjectIcon(next) {\n+  const { projectId, icons } = this.param;\n+  const data = icons.map(\n+    (value) => ({ version: '0.0.0', iconId: value, projectId })\n+  );\n+  const result = yield ProjectVersion.bulkCreate(data, { ignoreDuplicates: true });\n+  if (result) {\n+    this.state.respond = '添加项目图标成功';\n+  } else {\n+    this.state.respond = '添加项目图标失败';\n+  }\n+  yield next;\n+}\n+\n+export function* deleteProjectIcon(next) {\n+  const { projectId, icons } = this.param;\n+  let result = 0;\n+  for (let i = 0, len = icons.length; i < len; i++) {\n+    result += yield ProjectVersion.destroy({\n+      where: { version: '0.0.0', iconId: icons[i], projectId },\n+    });\n+  }\n+  if (result) {\n+    this.state.respond = '删除项目图标成功';\n+  } else {\n+    this.state.respond = '删除项目图标失败';\n+  }\n+  yield next;\n+}\n+\n+export function* updateProjectInfo(next) {\n+  if (this.state.user.isOwner) {\n+    const { projectId, info, name, owner, publicProject } = this.param;\n+    const data = { info, name, owner, public: publicProject };\n+    let projectResult = null;\n+    const key = Object.keys(data);\n+    key.forEach((v) => {\n+      if (data[v] === undefined) delete data[v];\n+    });\n+    if (Object.keys(data).length) {\n+      projectResult = yield Project.update(data, { where: { id: projectId } });\n+    }\n+    if (projectResult) {\n+      this.state.respond = '项目信息更新成功';\n+    } else {\n+      this.state.respond = '项目信息更新失败';\n+    }\n+  }\n+  yield next;\n+}\n+\n+export function* updateProjectMember(next) {\n+  const { projectId, members } = this.param;\n+  let deleteMember = null;\n+  let result = null;\n+  let flag = true; // 标志位，当是owner且删除数据成功时flag才会重置为true\n+\n+  if (projectId && members.length) {\n+    if (this.state.user.isOwner && members.indexOf(this.state.user.ownerId) > -1) {\n+      flag = false;\n+      let oldMember = yield UserProject.findAll({ where: { projectId }, raw: true });\n+      oldMember = oldMember.map((v) => v.userId);\n+      deleteMember = oldMember.filter((value) => members.indexOf(value) === -1);\n+      const deleteCount = yield UserProject.destroy({ where: { projectId } });","path":"src/controller/modules/project.js","position":73,"original_position":73,"commit_id":"c2af0337912eb87004bbb7f73dd242c40f1a0164","original_commit_id":"c2af0337912eb87004bbb7f73dd242c40f1a0164","user":{"login":"malcolmyu","id":3203962,"avatar_url":"https://avatars.githubusercontent.com/u/3203962?v=3","gravatar_id":"","url":"https://api.github.com/users/malcolmyu","html_url":"https://github.com/malcolmyu","followers_url":"https://api.github.com/users/malcolmyu/followers","following_url":"https://api.github.com/users/malcolmyu/following{/other_user}","gists_url":"https://api.github.com/users/malcolmyu/gists{/gist_id}","starred_url":"https://api.github.com/users/malcolmyu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/malcolmyu/subscriptions","organizations_url":"https://api.github.com/users/malcolmyu/orgs","repos_url":"https://api.github.com/users/malcolmyu/repos","events_url":"https://api.github.com/users/malcolmyu/events{/privacy}","received_events_url":"https://api.github.com/users/malcolmyu/received_events","type":"User","site_admin":false},"body":"？？这不是全 destory 了么","created_at":"2016-07-14T08:38:38Z","updated_at":"2016-07-14T08:38:38Z","html_url":"https://github.com/YMFE/yicon/pull/19#discussion_r70768944","pull_request_url":"https://api.github.com/repos/YMFE/yicon/pulls/19","_links":{"self":{"href":"https://api.github.com/repos/YMFE/yicon/pulls/comments/70768944"},"html":{"href":"https://github.com/YMFE/yicon/pull/19#discussion_r70768944"},"pull_request":{"href":"https://api.github.com/repos/YMFE/yicon/pulls/19"}}},"pull_request":{"url":"https://api.github.com/repos/YMFE/yicon/pulls/19","id":77407136,"html_url":"https://github.com/YMFE/yicon/pull/19","diff_url":"https://github.com/YMFE/yicon/pull/19.diff","patch_url":"https://github.com/YMFE/yicon/pull/19.patch","issue_url":"https://api.github.com/repos/YMFE/yicon/issues/19","number":19,"state":"open","locked":false,"title":"项目接口","user":{"login":"JasonFang93","id":13890076,"avatar_url":"https://avatars.githubusercontent.com/u/13890076?v=3","gravatar_id":"","url":"https://api.github.com/users/JasonFang93","html_url":"https://github.com/JasonFang93","followers_url":"https://api.github.com/users/JasonFang93/followers","following_url":"https://api.github.com/users/JasonFang93/following{/other_user}","gists_url":"https://api.github.com/users/JasonFang93/gists{/gist_id}","starred_url":"https://api.github.com/users/JasonFang93/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JasonFang93/subscriptions","organizations_url":"https://api.github.com/users/JasonFang93/orgs","repos_url":"https://api.github.com/users/JasonFang93/repos","events_url":"https://api.github.com/users/JasonFang93/events{/privacy}","received_events_url":"https://api.github.com/users/JasonFang93/received_events","type":"User","site_admin":false},"body":"添加项目图标（addProjectIcon）\r\n删除项目图标（deleteProjectIcon）\r\n更新项目信息（updateProjectInfo）\r\n更新项目成员（updateProjectMember）\r\n判断是否为项目owner中间件（isProjectOwner）","created_at":"2016-07-14T06:44:44Z","updated_at":"2016-07-14T08:38:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7f7790e8fbf3f46d0788bb404897e0561727d492","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/YMFE/yicon/pulls/19/commits","review_comments_url":"https://api.github.com/repos/YMFE/yicon/pulls/19/comments","review_comment_url":"https://api.github.com/repos/YMFE/yicon/pulls/comments{/number}","comments_url":"https://api.github.com/repos/YMFE/yicon/issues/19/comments","statuses_url":"https://api.github.com/repos/YMFE/yicon/statuses/c2af0337912eb87004bbb7f73dd242c40f1a0164","head":{"label":"YMFE:project-operation","ref":"project-operation","sha":"c2af0337912eb87004bbb7f73dd242c40f1a0164","user":{"login":"YMFE","id":19645609,"avatar_url":"https://avatars.githubusercontent.com/u/19645609?v=3","gravatar_id":"","url":"https://api.github.com/users/YMFE","html_url":"https://github.com/YMFE","followers_url":"https://api.github.com/users/YMFE/followers","following_url":"https://api.github.com/users/YMFE/following{/other_user}","gists_url":"https://api.github.com/users/YMFE/gists{/gist_id}","starred_url":"https://api.github.com/users/YMFE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/YMFE/subscriptions","organizations_url":"https://api.github.com/users/YMFE/orgs","repos_url":"https://api.github.com/users/YMFE/repos","events_url":"https://api.github.com/users/YMFE/events{/privacy}","received_events_url":"https://api.github.com/users/YMFE/received_events","type":"Organization","site_admin":false},"repo":{"id":59996356,"name":"yicon","full_name":"YMFE/yicon","owner":{"login":"YMFE","id":19645609,"avatar_url":"https://avatars.githubusercontent.com/u/19645609?v=3","gravatar_id":"","url":"https://api.github.com/users/YMFE","html_url":"https://github.com/YMFE","followers_url":"https://api.github.com/users/YMFE/followers","following_url":"https://api.github.com/users/YMFE/following{/other_user}","gists_url":"https://api.github.com/users/YMFE/gists{/gist_id}","starred_url":"https://api.github.com/users/YMFE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/YMFE/subscriptions","organizations_url":"https://api.github.com/users/YMFE/orgs","repos_url":"https://api.github.com/users/YMFE/repos","events_url":"https://api.github.com/users/YMFE/events{/privacy}","received_events_url":"https://api.github.com/users/YMFE/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/YMFE/yicon","description":"前端字体制作生成平台","fork":false,"url":"https://api.github.com/repos/YMFE/yicon","forks_url":"https://api.github.com/repos/YMFE/yicon/forks","keys_url":"https://api.github.com/repos/YMFE/yicon/keys{/key_id}","collaborators_url":"https://api.github.com/repos/YMFE/yicon/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/YMFE/yicon/teams","hooks_url":"https://api.github.com/repos/YMFE/yicon/hooks","issue_events_url":"https://api.github.com/repos/YMFE/yicon/issues/events{/number}","events_url":"https://api.github.com/repos/YMFE/yicon/events","assignees_url":"https://api.github.com/repos/YMFE/yicon/assignees{/user}","branches_url":"https://api.github.com/repos/YMFE/yicon/branches{/branch}","tags_url":"https://api.github.com/repos/YMFE/yicon/tags","blobs_url":"https://api.github.com/repos/YMFE/yicon/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/YMFE/yicon/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/YMFE/yicon/git/refs{/sha}","trees_url":"https://api.github.com/repos/YMFE/yicon/git/trees{/sha}","statuses_url":"https://api.github.com/repos/YMFE/yicon/statuses/{sha}","languages_url":"https://api.github.com/repos/YMFE/yicon/languages","stargazers_url":"https://api.github.com/repos/YMFE/yicon/stargazers","contributors_url":"https://api.github.com/repos/YMFE/yicon/contributors","subscribers_url":"https://api.github.com/repos/YMFE/yicon/subscribers","subscription_url":"https://api.github.com/repos/YMFE/yicon/subscription","commits_url":"https://api.github.com/repos/YMFE/yicon/commits{/sha}","git_commits_url":"https://api.github.com/repos/YMFE/yicon/git/commits{/sha}","comments_url":"https://api.github.com/repos/YMFE/yicon/comments{/number}","issue_comment_url":"https://api.github.com/repos/YMFE/yicon/issues/comments{/number}","contents_url":"https://api.github.com/repos/YMFE/yicon/contents/{+path}","compare_url":"https://api.github.com/repos/YMFE/yicon/compare/{base}...{head}","merges_url":"https://api.github.com/repos/YMFE/yicon/merges","archive_url":"https://api.github.com/repos/YMFE/yicon/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/YMFE/yicon/downloads","issues_url":"https://api.github.com/repos/YMFE/yicon/issues{/number}","pulls_url":"https://api.github.com/repos/YMFE/yicon/pulls{/number}","milestones_url":"https://api.github.com/repos/YMFE/yicon/milestones{/number}","notifications_url":"https://api.github.com/repos/YMFE/yicon/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/YMFE/yicon/labels{/name}","releases_url":"https://api.github.com/repos/YMFE/yicon/releases{/id}","deployments_url":"https://api.github.com/repos/YMFE/yicon/deployments","created_at":"2016-05-30T09:08:16Z","updated_at":"2016-07-12T07:24:30Z","pushed_at":"2016-07-14T07:45:04Z","git_url":"git://github.com/YMFE/yicon.git","ssh_url":"git@github.com:YMFE/yicon.git","clone_url":"https://github.com/YMFE/yicon.git","svn_url":"https://github.com/YMFE/yicon","homepage":null,"size":234,"stargazers_count":8,"watchers_count":8,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":12,"forks":2,"open_issues":12,"watchers":8,"default_branch":"master"}},"base":{"label":"YMFE:master","ref":"master","sha":"4b97eccd2b6600f2b86576179ce3a2de00e64eca","user":{"login":"YMFE","id":19645609,"avatar_url":"https://avatars.githubusercontent.com/u/19645609?v=3","gravatar_id":"","url":"https://api.github.com/users/YMFE","html_url":"https://github.com/YMFE","followers_url":"https://api.github.com/users/YMFE/followers","following_url":"https://api.github.com/users/YMFE/following{/other_user}","gists_url":"https://api.github.com/users/YMFE/gists{/gist_id}","starred_url":"https://api.github.com/users/YMFE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/YMFE/subscriptions","organizations_url":"https://api.github.com/users/YMFE/orgs","repos_url":"https://api.github.com/users/YMFE/repos","events_url":"https://api.github.com/users/YMFE/events{/privacy}","received_events_url":"https://api.github.com/users/YMFE/received_events","type":"Organization","site_admin":false},"repo":{"id":59996356,"name":"yicon","full_name":"YMFE/yicon","owner":{"login":"YMFE","id":19645609,"avatar_url":"https://avatars.githubusercontent.com/u/19645609?v=3","gravatar_id":"","url":"https://api.github.com/users/YMFE","html_url":"https://github.com/YMFE","followers_url":"https://api.github.com/users/YMFE/followers","following_url":"https://api.github.com/users/YMFE/following{/other_user}","gists_url":"https://api.github.com/users/YMFE/gists{/gist_id}","starred_url":"https://api.github.com/users/YMFE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/YMFE/subscriptions","organizations_url":"https://api.github.com/users/YMFE/orgs","repos_url":"https://api.github.com/users/YMFE/repos","events_url":"https://api.github.com/users/YMFE/events{/privacy}","received_events_url":"https://api.github.com/users/YMFE/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/YMFE/yicon","description":"前端字体制作生成平台","fork":false,"url":"https://api.github.com/repos/YMFE/yicon","forks_url":"https://api.github.com/repos/YMFE/yicon/forks","keys_url":"https://api.github.com/repos/YMFE/yicon/keys{/key_id}","collaborators_url":"https://api.github.com/repos/YMFE/yicon/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/YMFE/yicon/teams","hooks_url":"https://api.github.com/repos/YMFE/yicon/hooks","issue_events_url":"https://api.github.com/repos/YMFE/yicon/issues/events{/number}","events_url":"https://api.github.com/repos/YMFE/yicon/events","assignees_url":"https://api.github.com/repos/YMFE/yicon/assignees{/user}","branches_url":"https://api.github.com/repos/YMFE/yicon/branches{/branch}","tags_url":"https://api.github.com/repos/YMFE/yicon/tags","blobs_url":"https://api.github.com/repos/YMFE/yicon/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/YMFE/yicon/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/YMFE/yicon/git/refs{/sha}","trees_url":"https://api.github.com/repos/YMFE/yicon/git/trees{/sha}","statuses_url":"https://api.github.com/repos/YMFE/yicon/statuses/{sha}","languages_url":"https://api.github.com/repos/YMFE/yicon/languages","stargazers_url":"https://api.github.com/repos/YMFE/yicon/stargazers","contributors_url":"https://api.github.com/repos/YMFE/yicon/contributors","subscribers_url":"https://api.github.com/repos/YMFE/yicon/subscribers","subscription_url":"https://api.github.com/repos/YMFE/yicon/subscription","commits_url":"https://api.github.com/repos/YMFE/yicon/commits{/sha}","git_commits_url":"https://api.github.com/repos/YMFE/yicon/git/commits{/sha}","comments_url":"https://api.github.com/repos/YMFE/yicon/comments{/number}","issue_comment_url":"https://api.github.com/repos/YMFE/yicon/issues/comments{/number}","contents_url":"https://api.github.com/repos/YMFE/yicon/contents/{+path}","compare_url":"https://api.github.com/repos/YMFE/yicon/compare/{base}...{head}","merges_url":"https://api.github.com/repos/YMFE/yicon/merges","archive_url":"https://api.github.com/repos/YMFE/yicon/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/YMFE/yicon/downloads","issues_url":"https://api.github.com/repos/YMFE/yicon/issues{/number}","pulls_url":"https://api.github.com/repos/YMFE/yicon/pulls{/number}","milestones_url":"https://api.github.com/repos/YMFE/yicon/milestones{/number}","notifications_url":"https://api.github.com/repos/YMFE/yicon/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/YMFE/yicon/labels{/name}","releases_url":"https://api.github.com/repos/YMFE/yicon/releases{/id}","deployments_url":"https://api.github.com/repos/YMFE/yicon/deployments","created_at":"2016-05-30T09:08:16Z","updated_at":"2016-07-12T07:24:30Z","pushed_at":"2016-07-14T07:45:04Z","git_url":"git://github.com/YMFE/yicon.git","ssh_url":"git@github.com:YMFE/yicon.git","clone_url":"https://github.com/YMFE/yicon.git","svn_url":"https://github.com/YMFE/yicon","homepage":null,"size":234,"stargazers_count":8,"watchers_count":8,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":12,"forks":2,"open_issues":12,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/YMFE/yicon/pulls/19"},"html":{"href":"https://github.com/YMFE/yicon/pull/19"},"issue":{"href":"https://api.github.com/repos/YMFE/yicon/issues/19"},"comments":{"href":"https://api.github.com/repos/YMFE/yicon/issues/19/comments"},"review_comments":{"href":"https://api.github.com/repos/YMFE/yicon/pulls/19/comments"},"review_comment":{"href":"https://api.github.com/repos/YMFE/yicon/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/YMFE/yicon/pulls/19/commits"},"statuses":{"href":"https://api.github.com/repos/YMFE/yicon/statuses/c2af0337912eb87004bbb7f73dd242c40f1a0164"}}}}
{"actor":{"display_login":"malcolmyu"}}