Skip to content

Instantly share code, notes, and snippets.

@xiezefan
xiezefan / RedisClusterTest.java
Created December 3, 2015 01:24
Redis Cluster 写入/读取 测试
package cn.jpush.sms.test;
import org.apache.commons.lang.StringUtils;
import redis.clients.jedis.HostAndPort;
import redis.clients.jedis.JedisCluster;
import java.util.HashSet;
import java.util.Set;
/**
use ding;
drop table tb_user;
create table tb_user (
id varchar(36) primary key,
password varchar(256) not null,
registration_id varchar(36),
alias varchar(36),
avatar varchar(36),
[
{
"title": "Creative Lab获腾讯、Line1.1亿美元战略投资",
"cover_pic": "http://a.36krcnd.com/photo/2014/abbf36b722f8b052d152c340b4dfffd8.jpg",
"tag": [
"腾讯",
"投资"
],
"create_time": "2014-11-12",
"summary": "据韩国先驱报及Business Korea报道,即时通信巨头腾讯以及 Line 联合对韩国的游戏工作室 4:33 Creative Lab 进行了 1.1 亿美元的战略投资。"
[
{
"title": "创世网小说更新TEST",
"type": "SUBSCRIBE",
"description": "所关注的小说更新,将叮咚你",
"category_id": "1",
"notify_url": "http://127.0.0.1:3000/novel/chuangshi",
"name_pattern": "{book_name}更新",
"desc_pattern": "{book_name}更新,将叮咚你",
"has_lbs": false,

Dingdong Client API Design

标签(空格分隔): Dingdong


User

GET /user/followed 关注列表

POST /service/{serviceId}/{clientServiceId}/push

对指定的ClientService进行推送

KEY DESCRIPTION REQUIRE
platform 目标平台,支持all,ios,android false
audience 目标用户,支持all,与基于push_token点对点推送 true
type 推送的类型 true
text 文本对象 false

推送到所有平台(如未指定platform,默认推送到所有平台)

{ "platform" : "all" }

指定推送特定平台

Redis Key | Type | Value | Value Example ----|----|---- service:{sid}|hash|Service Object | {"name": "明天下雨提醒我", "category": "天气", ...} client.service.id:{sid}:${data}|string|ClientService's id | UUID - "klfdfd-fdsafdafdasfdas" client.service:{cid}|hash|ClientService Object | {"data":"data string", "parentId":"0542", ...} client.service.follower:{cid}|set|ClientService's id set |UUID - "abcd-efdasdasdasdasdasd" user:{uid}|hash|User Object | {"id":"UUID", "password":"123123123", ...} user.followed:{uid}|set|User followed service set | UUID - "abcd-efdasdasdasdasdasd" user.client.service.remark:{uid}:{cid}|string|Remark|生日提醒 1992-09-12 => 我的生日 client.service.push.token:{push_token}|string|User's ID| UUID - "abcd-efdasdasdasdasdasd"

@xiezefan
xiezefan / dingdong-server-create.json
Last active August 29, 2015 14:08
Ding创建服务的JSON
//NEXT
{
"title": "NEXT",
"description": "NEXT 是36氪旗下的一个实验性项目,灵感来自于Product Hunt",
"type": "SUBSCRIBE",
"category_id": "6",
"notify_url": "http://127.0.0.1/ding-node/next/product",
"has_lbs": false,
"has_ding": false
}
@xiezefan
xiezefan / gist:ddc83b4ec11c1d7f6848
Created October 28, 2014 02:11
API v3/users 接口返回BUG
//参数 time_unit=day start=2014-09-25 duration=50
//BUG
//1.出现这种非法的日期 2014-09-32
//2.返回的JSON中,步长这个属性,文档显示是step, 但返回的是duration
{
"time_unit": "day",
"start": "2014-09-25",
"duration": 50,