活动报名 APIs v1

活动管理,活动体验以及活动报名的相关API

活动报名

URL

POST /activity/enroll

TOKEN

required

INPUT

{
    "activity_id":        "4eb3a4ff-ad0c-4a03-963c-1a9e4290863e"         //string:required, 活动Id
    "attrs":{                                //基本属性
        "nickname":        "irons",          //string:required, 昵称
        "mobile":          "86-18621936702", //string:required, 电话号码
        "gender":          "female",         //string:required, 性别
        "birthday":        "2015-12-24",     //string:required, 生日
        "job":             "学生",           //string:required, 职业[学生, 上班族, 自由职业者, 全职主妇, 网红, 其他 ]
    },

    "extras":{                               //可扩展属性
        "invitation_code": "123456",         //string:option,   邀请码,meiId
        "front_photos":     ["http://qiniu.com/1dasdf/asdf.jpg","http://qiniu.com/1dasdf/asdf.jpg"],//[]:required,正面照
        "profile_photos":   ["http://qiniu.com/1dasdf/asdf.jpg","http://qiniu.com/1dasdf/asdf.jpg"],//[]:required,侧面照
        "apply_reason":     "申请理由"       //string:required,参加活动的理由,改善
    },
}

OUTPUT

{
    "code":"00000"
    "data":{
        "message":"附加信息,比如错误提醒以及,变更提醒"
    }   
}

{
    "code":"11201",
    "message":"用户已经注册该活动"
}

ERROR

  • ErrEnrollExists //error code:11201

CURL

curl\
    -X POST\
    -d '{"activity_id":"wefddw","mobile":"86-18621936702","gender":"female","birthday":"2015-12-24","job":"学生","invitation_code":"221ss","front_photo":["http://qiniu.com/fefw/ddw.jpg","http://qiniu.com/dee/fefew.jpg"],"profile_photo": ["http://qiniu.com/fefw/ddw.jpg","http://qiniu.com/dee/fefew.jpg"],"activity_id":"dwfeww","apply_reason":"申请理由"}'\
    -i http://localhost:3001/v1/activity/enroll\
    -H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0MzM0MjkwNjgsImlhdCI6MTQzMzE2OTg2OCwic3ViIjoiNTU2YzY0OTNkZjhlNTY2NDViM2NmYjdlIn0.WA3UlkU2gDH5UCZ_q4abUSBTMEuY21ytAWgyUfPInEaYlJaI1Iav23yHoSHLggloV4emHf6f2hJuV-3LQuGMQfO60yC4zkgeBvBjjXm6808K_ZsuWMtzco8sTjV-2y6VbHb-EnUItVNE-YJuRiP_i0A0H3gJb7IfsSubOz63G3bXvCFUFxPy9Y7DPmpocLXexltf_-EKbyMNHHob5Nll0XOnb3dMZnXU9QhXnx1kT-2uexzdDVsWEZC6UexmRS9b86_oZ4tfGCcNG-Tg9Bl1ole_Yp_9fUBvqA9o-5gsEzFcc0atdEyM1ytFXAaO5SVCqbOnvRKKOdCrduGLth2w"

用户是否注册

URL

POST /activity/is_enrolled

TOKEN

required

INPUT

{
    "activity_id":"4eb3a4ff-ad0c-4a03-963c-1a9e4290863e",
}

OUTPUT

{
    "code":"00000",
    "data":{
        "is_enrolled":false,
    },
}

{
    "code":"11203",
    "message":"活动不存在!"
}

ERROR

  • ErrActivityNotExists //error code:11203

CURL

curl -i http://localhost:3001/v1/activity/is_enrolled\
     -d '{"activity_id":"bhbdhbvdvfhfvbdfhd"}'\
     -H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0MzM0MjkwNjgsImlhdCI6MTQzMzE2OTg2OCwic3ViIjoiNTU2YzY0OTNkZjhlNTY2NDViM2NmYjdlIn0.WA3UlkU2gDH5UCZ_q4abUSBTMEuY21ytAWgyUfPInEaYlJaI1Iav23yHoSHLggloV4emHf6f2hJuV-3LQuGMQfO60yC4zkgeBvBjjXm6808K_ZsuWMtzco8sTjV-2y6VbHb-EnUItVNE-YJuRiP_i0A0H3gJb7IfsSubOz63G3bXvCFUFxPy9Y7DPmpocLXexltf_-EKbyMNHHob5Nll0XOnb3dMZnXU9QhXnx1kT-2uexzdDVsWEZC6UexmRS9b86_oZ4tfGCcNG-Tg9Bl1ole_Yp_9fUBvqA9o-5gsEzFcc0atdEyM1ytFXAaO5SVCqbOnvRKKOdCrduGLth2w"

创建活动

URL

POST /activity/create

TOKEN

not required

INPUT

{
    "activity_id":"cfgvhjbk",
    "attrs":{
         "name":"美白",
         "title":"第一季",
         "wechat":"12321",
         "city":"上海 北京",
         "start_at":45678933,
         "end_at":3221426,
    },
    "extras":{
           "apply_reason_example": "申请理由范例",
           "front_photo_examples":["http://www.baidu.com/123.jpg","http://www.baidu.com/123.jpg"],
           "profile_photo_examples":["http://www.baidu.com/123.jpg","http://www.baidu.com/123.jpg"],
           "banners":[
             {
               "img": "http://www.baidu.com/1122.jpg",
               "target_type": "web",
               "target_id": "12345",
             },
             {
               "img": "http://www.baidu.com/1122.jpg",
               "target_type": "web",
               "target_id": "1234532",
             },
           ],
    },
    "enroll_num":123,
    "fund_balance":22233.53,
}

OUTPUT

{
    "code":"00000",
    "data":{
        "message":"活动创建成功",
    },
}

{
    "code":"10002",
    "message":"格式化转化错误!"
}

ERROR

none

CURL

curl\
  -i http://localhost:3001/v1/activity/create\
  -d '{
        "attrs":{
             "name":"美白",
             "title":"第一季",
             "wechat":"12321",
             "city":"上海 北京",
             "start_at":45678933,
             "end_at":3221426,
        },
        "extras":{
               "apply_reason_example": "申请理由范例",
               "front_photo_examples":["http://www.baidu.com/123.jpg","http://www.baidu.com/123.jpg"],
               "profile_photo_examples":["http://www.baidu.com/123.jpg","http://www.baidu.com/123.jpg"],
               "banners":[
                 {
                   "img": "http://www.baidu.com/1122.jpg",
                   "target_type": "web",
                   "target_id": "12345",
                 },
                 {
                   "img": "http://www.baidu.com/1122.jpg",
                   "target_type": "web",
                   "target_id": "1234532",
                 },
               ]
        },
        "enroll_num":123,
        "fund_balance":22233.53,
      }'

##活动信息

URL

POST /activity/get_info

TOKEN

not required

INPUT

{
    "activity_id":"test", //string:required
    "extras":{},          //以后升级时需要的扩展属性
}

OUTPUT

{
    "code":"00000"
    "data":{
        "attrs":{
            "title":                 "第一季(仅限上海)",                                               //string:required, 标题
            "name":                  "活动名字",                                                       //string:required.活动名字
            "city":                  "上海"
            "wechat":                "wdwww",                                                         //string:required, 微信公众号
            "start_at":              1456305724,                                                      //timestamp:required,活动开始时间
            "end_at":                1456305724,                                                       //timestamp:required,活动结束时间
        },

        "extras":{
          "banners": [                                                                               //string:required, 标题页
              {                                                                             
                  "img"        : "http://qiniu.com/sdddww/dwe.jpg",                           //string:required, 图片链接
                  "target_type": "web",                                                       //string:required, 目标类型
                  "target_id"  : "http://qiniu.com/sdddww/dwe.jpg",                            //string:required, 目标链接
              },
              {
                  "img"        : "http://qiniu.com/sdddww/dwe.jpg",
                  "target_type": "web",
                  "target_id"  : "http://qiniu.com/sdddww/dwe.jpg",
              },
          ],

          "apply_reason_example":  "申请理由范例",                                                   //string:required,参加活动的理由,改善建议
          "front_photo_examples":   ["http://qiniu.com/1dasdf/asdf.jpg","http://qiniu.com/1dasdf/asdf.jpg"],//[]:required,正面照
          "profile_photo_examples": ["http://qiniu.com/1dasdf/asdf.jpg","http://qiniu.com/1dasdf/asdf.jpg"],//[]:required,侧面照
        },

        "enroll_num":            1221,                                                          //报名人数
        "fund_balance":          12334223.43,                                                   //string:required, 剩余基金
        "update_at":             45673232,   //timestamp:required, 活动信息更新时间戳
        "status"                 1,          // int:required,活动当前的状态,{-1:下线状态,1:上线状态}
    }
}

{
    "code":"11203",
    "message":"活动不存在!"
}

ERROR

  • ErrActivityNotExists //error code:11203

CURL

curl\
  -X POST\
  -i http://localhost:3001/v1/activity/get_info \
  -d '{"activity_id":"test"}'

获得活动列表

URL

POST /activity/get_activities

TOKEN

not required

INPUT

{
    "last":"234",// 上次的num数
    "limit":21,  // 需要获得至少limit条数据,limit不能小于1
    "extras":{}, // 以后扩展功能,"is_brief":true, 代表是简略的还是全部的信息,默认简略内容
}

OUTPUT

{
    "code":"00000"
    "data":{
        "activities": [
        {
                "title": "第一季(仅限上海)", // 本季活动的标题
                "status": 1,                 //-1:活动已下线,下线不显示;1:活动上线
                "num":1,                     // 活动次数
                "activity_id":"56789567"     // 报名活动的Id
                "update_at":  23432112     // 活动更新时间戳
            },
        {
                "title": "第一季(仅限上海)", // 本季活动的标题
                "status": 1,
                "activity_id":"56789567"
                "num":2
                "update_at":  23432112
            }
        ]  
    }
}

{
    "code":"10002",
    "message":"数据参数转化错误"
}

ERROR

none

CURL

curl\
  -X POST\
  -d '{"last":"2342","limit":2}'
  -i http://localhost:3001/v1/activity/get_activities

获得活动体验

URL

POST /activity/get_experiences

TOKEN

not required

INPUT

{
  "last":"上次的体验ID",
  "limit":1,
  "extras":{},
}

OUTPUT

{
    "code":"00000",
    "data":{
       "experiences":[
           {
                "user_id":"23432",
                "activity_name":"美白",
                "activity_title":"第一季",
                "activity_balance":12321.12,
                "extras":{},
            },
            {
                "user_id":"23432",
                "activity_name":"美白",
                "activity_title":"第一季",
                "activity_balance":12321.12,
                "extras":{},
            },
        ]
    },
}

{
    "code":"10002",
    "message":"数据参数转化错误"
}

ERROR

none

CURL

curl\
  -X POST\
  -i http://localhost:3001/v1/activity/get_experiences\
  -d '{"last":"2342","limit":2}'