通知中心 V1

为全公司提供短信、邮件、app推送、微信推送服务
功能:单条发送、批量发送、队列发送、异步logging、黑名单列表

使用方式

请求时使用POST方法 请求参数(params)放在POST内容中(JSON字符串格式)
http://notify.fruitday.com/{$版本号}/{$消息类型}/{$发送方式}?source={$来源}&sign={$数字签名}

Example:

POST http://notify.fruitday.com/v1/sms/send?source=test&sign=5afdd500b7cfc0d1e67695aec95abd2f 
{
    "mobile": "18621681531",
    "message": "蔡昀辰在测试SMS单条推送"
} 
{
    "code": 200,
    "msg": "send sms success"
}    

API地址

http://notify.fruitday.com (121.40.242.162) 需要加入服务器白名单

消息类型

发送方式

请求来源

不在列表内的来源不能访问本API

数字签名

function create($params) {
    //字符串拼接密钥后md5加密,去处最后一位再拼接”s",再md5加密
    return md5(substr(md5($params.SMS_SECRET), 0,-1)."s");
}

$params example (JSON object string):

{
    "mobile": "18621681531",
    "message": "蔡昀辰在测试SMS单条推送"
}

请求结果返回

发送短信

发送一条

POST http://notify.fruitday.com/v1/sms/send?source=test&sign=5afdd500b7cfc0d1e67695aec95abd2f 
{
    "mobile": "18621681531",
    "message": "蔡昀辰在测试SMS单条推送"
} 
{
    "code": 200,
    "msg": "send sms success"
} 

批量发送

POST http://notify.fruitday.com/v1/sms/group/?source=test&sign=633f5dbc6bf96125cedd8bba35b669c9 
{
    "mobile": ["18621681531", "13524497868"],
    "message": "蔡昀辰在测试SMS批量推送..."
} 
{
    "code": 200,
    "msg": [
        "3800757712919895840"
    ]
}         

队列发送

POST http://notify.fruitday.com/v1/sms/push?source=test&sign=d2a946768db1cf044f8edd0ad01365a9 
[
    {
        "mobile": "18621681531",
        "message": "蔡昀辰在测试SMS队列推送1"
    },
    {
        "mobile": "18621681531",
        "message": "蔡昀辰在测试SMS队列推送2"
    }               
] 
{
    "code": 200,
    "msg": "push sms success"
}       

发送APP推送

必要参数
uid/registration_id, title, message

可选参数

tabType: 
    HomeMarket 
    UserCenter 
    Guoshi
HomeMarket: 
    type: 1, 促销列表  target_id   title
    type: 2, 促销单品  target_id(productid)
    type: 3, 免费试吃 
    type: 7, 抢鲜列表  target_id   title
    type: 4, 抢鲜单品  target_id
    type: 6, html5活动页  page_url page_photo不为空 *********swipe_back_forbidden
    type: 5, 促销活动说明(图片) page_photo  title
    type: 8, html5活动页(外部)  page_url page_photo不为空 *********swipe_back_forbidden
UserCenter:
    type: 1, 积分-个人中心
    type: 2, 优惠券
    type: 3, 我的试吃
    type: 4, 可评价订单
    type: 5, 我的特权
    type: 6, 我的赠品
GuoShi:
    type: 1, 果友圈帖子详情 pid ptype 
    type: 2, 百科详情  

发送一条

POST http://notify.fruitday.com/v1/app/send?source=test&sign=bb22f163e085d0415d9e37a064e3eb01 
{
    "uid":          "3528371",
    "title":        "app推送测试",
    "message":      蔡昀辰在测试",
    "tabType":      "HomeMarket",
    "type":         "6",
    "page_url":     "a",
    "page_photo":   "b"
} 
{
    "code": 200,
    "msg": "send app success"
}    

批量发送

POST http://notify.fruitday.com/v1/app/group/?source=test&sign=3cfa9538cb3dc84284be17b14fe0bce0 
{
    "uid":          ["3528371", "3528371"],
    "title":        "app推送测试",
    "message":      "蔡昀辰在测试",
    "tabType":      "HomeMarket",
    "type":         "6",
    "page_url":     "a",
    "page_photo":   "b"
} 
{
    "code": 200,
    "msg": [
        "msg_id:3139999487"
    ]
}       

队列发送

POST http://notify.fruitday.com/v1/app/push?source=test&sign=706048780b5f3697d4d6564a3a1aa411 
[
    {
        "uid":          "3528371",
        "title":        "app推送测试1",
        "message":      "蔡昀辰在测试push1",
        "tabType":      "HomeMarket",
        "type":         "6",
        "page_url":     "a",
        "page_photo":   "b"
    },
    {
        "uid":          "3528371",
        "title":        "app推送测试2",
        "message":      "蔡昀辰在测试push2",
        "tabType":      "HomeMarket",
        "type":         "6",
        "page_url":     "a",
        "page_photo":   "b"
    }               
] 
{
    "code": 200,
    "msg": "push app success"
}      

发送EMAIL

发送一条

POST http://notify.fruitday.com/v1/email/send?source=test&sign=a0fa8ceb106fef9b01987618b09f0a01 
{
    "email":        "caiyunchen@fruitday.com",
    "title":        "email推送测试",
    "message":      "蔡昀辰在测试EMAIL单条推送"
} 
{
    "code": 200,
    "msg": "send email success"
}

批量推送

POST http://notify.fruitday.com/v1/email/group/?source=test&sign=1a6001b677691f344d6e4f25eabe4653 
{
    "email":        ["caiyunchen@fruitday.com", "caiyunchen@fruitday.com"],
    "title":        "email推送测试",
    "message":      "蔡昀辰在测试EMAIL批量推送"
} 
{
    "code": 200,
    "msg": "group (push) email success"
}                

队列推送

POST http://notify.fruitday.com/v1/email/push?source=test&sign=98d803e703f908ee597a67af9ddf85c6 
[
    {
        "email": "caiyunchen@fruitday.com",
        "title": "email队列推送测试1",
        "message": "蔡昀辰在测试EMAIL队列推送1"
    },
    {
        "email": "caiyunchen@fruitday.com",
        "title": "email推送测试2",
        "message": "蔡昀辰在测试EMAIL队列推送2"
    }               
] 
{
    "code": 200,
    "msg": "push email success"
}                

发送微信

发送一条

POST http://notify.fruitday.com/v1/weixin/send?source=test&sign=f47ccc4d20a30613121e6860c324f20b 
{
    "openid": "obGvfjno2qwDL7hTjjePEEVI8C58",
    "template_name": "未付款订单通知",
    "first": "weixin test",
    "orderProductPrice": "100元",
    "orderProductName": "樱桃一斤",
    "orderAddress": "康花路316号",
    "orderName": "123456",
    "remark": "蔡昀辰在测试",
    "url": "m.fruitday.com/user/orderdetail/123456"
} 
{
    "code": 200,
    "msg": "send weixin success"
}                

批量发送

POST http://notify.fruitday.com/v1/weixin/group/?source=test&sign=9505a3c4b357fcdf4aff856511648857 
{
    "openid": ["obGvfjno2qwDL7hTjjePEEVI8C58", "obGvfjno2qwDL7hTjjePEEVI8C58"],
    "template_name": "未付款订单通知",
    "first": "weixin test",
    "orderProductPrice": "100元",
    "orderProductName": "樱桃一斤",
    "orderAddress": "康花路316号",
    "orderName": "123456",
    "remark": "蔡昀辰在测试微信批量发送",
    "url": "m.fruitday.com/user/orderdetail/123456"
} 
{
    "code": 200,
    "msg": "group (push) weixin success"
}                

队列发送

POST http://notify.fruitday.com/v1/weixin/push?source=test&sign=1e4d7e69f7087504b0f9abf185023bfc 
[
    {
        "openid": "obGvfjno2qwDL7hTjjePEEVI8C58",
        "template_name": "未付款订单通知",
        "first": "weixin test",
        "orderProductPrice": "100元",
        "orderProductName": "樱桃一斤",
        "orderAddress": "康花路316号",
        "orderName": "123456",
        "remark": "蔡昀辰在测试微信队列发送1",
        "url": "m.fruitday.com/user/orderdetail/123456"
    },
    {
        "openid": "obGvfjno2qwDL7hTjjePEEVI8C58",
        "template_name": "未付款订单通知",
        "first": "weixin test",
        "orderProductPrice": "100元",
        "orderProductName": "樱桃一斤",
        "orderAddress": "康花路316号",
        "orderName": "123456",
        "remark": "蔡昀辰在测试微信队列发送2",
        "url": "m.fruitday.com/user/orderdetail/123456"
    }               
] 
{
    "code": 200,
    "msg": "push weixin success"
}                

微信模板

订单确认收货通知

{{first.DATA}}
订单号:{{keyword1.DATA}}
商品名称:{{keyword2.DATA}}
下单时间:{{keyword3.DATA}}
发货时间:{{keyword4.DATA}}
确认收货时间:{{keyword5.DATA}}
{{remark.DATA}}

账号未绑定通知

{{first.DATA}}
微信号:{{keyword1.DATA}}
绑定状态:{{keyword2.DATA}}
{{remark.DATA}}


优惠券过期提醒

{{first.DATA}}                          
适用范围:{{orderTicketStore.DATA}}           
使用规则:{{orderTicketRule.DATA}}              
{{remark.DATA}}    

未付款订单通知

{{first.DATA}}

订单金额:{{orderProductPrice.DATA}}
商品详情:{{orderProductName.DATA}}
收货信息:{{orderAddress.DATA}} 
订单编号:{{orderName.DATA}}
{{remark.DATA}}    

领取成功通知

{{first.DATA}}

领取人:{{toName.DATA}}
赠品:{{gift.DATA}}
领取时间:{{time.DATA}}
{{remark.DATA}}    

付款成功通知

{{first.DATA}}

订单金额:{{orderProductPrice.DATA}}
商品详情:{{orderProductName.DATA}}
收货信息:{{orderAddress.DATA}} 
订单编号:{{orderName.DATA}}
{{remark.DATA}} 

收到回复通知

{{first.DATA}}
回复者:{{keyword1.DATA}}
回复时间:{{keyword2.DATA}}
回复内容:{{keyword3.DATA}}
{{remark.DATA}}    

积分提醒

{{first.DATA}}

账户:{{account.DATA}}
时间:{{time.DATA}}
类型:{{type.DATA}}
{{creditChange.DATA}}积分:{{number.DATA}}
{{creditName.DATA}}余额:{{amount.DATA}}
{{remark.DATA}}    

优惠券领取成功通知

{{first.DATA}}
优惠券名称:{{keyword1.DATA}}
兑换码:{{keyword2.DATA}}
失效期:{{keyword3.DATA}}
{{remark.DATA}}

微信绑定成功通知

{{first.DATA}}
微信ID:{{keyword1.DATA}}
绑定账号:{{keyword2.DATA}}
开通功能:{{keyword3.DATA}}
{{remark.DATA}}    

微信解绑成功通知

{{first.DATA}}
绑定帐号:{{keyword1.DATA}}
绑定状态:{{keyword2.DATA}}
绑定时间:{{keyword3.DATA}}
{{remark.DATA}}    

订单取消通知

{{first.DATA}} 
订单金额:{{orderProductPrice.DATA}} 
商品详情:{{orderProductName.DATA}} 
收货信息:{{orderAddress.DATA}} 
订单编号:{{orderName.DATA}} 
{{remark.DATA}}    


订单标记发货通知

{{first.DATA}}

订单金额:{{orderProductPrice.DATA}}
商品详情:{{orderProductName.DATA}}
收货信息:{{orderAddress.DATA}}
订单编号:{{orderName.DATA}}
{{remark.DATA}}      

聚合发送

可以同时发送不同类型的消息

发送一条

POST http://notify.fruitday.com/v1/notify/send?source=test&sign=75fdac9c8067b63e682d7a9bf3b0c5f3                  
{
    sms: {
        mobile: "18621681531",
        message: "蔡昀辰在测试"
    },
    app: {
        uid: "3528371",
        title: "app推送测试",
        message: "蔡昀辰在测试APP单条推送",
        tabType: "HomeMarket",
        type: "6",
        page_url: "a",
        page_photo: "b"
    },
    email: {
        email: "caiyunchen@fruitday.com",
        title: "email推送测试",
        message: "蔡昀辰在测试EMAIL单条推送"
    },
    weixin: {
        openid: "obGvfjno2qwDL7hTjjePEEVI8C58",
        template_name: "未付款订单通知",
        first: "weixin test",
        orderProductPrice: "100元",
        orderProductName: "樱桃一斤",
        orderAddress: "康花路316号",
        orderName: "123456",
        remark: "蔡昀辰在测试",
        url: "m.fruitday.com/user/orderdetail/123456"
    }
}
{
    sms: {
        code: 200,
        msg: "send sms success"
    },
    app: {
        code: 200,
        msg: "send app success"
    },
    email: {
        code: 200,
        msg: "send email success"
    },
    weixin: {
        code: 200,
        msg: "send weixin success"
    }
}

批量发送

POST http://notify.fruitday.com/v1/notify/group?source=test&sign=75fdac9c8067b63e682d7a9bf3b0c5f3 
{
    sms: {
        mobile: [
            "18621681531",
            "13524497868"
        ],
        message: "蔡昀辰在测试"
    },
    app: {
        uid: [
            "3528371",
            "3528371"
        ],
        title: "app推送测试",
        message: "蔡昀辰在测试APP单条推送",
        tabType: "HomeMarket",
        type: "6",
        page_url: "a",
        page_photo: "b"
    },
    email: {
        email: [
            "caiyunchen@fruitday.com",
            "caiyunchen@fruitday.com"
        ],
        title: "email推送测试",
        message: "蔡昀辰在测试EMAIL单条推送"
    },
    weixin: {
        openid: [
            "obGvfjno2qwDL7hTjjePEEVI8C58",
            "obGvfjno2qwDL7hTjjePEEVI8C58"
        ],
        template_name: "未付款订单通知",
        first: "weixin test",
        orderProductPrice: "100元",
        orderProductName: "樱桃一斤",
        orderAddress: "康花路316号",
        orderName: "123456",
        remark: "蔡昀辰在测试",
        url: "m.fruitday.com/user/orderdetail/123456"
    }
}
{
    sms: {
        code: 200,
        msg: [
            "4552770889759916492"
        ]
    },
    app: {
        code: 200,
        msg: [
            "msg_id:1751891658"
        ]
    },
    email: {
        code: 200,
        msg: "group (push) email success"
    },
    weixin: {
        code: 200,
        msg: "group (push) weixin success"
    }
}

队列发送

POST http://notify.fruitday.com/v1/notify/push?source=test&sign=75fdac9c8067b63e682d7a9bf3b0c5f3

{
    sms: [
        {
            mobile: "18621681531",
            message: "蔡昀辰在测试队列推送1"
        },
        {
            mobile: "18621681531",
            message: "蔡昀辰在测试队列推送2"
        }
    ],
    app: [
        {
            uid: "3528371",
            title: "app推送测试",
            message: "蔡昀辰在测试APP队列推送1",
            tabType: "HomeMarket",
            type: "6",
            page_url: "a",
            page_photo: "b"
        },
        {
            uid: "3528371",
            title: "app推送测试",
            message: "蔡昀辰在测试APP队列推送2",
            tabType: "HomeMarket",
            type: "6",
            page_url: "a",
            page_photo: "b"
        }
    ],
    email: [
        {
            email: "caiyunchen@fruitday.com",
            title: "email推送测试",
            message: "蔡昀辰在测试EMAIL队列推送1"
        },
        {
            email: "caiyunchen@fruitday.com",
            title: "email推送测试",
            message: "蔡昀辰在测试EMAIL队列推送2"
        }
    ],
    weixin: [
        {
            openid: "obGvfjno2qwDL7hTjjePEEVI8C58",
            template_name: "未付款订单通知",
            first: "weixin test",
            orderProductPrice: "100元",
            orderProductName: "樱桃一斤",
            orderAddress: "康花路316号",
            orderName: "123456",
            remark: "蔡昀辰在测试微信队列推送1",
            url: "m.fruitday.com/user/orderdetail/123456"
        },
        {
            openid: "obGvfjno2qwDL7hTjjePEEVI8C58",
            template_name: "未付款订单通知",
            first: "weixin test",
            orderProductPrice: "100元",
            orderProductName: "樱桃一斤",
            orderAddress: "康花路316号",
            orderName: "123456",
            remark: "蔡昀辰在测试微信队列推送2",
            url: "m.fruitday.com/user/orderdetail/123456"
        }
    ]
}  

{
    sms: {
        code: 200,
        msg: "push sms success"
    },
    app: {
        code: 200,
        msg: "push app success"
    },
    email: {
        code: 200,
        msg: "push email success"
    },
    weixin: {
        code: 200,
        msg: "push weixin success"
    }
}