unissoft-bj / ihostsvc

system services & data services on ihost
0 stars 0 forks source link

用户注册 rest 1 :上网码发放(目前只做上网码注册) #23

Open unissoft-bj opened 9 years ago

unissoft-bj commented 9 years ago

功能:为用户发放上网码;前端直接呈现给顾客;或者以短信方式发送给顾客(暂不做)

提交参数:phone,有效期(默认24小时);phone可以没有;没有phone意味着临时上网码 返回参数:上网码

rest 逻辑: 1,接收phone,有效期 2,生成6位数的上网码 3,在“码表”中创建上网码记录:phone,上网码,role(普通顾客、销售顾问、客服、销售经理)有效期,发送方式(短信、直接呈现),销售顾问id 4,返回上网码

michaelyin commented 9 years ago

mysql> select * from role; +----+--------------+ | id | name | +----+--------------+ | 1 | ROLE_USER | | 2 | ROLE_MANAGER | | 3 | ROLE_SALES | | 4 | ROLE_SERVICE |

michaelyin commented 9 years ago

Json input:

{"userRole":"ROLE_SALES","phone":"1380796221","type":"sms"}

michaelyin commented 9 years ago

returned json example: { id: 1 phone: "1380796221" token: 870805 agent_id: "90b1e606-dfd3-11e4-90f4-000c29c5df73" create_t: 1428900355092 used: false }

michaelyin commented 9 years ago

rest call example: post http://ihost:8080/secure/shangwangma

body: {"userRole":"ROLE_USER","phone":"5016548878","type":"sms"}

return: { id: 2 phone: "5016548878" token: 503336 agent_id: "4028a7814cb58e21014cb5901ace0000" create_t: 1429540389899 used: false mac: "" user_role: "ROLE_USER" }