# 增减用户剩余抽奖机会 user/setRemainNum
>[info] 此 API 用于增加或减少用户在抽奖工坊中剩余的抽奖次数。
> 因为在给用户增加抽奖机会的时,有些时候抽奖工坊中并未有此用户的信息。因为此接口要求同事要传入用户的昵称和头像等信息。
## **API 地址**
>[info] https://s1.lezhi99.com/api/user/setRemainNum
### **API 参数列表&测试**
~~~[api]
post:https://s1.lezhi99.com/api/user/setRemainNum
*int:project_id=10233#抽奖项目 ID
*string:identifier=23823#用户的唯一标识,例如用户 ID
*string:nickname=樱桃丸子#用户昵称/用户名等
string:avatar=https://xxx.com/a.png#用户头像URL,可留空
*int:change=1#要操作的次数。正数为增加,负数为减少
*string:note=系统赠送#备注信息
string:check_note=0#是否检查note的唯一性,若传入数字“1”,将检查30分钟内是否有相同note的请求,有则会拒请求。
*int:time=1576830778#时间戳(Unix timestamp),精确到秒
*string:token=xxxxxxxxxx#通讯令牌 (token) 值
<<<
success
{
"status": "success",
"data": {
"remain_num": "23"
}
}
<<<
error
{
"status": "error",
"msg": "Invalid token"
}
~~~
## **返回**
此API返回内容为JSON格式,包含如下信息:
<table>
<tr style="background:#f5f5f5;">
<th style="width:200px">参数名</th>
<th style="width:150px">类型</th>
<th style="width:100px">必须</th>
<th>说明</th>
</tr>
<tr>
<td>status</td>
<td>字符串</td>
<td>是</td>
<td>success=成功;error=失败/错误;</td>
</tr>
<tr>
<td>data</td>
<td>数据集</td>
<td>否</td>
<td>执行返回的数据集,当 status = success 的时候存在</td>
</tr>
<tr>
<td>- data.remain_num</td>
<td>整数</td>
<td>是</td>
<td>用户新的剩余次数</td>
</tr>
<tr>
<td>msg</td>
<td>字符串</td>
<td>否</td>
<td>提示信息,当 status=error 时存在</td>
</tr>
</table>
获取成功返回示例:
```
{
"status": "success",
"data": {
"remain_num": "23"
}
}
```
失败返回示例:
```
{
"status": "error",
"msg": "Invalid token"
}
```