| @@ -1,51 +1,32 @@ | |||
| package main | |||
| //procedure 000 | |||
| //available state | |||
| var statesGetBasicUserInfo = map[string]chatState{ | |||
| "Intro": chatState{}, | |||
| "AskName": chatState{}, | |||
| "AskEnglishName": chatState{}, | |||
| "AskEmail": chatState{}, | |||
| "AskMobileNumber": chatState{}, | |||
| "AskProfilePhoto": chatState{}, | |||
| "Done": chatState{}, | |||
| var procGetBasicUserInfo = chatProcedure{ | |||
| getBasicUserInfoInit, | |||
| getBasicUserInfoClean, | |||
| getBasicUserInfoStart, | |||
| getBasicUserInfoServe, | |||
| getBasicUserInfoSummary, | |||
| getBasicUserInfoInto, | |||
| } | |||
| var validateGetBasicUserInfo = map[string]Validator{ | |||
| "validateChineseName": validateChineseName, | |||
| func getBasicUserInfoInit() { | |||
| } | |||
| func getBasicUserInfoClean() { | |||
| } | |||
| func getBasicUserInfoStart(*openIDSessionData, InWechatMsg) { | |||
| func proc000AskName(openid string) { | |||
| s := chatState{} | |||
| s.Name = "AskName" | |||
| s.Expire = 300 //5 minutes | |||
| s.Save = map[string]string{} //clear | |||
| } | |||
| func validateChineseName(s chatState) (r ValidationResult) { | |||
| r.accept = true | |||
| r.Error = "" | |||
| //TODO | |||
| input := "abc" | |||
| // input := s.Receive.Message["name"] | |||
| r.Hint = "通常中文名只有三个字或者四个字,比如 王更新,诸葛亮,司马相如,慕容白雪" | |||
| if len(input) >= 10 { | |||
| r.accept = false | |||
| r.Error = "您的名字过长" | |||
| } | |||
| if len(input) <= 1 { | |||
| r.accept = false | |||
| r.Error = "您的名字很萌,就是有点太短了" | |||
| } | |||
| if len(input) >= 5 { | |||
| r.Warning = "您的名字有点长,可以勉强接收" | |||
| } | |||
| return | |||
| func getBasicUserInfoServe(*openIDSessionData, InWechatMsg) { | |||
| } | |||
| func getBasicUserInfoSummary() { | |||
| } | |||
| func initGetBasicUserInfo(openid string) (initState chatState) { | |||
| return | |||
| func getBasicUserInfoInto() { | |||
| } | |||