mirror of
https://github.com/YMFE/yapi.git
synced 2024-12-15 05:10:47 +08:00
Merge branch 'dev' of http://gitlab.corp.qunar.com/mfe/yapi into dev
This commit is contained in:
commit
102a2c799e
1
.gitignore
vendored
1
.gitignore
vendored
@ -39,3 +39,4 @@ prd/
|
||||
dev/
|
||||
.tags
|
||||
.tags1
|
||||
tsconfig.json
|
||||
|
@ -5,6 +5,8 @@
|
||||
border-top: 1px solid #ddd;
|
||||
height: 2.4rem;
|
||||
width: 100%;
|
||||
background-color: $color-bg-dark;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.footer-container{
|
||||
@ -28,7 +30,7 @@
|
||||
line-height: .3rem;
|
||||
transition: color .2s;
|
||||
&:hover {
|
||||
color: #2e2e5a;
|
||||
color: $color-bg-gray;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,12 +11,19 @@
|
||||
.m-card, .card-btns {
|
||||
transform: translateY(-4px);
|
||||
}
|
||||
.m-card .ant-card-body {
|
||||
box-shadow: 0 4px 8px rgba(50, 50, 93, 0.11), 0 4px 6px rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
}
|
||||
&:active {
|
||||
.m-card, .card-btns {
|
||||
transform: translateY(4px);
|
||||
}
|
||||
}
|
||||
// 覆盖 card 组件 hover 状态的默认阴影样式
|
||||
.ant-card:not(.ant-card-no-hovering):hover {
|
||||
box-shadow: none;
|
||||
}
|
||||
// 卡片右上角按钮
|
||||
.card-btns {
|
||||
position: absolute;
|
||||
@ -47,6 +54,7 @@
|
||||
border-radius: 4px;
|
||||
padding-top: .24rem + .16rem + 1rem;
|
||||
box-shadow: 0 4px 6px rgba(50,50,93,.11), 0 1px 3px rgba(0,0,0,.08);
|
||||
transition: all .2s;
|
||||
}
|
||||
.ui-logo {
|
||||
width: 1rem;
|
||||
|
@ -4,15 +4,9 @@ import { connect } from 'react-redux';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { Row, Col, Button, Icon, Card } from 'antd';
|
||||
import PropTypes from "prop-types";
|
||||
import { withRouter } from 'react-router';
|
||||
import { logoSVG } from '../../common.js';
|
||||
|
||||
// import Intro from '../../components/Intro/Intro'
|
||||
import { changeMenuItem } from '../../reducer/modules/menu'
|
||||
import { OverPack } from 'rc-scroll-anim'
|
||||
import TweenOne from 'rc-tween-one'
|
||||
import QueueAnim from 'rc-queue-anim';
|
||||
|
||||
const oneAnim = { y: '+=30', opacity: 0, type: 'from', ease: 'easeOutQuad' };
|
||||
|
||||
const HomeGuest = () => (
|
||||
<div className="g-body">
|
||||
@ -42,7 +36,7 @@ const HomeGuest = () => (
|
||||
<div className="detail">高效、易用、可部署的API管理平台<br/><span className="desc">旨在为开发、产品、测试人员提供更优雅的接口管理服务</span></div>
|
||||
<div className="btn-group">
|
||||
<Link to="/login"><Button type="primary" className="btn-home btn-login">登录 / 注册</Button></Link>
|
||||
<Button className="btn-home btn-qsso" id="qsso-login">QSSO 登录</Button>
|
||||
<Button className="btn-home btn-home-normal" id="qsso-login">QSSO 登录</Button>
|
||||
</div>
|
||||
</div>
|
||||
</Col>
|
||||
@ -56,43 +50,25 @@ const HomeGuest = () => (
|
||||
</div>
|
||||
<div className="feat-part section-feature">
|
||||
<div className="container home-section">
|
||||
<OverPack
|
||||
playScale={[0.2,0.1]}
|
||||
>
|
||||
<TweenOne
|
||||
key="feat-motion-one"
|
||||
animation={oneAnim}
|
||||
>
|
||||
<h3 className="title">为API开发者设计的管理平台</h3>
|
||||
<span className="desc">YApi让接口开发更简单高效,让接口的管理更具可读性、可维护性,让团队协作更合理。</span>
|
||||
</TweenOne>
|
||||
<Row key="feat-motion-row">
|
||||
<QueueAnim
|
||||
delay = {200}
|
||||
interval ={200}
|
||||
leaveReverse={true}
|
||||
ease = 'easeOutQuad'
|
||||
animConfig ={{ opacity:[1,0],y: '+=30' }}
|
||||
key="feat-motion-queue"
|
||||
>
|
||||
<Col span={8} className="section-item" key="feat-wrapper-1">
|
||||
<Icon type="api" className="img" />
|
||||
<h4 className="title">项目接口管理</h4>
|
||||
<span className="desc">提供基本的项目分组,项目管理,接口管理功能</span>
|
||||
</Col>
|
||||
<Col span={8} className="section-item" key="feat-wrapper-2">
|
||||
<Icon type="code-o" className="img" />
|
||||
<h4 className="title">可部署</h4>
|
||||
<span className="desc">用户只需配置接口的基本路径,通过将线上域名指到我们的YApi平台服务器,就可使用mockServer服务</span>
|
||||
</Col>
|
||||
<Col span={8} className="section-item" key="feat-wrapper-3">
|
||||
<Icon type="team" className="img" />
|
||||
<h4 className="title">用户管理</h4>
|
||||
<span className="desc">提供基本的用户注册登录管理等功能,集成了去哪儿QSSO登录</span>
|
||||
</Col>
|
||||
</QueueAnim>
|
||||
</Row>
|
||||
</OverPack>
|
||||
<h3 className="title">为API开发者设计的管理平台</h3>
|
||||
<span className="desc">YApi让接口开发更简单高效,让接口的管理更具可读性、可维护性,让团队协作更合理。</span>
|
||||
<Row key="feat-motion-row">
|
||||
<Col span={8} className="section-item" key="feat-wrapper-1">
|
||||
<Icon type="api" className="img" />
|
||||
<h4 className="title">项目接口管理</h4>
|
||||
<span className="desc">提供基本的项目分组,项目管理,接口管理功能</span>
|
||||
</Col>
|
||||
<Col span={8} className="section-item" key="feat-wrapper-2">
|
||||
<Icon type="code-o" className="img" />
|
||||
<h4 className="title">可部署</h4>
|
||||
<span className="desc">用户只需配置接口的基本路径,通过将线上域名指到我们的YApi平台服务器,就可使用mockServer服务</span>
|
||||
</Col>
|
||||
<Col span={8} className="section-item" key="feat-wrapper-3">
|
||||
<Icon type="team" className="img" />
|
||||
<h4 className="title">用户管理</h4>
|
||||
<span className="desc">提供基本的用户注册登录管理等功能,集成了去哪儿QSSO登录</span>
|
||||
</Col>
|
||||
</Row>
|
||||
</div>
|
||||
</div>
|
||||
<div className="feat-part m-mock m-skew home-section">
|
||||
@ -110,15 +86,15 @@ const HomeGuest = () => (
|
||||
<p className="mock-desc">通过学习一些简单的 Mock 模板规则即可轻松编写接口,这将大大提高定义接口的效率,并且无需为编写 Mock 数据烦恼: 所有的数据都可以实时随机生成。</p>
|
||||
<div className="code">
|
||||
<ol start="1">
|
||||
<li className="alt"><span className="orderNum orderNum-first">1</span><span><span>{  </span></span></li>
|
||||
<li className=""><span className="orderNum">2</span><span>    <span className="string">"errcode|200-500"</span><span>: <span className="number">200</span>,  </span></span></li>
|
||||
<li className="alt"><span className="orderNum">3</span><span>    <span className="string">"errmsg|4-8"</span><span>: </span><span className="string">"@string"</span><span>,  </span></span></li>
|
||||
<li className=""><span className="orderNum">4</span><span>    <span className="string">"data"</span><span>: {  </span></span></li>
|
||||
<li className="alt"><span className="orderNum">5</span><span>        <span className="string">"boolean|1"</span><span>: </span><span className="keyword">true</span><span>,  </span></span></li>
|
||||
<li className=""><span className="orderNum">6</span><span>        <span className="string">"array|4"</span><span>: <span className="number">1</span>,  </span></span></li>
|
||||
<li className="alt"><span className="orderNum">7</span><span>        <span className="string">"combine"</span><span>: </span><span className="string">"@boolean & @array"</span><span>  </span></span></li>
|
||||
<li className=""><span className="orderNum">8</span><span>    }  </span></li>
|
||||
<li className="alt"><span className="orderNum orderNum-last">9</span><span>}  </span></li>
|
||||
<li className="item"><span className="orderNum orderNum-first">1</span><span><span>{  </span></span></li>
|
||||
<li className="item"><span className="orderNum">2</span><span>    <span className="string">"errcode|200-500"</span><span>: <span className="number">200</span>,  </span></span></li>
|
||||
<li className="item"><span className="orderNum">3</span><span>    <span className="string">"errmsg|4-8"</span><span>: </span><span className="string">"@string"</span><span>,  </span></span></li>
|
||||
<li className="item"><span className="orderNum">4</span><span>    <span className="string">"data"</span><span>: {  </span></span></li>
|
||||
<li className="item"><span className="orderNum">5</span><span>        <span className="string">"boolean|1"</span><span>: </span><span className="keyword">true</span><span>,  </span></span></li>
|
||||
<li className="item"><span className="orderNum">6</span><span>        <span className="string">"array|4"</span><span>: <span className="number">1</span>,  </span></span></li>
|
||||
<li className="item"><span className="orderNum">7</span><span>        <span className="string">"combine"</span><span>: </span><span className="string">"@boolean & @array"</span><span>  </span></span></li>
|
||||
<li className="item"><span className="orderNum">8</span><span>    }  </span></li>
|
||||
<li className="item"><span className="orderNum orderNum-last">9</span><span>}  </span></li>
|
||||
</ol>
|
||||
</div>
|
||||
</Card>
|
||||
@ -146,7 +122,7 @@ const HomeGuest = () => (
|
||||
</div>
|
||||
<div className="home-section section-manage">
|
||||
<div className="container">
|
||||
<Row className="row-card">
|
||||
<Row className="row-card" style={{marginBottom: '.48rem'}}>
|
||||
<Col span={7} className="section-card">
|
||||
<Card>
|
||||
<div className="section-block block-first">
|
||||
@ -191,7 +167,7 @@ HomeGuest.propTypes ={
|
||||
changeMenuItem
|
||||
}
|
||||
)
|
||||
|
||||
@withRouter
|
||||
class Home extends Component {
|
||||
constructor(props) {
|
||||
super(props)
|
||||
@ -202,6 +178,7 @@ class Home extends Component {
|
||||
static propTypes = {
|
||||
introList: PropTypes.array,
|
||||
login : PropTypes.bool,
|
||||
history: PropTypes.object,
|
||||
changeMenuItem : PropTypes.func
|
||||
}
|
||||
toStart = () =>{
|
||||
@ -211,21 +188,21 @@ class Home extends Component {
|
||||
const { login } = this.props;
|
||||
return (
|
||||
<div className="home-main">
|
||||
{login?
|
||||
(
|
||||
<div className="user-home">
|
||||
<div className="user-des">
|
||||
<p className="title">YAPI</p>
|
||||
<p className="des">一个高效,易用,可部署的Api管理系统</p>
|
||||
<div className="btn">
|
||||
<Button type="primary" size="large">
|
||||
<Link to="/group" onClick={this.toStart}>开始</Link>
|
||||
</Button>
|
||||
</div>
|
||||
{login? this.props.history.push('/group') : <HomeGuest introList={this.props.introList}/>}
|
||||
<div className="row-tip">
|
||||
<div className="container">
|
||||
<div className="tip-title">
|
||||
<h3 className="title">准备好使用了吗?</h3>
|
||||
<p className="desc">注册账号尽请使用吧,查看使用文档了解更多信息</p>
|
||||
</div>
|
||||
<div className="tip-btns">
|
||||
<div className="btn-group">
|
||||
<Link to="/login"><Button type="primary" className="btn-home btn-login">登录 / 注册</Button></Link>
|
||||
<Button className="btn-home btn-home-normal"><a target="_blank" href="/doc/index.html" >使用文档</a></Button>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
: <HomeGuest introList={this.props.introList}/>}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
@ -27,6 +27,51 @@ $color-bg-lightblue: #c6e2ff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 按钮组
|
||||
.btn-group {
|
||||
padding: .3rem .24rem;
|
||||
.btn-home {
|
||||
font-size: .15rem;
|
||||
font-weight: 200;
|
||||
letter-spacing: 1px;
|
||||
border: none;
|
||||
line-height: .4rem;
|
||||
height: .4rem;
|
||||
padding: 0 .24rem;
|
||||
margin-right: .24rem;
|
||||
box-shadow: 0 4px 6px rgba(50,50,93,.11), 0 1px 3px rgba(0,0,0,.08);
|
||||
transform: translateY(0);
|
||||
transition: all .2s;
|
||||
&:hover {
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 7px 14px rgba(50,50,93,.1), 0 3px 6px rgba(0,0,0,.08);
|
||||
}
|
||||
&:active {
|
||||
transform: translateY(1px);
|
||||
}
|
||||
}
|
||||
.btn-login {
|
||||
background-color: #32325d;
|
||||
&:hover {
|
||||
background-color: #43459a;
|
||||
}
|
||||
&:active, &:focus {
|
||||
color: #e6ebf1;
|
||||
background-color: #32325d;
|
||||
}
|
||||
}
|
||||
.btn-home-normal {
|
||||
color: #43459a;
|
||||
&:hover {
|
||||
color: #7795f8;
|
||||
}
|
||||
&:hover, &:focus {
|
||||
background-color: #f6f9fc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.m-bg {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
@ -104,47 +149,6 @@ $color-bg-lightblue: #c6e2ff;
|
||||
.desc {
|
||||
font-size: .18rem;
|
||||
}
|
||||
.btn-group {
|
||||
padding: .3rem .24rem;
|
||||
.btn-home {
|
||||
font-size: .15rem;
|
||||
font-weight: 200;
|
||||
letter-spacing: 1px;
|
||||
border: none;
|
||||
line-height: .4rem;
|
||||
height: .4rem;
|
||||
padding: 0 .24rem;
|
||||
margin-right: .24rem;
|
||||
box-shadow: 0 4px 6px rgba(50,50,93,.11), 0 1px 3px rgba(0,0,0,.08);
|
||||
transform: translateY(0);
|
||||
transition: all .2s;
|
||||
&:hover {
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 7px 14px rgba(50,50,93,.1), 0 3px 6px rgba(0,0,0,.08);
|
||||
}
|
||||
&:active {
|
||||
transform: translateY(1px);
|
||||
}
|
||||
}
|
||||
.btn-login {
|
||||
background-color: #43459a;
|
||||
&:hover {
|
||||
background-color: #555abf;
|
||||
}
|
||||
&:hover {
|
||||
background-color: #32325d;
|
||||
}
|
||||
}
|
||||
.btn-qsso {
|
||||
color: #43459a;
|
||||
&:hover {
|
||||
color: #7795f8;
|
||||
}
|
||||
&:hover {
|
||||
background-color: #f6f9fc;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.login-form{
|
||||
color: $color-white;
|
||||
@ -351,6 +355,9 @@ $color-bg-lightblue: #c6e2ff;
|
||||
box-shadow: 0 15px 35px rgba(50,50,93,.1), 0 5px 15px rgba(0,0,0,.07);
|
||||
border: none;
|
||||
}
|
||||
.ant-card:not(.ant-card-no-hovering):hover {
|
||||
box-shadow: 0 15px 35px rgba(50,50,93,.1), 0 5px 15px rgba(0,0,0,.07);
|
||||
}
|
||||
.ant-card-head {
|
||||
background-color: $color-blue-grey-lighter;
|
||||
border-top-left-radius: .04rem;
|
||||
@ -399,6 +406,11 @@ $color-bg-lightblue: #c6e2ff;
|
||||
.keyword {
|
||||
color: #2359f1;
|
||||
}
|
||||
.item {
|
||||
overflow: hidden;
|
||||
text-overflow:ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
.mock-after {
|
||||
.ant-card-head {
|
||||
@ -462,8 +474,41 @@ $color-bg-lightblue: #c6e2ff;
|
||||
}
|
||||
}
|
||||
|
||||
.row-tip {
|
||||
margin-top: .48rem;
|
||||
padding-top: .48rem;
|
||||
padding-bottom: .24rem;
|
||||
background-color: #ececec;
|
||||
.container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.tip-title {
|
||||
flex: 2;
|
||||
}
|
||||
.tip-btns {
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
.btn-group {
|
||||
white-space: nowrap;
|
||||
}
|
||||
.title {
|
||||
-webkit-font-smoothing: antialiased;
|
||||
padding-left: .24rem;
|
||||
color: #2e2e5a;
|
||||
line-height: .32rem;
|
||||
margin-bottom: .08rem;
|
||||
font-size: .24rem;
|
||||
}
|
||||
.desc {
|
||||
-webkit-font-smoothing: antialiased;
|
||||
padding-left: .24rem;
|
||||
color: #6d7c90;
|
||||
font-size: .16rem;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// LOGO 旋转动画
|
||||
@keyframes spin
|
||||
{
|
||||
from {
|
||||
|
@ -120,7 +120,7 @@ export default class InterfaceCaseContent extends Component {
|
||||
const { currCase, currProject } = this.props;
|
||||
const data = Object.assign({}, currCase, currProject, {_id: currCase._id});
|
||||
return (
|
||||
<div>
|
||||
<div style={{padding: '6px 0'}}>
|
||||
<h1 style={{marginLeft: 8}}>{currCase.casename}</h1>
|
||||
<div>
|
||||
<Postman data={data} type="case" saveTip="更新保存修改" save={this.updateCase} ref={this.savePostmanRef} />
|
||||
|
@ -293,7 +293,7 @@ class InterfaceMenu extends Component {
|
||||
return <div>
|
||||
<div className="interface-filter">
|
||||
<Input onChange={this.onFilter} value={this.state.filter} placeholder="Filter by name" style={{ width: "70%" }} />
|
||||
<Tag color="#108ee9" style={{ marginLeft: "15px" }} ><Icon type="plus" onClick={() => this.changeModal('add_cat_modal_visible', true)} /></Tag>
|
||||
<Tag color="#108ee9" onClick={() => this.changeModal('add_cat_modal_visible', true)} style={{ marginLeft: "15px" }} ><Icon type="plus" /></Tag>
|
||||
<Modal
|
||||
title="添加接口"
|
||||
visible={this.state.visible}
|
||||
|
@ -35,6 +35,11 @@
|
||||
border-radius: 2px;
|
||||
.ant-card-head {
|
||||
background-color: #eee;
|
||||
padding: 0 .08rem !important;
|
||||
}
|
||||
.ant-card-head-title {
|
||||
font-size: .12rem;
|
||||
float: inherit;
|
||||
}
|
||||
.ant-card-body {
|
||||
padding: 0;
|
||||
|
@ -4,7 +4,7 @@ $color-blue : #108ee9;
|
||||
$color-blue-deeper: #34495E;
|
||||
$color-grey-deep : #929aac;
|
||||
$color-black-light : #404040;
|
||||
$color-bg-dark: #273848; // 背景色 - 深蓝
|
||||
$color-bg-dark: #202d3a; // 背景色 - 深蓝
|
||||
|
||||
@mixin row-width-limit {
|
||||
max-width: 12.2rem;
|
||||
|
@ -295,9 +295,6 @@
|
||||
@card-head-height: 48px;
|
||||
@card-head-color: @heading-color;
|
||||
@card-head-background: @component-background;
|
||||
.ant-card-wider-padding .ant-card-body {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
// Tabs
|
||||
// ---
|
||||
|
@ -43,7 +43,6 @@ class interfaceController extends baseController {
|
||||
*/
|
||||
async add(ctx) {
|
||||
let params = ctx.request.body;
|
||||
|
||||
params = yapi.commons.handleParams(params, {
|
||||
project_id: 'number',
|
||||
title: 'string',
|
||||
@ -52,6 +51,11 @@ class interfaceController extends baseController {
|
||||
desc: 'string',
|
||||
catid: 'number'
|
||||
});
|
||||
|
||||
let auth = await this.checkAuth(params.project_id, 'project', 'edit')
|
||||
if (!auth) {
|
||||
return ctx.body = yapi.commons.resReturn(null, 400, '没有权限');
|
||||
}
|
||||
params.method = params.method || 'GET';
|
||||
params.method = params.method.toUpperCase();
|
||||
params.res_body_type = params.res_body_type ? params.res_body_type.toLowerCase() : 'json';
|
||||
@ -196,14 +200,14 @@ class interfaceController extends baseController {
|
||||
}
|
||||
try {
|
||||
let result = await this.catModel.list(project_id), newResult = [];
|
||||
for(let i=0, item, list;i< result.length; i++){
|
||||
for (let i = 0, item, list; i < result.length; i++) {
|
||||
item = result[i].toObject()
|
||||
list = await this.Model.listByCatid(item._id, '_id title method path')
|
||||
for(let j=0; j< list.length; j++){
|
||||
for (let j = 0; j < list.length; j++) {
|
||||
list[j] = list[j].toObject()
|
||||
}
|
||||
}
|
||||
item.list = list;
|
||||
newResult[i] = item
|
||||
newResult[i] = item
|
||||
}
|
||||
ctx.body = yapi.commons.resReturn(newResult);
|
||||
} catch (err) {
|
||||
@ -249,6 +253,7 @@ class interfaceController extends baseController {
|
||||
desc: 'string',
|
||||
catid: 'number'
|
||||
});
|
||||
|
||||
params.method = params.method || 'GET';
|
||||
params.method = params.method.toUpperCase();
|
||||
|
||||
@ -257,7 +262,12 @@ class interfaceController extends baseController {
|
||||
if (!id) {
|
||||
return ctx.body = yapi.commons.resReturn(null, 400, '接口id不能为空');
|
||||
}
|
||||
|
||||
let interfaceData = await this.Model.get(id);
|
||||
let auth = await this.checkAuth(interfaceData.project_id, 'project', 'edit')
|
||||
if (!auth) {
|
||||
return ctx.body = yapi.commons.resReturn(null, 400, '没有权限');
|
||||
}
|
||||
|
||||
if (params.path && !yapi.commons.verifyPath(params.path)) {
|
||||
return ctx.body = yapi.commons.resReturn(null, 400, '接口path第一位必须是/,最后一位不能为/');
|
||||
@ -287,7 +297,7 @@ class interfaceController extends baseController {
|
||||
data.method = params.method;
|
||||
}
|
||||
|
||||
if(params.catid){
|
||||
if (params.catid) {
|
||||
data.catid = params.catid;
|
||||
}
|
||||
|
||||
@ -323,7 +333,7 @@ class interfaceController extends baseController {
|
||||
data.res_body = params.res_body;
|
||||
}
|
||||
|
||||
if(params.status){
|
||||
if (params.status) {
|
||||
data.status = params.status;
|
||||
}
|
||||
|
||||
@ -331,13 +341,13 @@ class interfaceController extends baseController {
|
||||
let result = await this.Model.up(id, data);
|
||||
let username = this.getUsername();
|
||||
let cate;
|
||||
if(params.catid){
|
||||
if (params.catid) {
|
||||
cate = await this.catModel.get(+params.catid);
|
||||
}else{
|
||||
} else {
|
||||
let inter = await this.Model.get(id);
|
||||
cate = await this.catModel.get(inter.catid);
|
||||
cate = interfaceData.catid;
|
||||
}
|
||||
|
||||
|
||||
yapi.commons.saveLog({
|
||||
content: `用户 "${username}" 更新了分类 "${cate.name}" 下的接口 "${data.title}"`,
|
||||
type: 'project',
|
||||
@ -374,8 +384,9 @@ class interfaceController extends baseController {
|
||||
let data = await this.Model.get(ctx.request.body.id);
|
||||
|
||||
if (data.uid != this.getUid()) {
|
||||
if (await this.jungeProjectAuth(data.project_id) !== true) {
|
||||
return ctx.body = yapi.commons.resReturn(null, 405, '没有权限');
|
||||
let auth = await this.checkAuth(data.project_id, 'project', 'danger')
|
||||
if (!auth) {
|
||||
return ctx.body = yapi.commons.resReturn(null, 400, '没有权限');
|
||||
}
|
||||
}
|
||||
|
||||
@ -438,10 +449,16 @@ class interfaceController extends baseController {
|
||||
if (!params.project_id) {
|
||||
return ctx.body = yapi.commons.resReturn(null, 400, '项目id不能为空');
|
||||
}
|
||||
|
||||
let auth = await this.checkAuth(params.project_id, 'project', 'edit')
|
||||
if (!auth) {
|
||||
return ctx.body = yapi.commons.resReturn(null, 400, '没有权限');
|
||||
}
|
||||
if (!params.name) {
|
||||
return ctx.body = yapi.commons.resReturn(null, 400, '名称不能为空');
|
||||
}
|
||||
|
||||
|
||||
let result = await this.catModel.save({
|
||||
name: params.name,
|
||||
project_id: params.project_id,
|
||||
@ -474,10 +491,15 @@ class interfaceController extends baseController {
|
||||
name: params.name,
|
||||
desc: params.desc,
|
||||
up_time: yapi.commons.time()
|
||||
});
|
||||
});
|
||||
|
||||
let username = this.getUsername();
|
||||
let cate = await this.catModel.get(params.catid);
|
||||
|
||||
let auth = await this.checkAuth(cate.project_id, 'project', 'edit')
|
||||
if (!auth) {
|
||||
return ctx.body = yapi.commons.resReturn(null, 400, '没有权限');
|
||||
}
|
||||
yapi.commons.saveLog({
|
||||
content: `用户 "${username}" 更新了分类 "${cate.name}"`,
|
||||
type: 'project',
|
||||
@ -511,7 +533,7 @@ class interfaceController extends baseController {
|
||||
let result = await this.catModel.del(id);
|
||||
let r = await this.Model.delByCatid(id);
|
||||
let username = this.getUsername();
|
||||
|
||||
|
||||
yapi.commons.saveLog({
|
||||
content: `用户 "${username}" 删除了分类 "${cate.name}" 及该分类下的接口`,
|
||||
type: 'project',
|
||||
|
@ -21,7 +21,7 @@ class interfaceColController extends baseController{
|
||||
* @example
|
||||
*/
|
||||
async list(ctx){
|
||||
try {
|
||||
try {
|
||||
let id = ctx.query.project_id;
|
||||
let result = await this.colModel.list(id);
|
||||
|
||||
@ -64,6 +64,11 @@ class interfaceColController extends baseController{
|
||||
return ctx.body = yapi.commons.resReturn(null, 400, '名称不能为空');
|
||||
}
|
||||
|
||||
let auth = await this.checkAuth(params.project_id, 'project', 'edit')
|
||||
if (!auth) {
|
||||
return ctx.body = yapi.commons.resReturn(null, 400, '没有权限');
|
||||
}
|
||||
|
||||
let result = await this.colModel.save({
|
||||
name: params.name,
|
||||
project_id: params.project_id,
|
||||
@ -133,9 +138,16 @@ class interfaceColController extends baseController{
|
||||
method: 'string'
|
||||
});
|
||||
|
||||
|
||||
if (!params.project_id) {
|
||||
return ctx.body = yapi.commons.resReturn(null, 400, '项目id不能为空');
|
||||
}
|
||||
|
||||
let auth = await this.checkAuth(params.project_id, 'project', 'edit')
|
||||
if (!auth) {
|
||||
return ctx.body = yapi.commons.resReturn(null, 400, '没有权限');
|
||||
}
|
||||
|
||||
if (!params.col_id) {
|
||||
return ctx.body = yapi.commons.resReturn(null, 400, '接口集id不能为空');
|
||||
}
|
||||
@ -192,11 +204,16 @@ class interfaceColController extends baseController{
|
||||
return ctx.body = yapi.commons.resReturn(null, 400, '用例id不能为空');
|
||||
}
|
||||
|
||||
|
||||
if(!params.casename){
|
||||
return ctx.body = yapi.commons.resReturn(null, 400, '用例名称不能为空');
|
||||
}
|
||||
|
||||
let caseData = await this.caseModel.get(id);
|
||||
let auth = await this.checkAuth(caseData.project_id, 'project', 'edit')
|
||||
if (!auth) {
|
||||
return ctx.body = yapi.commons.resReturn(null, 400, '没有权限');
|
||||
}
|
||||
|
||||
params.uid = this.getUid();
|
||||
|
||||
let result = await this.caseModel.up(params.id, params);
|
||||
@ -244,6 +261,13 @@ class interfaceColController extends baseController{
|
||||
async upCol(ctx){
|
||||
try{
|
||||
let params = ctx.request.body;
|
||||
let id = params.col_id;
|
||||
let colData = await this.colModel.get(id);
|
||||
let auth = await this.checkAuth(colData.project_id, 'project', 'edit')
|
||||
if (!auth) {
|
||||
return ctx.body = yapi.commons.resReturn(null, 400, '没有权限');
|
||||
}
|
||||
|
||||
let result = await this.colModel.up(params.col_id, {
|
||||
name: params.name,
|
||||
desc: params.desc,
|
||||
|
@ -589,6 +589,11 @@ class projectController extends baseController {
|
||||
if (!id) {
|
||||
return ctx.body = yapi.commons.resReturn(null, 405, '项目id不能为空');
|
||||
}
|
||||
|
||||
let auth = await this.checkAuth(id, 'project', 'danger')
|
||||
if (!auth) {
|
||||
return ctx.body = yapi.commons.resReturn(null, 400, '没有权限');
|
||||
}
|
||||
try {
|
||||
let result = await this.Model.up(id, data);
|
||||
ctx.body = yapi.commons.resReturn(result);
|
||||
|
@ -72,7 +72,7 @@ app.use(compress({
|
||||
}));
|
||||
|
||||
app.use(function () {
|
||||
var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(ctx, next) {
|
||||
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(ctx, next) {
|
||||
return _regenerator2.default.wrap(function _callee$(_context) {
|
||||
while (1) {
|
||||
switch (_context.prev = _context.next) {
|
||||
|
@ -59,7 +59,7 @@ var baseController = function () {
|
||||
(0, _createClass3.default)(baseController, [{
|
||||
key: 'init',
|
||||
value: function () {
|
||||
var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(ctx) {
|
||||
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(ctx) {
|
||||
var ignoreRouter;
|
||||
return _regenerator2.default.wrap(function _callee$(_context) {
|
||||
while (1) {
|
||||
@ -103,7 +103,7 @@ var baseController = function () {
|
||||
}, {
|
||||
key: 'checkLogin',
|
||||
value: function () {
|
||||
var _ref2 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee2(ctx) {
|
||||
var _ref2 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2(ctx) {
|
||||
var token, uid, userInst, result, decoded;
|
||||
return _regenerator2.default.wrap(function _callee2$(_context2) {
|
||||
while (1) {
|
||||
@ -170,7 +170,7 @@ var baseController = function () {
|
||||
}, {
|
||||
key: 'getLoginStatus',
|
||||
value: function () {
|
||||
var _ref3 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee3(ctx) {
|
||||
var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee3(ctx) {
|
||||
var result;
|
||||
return _regenerator2.default.wrap(function _callee3$(_context3) {
|
||||
while (1) {
|
||||
@ -222,7 +222,7 @@ var baseController = function () {
|
||||
}, {
|
||||
key: 'getProjectRole',
|
||||
value: function () {
|
||||
var _ref4 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee4(id, type) {
|
||||
var _ref4 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee4(id, type) {
|
||||
var _this = this;
|
||||
|
||||
var result, interfaceInst, interfaceData, projectInst, projectData, memberData, groupInst, groupData, groupMemberData;
|
||||
@ -379,7 +379,7 @@ var baseController = function () {
|
||||
}, {
|
||||
key: 'checkAuth',
|
||||
value: function () {
|
||||
var _ref5 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee5(id, type, action) {
|
||||
var _ref5 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee5(id, type, action) {
|
||||
var role;
|
||||
return _regenerator2.default.wrap(function _callee5$(_context5) {
|
||||
while (1) {
|
||||
|
@ -74,7 +74,7 @@ var followController = function (_baseController) {
|
||||
(0, _createClass3.default)(followController, [{
|
||||
key: 'list',
|
||||
value: function () {
|
||||
var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(ctx) {
|
||||
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(ctx) {
|
||||
var uid, page, limit, result;
|
||||
return _regenerator2.default.wrap(function _callee$(_context) {
|
||||
while (1) {
|
||||
@ -139,7 +139,7 @@ var followController = function (_baseController) {
|
||||
}, {
|
||||
key: 'del',
|
||||
value: function () {
|
||||
var _ref2 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee2(ctx) {
|
||||
var _ref2 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2(ctx) {
|
||||
var params, uid, checkRepeat, result;
|
||||
return _regenerator2.default.wrap(function _callee2$(_context2) {
|
||||
while (1) {
|
||||
@ -217,7 +217,7 @@ var followController = function (_baseController) {
|
||||
}, {
|
||||
key: 'add',
|
||||
value: function () {
|
||||
var _ref3 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee3(ctx) {
|
||||
var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee3(ctx) {
|
||||
var params, uid, checkRepeat, project, data, result;
|
||||
return _regenerator2.default.wrap(function _callee3$(_context3) {
|
||||
while (1) {
|
||||
|
@ -88,7 +88,7 @@ var groupController = function (_baseController) {
|
||||
(0, _createClass3.default)(groupController, [{
|
||||
key: 'get',
|
||||
value: function () {
|
||||
var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(ctx) {
|
||||
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(ctx) {
|
||||
var params, groupInst, result;
|
||||
return _regenerator2.default.wrap(function _callee$(_context) {
|
||||
while (1) {
|
||||
@ -160,7 +160,7 @@ var groupController = function (_baseController) {
|
||||
}, {
|
||||
key: 'add',
|
||||
value: function () {
|
||||
var _ref2 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee2(ctx) {
|
||||
var _ref2 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2(ctx) {
|
||||
var params, groupUserdata, groupInst, checkRepeat, data, result;
|
||||
return _regenerator2.default.wrap(function _callee2$(_context2) {
|
||||
while (1) {
|
||||
@ -272,7 +272,7 @@ var groupController = function (_baseController) {
|
||||
}, {
|
||||
key: 'getUserdata',
|
||||
value: function () {
|
||||
var _ref3 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee3(uid, role) {
|
||||
var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee3(uid, role) {
|
||||
var userInst, userData;
|
||||
return _regenerator2.default.wrap(function _callee3$(_context3) {
|
||||
while (1) {
|
||||
@ -333,7 +333,7 @@ var groupController = function (_baseController) {
|
||||
}, {
|
||||
key: 'addMember',
|
||||
value: function () {
|
||||
var _ref4 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee4(ctx) {
|
||||
var _ref4 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee4(ctx) {
|
||||
var params, groupInst, check, groupUserdata, result;
|
||||
return _regenerator2.default.wrap(function _callee4$(_context4) {
|
||||
while (1) {
|
||||
@ -446,7 +446,7 @@ var groupController = function (_baseController) {
|
||||
}, {
|
||||
key: 'changeMemberRole',
|
||||
value: function () {
|
||||
var _ref5 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee5(ctx) {
|
||||
var _ref5 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee5(ctx) {
|
||||
var params, groupInst, check, result;
|
||||
return _regenerator2.default.wrap(function _callee5$(_context5) {
|
||||
while (1) {
|
||||
@ -547,7 +547,7 @@ var groupController = function (_baseController) {
|
||||
}, {
|
||||
key: 'getMemberList',
|
||||
value: function () {
|
||||
var _ref6 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee6(ctx) {
|
||||
var _ref6 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee6(ctx) {
|
||||
var params, groupInst, group;
|
||||
return _regenerator2.default.wrap(function _callee6$(_context6) {
|
||||
while (1) {
|
||||
@ -611,7 +611,7 @@ var groupController = function (_baseController) {
|
||||
}, {
|
||||
key: 'delMember',
|
||||
value: function () {
|
||||
var _ref7 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee7(ctx) {
|
||||
var _ref7 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee7(ctx) {
|
||||
var params, groupInst, check, result;
|
||||
return _regenerator2.default.wrap(function _callee7$(_context7) {
|
||||
while (1) {
|
||||
@ -709,7 +709,7 @@ var groupController = function (_baseController) {
|
||||
}, {
|
||||
key: 'list',
|
||||
value: function () {
|
||||
var _ref8 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee8(ctx) {
|
||||
var _ref8 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee8(ctx) {
|
||||
var groupInst, result;
|
||||
return _regenerator2.default.wrap(function _callee8$(_context8) {
|
||||
while (1) {
|
||||
@ -762,7 +762,7 @@ var groupController = function (_baseController) {
|
||||
}, {
|
||||
key: 'del',
|
||||
value: function () {
|
||||
var _ref9 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee10(ctx) {
|
||||
var _ref9 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee10(ctx) {
|
||||
var _this2 = this;
|
||||
|
||||
var groupInst, projectInst, interfaceInst, interfaceColInst, interfaceCaseInst, _id, projectList, result;
|
||||
@ -802,7 +802,7 @@ var groupController = function (_baseController) {
|
||||
projectList = _context10.sent;
|
||||
|
||||
projectList.forEach(function () {
|
||||
var _ref10 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee9(p) {
|
||||
var _ref10 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee9(p) {
|
||||
return _regenerator2.default.wrap(function _callee9$(_context9) {
|
||||
while (1) {
|
||||
switch (_context9.prev = _context9.next) {
|
||||
@ -881,7 +881,7 @@ var groupController = function (_baseController) {
|
||||
}, {
|
||||
key: 'up',
|
||||
value: function () {
|
||||
var _ref11 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee11(ctx) {
|
||||
var _ref11 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee11(ctx) {
|
||||
var groupInst, _id2, data, result;
|
||||
|
||||
return _regenerator2.default.wrap(function _callee11$(_context11) {
|
||||
|
@ -105,15 +105,14 @@ var interfaceController = function (_baseController) {
|
||||
(0, _createClass3.default)(interfaceController, [{
|
||||
key: 'add',
|
||||
value: function () {
|
||||
var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(ctx) {
|
||||
var params, checkRepeat, data, result, username, cate;
|
||||
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(ctx) {
|
||||
var params, auth, checkRepeat, data, result, username, cate;
|
||||
return _regenerator2.default.wrap(function _callee$(_context) {
|
||||
while (1) {
|
||||
switch (_context.prev = _context.next) {
|
||||
case 0:
|
||||
params = ctx.request.body;
|
||||
|
||||
|
||||
params = _yapi2.default.commons.handleParams(params, {
|
||||
project_id: 'number',
|
||||
title: 'string',
|
||||
@ -122,49 +121,64 @@ var interfaceController = function (_baseController) {
|
||||
desc: 'string',
|
||||
catid: 'number'
|
||||
});
|
||||
|
||||
_context.next = 4;
|
||||
return this.checkAuth(params.project_id, 'project', 'edit');
|
||||
|
||||
case 4:
|
||||
auth = _context.sent;
|
||||
|
||||
if (auth) {
|
||||
_context.next = 7;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 400, '没有权限'));
|
||||
|
||||
case 7:
|
||||
params.method = params.method || 'GET';
|
||||
params.method = params.method.toUpperCase();
|
||||
params.res_body_type = params.res_body_type ? params.res_body_type.toLowerCase() : 'json';
|
||||
|
||||
if (params.project_id) {
|
||||
_context.next = 7;
|
||||
_context.next = 12;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 400, '项目id不能为空'));
|
||||
|
||||
case 7:
|
||||
case 12:
|
||||
if (params.path) {
|
||||
_context.next = 9;
|
||||
_context.next = 14;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 400, '接口请求路径不能为空'));
|
||||
|
||||
case 9:
|
||||
case 14:
|
||||
if (_yapi2.default.commons.verifyPath(params.path)) {
|
||||
_context.next = 11;
|
||||
_context.next = 16;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 400, '接口path第一位必须是/,最后一位不能为/'));
|
||||
|
||||
case 11:
|
||||
_context.next = 13;
|
||||
case 16:
|
||||
_context.next = 18;
|
||||
return this.Model.checkRepeat(params.project_id, params.path, params.method);
|
||||
|
||||
case 13:
|
||||
case 18:
|
||||
checkRepeat = _context.sent;
|
||||
|
||||
if (!(checkRepeat > 0)) {
|
||||
_context.next = 16;
|
||||
_context.next = 21;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 401, '已存在的接口:' + params.path + '[' + params.method + ']'));
|
||||
|
||||
case 16:
|
||||
_context.prev = 16;
|
||||
case 21:
|
||||
_context.prev = 21;
|
||||
data = {
|
||||
project_id: params.project_id,
|
||||
catid: params.catid,
|
||||
@ -199,18 +213,18 @@ var interfaceController = function (_baseController) {
|
||||
data.req_body_other = params.req_body_other;
|
||||
}
|
||||
|
||||
_context.next = 24;
|
||||
_context.next = 29;
|
||||
return this.Model.save(data);
|
||||
|
||||
case 24:
|
||||
case 29:
|
||||
result = _context.sent;
|
||||
username = this.getUsername();
|
||||
// let project = await this.projectModel.get(params.project_id);
|
||||
|
||||
_context.next = 28;
|
||||
_context.next = 33;
|
||||
return this.catModel.get(params.catid);
|
||||
|
||||
case 28:
|
||||
case 33:
|
||||
cate = _context.sent;
|
||||
|
||||
_yapi2.default.commons.saveLog({
|
||||
@ -221,21 +235,21 @@ var interfaceController = function (_baseController) {
|
||||
typeid: params.project_id
|
||||
});
|
||||
ctx.body = _yapi2.default.commons.resReturn(result);
|
||||
_context.next = 36;
|
||||
_context.next = 41;
|
||||
break;
|
||||
|
||||
case 33:
|
||||
_context.prev = 33;
|
||||
_context.t0 = _context['catch'](16);
|
||||
case 38:
|
||||
_context.prev = 38;
|
||||
_context.t0 = _context['catch'](21);
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(null, 402, _context.t0.message);
|
||||
|
||||
case 36:
|
||||
case 41:
|
||||
case 'end':
|
||||
return _context.stop();
|
||||
}
|
||||
}
|
||||
}, _callee, this, [[16, 33]]);
|
||||
}, _callee, this, [[21, 38]]);
|
||||
}));
|
||||
|
||||
function add(_x) {
|
||||
@ -259,7 +273,7 @@ var interfaceController = function (_baseController) {
|
||||
}, {
|
||||
key: 'get',
|
||||
value: function () {
|
||||
var _ref2 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee2(ctx) {
|
||||
var _ref2 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2(ctx) {
|
||||
var params, result;
|
||||
return _regenerator2.default.wrap(function _callee2$(_context2) {
|
||||
while (1) {
|
||||
@ -321,7 +335,7 @@ var interfaceController = function (_baseController) {
|
||||
}, {
|
||||
key: 'list',
|
||||
value: function () {
|
||||
var _ref3 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee3(ctx) {
|
||||
var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee3(ctx) {
|
||||
var project_id, result;
|
||||
return _regenerator2.default.wrap(function _callee3$(_context3) {
|
||||
while (1) {
|
||||
@ -371,7 +385,7 @@ var interfaceController = function (_baseController) {
|
||||
}, {
|
||||
key: 'listByCat',
|
||||
value: function () {
|
||||
var _ref4 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee4(ctx) {
|
||||
var _ref4 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee4(ctx) {
|
||||
var catid, result;
|
||||
return _regenerator2.default.wrap(function _callee4$(_context4) {
|
||||
while (1) {
|
||||
@ -421,7 +435,7 @@ var interfaceController = function (_baseController) {
|
||||
}, {
|
||||
key: 'listByMenu',
|
||||
value: function () {
|
||||
var _ref5 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee5(ctx) {
|
||||
var _ref5 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee5(ctx) {
|
||||
var project_id, result, newResult, i, item, list, j;
|
||||
return _regenerator2.default.wrap(function _callee5$(_context5) {
|
||||
while (1) {
|
||||
@ -526,8 +540,8 @@ var interfaceController = function (_baseController) {
|
||||
}, {
|
||||
key: 'up',
|
||||
value: function () {
|
||||
var _ref6 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee6(ctx) {
|
||||
var params, id, interfaceData, checkRepeat, data, result, username, cate, inter;
|
||||
var _ref6 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee6(ctx) {
|
||||
var params, id, interfaceData, auth, checkRepeat, data, result, username, cate, inter;
|
||||
return _regenerator2.default.wrap(function _callee6$(_context6) {
|
||||
while (1) {
|
||||
switch (_context6.prev = _context6.next) {
|
||||
@ -542,6 +556,7 @@ var interfaceController = function (_baseController) {
|
||||
desc: 'string',
|
||||
catid: 'number'
|
||||
});
|
||||
|
||||
params.method = params.method || 'GET';
|
||||
params.method = params.method.toUpperCase();
|
||||
|
||||
@ -560,34 +575,47 @@ var interfaceController = function (_baseController) {
|
||||
|
||||
case 9:
|
||||
interfaceData = _context6.sent;
|
||||
_context6.next = 12;
|
||||
return this.checkAuth(interfaceData.project_id, 'project', 'edit');
|
||||
|
||||
case 12:
|
||||
auth = _context6.sent;
|
||||
|
||||
if (auth) {
|
||||
_context6.next = 15;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context6.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 400, '没有权限'));
|
||||
|
||||
case 15:
|
||||
if (!(params.path && !_yapi2.default.commons.verifyPath(params.path))) {
|
||||
_context6.next = 12;
|
||||
_context6.next = 17;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context6.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 400, '接口path第一位必须是/,最后一位不能为/'));
|
||||
|
||||
case 12:
|
||||
case 17:
|
||||
if (!(params.path && params.path !== interfaceData.path && params.method !== interfaceData.method)) {
|
||||
_context6.next = 18;
|
||||
_context6.next = 23;
|
||||
break;
|
||||
}
|
||||
|
||||
_context6.next = 15;
|
||||
_context6.next = 20;
|
||||
return this.Model.checkRepeat(interfaceData.project_id, params.path, params.method);
|
||||
|
||||
case 15:
|
||||
case 20:
|
||||
checkRepeat = _context6.sent;
|
||||
|
||||
if (!(checkRepeat > 0)) {
|
||||
_context6.next = 18;
|
||||
_context6.next = 23;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context6.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 401, '已存在的接口:' + params.path + '[' + params.method + ']'));
|
||||
|
||||
case 18:
|
||||
case 23:
|
||||
data = {
|
||||
up_time: _yapi2.default.commons.time()
|
||||
};
|
||||
@ -646,41 +674,38 @@ var interfaceController = function (_baseController) {
|
||||
data.status = params.status;
|
||||
}
|
||||
|
||||
_context6.prev = 33;
|
||||
_context6.next = 36;
|
||||
_context6.prev = 38;
|
||||
_context6.next = 41;
|
||||
return this.Model.up(id, data);
|
||||
|
||||
case 36:
|
||||
case 41:
|
||||
result = _context6.sent;
|
||||
username = this.getUsername();
|
||||
cate = void 0;
|
||||
|
||||
if (!params.catid) {
|
||||
_context6.next = 45;
|
||||
_context6.next = 50;
|
||||
break;
|
||||
}
|
||||
|
||||
_context6.next = 42;
|
||||
_context6.next = 47;
|
||||
return this.catModel.get(+params.catid);
|
||||
|
||||
case 42:
|
||||
case 47:
|
||||
cate = _context6.sent;
|
||||
_context6.next = 51;
|
||||
_context6.next = 54;
|
||||
break;
|
||||
|
||||
case 45:
|
||||
_context6.next = 47;
|
||||
case 50:
|
||||
_context6.next = 52;
|
||||
return this.Model.get(id);
|
||||
|
||||
case 47:
|
||||
case 52:
|
||||
inter = _context6.sent;
|
||||
_context6.next = 50;
|
||||
return this.catModel.get(inter.catid);
|
||||
|
||||
case 50:
|
||||
cate = _context6.sent;
|
||||
cate = interfaceData.catid;
|
||||
|
||||
case 51:
|
||||
case 54:
|
||||
|
||||
_yapi2.default.commons.saveLog({
|
||||
content: '\u7528\u6237 "' + username + '" \u66F4\u65B0\u4E86\u5206\u7C7B "' + cate.name + '" \u4E0B\u7684\u63A5\u53E3 "' + data.title + '"',
|
||||
@ -690,21 +715,21 @@ var interfaceController = function (_baseController) {
|
||||
typeid: cate.project_id
|
||||
});
|
||||
ctx.body = _yapi2.default.commons.resReturn(result);
|
||||
_context6.next = 58;
|
||||
_context6.next = 61;
|
||||
break;
|
||||
|
||||
case 55:
|
||||
_context6.prev = 55;
|
||||
_context6.t0 = _context6['catch'](33);
|
||||
case 58:
|
||||
_context6.prev = 58;
|
||||
_context6.t0 = _context6['catch'](38);
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(null, 402, _context6.t0.message);
|
||||
|
||||
case 58:
|
||||
case 61:
|
||||
case 'end':
|
||||
return _context6.stop();
|
||||
}
|
||||
}
|
||||
}, _callee6, this, [[33, 55]]);
|
||||
}, _callee6, this, [[38, 58]]);
|
||||
}));
|
||||
|
||||
function up(_x6) {
|
||||
@ -728,8 +753,8 @@ var interfaceController = function (_baseController) {
|
||||
}, {
|
||||
key: 'del',
|
||||
value: function () {
|
||||
var _ref7 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee7(ctx) {
|
||||
var id, data, inter, result, username, cate;
|
||||
var _ref7 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee7(ctx) {
|
||||
var id, data, auth, inter, result, username, cate;
|
||||
return _regenerator2.default.wrap(function _callee7$(_context7) {
|
||||
while (1) {
|
||||
switch (_context7.prev = _context7.next) {
|
||||
@ -757,17 +782,17 @@ var interfaceController = function (_baseController) {
|
||||
}
|
||||
|
||||
_context7.next = 10;
|
||||
return this.jungeProjectAuth(data.project_id);
|
||||
return this.checkAuth(data.project_id, 'project', 'danger');
|
||||
|
||||
case 10:
|
||||
_context7.t0 = _context7.sent;
|
||||
auth = _context7.sent;
|
||||
|
||||
if (!(_context7.t0 !== true)) {
|
||||
if (auth) {
|
||||
_context7.next = 13;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context7.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 405, '没有权限'));
|
||||
return _context7.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 400, '没有权限'));
|
||||
|
||||
case 13:
|
||||
_context7.next = 15;
|
||||
@ -801,9 +826,9 @@ var interfaceController = function (_baseController) {
|
||||
|
||||
case 27:
|
||||
_context7.prev = 27;
|
||||
_context7.t1 = _context7['catch'](0);
|
||||
_context7.t0 = _context7['catch'](0);
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(null, 402, _context7.t1.message);
|
||||
ctx.body = _yapi2.default.commons.resReturn(null, 402, _context7.t0.message);
|
||||
|
||||
case 30:
|
||||
case 'end':
|
||||
@ -822,7 +847,7 @@ var interfaceController = function (_baseController) {
|
||||
}, {
|
||||
key: 'solveConflict',
|
||||
value: function () {
|
||||
var _ref8 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee8(ctx) {
|
||||
var _ref8 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee8(ctx) {
|
||||
var _this2 = this;
|
||||
|
||||
var id, result, userInst, userinfo, data;
|
||||
@ -905,8 +930,8 @@ var interfaceController = function (_baseController) {
|
||||
}, {
|
||||
key: 'addCat',
|
||||
value: function () {
|
||||
var _ref9 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee9(ctx) {
|
||||
var params, result, username;
|
||||
var _ref9 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee9(ctx) {
|
||||
var params, auth, result, username;
|
||||
return _regenerator2.default.wrap(function _callee9$(_context9) {
|
||||
while (1) {
|
||||
switch (_context9.prev = _context9.next) {
|
||||
@ -928,15 +953,29 @@ var interfaceController = function (_baseController) {
|
||||
return _context9.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 400, '项目id不能为空'));
|
||||
|
||||
case 5:
|
||||
_context9.next = 7;
|
||||
return this.checkAuth(params.project_id, 'project', 'edit');
|
||||
|
||||
case 7:
|
||||
auth = _context9.sent;
|
||||
|
||||
if (auth) {
|
||||
_context9.next = 10;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context9.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 400, '没有权限'));
|
||||
|
||||
case 10:
|
||||
if (params.name) {
|
||||
_context9.next = 7;
|
||||
_context9.next = 12;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context9.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 400, '名称不能为空'));
|
||||
|
||||
case 7:
|
||||
_context9.next = 9;
|
||||
case 12:
|
||||
_context9.next = 14;
|
||||
return this.catModel.save({
|
||||
name: params.name,
|
||||
project_id: params.project_id,
|
||||
@ -946,7 +985,7 @@ var interfaceController = function (_baseController) {
|
||||
up_time: _yapi2.default.commons.time()
|
||||
});
|
||||
|
||||
case 9:
|
||||
case 14:
|
||||
result = _context9.sent;
|
||||
username = this.getUsername();
|
||||
|
||||
@ -960,21 +999,21 @@ var interfaceController = function (_baseController) {
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(result);
|
||||
|
||||
_context9.next = 18;
|
||||
_context9.next = 23;
|
||||
break;
|
||||
|
||||
case 15:
|
||||
_context9.prev = 15;
|
||||
case 20:
|
||||
_context9.prev = 20;
|
||||
_context9.t0 = _context9['catch'](0);
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(null, 402, _context9.t0.message);
|
||||
|
||||
case 18:
|
||||
case 23:
|
||||
case 'end':
|
||||
return _context9.stop();
|
||||
}
|
||||
}
|
||||
}, _callee9, this, [[0, 15]]);
|
||||
}, _callee9, this, [[0, 20]]);
|
||||
}));
|
||||
|
||||
function addCat(_x9) {
|
||||
@ -986,8 +1025,8 @@ var interfaceController = function (_baseController) {
|
||||
}, {
|
||||
key: 'upCat',
|
||||
value: function () {
|
||||
var _ref10 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee10(ctx) {
|
||||
var params, result, username, cate;
|
||||
var _ref10 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee10(ctx) {
|
||||
var params, result, username, cate, auth;
|
||||
return _regenerator2.default.wrap(function _callee10$(_context10) {
|
||||
while (1) {
|
||||
switch (_context10.prev = _context10.next) {
|
||||
@ -1009,7 +1048,20 @@ var interfaceController = function (_baseController) {
|
||||
|
||||
case 8:
|
||||
cate = _context10.sent;
|
||||
_context10.next = 11;
|
||||
return this.checkAuth(cate.project_id, 'project', 'edit');
|
||||
|
||||
case 11:
|
||||
auth = _context10.sent;
|
||||
|
||||
if (auth) {
|
||||
_context10.next = 14;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context10.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 400, '没有权限'));
|
||||
|
||||
case 14:
|
||||
_yapi2.default.commons.saveLog({
|
||||
content: '\u7528\u6237 "' + username + '" \u66F4\u65B0\u4E86\u5206\u7C7B "' + cate.name + '"',
|
||||
type: 'project',
|
||||
@ -1019,21 +1071,21 @@ var interfaceController = function (_baseController) {
|
||||
});
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(result);
|
||||
_context10.next = 16;
|
||||
_context10.next = 21;
|
||||
break;
|
||||
|
||||
case 13:
|
||||
_context10.prev = 13;
|
||||
case 18:
|
||||
_context10.prev = 18;
|
||||
_context10.t0 = _context10['catch'](0);
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(null, 400, _context10.t0.message);
|
||||
|
||||
case 16:
|
||||
case 21:
|
||||
case 'end':
|
||||
return _context10.stop();
|
||||
}
|
||||
}
|
||||
}, _callee10, this, [[0, 13]]);
|
||||
}, _callee10, this, [[0, 18]]);
|
||||
}));
|
||||
|
||||
function upCat(_x10) {
|
||||
@ -1045,7 +1097,7 @@ var interfaceController = function (_baseController) {
|
||||
}, {
|
||||
key: 'delCat',
|
||||
value: function () {
|
||||
var _ref11 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee11(ctx) {
|
||||
var _ref11 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee11(ctx) {
|
||||
var id, catData, auth, cate, result, r, username;
|
||||
return _regenerator2.default.wrap(function _callee11$(_context11) {
|
||||
while (1) {
|
||||
|
@ -74,16 +74,17 @@ var interfaceColController = function (_baseController) {
|
||||
(0, _createClass3.default)(interfaceColController, [{
|
||||
key: 'list',
|
||||
value: function () {
|
||||
var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(ctx) {
|
||||
var id, result, i;
|
||||
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(ctx) {
|
||||
var _id, result, i;
|
||||
|
||||
return _regenerator2.default.wrap(function _callee$(_context) {
|
||||
while (1) {
|
||||
switch (_context.prev = _context.next) {
|
||||
case 0:
|
||||
_context.prev = 0;
|
||||
id = ctx.query.project_id;
|
||||
_id = ctx.query.project_id;
|
||||
_context.next = 4;
|
||||
return this.colModel.list(id);
|
||||
return this.colModel.list(_id);
|
||||
|
||||
case 4:
|
||||
result = _context.sent;
|
||||
@ -149,8 +150,8 @@ var interfaceColController = function (_baseController) {
|
||||
}, {
|
||||
key: 'addCol',
|
||||
value: function () {
|
||||
var _ref2 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee2(ctx) {
|
||||
var params, result;
|
||||
var _ref2 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2(ctx) {
|
||||
var params, auth, result;
|
||||
return _regenerator2.default.wrap(function _callee2$(_context2) {
|
||||
while (1) {
|
||||
switch (_context2.prev = _context2.next) {
|
||||
@ -181,6 +182,20 @@ var interfaceColController = function (_baseController) {
|
||||
|
||||
case 7:
|
||||
_context2.next = 9;
|
||||
return this.checkAuth(params.project_id, 'project', 'edit');
|
||||
|
||||
case 9:
|
||||
auth = _context2.sent;
|
||||
|
||||
if (auth) {
|
||||
_context2.next = 12;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context2.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 400, '没有权限'));
|
||||
|
||||
case 12:
|
||||
_context2.next = 14;
|
||||
return this.colModel.save({
|
||||
name: params.name,
|
||||
project_id: params.project_id,
|
||||
@ -190,26 +205,26 @@ var interfaceColController = function (_baseController) {
|
||||
up_time: _yapi2.default.commons.time()
|
||||
});
|
||||
|
||||
case 9:
|
||||
case 14:
|
||||
result = _context2.sent;
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(result);
|
||||
|
||||
_context2.next = 16;
|
||||
_context2.next = 21;
|
||||
break;
|
||||
|
||||
case 13:
|
||||
_context2.prev = 13;
|
||||
case 18:
|
||||
_context2.prev = 18;
|
||||
_context2.t0 = _context2['catch'](0);
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(null, 402, _context2.t0.message);
|
||||
|
||||
case 16:
|
||||
case 21:
|
||||
case 'end':
|
||||
return _context2.stop();
|
||||
}
|
||||
}
|
||||
}, _callee2, this, [[0, 13]]);
|
||||
}, _callee2, this, [[0, 18]]);
|
||||
}));
|
||||
|
||||
function addCol(_x2) {
|
||||
@ -233,17 +248,18 @@ var interfaceColController = function (_baseController) {
|
||||
}, {
|
||||
key: 'getCaseList',
|
||||
value: function () {
|
||||
var _ref3 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee3(ctx) {
|
||||
var id, inst, result;
|
||||
var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee3(ctx) {
|
||||
var _id2, inst, result;
|
||||
|
||||
return _regenerator2.default.wrap(function _callee3$(_context3) {
|
||||
while (1) {
|
||||
switch (_context3.prev = _context3.next) {
|
||||
case 0:
|
||||
_context3.prev = 0;
|
||||
id = ctx.query.col_id;
|
||||
_id2 = ctx.query.col_id;
|
||||
inst = _yapi2.default.getInst(_interfaceCase2.default);
|
||||
_context3.next = 5;
|
||||
return inst.list(id, 'all');
|
||||
return inst.list(_id2, 'all');
|
||||
|
||||
case 5:
|
||||
result = _context3.sent;
|
||||
@ -297,8 +313,8 @@ var interfaceColController = function (_baseController) {
|
||||
}, {
|
||||
key: 'addCase',
|
||||
value: function () {
|
||||
var _ref4 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee4(ctx) {
|
||||
var params, result;
|
||||
var _ref4 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee4(ctx) {
|
||||
var params, auth, result;
|
||||
return _regenerator2.default.wrap(function _callee4$(_context4) {
|
||||
while (1) {
|
||||
switch (_context4.prev = _context4.next) {
|
||||
@ -322,51 +338,65 @@ var interfaceColController = function (_baseController) {
|
||||
return _context4.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 400, '项目id不能为空'));
|
||||
|
||||
case 5:
|
||||
_context4.next = 7;
|
||||
return this.checkAuth(params.project_id, 'project', 'edit');
|
||||
|
||||
case 7:
|
||||
auth = _context4.sent;
|
||||
|
||||
if (auth) {
|
||||
_context4.next = 10;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context4.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 400, '没有权限'));
|
||||
|
||||
case 10:
|
||||
if (params.col_id) {
|
||||
_context4.next = 7;
|
||||
_context4.next = 12;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context4.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 400, '接口集id不能为空'));
|
||||
|
||||
case 7:
|
||||
case 12:
|
||||
if (params.casename) {
|
||||
_context4.next = 9;
|
||||
_context4.next = 14;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context4.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 400, '用例名称不能为空'));
|
||||
|
||||
case 9:
|
||||
case 14:
|
||||
|
||||
params.uid = this.getUid();
|
||||
params.index = 0;
|
||||
params.add_time = _yapi2.default.commons.time();
|
||||
params.up_time = _yapi2.default.commons.time();
|
||||
_context4.next = 15;
|
||||
_context4.next = 20;
|
||||
return this.caseModel.save(params);
|
||||
|
||||
case 15:
|
||||
case 20:
|
||||
result = _context4.sent;
|
||||
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(result);
|
||||
|
||||
_context4.next = 22;
|
||||
_context4.next = 27;
|
||||
break;
|
||||
|
||||
case 19:
|
||||
_context4.prev = 19;
|
||||
case 24:
|
||||
_context4.prev = 24;
|
||||
_context4.t0 = _context4['catch'](0);
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(null, 402, _context4.t0.message);
|
||||
|
||||
case 22:
|
||||
case 27:
|
||||
case 'end':
|
||||
return _context4.stop();
|
||||
}
|
||||
}
|
||||
}, _callee4, this, [[0, 19]]);
|
||||
}, _callee4, this, [[0, 24]]);
|
||||
}));
|
||||
|
||||
function addCase(_x4) {
|
||||
@ -399,8 +429,8 @@ var interfaceColController = function (_baseController) {
|
||||
}, {
|
||||
key: 'upCase',
|
||||
value: function () {
|
||||
var _ref5 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee5(ctx) {
|
||||
var params, result;
|
||||
var _ref5 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee5(ctx) {
|
||||
var params, caseData, auth, result;
|
||||
return _regenerator2.default.wrap(function _callee5$(_context5) {
|
||||
while (1) {
|
||||
switch (_context5.prev = _context5.next) {
|
||||
@ -431,33 +461,52 @@ var interfaceColController = function (_baseController) {
|
||||
return _context5.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 400, '用例名称不能为空'));
|
||||
|
||||
case 7:
|
||||
_context5.next = 9;
|
||||
return this.caseModel.get(id);
|
||||
|
||||
case 9:
|
||||
caseData = _context5.sent;
|
||||
_context5.next = 12;
|
||||
return this.checkAuth(caseData.project_id, 'project', 'edit');
|
||||
|
||||
case 12:
|
||||
auth = _context5.sent;
|
||||
|
||||
if (auth) {
|
||||
_context5.next = 15;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context5.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 400, '没有权限'));
|
||||
|
||||
case 15:
|
||||
|
||||
params.uid = this.getUid();
|
||||
|
||||
_context5.next = 10;
|
||||
_context5.next = 18;
|
||||
return this.caseModel.up(params.id, params);
|
||||
|
||||
case 10:
|
||||
case 18:
|
||||
result = _context5.sent;
|
||||
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(result);
|
||||
|
||||
_context5.next = 17;
|
||||
_context5.next = 25;
|
||||
break;
|
||||
|
||||
case 14:
|
||||
_context5.prev = 14;
|
||||
case 22:
|
||||
_context5.prev = 22;
|
||||
_context5.t0 = _context5['catch'](0);
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(null, 402, _context5.t0.message);
|
||||
|
||||
case 17:
|
||||
case 25:
|
||||
case 'end':
|
||||
return _context5.stop();
|
||||
}
|
||||
}
|
||||
}, _callee5, this, [[0, 14]]);
|
||||
}, _callee5, this, [[0, 22]]);
|
||||
}));
|
||||
|
||||
function upCase(_x5) {
|
||||
@ -481,16 +530,17 @@ var interfaceColController = function (_baseController) {
|
||||
}, {
|
||||
key: 'getCase',
|
||||
value: function () {
|
||||
var _ref6 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee6(ctx) {
|
||||
var id, result;
|
||||
var _ref6 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee6(ctx) {
|
||||
var _id3, result;
|
||||
|
||||
return _regenerator2.default.wrap(function _callee6$(_context6) {
|
||||
while (1) {
|
||||
switch (_context6.prev = _context6.next) {
|
||||
case 0:
|
||||
_context6.prev = 0;
|
||||
id = ctx.query.caseid;
|
||||
_id3 = ctx.query.caseid;
|
||||
_context6.next = 4;
|
||||
return this.caseModel.get(id);
|
||||
return this.caseModel.get(_id3);
|
||||
|
||||
case 4:
|
||||
result = _context6.sent;
|
||||
@ -535,40 +585,61 @@ var interfaceColController = function (_baseController) {
|
||||
}, {
|
||||
key: 'upCol',
|
||||
value: function () {
|
||||
var _ref7 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee7(ctx) {
|
||||
var params, result;
|
||||
var _ref7 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee7(ctx) {
|
||||
var params, _id4, colData, auth, result;
|
||||
|
||||
return _regenerator2.default.wrap(function _callee7$(_context7) {
|
||||
while (1) {
|
||||
switch (_context7.prev = _context7.next) {
|
||||
case 0:
|
||||
_context7.prev = 0;
|
||||
params = ctx.request.body;
|
||||
_context7.next = 4;
|
||||
_id4 = params.col_id;
|
||||
_context7.next = 5;
|
||||
return this.colModel.get(_id4);
|
||||
|
||||
case 5:
|
||||
colData = _context7.sent;
|
||||
_context7.next = 8;
|
||||
return this.checkAuth(colData.project_id, 'project', 'edit');
|
||||
|
||||
case 8:
|
||||
auth = _context7.sent;
|
||||
|
||||
if (auth) {
|
||||
_context7.next = 11;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context7.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 400, '没有权限'));
|
||||
|
||||
case 11:
|
||||
_context7.next = 13;
|
||||
return this.colModel.up(params.col_id, {
|
||||
name: params.name,
|
||||
desc: params.desc,
|
||||
up_time: _yapi2.default.commons.time()
|
||||
});
|
||||
|
||||
case 4:
|
||||
case 13:
|
||||
result = _context7.sent;
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(result);
|
||||
_context7.next = 11;
|
||||
_context7.next = 20;
|
||||
break;
|
||||
|
||||
case 8:
|
||||
_context7.prev = 8;
|
||||
case 17:
|
||||
_context7.prev = 17;
|
||||
_context7.t0 = _context7['catch'](0);
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(null, 400, _context7.t0.message);
|
||||
|
||||
case 11:
|
||||
case 20:
|
||||
case 'end':
|
||||
return _context7.stop();
|
||||
}
|
||||
}
|
||||
}, _callee7, this, [[0, 8]]);
|
||||
}, _callee7, this, [[0, 17]]);
|
||||
}));
|
||||
|
||||
function upCol(_x7) {
|
||||
@ -592,7 +663,7 @@ var interfaceColController = function (_baseController) {
|
||||
}, {
|
||||
key: 'upCaseIndex',
|
||||
value: function () {
|
||||
var _ref8 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee8(ctx) {
|
||||
var _ref8 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee8(ctx) {
|
||||
var _this2 = this;
|
||||
|
||||
var params;
|
||||
@ -651,16 +722,17 @@ var interfaceColController = function (_baseController) {
|
||||
}, {
|
||||
key: 'delCol',
|
||||
value: function () {
|
||||
var _ref9 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee9(ctx) {
|
||||
var id, colData, auth, result;
|
||||
var _ref9 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee9(ctx) {
|
||||
var _id5, colData, auth, result;
|
||||
|
||||
return _regenerator2.default.wrap(function _callee9$(_context9) {
|
||||
while (1) {
|
||||
switch (_context9.prev = _context9.next) {
|
||||
case 0:
|
||||
_context9.prev = 0;
|
||||
id = ctx.query.col_id;
|
||||
_id5 = ctx.query.col_id;
|
||||
_context9.next = 4;
|
||||
return this.colModel.get(id);
|
||||
return this.colModel.get(_id5);
|
||||
|
||||
case 4:
|
||||
colData = _context9.sent;
|
||||
@ -689,12 +761,12 @@ var interfaceColController = function (_baseController) {
|
||||
|
||||
case 12:
|
||||
_context9.next = 14;
|
||||
return this.colModel.del(id);
|
||||
return this.colModel.del(_id5);
|
||||
|
||||
case 14:
|
||||
result = _context9.sent;
|
||||
_context9.next = 17;
|
||||
return this.caseModel.delByCol(id);
|
||||
return this.caseModel.delByCol(_id5);
|
||||
|
||||
case 17:
|
||||
return _context9.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(result));
|
||||
@ -728,7 +800,7 @@ var interfaceColController = function (_baseController) {
|
||||
}, {
|
||||
key: 'delCase',
|
||||
value: function () {
|
||||
var _ref10 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee10(ctx) {
|
||||
var _ref10 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee10(ctx) {
|
||||
var caseid, caseData, auth, result;
|
||||
return _regenerator2.default.wrap(function _callee10$(_context10) {
|
||||
while (1) {
|
||||
|
@ -75,7 +75,7 @@ var logController = function (_baseController) {
|
||||
(0, _createClass3.default)(logController, [{
|
||||
key: 'list',
|
||||
value: function () {
|
||||
var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(ctx) {
|
||||
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(ctx) {
|
||||
var typeid, page, limit, type, result, count;
|
||||
return _regenerator2.default.wrap(function _callee$(_context) {
|
||||
while (1) {
|
||||
|
@ -148,7 +148,7 @@ var projectController = function (_baseController) {
|
||||
}, {
|
||||
key: 'add',
|
||||
value: function () {
|
||||
var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(ctx) {
|
||||
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(ctx) {
|
||||
var params, checkRepeat, data, result, colInst, catInst, username;
|
||||
return _regenerator2.default.wrap(function _callee$(_context) {
|
||||
while (1) {
|
||||
@ -321,7 +321,7 @@ var projectController = function (_baseController) {
|
||||
}, {
|
||||
key: 'addMember',
|
||||
value: function () {
|
||||
var _ref2 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee2(ctx) {
|
||||
var _ref2 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2(ctx) {
|
||||
var params, check, userdata, result, username;
|
||||
return _regenerator2.default.wrap(function _callee2$(_context2) {
|
||||
while (1) {
|
||||
@ -444,7 +444,7 @@ var projectController = function (_baseController) {
|
||||
}, {
|
||||
key: 'delMember',
|
||||
value: function () {
|
||||
var _ref3 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee3(ctx) {
|
||||
var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee3(ctx) {
|
||||
var params, check, result, username, project, member;
|
||||
return _regenerator2.default.wrap(function _callee3$(_context3) {
|
||||
while (1) {
|
||||
@ -548,7 +548,7 @@ var projectController = function (_baseController) {
|
||||
}, {
|
||||
key: 'getUserdata',
|
||||
value: function () {
|
||||
var _ref4 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee4(uid, role) {
|
||||
var _ref4 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee4(uid, role) {
|
||||
var userInst, userData;
|
||||
return _regenerator2.default.wrap(function _callee4$(_context4) {
|
||||
while (1) {
|
||||
@ -606,7 +606,7 @@ var projectController = function (_baseController) {
|
||||
}, {
|
||||
key: 'getMemberList',
|
||||
value: function () {
|
||||
var _ref5 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee5(ctx) {
|
||||
var _ref5 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee5(ctx) {
|
||||
var params, project;
|
||||
return _regenerator2.default.wrap(function _callee5$(_context5) {
|
||||
while (1) {
|
||||
@ -668,7 +668,7 @@ var projectController = function (_baseController) {
|
||||
}, {
|
||||
key: 'get',
|
||||
value: function () {
|
||||
var _ref6 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee6(ctx) {
|
||||
var _ref6 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee6(ctx) {
|
||||
var params, result, catInst, cat;
|
||||
return _regenerator2.default.wrap(function _callee6$(_context6) {
|
||||
while (1) {
|
||||
@ -753,7 +753,7 @@ var projectController = function (_baseController) {
|
||||
}, {
|
||||
key: 'list',
|
||||
value: function () {
|
||||
var _ref7 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee7(ctx) {
|
||||
var _ref7 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee7(ctx) {
|
||||
var group_id, auth, result, follow, uids, _users, users;
|
||||
|
||||
return _regenerator2.default.wrap(function _callee7$(_context7) {
|
||||
@ -853,7 +853,7 @@ var projectController = function (_baseController) {
|
||||
}, {
|
||||
key: 'del',
|
||||
value: function () {
|
||||
var _ref8 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee8(ctx) {
|
||||
var _ref8 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee8(ctx) {
|
||||
var id, interfaceInst, interfaceColInst, interfaceCaseInst, result;
|
||||
return _regenerator2.default.wrap(function _callee8$(_context8) {
|
||||
while (1) {
|
||||
@ -946,7 +946,7 @@ var projectController = function (_baseController) {
|
||||
}, {
|
||||
key: 'changeMemberRole',
|
||||
value: function () {
|
||||
var _ref9 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee9(ctx) {
|
||||
var _ref9 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee9(ctx) {
|
||||
var params, projectInst, check, result, username, project, member;
|
||||
return _regenerator2.default.wrap(function _callee9$(_context9) {
|
||||
while (1) {
|
||||
@ -1068,7 +1068,7 @@ var projectController = function (_baseController) {
|
||||
}, {
|
||||
key: 'upSet',
|
||||
value: function () {
|
||||
var _ref10 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee10(ctx) {
|
||||
var _ref10 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee10(ctx) {
|
||||
var id, data, result;
|
||||
return _regenerator2.default.wrap(function _callee10$(_context10) {
|
||||
while (1) {
|
||||
@ -1147,7 +1147,7 @@ var projectController = function (_baseController) {
|
||||
}, {
|
||||
key: 'up',
|
||||
value: function () {
|
||||
var _ref11 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee11(ctx) {
|
||||
var _ref11 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee11(ctx) {
|
||||
var id, params, projectData, checkRepeat, data, result, username;
|
||||
return _regenerator2.default.wrap(function _callee11$(_context11) {
|
||||
while (1) {
|
||||
@ -1294,8 +1294,8 @@ var projectController = function (_baseController) {
|
||||
}, {
|
||||
key: 'upSet',
|
||||
value: function () {
|
||||
var _ref12 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee12(ctx) {
|
||||
var id, data, result;
|
||||
var _ref12 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee12(ctx) {
|
||||
var id, data, auth, result;
|
||||
return _regenerator2.default.wrap(function _callee12$(_context12) {
|
||||
while (1) {
|
||||
switch (_context12.prev = _context12.next) {
|
||||
@ -1314,36 +1314,50 @@ var projectController = function (_baseController) {
|
||||
return _context12.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 405, '项目id不能为空'));
|
||||
|
||||
case 6:
|
||||
_context12.prev = 6;
|
||||
_context12.next = 9;
|
||||
_context12.next = 8;
|
||||
return this.checkAuth(id, 'project', 'danger');
|
||||
|
||||
case 8:
|
||||
auth = _context12.sent;
|
||||
|
||||
if (auth) {
|
||||
_context12.next = 11;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context12.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 400, '没有权限'));
|
||||
|
||||
case 11:
|
||||
_context12.prev = 11;
|
||||
_context12.next = 14;
|
||||
return this.Model.up(id, data);
|
||||
|
||||
case 9:
|
||||
case 14:
|
||||
result = _context12.sent;
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(result);
|
||||
_context12.next = 16;
|
||||
_context12.next = 21;
|
||||
break;
|
||||
|
||||
case 13:
|
||||
_context12.prev = 13;
|
||||
_context12.t0 = _context12['catch'](6);
|
||||
case 18:
|
||||
_context12.prev = 18;
|
||||
_context12.t0 = _context12['catch'](11);
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(null, 402, _context12.t0.message);
|
||||
|
||||
case 16:
|
||||
case 21:
|
||||
try {
|
||||
this.followModel.updateById(this.getUid(), id, data).then();
|
||||
} catch (e) {
|
||||
_yapi2.default.commons.log(e, 'error'); // eslint-disable-line
|
||||
}
|
||||
|
||||
case 17:
|
||||
case 22:
|
||||
case 'end':
|
||||
return _context12.stop();
|
||||
}
|
||||
}
|
||||
}, _callee12, this, [[6, 13]]);
|
||||
}, _callee12, this, [[11, 18]]);
|
||||
}));
|
||||
|
||||
function upSet(_x13) {
|
||||
@ -1367,7 +1381,7 @@ var projectController = function (_baseController) {
|
||||
}, {
|
||||
key: 'search',
|
||||
value: function () {
|
||||
var _ref13 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee13(ctx) {
|
||||
var _ref13 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee13(ctx) {
|
||||
var q, projectList, groupList, projectRules, groupRules, queryList;
|
||||
return _regenerator2.default.wrap(function _callee13$(_context13) {
|
||||
while (1) {
|
||||
@ -1442,7 +1456,7 @@ var projectController = function (_baseController) {
|
||||
}, {
|
||||
key: 'download',
|
||||
value: function () {
|
||||
var _ref14 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee14(ctx) {
|
||||
var _ref14 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee14(ctx) {
|
||||
var project_id, interfaceInst, count, arr, fileName, res;
|
||||
return _regenerator2.default.wrap(function _callee14$(_context14) {
|
||||
while (1) {
|
||||
|
@ -99,7 +99,7 @@ var userController = function (_baseController) {
|
||||
(0, _createClass3.default)(userController, [{
|
||||
key: 'login',
|
||||
value: function () {
|
||||
var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(ctx) {
|
||||
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(ctx) {
|
||||
var userInst, email, password, result;
|
||||
return _regenerator2.default.wrap(function _callee$(_context) {
|
||||
while (1) {
|
||||
@ -190,7 +190,7 @@ var userController = function (_baseController) {
|
||||
}, {
|
||||
key: 'logout',
|
||||
value: function () {
|
||||
var _ref2 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee2(ctx) {
|
||||
var _ref2 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2(ctx) {
|
||||
return _regenerator2.default.wrap(function _callee2$(_context2) {
|
||||
while (1) {
|
||||
switch (_context2.prev = _context2.next) {
|
||||
@ -248,7 +248,7 @@ var userController = function (_baseController) {
|
||||
}, {
|
||||
key: 'loginByToken',
|
||||
value: function () {
|
||||
var _ref3 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee3(ctx) {
|
||||
var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee3(ctx) {
|
||||
var config, token, ret, login;
|
||||
return _regenerator2.default.wrap(function _callee3$(_context3) {
|
||||
while (1) {
|
||||
@ -300,7 +300,7 @@ var userController = function (_baseController) {
|
||||
}, {
|
||||
key: 'handleThirdLogin',
|
||||
value: function () {
|
||||
var _ref4 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee4(email, username) {
|
||||
var _ref4 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee4(email, username) {
|
||||
var user, data, passsalt, userInst;
|
||||
return _regenerator2.default.wrap(function _callee4$(_context4) {
|
||||
while (1) {
|
||||
@ -384,7 +384,7 @@ var userController = function (_baseController) {
|
||||
}, {
|
||||
key: 'changePassword',
|
||||
value: function () {
|
||||
var _ref5 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee5(ctx) {
|
||||
var _ref5 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee5(ctx) {
|
||||
var params, userInst, user, passsalt, data, result;
|
||||
return _regenerator2.default.wrap(function _callee5$(_context5) {
|
||||
while (1) {
|
||||
@ -512,7 +512,7 @@ var userController = function (_baseController) {
|
||||
}, {
|
||||
key: 'reg',
|
||||
value: function () {
|
||||
var _ref6 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee6(ctx) {
|
||||
var _ref6 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee6(ctx) {
|
||||
var userInst, params, checkRepeat, passsalt, data, user;
|
||||
return _regenerator2.default.wrap(function _callee6$(_context6) {
|
||||
while (1) {
|
||||
@ -636,7 +636,7 @@ var userController = function (_baseController) {
|
||||
}, {
|
||||
key: 'list',
|
||||
value: function () {
|
||||
var _ref7 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee7(ctx) {
|
||||
var _ref7 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee7(ctx) {
|
||||
var page, limit, userInst, user, count;
|
||||
return _regenerator2.default.wrap(function _callee7$(_context7) {
|
||||
while (1) {
|
||||
@ -694,7 +694,7 @@ var userController = function (_baseController) {
|
||||
}, {
|
||||
key: 'findById',
|
||||
value: function () {
|
||||
var _ref8 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee8(ctx) {
|
||||
var _ref8 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee8(ctx) {
|
||||
var userInst, id, result;
|
||||
return _regenerator2.default.wrap(function _callee8$(_context8) {
|
||||
while (1) {
|
||||
@ -770,7 +770,7 @@ var userController = function (_baseController) {
|
||||
}, {
|
||||
key: 'del',
|
||||
value: function () {
|
||||
var _ref9 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee9(ctx) {
|
||||
var _ref9 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee9(ctx) {
|
||||
var userInst, id, result;
|
||||
return _regenerator2.default.wrap(function _callee9$(_context9) {
|
||||
while (1) {
|
||||
@ -846,7 +846,7 @@ var userController = function (_baseController) {
|
||||
}, {
|
||||
key: 'update',
|
||||
value: function () {
|
||||
var _ref10 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee10(ctx) {
|
||||
var _ref10 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee10(ctx) {
|
||||
var params, userInst, id, data, checkRepeat, result;
|
||||
return _regenerator2.default.wrap(function _callee10$(_context10) {
|
||||
while (1) {
|
||||
@ -952,7 +952,7 @@ var userController = function (_baseController) {
|
||||
}, {
|
||||
key: 'uploadAvatar',
|
||||
value: function () {
|
||||
var _ref11 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee11(ctx) {
|
||||
var _ref11 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee11(ctx) {
|
||||
var basecode, pngPrefix, jpegPrefix, type, strLength, avatarInst, result;
|
||||
return _regenerator2.default.wrap(function _callee11$(_context11) {
|
||||
while (1) {
|
||||
@ -1054,7 +1054,7 @@ var userController = function (_baseController) {
|
||||
}, {
|
||||
key: 'avatar',
|
||||
value: function () {
|
||||
var _ref12 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee12(ctx) {
|
||||
var _ref12 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee12(ctx) {
|
||||
var uid, avatarInst, data, dataBuffer, type;
|
||||
return _regenerator2.default.wrap(function _callee12$(_context12) {
|
||||
while (1) {
|
||||
@ -1118,7 +1118,7 @@ var userController = function (_baseController) {
|
||||
}, {
|
||||
key: 'search',
|
||||
value: function () {
|
||||
var _ref13 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee13(ctx) {
|
||||
var _ref13 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee13(ctx) {
|
||||
var q, queryList, rules, filteredRes;
|
||||
return _regenerator2.default.wrap(function _callee13$(_context13) {
|
||||
while (1) {
|
||||
@ -1190,7 +1190,7 @@ var userController = function (_baseController) {
|
||||
}, {
|
||||
key: 'project',
|
||||
value: function () {
|
||||
var _ref14 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee14(ctx) {
|
||||
var _ref14 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee14(ctx) {
|
||||
var _ctx$request$query, id, type, result, interfaceInst, interfaceData, projectInst, projectData, ownerAuth, devAuth, groupInst, groupData, _ownerAuth, _devAuth;
|
||||
|
||||
return _regenerator2.default.wrap(function _callee14$(_context14) {
|
||||
|
@ -47,7 +47,7 @@ function matchApi(apiPath, apiRule) {
|
||||
}
|
||||
|
||||
module.exports = function () {
|
||||
var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(ctx, next) {
|
||||
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(ctx, next) {
|
||||
var hostname, config, path, paths, projectId, projectInst, project, interfaceData, newData, newpath, interfaceInst, _newData, findInterface, res;
|
||||
|
||||
return _regenerator2.default.wrap(function _callee$(_context) {
|
||||
|
@ -26,7 +26,7 @@ function websocket(app) {
|
||||
return next(ctx);
|
||||
});
|
||||
router.get('/api/interface/solve_conflict', function () {
|
||||
var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(ctx) {
|
||||
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(ctx) {
|
||||
var inst;
|
||||
return _regenerator2.default.wrap(function _callee$(_context) {
|
||||
while (1) {
|
||||
|
Loading…
Reference in New Issue
Block a user