优惠码接口服务定义
---------------------

## 查询优惠码列表接口

> 接口名: `portal.couponCode.getList`

### 入参

-------------------------
|属性名称|类型|例子|说明| 
|--------|----|----|----|
|id|int|123|优惠码标示|
|name|string|50元优惠码|优惠码名称|
|req_department|string|零售部/运营部|申请部门|
|state|int|1|状态|
|limit|int|20|分页|
|offset|int|0|第几个|
---------------------

### 返回

``` json
{
  "code":200
  "list":
  [
    {
      "id":123,
      "name":"50元优惠券",
      "limit_times":10,
      "req_department":"零售部/运营部",
      "limit_date_from":"2016-01-16 00:00:00", 
      "limit_date_to":"2016-01-20 00:00:00", 
      "describe":"xxxxxxx",
      "staff":"李四",
      "state":0
    }
  ],
  "total":100,
  "limit":20,
  "offset:0
}

```


## 查询优惠码详情接口
> 接口名: `portal.couponCode.detail`

### 入参

-------------------------
|属性名称|类型|例子|说明| 
|--------|----|----|----|
|id|int|123|优惠码标示|
---------------------------

### 返回

```json

{
  "code":200
  "info":
  {
      "id":123,
      "name":"50元优惠券",
      "limit_times":10,
      "code":"sdads123123,dasd",
      "req_department":"零售部/运营部",
      "limit_date_from":"2016-01-16 00:00:00", 
      "limit_date_to":"2016-01-20 00:00:00", 
      "promotion_info":
        {
            "type": "discount_market_price", 
            "condition": {
                "amount_at_least": 100, 
                "count_at_least": 1
            }, 
            "action": {
                "discount": 0.88, 
                "discount_at_most": 100
            }
        },
      "user_use_limit":10,
      "user_source_limit":"iSO",
      "user_type_limit":"new_reg",//no_buy:未购买,new_reg:新注册
      "describe":"xxxxxxx",
      "staff":"李四",
      "state":0
  }
}
```

> 促销信息详细参考[优惠码表设计](http://git.dev.yoho.cn/yoho30/yohobuy-order/blob/master/promotion_code.md)

## 新增优惠码接口(修改)

> 接口名: `portal.couponCode.add`
> 接口名: `portal.couponCode.update`

-------------------------
|属性名称|类型|例子|说明| 
|--------|----|----|----|
|id|int|123|优惠码标示(修改的时候需要提交)|
|name|string|50元优惠码|优惠码名称|
|code|string|VA32434|码值|
|req_department|string|零售部/运营部|申请部门|
|limit_date_from|string|2016-01-16 00:00:00|优惠开始时间|
|limit_date_to|string|2016-01-16 00:00:00|优惠结束时间|
|promotion_info|string|参见如下json|促销信息|
|user_use_limit|int|10|使用限制次数|
|user_source_limit|string|iOS|用户来源|
|user_type_limit|string|no_buy|用户类型(未购买,新注册)|
|describe|string|xxxx|描述|
|staff|string|李四|员工|
----------------------------

```json
{
    "type": "discount_market_price", 
    "condition": {
        "amount_at_least": 100, 
        "count_at_least": 1
    }, 
    "action": {
        "discount": 0.88, 
        "discount_at_most": 100
    }
}
```
### 返回

```json
{
  "code":20001,
  "message":"保存成功!"
}

//or

{
  "code":5001,
  "message":"保存失败"
}

```

## 审核优惠码接口(通过,驳回,作废)

> 接口名:`portal.couponCode.setState`

### 入参

-------------------------
|属性名称|类型|例子|说明| 
|--------|----|----|----|
|id|int|123|优惠码标示(修改的时候需要提交)|
|state|int|1|状态|
-------------------

### 返回

```json
{
  "code":20001,
  "message":"设置成功!"
}

//or

{
  "code":50002,
  "message":"设置失败"
}
```


---------------------------

其他接口,可以暂时写死的方式

## 登陆

> 接口名: portal.system.login

### 入参

-------------------------
|属性名称|类型|例子|说明| 
|--------|----|----|----|
|user|string|admin|用户名|
|password|string|123321|密码|
-----------------------------

### 返回

```json

{
  "code":20003
  "data":
  {
    "auth":123123
  }
}

//or

{
  "code":50003
  "message": "登录失败!"
}

```

## 获取权限菜单

> 接口名: portal.system.menu

### 入参

-------------------------
|属性名称|类型|例子|说明| 
|--------|----|----|----|
|auth|int|123123|后台用户ID|
-----------------------------

### 返回

```json

{
    list:[
      {
        title:'首页',
        href:'/',
        icon:'home'
      },
      {
        title:'页面模板',
        parent:true,
        list:[
          {
            title:'个人资料',
            href:'/chart02',
            icon:'check'
          },
          {
            title:'帮助页',
            href:'/test',
            icon:'puzzle-piece'
          },
          {
            title:'404',
            href:'/404',
            icon:'bug'
          }
        ]
      }
    ]
}

```


## 获取部门信息

```json
var department = 
{
  list:[
    {
      "name":"零售部",
      "id":1,
      "sub":[ 
        {
          "name":"商品部",
          "id":11
        }
      ]
    }
  ]

}

```