docs: 文档更新

This commit is contained in:
wenbo.dong 2017-08-10 17:20:47 +08:00
parent e2fa9c1c4e
commit ad81bb3e1a
5 changed files with 628 additions and 227 deletions

View File

@ -228,6 +228,28 @@
</ul>
<!-- <li > -->
<li >
<a href="#follow">follow</a>
</li>
<ul class="nav docs-sidenav-extend" >
<li >
<a href="#-follow-list">/follow/list</a>
</li>
<li >
<a href="#-follow-list">/follow/list</a>
</li>
<li >
<a href="#-follow-list">/follow/list</a>
</li>
</ul>
<!-- <li > -->
<li >
@ -273,13 +295,13 @@
<!-- <li > -->
<li >
<a href="#node">node</a>
<a href="#log">log</a>
</li>
<ul class="nav docs-sidenav-extend" >
<li >
<a href="#-node-list">/node/list</a>
<a href="#-log-list">/log/list</a>
</li>
</ul>
@ -641,7 +663,7 @@
<p>
<small class="text-muted">源码位置:</small>
<a href="./static/server/controllers/user.js.html#17" target="_blank">./server/controllers/user.js:17</a>
<a href="./static/server/controllers/user.js.html#18" target="_blank">./server/controllers/user.js:18</a>
</p>
@ -728,7 +750,7 @@
<p>
<small class="text-muted">源码位置:</small>
<a href="./static/server/controllers/user.js.html#63" target="_blank">./server/controllers/user.js:63</a>
<a href="./static/server/controllers/user.js.html#64" target="_blank">./server/controllers/user.js:64</a>
</p>
@ -761,7 +783,7 @@
<p>
<small class="text-muted">源码位置:</small>
<a href="./static/server/controllers/user.js.html#160" target="_blank">./server/controllers/user.js:160</a>
<a href="./static/server/controllers/user.js.html#162" target="_blank">./server/controllers/user.js:162</a>
</p>
@ -857,7 +879,7 @@
<p>
<small class="text-muted">源码位置:</small>
<a href="./static/server/controllers/user.js.html#229" target="_blank">./server/controllers/user.js:229</a>
<a href="./static/server/controllers/user.js.html#227" target="_blank">./server/controllers/user.js:227</a>
</p>
@ -954,7 +976,7 @@
<p>
<small class="text-muted">源码位置:</small>
<a href="./static/server/controllers/user.js.html#301" target="_blank">./server/controllers/user.js:301</a>
<a href="./static/server/controllers/user.js.html#300" target="_blank">./server/controllers/user.js:300</a>
</p>
@ -1024,7 +1046,7 @@
<p>
<small class="text-muted">源码位置:</small>
<a href="./static/server/controllers/user.js.html#329" target="_blank">./server/controllers/user.js:329</a>
<a href="./static/server/controllers/user.js.html#328" target="_blank">./server/controllers/user.js:328</a>
</p>
@ -1086,7 +1108,7 @@
<p>
<small class="text-muted">源码位置:</small>
<a href="./static/server/controllers/user.js.html#367" target="_blank">./server/controllers/user.js:367</a>
<a href="./static/server/controllers/user.js.html#366" target="_blank">./server/controllers/user.js:366</a>
</p>
@ -1148,7 +1170,7 @@
<p>
<small class="text-muted">源码位置:</small>
<a href="./static/server/controllers/user.js.html#398" target="_blank">./server/controllers/user.js:398</a>
<a href="./static/server/controllers/user.js.html#397" target="_blank">./server/controllers/user.js:397</a>
</p>
@ -1240,7 +1262,7 @@
<p>
<small class="text-muted">源码位置:</small>
<a href="./static/server/controllers/user.js.html#457" target="_blank">./server/controllers/user.js:457</a>
<a href="./static/server/controllers/user.js.html#511" target="_blank">./server/controllers/user.js:511</a>
</p>
@ -1318,7 +1340,7 @@
<p>
<small class="text-muted">源码位置:</small>
<a href="./static/server/controllers/user.js.html#503" target="_blank">./server/controllers/user.js:503</a>
<a href="./static/server/controllers/user.js.html#556" target="_blank">./server/controllers/user.js:556</a>
</p>
@ -3227,6 +3249,260 @@
</div>
<h2 id="follow" class="page-header subject">follow<a class="hashlink" href="#follow">#</a></h2>
<div class="con-list-item">
<blockquote class="api">
<h3 id="-follow-list" class="page-header subject">
/follow/list
<span class="ui-badge">GET</span>
<a class="hashlink" href="#-follow-list">#</a>
</h3>
</blockquote>
<p>
<small class="text-muted">描述:</small>
获取关注项目列表
</p>
<p>
<small class="text-muted">源码位置:</small>
<a href="./static/server/controllers/follow.js.html#24" target="_blank">./server/controllers/follow.js:24</a>
</p>
<p>
<small class="text-muted">参数:</small>
</p>
<div class="docs-table">
<table class="yo-table yo-table-border">
<colgroup>
<col class="c1">
<col class="c2">
<col class="c3">
<col class="c4">
</colgroup>
<thead>
<tr class="active">
<th>参数名</th>
<th>类型</th>
<th>描述</th>
<th>必选</th>
<th>支持版本</th>
</tr>
</thead>
<tr>
<td>uid</td>
<td>Number</td>
<td>用户id 不能为空</td>
<td>
<i class="yo-ico glyphicon glyphicon-ok text-success"></i>
</td>
<td></td>
</tr>
<tr>
<td>page</td>
<td>Number</td>
<td>分页页码</td>
<td>
</td>
<td></td>
</tr>
<tr>
<td>limit</td>
<td>Number</td>
<td>分页大小</td>
<td>
</td>
<td></td>
</tr>
</table>
</div>
<div>示例:</div>
<pre class="ydoc-example" data-foldnumber=10><code class="js-code"><span class="token operator">/</span>follow<span class="token operator">/</span>list</code></pre>
</div>
<div class="con-list-item">
<blockquote class="api">
<h3 id="-follow-list" class="page-header subject">
/follow/list
<span class="ui-badge">POST</span>
<a class="hashlink" href="#-follow-list">#</a>
</h3>
</blockquote>
<p>
<small class="text-muted">描述:</small>
取消关注
</p>
<p>
<small class="text-muted">源码位置:</small>
<a href="./static/server/controllers/follow.js.html#60" target="_blank">./server/controllers/follow.js:60</a>
</p>
<p>
<small class="text-muted">参数:</small>
</p>
<div class="docs-table">
<table class="yo-table yo-table-border">
<colgroup>
<col class="c1">
<col class="c2">
<col class="c3">
<col class="c4">
</colgroup>
<thead>
<tr class="active">
<th>参数名</th>
<th>类型</th>
<th>描述</th>
<th>必选</th>
<th>支持版本</th>
</tr>
</thead>
<tr>
<td>id</td>
<td>Number</td>
<td>关注id</td>
<td>
<i class="yo-ico glyphicon glyphicon-ok text-success"></i>
</td>
<td></td>
</tr>
</table>
</div>
<div>示例:</div>
<pre class="ydoc-example" data-foldnumber=10><code class="js-code"><span class="token operator">/</span>follow<span class="token operator">/</span>del</code></pre>
</div>
<div class="con-list-item">
<blockquote class="api">
<h3 id="-follow-list" class="page-header subject">
/follow/list
<span class="ui-badge">POST</span>
<a class="hashlink" href="#-follow-list">#</a>
</h3>
</blockquote>
<p>
<small class="text-muted">描述:</small>
添加关注
</p>
<p>
<small class="text-muted">源码位置:</small>
<a href="./static/server/controllers/follow.js.html#86" target="_blank">./server/controllers/follow.js:86</a>
</p>
<p>
<small class="text-muted">参数:</small>
</p>
<div class="docs-table">
<table class="yo-table yo-table-border">
<colgroup>
<col class="c1">
<col class="c2">
<col class="c3">
<col class="c4">
</colgroup>
<thead>
<tr class="active">
<th>参数名</th>
<th>类型</th>
<th>描述</th>
<th>必选</th>
<th>支持版本</th>
</tr>
</thead>
<tr>
<td>uid</td>
<td>Number</td>
<td>用户id</td>
<td>
<i class="yo-ico glyphicon glyphicon-ok text-success"></i>
</td>
<td></td>
</tr>
<tr>
<td>projectid</td>
<td>Number</td>
<td>项目id</td>
<td>
<i class="yo-ico glyphicon glyphicon-ok text-success"></i>
</td>
<td></td>
</tr>
<tr>
<td>projectname</td>
<td>String</td>
<td>项目名</td>
<td>
<i class="yo-ico glyphicon glyphicon-ok text-success"></i>
</td>
<td></td>
</tr>
<tr>
<td>icon</td>
<td>String</td>
<td>项目icon</td>
<td>
<i class="yo-ico glyphicon glyphicon-ok text-success"></i>
</td>
<td></td>
</tr>
</table>
</div>
<div>示例:</div>
<pre class="ydoc-example" data-foldnumber=10><code class="js-code"><span class="token operator">/</span>follow<span class="token operator">/</span>add</code></pre>
</div>
<h2 id="col" class="page-header subject">col<a class="hashlink" href="#col">#</a></h2>
<div class="con-list-item">
@ -3892,22 +4168,22 @@
</div>
<h2 id="node" class="page-header subject">node<a class="hashlink" href="#node">#</a></h2>
<h2 id="log" class="page-header subject">log<a class="hashlink" href="#log">#</a></h2>
<div class="con-list-item">
<blockquote class="api">
<h3 id="-node-list" class="page-header subject">
/node/list
<h3 id="-log-list" class="page-header subject">
/log/list
<span class="ui-badge">GET</span>
<a class="hashlink" href="#-node-list">#</a>
<a class="hashlink" href="#-log-list">#</a>
</h3>
</blockquote>
<p>
<small class="text-muted">描述:</small>
获取节点列表
获取动态列表
</p>
<p>
@ -3974,169 +4250,7 @@
<div>示例:</div>
<pre class="ydoc-example" data-foldnumber=10><code class="js-code"><span class="token punctuation">{</span>
<span class="token string">"errcode"</span><span class="token punctuation">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
<span class="token string">"errmsg"</span><span class="token punctuation">:</span> <span class="token string">"success"</span><span class="token punctuation">,</span>
<span class="token string">"data"</span><span class="token punctuation">:</span> <span class="token punctuation">{</span>
<span class="token string">"total"</span><span class="token punctuation">:</span> <span class="token number">2</span><span class="token punctuation">,</span>
<span class="token string">"list"</span><span class="token punctuation">:</span> <span class="token punctuation">[</span>
<span class="token punctuation">{</span>
<span class="token string">"_id"</span><span class="token punctuation">:</span> <span class="token number">529</span><span class="token punctuation">,</span>
<span class="token string">"name"</span><span class="token punctuation">:</span> <span class="token string">"yapi"</span><span class="token punctuation">,</span>
<span class="token string">"desc"</span><span class="token punctuation">:</span> <span class="token string">"aaa"</span><span class="token punctuation">,</span>
<span class="token string">"prd_host"</span><span class="token punctuation">:</span> <span class="token string">"http://www.yapi.com"</span><span class="token punctuation">,</span>
<span class="token string">"basepath"</span><span class="token punctuation">:</span> <span class="token string">"/a/"</span><span class="token punctuation">,</span>
<span class="token string">"uid"</span><span class="token punctuation">:</span> <span class="token number">107</span><span class="token punctuation">,</span>
<span class="token string">"group_id"</span><span class="token punctuation">:</span> <span class="token number">181</span><span class="token punctuation">,</span>
<span class="token string">"add_time"</span><span class="token punctuation">:</span> <span class="token number">1500465369</span><span class="token punctuation">,</span>
<span class="token string">"up_time"</span><span class="token punctuation">:</span> <span class="token number">1500522419</span><span class="token punctuation">,</span>
<span class="token string">"__v"</span><span class="token punctuation">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
<span class="token string">"env"</span><span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
<span class="token string">"members"</span><span class="token punctuation">:</span> <span class="token punctuation">[</span>
<span class="token string">"107"</span>
<span class="token punctuation">]</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span>
<span class="token punctuation">{</span>
<span class="token string">"_id"</span><span class="token punctuation">:</span> <span class="token number">558</span><span class="token punctuation">,</span>
<span class="token string">"name"</span><span class="token punctuation">:</span> <span class="token string">"12"</span><span class="token punctuation">,</span>
<span class="token string">"desc"</span><span class="token punctuation">:</span> <span class="token string">"21\n"</span><span class="token punctuation">,</span>
<span class="token string">"prd_host"</span><span class="token punctuation">:</span> <span class="token string">"http://11/"</span><span class="token punctuation">,</span>
<span class="token string">"basepath"</span><span class="token punctuation">:</span> <span class="token string">"12/"</span><span class="token punctuation">,</span>
<span class="token string">"uid"</span><span class="token punctuation">:</span> <span class="token number">107</span><span class="token punctuation">,</span>
<span class="token string">"group_id"</span><span class="token punctuation">:</span> <span class="token number">181</span><span class="token punctuation">,</span>
<span class="token string">"add_time"</span><span class="token punctuation">:</span> <span class="token number">1500466250</span><span class="token punctuation">,</span>
<span class="token string">"up_time"</span><span class="token punctuation">:</span> <span class="token number">1500466250</span><span class="token punctuation">,</span>
<span class="token string">"__v"</span><span class="token punctuation">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
<span class="token string">"env"</span><span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
<span class="token string">"members"</span><span class="token punctuation">:</span> <span class="token punctuation">[</span>
<span class="token string">"107"</span>
<span class="token punctuation">]</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span>
<span class="token punctuation">{</span>
<span class="token string">"_id"</span><span class="token punctuation">:</span> <span class="token number">626</span><span class="token punctuation">,</span>
<span class="token string">"name"</span><span class="token punctuation">:</span> <span class="token string">"1233"</span><span class="token punctuation">,</span>
<span class="token string">"desc"</span><span class="token punctuation">:</span> <span class="token string">"123"</span><span class="token punctuation">,</span>
<span class="token string">"prd_host"</span><span class="token punctuation">:</span> <span class="token string">"http://1234/"</span><span class="token punctuation">,</span>
<span class="token string">"basepath"</span><span class="token punctuation">:</span> <span class="token string">"1234/"</span><span class="token punctuation">,</span>
<span class="token string">"uid"</span><span class="token punctuation">:</span> <span class="token number">107</span><span class="token punctuation">,</span>
<span class="token string">"group_id"</span><span class="token punctuation">:</span> <span class="token number">181</span><span class="token punctuation">,</span>
<span class="token string">"add_time"</span><span class="token punctuation">:</span> <span class="token number">1500471230</span><span class="token punctuation">,</span>
<span class="token string">"up_time"</span><span class="token punctuation">:</span> <span class="token number">1500471230</span><span class="token punctuation">,</span>
<span class="token string">"__v"</span><span class="token punctuation">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
<span class="token string">"env"</span><span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
<span class="token string">"members"</span><span class="token punctuation">:</span> <span class="token punctuation">[</span>
<span class="token string">"107"</span>
<span class="token punctuation">]</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span>
<span class="token punctuation">{</span>
<span class="token string">"_id"</span><span class="token punctuation">:</span> <span class="token number">665</span><span class="token punctuation">,</span>
<span class="token string">"name"</span><span class="token punctuation">:</span> <span class="token string">"222"</span><span class="token punctuation">,</span>
<span class="token string">"desc"</span><span class="token punctuation">:</span> <span class="token string">"222"</span><span class="token punctuation">,</span>
<span class="token string">"prd_host"</span><span class="token punctuation">:</span> <span class="token string">"http://222/"</span><span class="token punctuation">,</span>
<span class="token string">"basepath"</span><span class="token punctuation">:</span> <span class="token string">"222/"</span><span class="token punctuation">,</span>
<span class="token string">"uid"</span><span class="token punctuation">:</span> <span class="token number">107</span><span class="token punctuation">,</span>
<span class="token string">"group_id"</span><span class="token punctuation">:</span> <span class="token number">181</span><span class="token punctuation">,</span>
<span class="token string">"add_time"</span><span class="token punctuation">:</span> <span class="token number">1500471668</span><span class="token punctuation">,</span>
<span class="token string">"up_time"</span><span class="token punctuation">:</span> <span class="token number">1500471668</span><span class="token punctuation">,</span>
<span class="token string">"__v"</span><span class="token punctuation">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
<span class="token string">"env"</span><span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
<span class="token string">"members"</span><span class="token punctuation">:</span> <span class="token punctuation">[</span>
<span class="token string">"107"</span>
<span class="token punctuation">]</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span>
<span class="token punctuation">{</span>
<span class="token string">"_id"</span><span class="token punctuation">:</span> <span class="token number">704</span><span class="token punctuation">,</span>
<span class="token string">"name"</span><span class="token punctuation">:</span> <span class="token string">"333"</span><span class="token punctuation">,</span>
<span class="token string">"desc"</span><span class="token punctuation">:</span> <span class="token string">"222333"</span><span class="token punctuation">,</span>
<span class="token string">"prd_host"</span><span class="token punctuation">:</span> <span class="token string">"http://333/"</span><span class="token punctuation">,</span>
<span class="token string">"basepath"</span><span class="token punctuation">:</span> <span class="token string">"333/"</span><span class="token punctuation">,</span>
<span class="token string">"uid"</span><span class="token punctuation">:</span> <span class="token number">107</span><span class="token punctuation">,</span>
<span class="token string">"group_id"</span><span class="token punctuation">:</span> <span class="token number">181</span><span class="token punctuation">,</span>
<span class="token string">"add_time"</span><span class="token punctuation">:</span> <span class="token number">1500471674</span><span class="token punctuation">,</span>
<span class="token string">"up_time"</span><span class="token punctuation">:</span> <span class="token number">1500471674</span><span class="token punctuation">,</span>
<span class="token string">"__v"</span><span class="token punctuation">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
<span class="token string">"env"</span><span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
<span class="token string">"members"</span><span class="token punctuation">:</span> <span class="token punctuation">[</span>
<span class="token string">"107"</span>
<span class="token punctuation">]</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span>
<span class="token punctuation">{</span>
<span class="token string">"_id"</span><span class="token punctuation">:</span> <span class="token number">743</span><span class="token punctuation">,</span>
<span class="token string">"name"</span><span class="token punctuation">:</span> <span class="token string">"444"</span><span class="token punctuation">,</span>
<span class="token string">"desc"</span><span class="token punctuation">:</span> <span class="token string">"444"</span><span class="token punctuation">,</span>
<span class="token string">"prd_host"</span><span class="token punctuation">:</span> <span class="token string">"https://444/"</span><span class="token punctuation">,</span>
<span class="token string">"basepath"</span><span class="token punctuation">:</span> <span class="token string">"444/"</span><span class="token punctuation">,</span>
<span class="token string">"uid"</span><span class="token punctuation">:</span> <span class="token number">107</span><span class="token punctuation">,</span>
<span class="token string">"group_id"</span><span class="token punctuation">:</span> <span class="token number">181</span><span class="token punctuation">,</span>
<span class="token string">"add_time"</span><span class="token punctuation">:</span> <span class="token number">1500471695</span><span class="token punctuation">,</span>
<span class="token string">"up_time"</span><span class="token punctuation">:</span> <span class="token number">1500471695</span><span class="token punctuation">,</span>
<span class="token string">"__v"</span><span class="token punctuation">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
<span class="token string">"env"</span><span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
<span class="token string">"members"</span><span class="token punctuation">:</span> <span class="token punctuation">[</span>
<span class="token string">"107"</span>
<span class="token punctuation">]</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span>
<span class="token punctuation">{</span>
<span class="token string">"_id"</span><span class="token punctuation">:</span> <span class="token number">763</span><span class="token punctuation">,</span>
<span class="token string">"name"</span><span class="token punctuation">:</span> <span class="token string">"122333"</span><span class="token punctuation">,</span>
<span class="token string">"desc"</span><span class="token punctuation">:</span> <span class="token string">"3/"</span><span class="token punctuation">,</span>
<span class="token string">"prd_host"</span><span class="token punctuation">:</span> <span class="token string">"http://33/"</span><span class="token punctuation">,</span>
<span class="token string">"basepath"</span><span class="token punctuation">:</span> <span class="token string">"33/"</span><span class="token punctuation">,</span>
<span class="token string">"uid"</span><span class="token punctuation">:</span> <span class="token number">107</span><span class="token punctuation">,</span>
<span class="token string">"group_id"</span><span class="token punctuation">:</span> <span class="token number">181</span><span class="token punctuation">,</span>
<span class="token string">"add_time"</span><span class="token punctuation">:</span> <span class="token number">1500481743</span><span class="token punctuation">,</span>
<span class="token string">"up_time"</span><span class="token punctuation">:</span> <span class="token number">1500481743</span><span class="token punctuation">,</span>
<span class="token string">"__v"</span><span class="token punctuation">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
<span class="token string">"env"</span><span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
<span class="token string">"members"</span><span class="token punctuation">:</span> <span class="token punctuation">[</span>
<span class="token string">"107"</span>
<span class="token punctuation">]</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span>
<span class="token punctuation">{</span>
<span class="token string">"_id"</span><span class="token punctuation">:</span> <span class="token number">778</span><span class="token punctuation">,</span>
<span class="token string">"name"</span><span class="token punctuation">:</span> <span class="token string">"555"</span><span class="token punctuation">,</span>
<span class="token string">"desc"</span><span class="token punctuation">:</span> <span class="token string">"555"</span><span class="token punctuation">,</span>
<span class="token string">"prd_host"</span><span class="token punctuation">:</span> <span class="token string">"https://555/"</span><span class="token punctuation">,</span>
<span class="token string">"basepath"</span><span class="token punctuation">:</span> <span class="token string">"555/"</span><span class="token punctuation">,</span>
<span class="token string">"uid"</span><span class="token punctuation">:</span> <span class="token number">107</span><span class="token punctuation">,</span>
<span class="token string">"group_id"</span><span class="token punctuation">:</span> <span class="token number">181</span><span class="token punctuation">,</span>
<span class="token string">"add_time"</span><span class="token punctuation">:</span> <span class="token number">1500519203</span><span class="token punctuation">,</span>
<span class="token string">"up_time"</span><span class="token punctuation">:</span> <span class="token number">1500519203</span><span class="token punctuation">,</span>
<span class="token string">"__v"</span><span class="token punctuation">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
<span class="token string">"env"</span><span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
<span class="token string">"members"</span><span class="token punctuation">:</span> <span class="token punctuation">[</span>
<span class="token string">"107"</span>
<span class="token punctuation">]</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span>
<span class="token punctuation">{</span>
<span class="token string">"_id"</span><span class="token punctuation">:</span> <span class="token number">823</span><span class="token punctuation">,</span>
<span class="token string">"name"</span><span class="token punctuation">:</span> <span class="token string">"5"</span><span class="token punctuation">,</span>
<span class="token string">"desc"</span><span class="token punctuation">:</span> <span class="token string">"5"</span><span class="token punctuation">,</span>
<span class="token string">"prd_host"</span><span class="token punctuation">:</span> <span class="token string">"http://5/"</span><span class="token punctuation">,</span>
<span class="token string">"basepath"</span><span class="token punctuation">:</span> <span class="token string">"5/"</span><span class="token punctuation">,</span>
<span class="token string">"uid"</span><span class="token punctuation">:</span> <span class="token number">107</span><span class="token punctuation">,</span>
<span class="token string">"group_id"</span><span class="token punctuation">:</span> <span class="token number">181</span><span class="token punctuation">,</span>
<span class="token string">"add_time"</span><span class="token punctuation">:</span> <span class="token number">1500519769</span><span class="token punctuation">,</span>
<span class="token string">"up_time"</span><span class="token punctuation">:</span> <span class="token number">1500519769</span><span class="token punctuation">,</span>
<span class="token string">"__v"</span><span class="token punctuation">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
<span class="token string">"env"</span><span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
<span class="token string">"members"</span><span class="token punctuation">:</span> <span class="token punctuation">[</span>
<span class="token string">"107"</span>
<span class="token punctuation">]</span>
<span class="token punctuation">}</span>
<span class="token punctuation">]</span><span class="token punctuation">,</span>
<span class="token string">"userinfo"</span><span class="token punctuation">:</span> <span class="token punctuation">{</span>
<span class="token string">"107"</span><span class="token punctuation">:</span> <span class="token punctuation">{</span>
<span class="token string">"_id"</span><span class="token punctuation">:</span> <span class="token number">107</span><span class="token punctuation">,</span>
<span class="token string">"username"</span><span class="token punctuation">:</span> <span class="token string">"admin"</span><span class="token punctuation">,</span>
<span class="token string">"email"</span><span class="token punctuation">:</span> <span class="token string">"admin@admin.com"</span><span class="token punctuation">,</span>
<span class="token string">"role"</span><span class="token punctuation">:</span> <span class="token string">"admin"</span><span class="token punctuation">,</span>
<span class="token string">"add_time"</span><span class="token punctuation">:</span> <span class="token number">1500280333</span><span class="token punctuation">,</span>
<span class="token string">"up_time"</span><span class="token punctuation">:</span> <span class="token number">1500373530</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span></code></pre>
<pre class="ydoc-example" data-foldnumber=10><code class="js-code"><span class="token operator">/</span>log<span class="token operator">/</span>list</code></pre>
</div>

View File

@ -0,0 +1,213 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no" />
<title>YApi : ./server/controllers/follow.js</title>
<link type="text/css" rel="stylesheet" href="../../../source/code.css"/>
<script type="text/javascript" src="../../../source/shCore.js"></script>
<script type="text/javascript" src="../../../source/shBrush-js.js"></script>
<style>
.syntaxhighlighter .number1 .spaces,.syntaxhighlighter .toolbar{ display: none;}
.syntaxhighlighter table td.gutter .line.highlight { background-color: #6ce26c !important; color: white; }
</style>
</head>
<body>
<div class="ydoc">
<div class="ydoc-banner-bg">
<div class="ydoc-banner" id="content" tabindex="-1">
<div class="ydoc-banner-area">
<h1>YApi : ./server/controllers/follow.js</h1>
<p>源代码</p>
</div>
</div>
<div class="ydoc-container">
<div class="ydoc-container-content">
<div class="static-code-content" role="main">
<pre class="brush: js;">
import yapi from '../yapi.js';
import baseController from './base.js';
import followModel from '../models/follow';
class followController extends baseController {
constructor(ctx) {
super(ctx);
this.Model = yapi.getInst(followModel);
// try{
// var res = this.Model.save({
// uid: 107,
// projectid: 221,
// projectname: 'Flight',
// icon: 'code'
// });
// // var res = this.Model.del(107);
// ctx.body = yapi.commons.resReturn(null, 200,res);
// }catch(err){
// ctx.body = yapi.commons.resReturn(null, 402, err.message);
// }
}
/**
* 获取关注项目列表
* @interface /follow/list
* @method GET
* @category follow
* @foldnumber 10
* @param {Number} uid 用户id 不能为空
* @param {Number} [page] 分页页码
* @param {Number} [limit] 分页大小
* @returns {Object}
* @example /follow/list
*/
async list(ctx) {
let uid = ctx.request.query.uid,
page = ctx.request.query.page || 1,
limit = ctx.request.query.limit || 10;
if (!uid) {
return ctx.body = yapi.commons.resReturn(null, 400, '用户id不能为空');
}
try {
let result = await this.Model.listWithPaging(uid, page, limit);
let count = await this.Model.listCount(uid);
ctx.body = yapi.commons.resReturn({
total: Math.ceil(count / limit),
list: result
});
} catch (err) {
ctx.body = yapi.commons.resReturn(null, 402, err.message);
}
}
/**
* 取消关注
* @interface /follow/list
* @method POST
* @category follow
* @foldnumber 10
* @param {Number} id 关注id
* @returns {Object}
* @example /follow/del
*/
async del(ctx) {
let params = ctx.request.body;
if(params.followid){
return ctx.body = yapi.commons.resReturn(null, 400, '关注id不能为空');
}
try {
let result = await this.Model.del(params.id);
ctx.body = yapi.commons.resReturn(result);
} catch (e) {
ctx.body = yapi.commons.resReturn(null, 402, e.message);
}
}
/**
* 添加关注
* @interface /follow/list
* @method POST
* @category follow
* @foldnumber 10
* @param {Number} uid 用户id
* @param {Number} projectid 项目id
* @param {String} projectname 项目名
* @param {String} icon 项目icon
* @returns {Object}
* @example /follow/add
*/
async add(ctx) {
let params = ctx.request.body;
params = yapi.commons.handleParams(params, {
uid: 'number',
projectid: 'number',
projectname: 'string',
icon: 'string'
});
if (!params.uid) {
return ctx.body = yapi.commons.resReturn(null, 400, '用户id不为空');
}
if (!params.projectid) {
return ctx.body = yapi.commons.resReturn(null, 400, '项目id不能为空');
}
let checkRepeat = await this.Model.checkProjectRepeat(params.uid,params.projectid);
if (checkRepeat) {
return ctx.body = yapi.commons.resReturn(null, 401, '项目已关注');
}
if (!params.projectname) {
return ctx.body = yapi.commons.resReturn(null, 400, '项目名不能为空');
}
if (!params.icon) {
return ctx.body = yapi.commons.resReturn(null, 400, '项目图标标志不能为空');
}
let data = {
uid: params.uid,
projectid: params.projectid,
projectname: params.projectname,
icon: params.icon
};
try {
let result = await this.Model.save(data);
result = yapi.commons.fieldSelect(result, ['_id', 'uid', 'projectid', 'projectname', 'icon']);
ctx.body = yapi.commons.resReturn(result);
} catch (e) {
ctx.body = yapi.commons.resReturn(null, 402, e.message);
}
}
}
module.exports = followController;
</pre>
</div>
</div>
</div>
</div>
<!-- <div class="docs-header" id="content" tabindex="-1">
<div class="container">
<h1>YApi : ./server/controllers/follow.js</h1>
<p>源代码</p>
</div>
</div> -->
<footer class="docs-footer" role="contentinfo">
<div class="container">
<p></p>
</div>
</footer>
</div>
<script type="text/javascript">
SyntaxHighlighter.all();
function getTop(node){
return node.offsetTop + (node.offsetParent ? getTop(node.offsetParent) : 0);
}
document.addEventListener('DOMContentLoaded', function() {
setTimeout(function() {
try {
var lineNum = (parseInt(location.hash.replace(/#/g, '')) - 1) || 0,
node = document.querySelectorAll('div.line')[lineNum];
document.body.scrollTop = getTop(node);
node.className += ' highlight';
} catch(e) {}
}, 500);
}, false);
</script>
</body>
</html>

View File

@ -54,16 +54,16 @@ class logController extends baseController {
}
/**
* 获取节点列表
* @interface /node/list
* 获取动态列表
* @interface /log/list
* @method GET
* @category node
* @category log
* @foldnumber 10
* @param {Number} uid 用户id 不能为空
* @param {Number} [page] 分页页码
* @param {Number} [limit] 分页大小
* @returns {Object}
* @example ./api/project/list.json
* @example /log/list
*/
async list(ctx) {
@ -72,7 +72,7 @@ class logController extends baseController {
limit = ctx.request.query.limit || 10;
if (!typeid) {
return ctx.body = yapi.commons.resReturn(null, 400, '项目id不能为空');
return ctx.body = yapi.commons.resReturn(null, 400, 'typeid不能为空');
}
try {

View File

@ -552,39 +552,60 @@ class projectController extends baseController {
* @param {String} project_id
*/
async download(ctx) {
const project_id = ctx.request.query.project_id;
let interfaceInst = yapi.getInst(interfaceModel);
// 根据 project_id 获取接口数据
let count = await interfaceInst.list(project_id);
const project_id = ctx.request.query.project_id;
let interfaceInst = yapi.getInst(interfaceModel);
// 根据 project_id 获取接口数据
let count = await interfaceInst.list(project_id);
if (!project_id) {
return ctx.body = yapi.commons.resReturn(null, 405, '项目id不能为空');
} else if (!count) {
return ctx.body = yapi.commons.resReturn(null, 401, '项目id不存在');
}
if (!project_id) {
return ctx.body = yapi.commons.resReturn(null, 405, '项目id不能为空');
} else if (!count) {
return ctx.body = yapi.commons.resReturn(null, 401, '项目id不存在');
}
console.log('cont',count);
const arr = JSON.stringify(count.map(function(item) {
// 返回的json模板数据: item.res_body
const mockData = Mock.mock(
yapi.commons.json_parse(item.res_body)
);
return {
path: item.path,
mock: mockData
}
}));
// console.log(arr);
const arr = JSON.stringify(count.map(function(item) {
// 返回的json模板数据: item.res_body
const mockData = Mock.mock(
yapi.commons.json_parse(item.res_body)
);
return {
path: item.path,
mock: mockData
}
}));
const fileName = 'mock.js';
ctx.attachment(fileName);
await send(ctx, fileName, { root: __dirname + '/public' });
const fileName = 'mock.js';
ctx.attachment(fileName);
await send(ctx, fileName, { root: __dirname + '/public' });
const res = `
var data = ${arr};
module.exports = data;`
.trim();
return ctx.body = res;
const res = `
var Mock = require('mockjs');
var xhook = require('xhook');
var data = ${arr};
function run() {
xhook.before(function(request, callback) {
setTimeout(function() {
var res;
data.forEach((item) => {
// 请求的接口在 data 中存在
if(request.url === item.path) {
res = {
status: 200,
text: Mock.mock(item.mock)
}
}
});
if (res) {
callback(res);
}else {
callback({ status: 405, text: '接口不存在' });
}
}, 500);
});
}
module.exports = run;`;
.trim();
return ctx.body = res;
}
}

View File

@ -34,6 +34,7 @@ import common from '../utils/commons.js';
import interfaceModel from '../models/interface.js'
import groupModel from '../models/group.js'
import projectModel from '../models/project.js'
import avatarModel from '../models/avatar.js'
const jwt = require('jsonwebtoken');
@ -168,12 +169,13 @@ class userController extends baseController {
passsalt: passsalt,
role: 'member',
add_time: yapi.commons.time(),
up_time: yapi.commons.time()
up_time: yapi.commons.time(),
type: 'third'
};
user = await userInst.save(data);
yapi.commons.sendMail({
to: email,
contents: `<h3>亲爱的用户:</h3><p>您好感谢使用YApi,系统检测您是第一次用Qsso账号登录YApi服务,您的Email是 ${email} ,初始化密码为:${passsalt}</p>`
contents: `<h3>亲爱的用户:</h3><p>您好感谢使用YApi平台.</p>`
});
}
@ -237,10 +239,6 @@ class userController extends baseController {
}
}
async forgetPassword() { }
async resetPassword() { }
setLoginCookie(uid, passsalt) {
let token = jwt.sign({ uid: uid }, passsalt, { expiresIn: '7 days' });
@ -298,7 +296,8 @@ class userController extends baseController {
passsalt: passsalt,
role: 'member',
add_time: yapi.commons.time(),
up_time: yapi.commons.time()
up_time: yapi.commons.time(),
type: "site"
};
if (!data.username) {
@ -460,10 +459,6 @@ class userController extends baseController {
up_time: yapi.commons.time()
};
if (this.getRole() === 'admin') {
params.role && (data.role = params.role);
}
params.username && (data.username = params.username);
params.email && (data.email = params.email);
@ -482,6 +477,65 @@ class userController extends baseController {
}
}
/**
*
* @param {*} basecode base64编码通过h5 api传给后端
*/
async uploadAvatar(ctx) {
try {
let basecode = ctx.request.body.basecode;
if(!basecode){
return ctx.body = yapi.commons.resReturn(null, 400, 'basecode不能为空')
}
let pngPrefix = 'data:image/png;base64,';
let jpegPrefix = 'data:image/jpeg;base64,';
let type;
if(basecode.substr(0, pngPrefix.length ) === pngPrefix){
basecode = basecode.substr(pngPrefix.length);
type = 'image/png';
}else if(basecode.substr(0, jpegPrefix.length ) === jpegPrefix){
basecode = basecode.substr(jpegPrefix.length);
type = 'image/jpeg';
}else{
return ctx.body = yapi.commons.resReturn(null, 400, '仅支持jpeg和png格式的图片')
}
let strLength = basecode.length;
if(parseInt(strLength-(strLength/8)*2) > 200000){
return ctx.body = yapi.commons.resReturn(null, 400, '图片大小不能超过200kb');
}
let avatarInst = yapi.getInst(avatarModel);
let result = await avatarInst.up(this.getUid(), basecode, type)
ctx.body = yapi.commons.resReturn(result);
} catch (e) {
ctx.body = yapi.commons.resReturn(null, 401, e.message);
}
}
async avatar(ctx) {
try{
let avatarInst = yapi.getInst(avatarModel);
let data = await avatarInst.get(this.getUid());
let dataBuffer, type;
if(!data || !data.basecode){
dataBuffer = yapi.fs.readFileSync(yapi.path.join(yapi.WEBROOT, 'static/image/avatar.png'));
type = 'image/png'
}else{
type = data.type;
dataBuffer = new Buffer(data.basecode, 'base64');
}
ctx.set('Content-type', type);
ctx.body = dataBuffer;
}catch(err){
ctx.body = 'error:' + err.message
}
}
/**
* 模糊搜索用户名或者email
* @interface /user/search
@ -523,7 +577,6 @@ class userController extends baseController {
];
let filteredRes = common.filterRes(queryList, rules);
console.log(queryList); // eslint-disable-line
return ctx.body = yapi.commons.resReturn(filteredRes, 0, 'ok');
}
@ -548,7 +601,7 @@ class userController extends baseController {
let interfaceData = await interfaceInst.get(id)
result["interface_id"] = interfaceData._id;
result["interface_name"] = interfaceData.path;
type = 'project';
id = interfaceData.project_id;
}