unissoft-bj / ihostsvc

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

用户注册 rest 2 :上网码使用(目前只做上网码注册) #24

Open unissoft-bj opened 9 years ago

unissoft-bj commented 9 years ago

use case:

用户在前端页面输入上网码

创建新的account,绑定mac 绑定mac到已有的account 为老account-老mac分配新的mac-pwd 清除account的account-pwd认证模式,恢复mac-pwd认证模式,并分配新mac-pwd

提交参数:上网码,mac 返回参数:状态,account,mac-pwd

REST 逻辑: 1,接收上网码,mac参数 2,到“码表”中查找对应的上网码记录(上网码,有效期)

如果没有找到,返回错误信息 如果找到,查phone

如果没有phone,查销售顾问account;以及销售顾问account是否已绑定该mac

如果没有绑定,则把mac绑定到销售顾问account并disable;返回成功、tmp-account,mac-pwd 如果已绑定,则查mac-pwd;设置为disable状态返回成功、tmp-account、mac-pwd 增强功能:disable状态:改为datatime类型,代表有效期使用,避免临时用户反复发放上网码

如果有phone,查account表中的phone(enable=1)

如果account表中没有phone,则创建新的account(根据“码表”中的role),绑定mac,返回成功、account、mac-pwd 如果account表中有phone,则查该phone是否已绑定该mac

如果没有绑定,则绑定此mac,返回成功、account、mac-pwd 如果已有绑定,则清空该account的 account-pwd,查mac-pwd,返回成功、account、mac-pwd

ycyn521 commented 9 years ago

register(String netCode) return:userInfo{phone、userRole} userRole: -1-failed,0-普通用户,1-销售经理,2-销售顾问,3-客服 服务端操作:如果注册成功则将该用户相应的登陆信息如mac-pwd加ihost指纹写入到cookie中,将用户id等webstate信息写在session中。 前台操作:登陆失败提示相应的信息; 登陆成功后先开通internet,然后根据userRole转到相应的页面

ycyn521 commented 9 years ago

post: /register pamars:shangwangma return:null 去找httpcode

michaelyin commented 9 years ago

用户在前端页面输入上网码. 用户是否也需输入phone?

unissoft-bj commented 9 years ago

输入上网码时,不需要phone 销售顾问发放上网码时,如果收集到了手机号,则phone已经在database中; 如果没有收集到手机号,则database中没有phone,此时相当于借用销售顾问的account上网。需要注意的是,此时仅接通internet,不会返回销售顾问的account,不能进入到销售顾问的工作界面

michaelyin commented 9 years ago

with empty phone: { name: "005056C00008" mac: "005056C00008" mac_pwd: "f64fd6d0-49f8-4fc8-a787-59766e7069d4" role: "UNKNOWN" phone: "UNKNOWN" }

michaelyin commented 9 years ago

rest example: post http://ihost:8080/register

json payload: {"mac":"88-36-99-FF-FF-BB","token":"503336"}

return json message: { name: "88-36-99-FF-FF-BB" mac: "88-36-99-FF-FF-BB" mac_pwd: "68d369de-f603-4ecf-b3b9-1a11420eee2e" role: "ROLE_USER" phone: "5016548878" }

michaelyin commented 9 years ago

error code http 404: cannot find the token http 409: token has been used http 400: token expires. now the token expires in 24 hours.