wangchuanjin %!s(int64=9) %!d(string=hai) anos
pai
achega
388b363ff8

+ 3 - 1
weixin/src/qfw/weixin/distinguishwork.go

@@ -167,7 +167,9 @@ func (a *DistinguishWork) Reply(openId, content string) {
 	client.WriteObj(obj[1], obj[0], util.EVENT_RECIVE_CALLBACK, util.SENDTO_TYPE_P2P, tmp)
 	deleteWorker(openId)
 	updateWorker(openId, status_rest)
-	toWork(nil)
+	time.AfterFunc(1*time.Second, func() {
+		toWork(nil)
+	})
 }
 
 //删除工作的人

+ 14 - 16
weixin/src/qfw/weixin/msgtxtchandler.go

@@ -46,7 +46,20 @@ func MsgTxtHandler(w ResponseWriter, r *Request) {
 	openid := r.FromUserName
 	//log.Println("........", r.FromUserName, r.Content)
 	//在会话中
-	if us, ok := UserSession[openid]; ok {
+	if r.Content == "开始识别验证码" { //进入人工识别验证码工作
+		w.PostText(wf.SysConfig.DistinguishWork["in"].(string))
+		time.AfterFunc(2*time.Second, func() {
+			distinguishWork.Start(openid)
+		})
+	} else if distinguishWork.IsWorking(openid) { //人工识别验证码工作中。。。
+		if r.Content == "结束识别验证码" {
+			w.ReplyText(wf.SysConfig.DistinguishWork["out"].(string))
+			distinguishWork.End(openid)
+		} else if distinguishWork.IsWaitReply(openid) {
+			w.PostText(wf.SysConfig.DistinguishWork["reply"].(string))
+			distinguishWork.Reply(openid, r.Content)
+		}
+	} else if us, ok := UserSession[openid]; ok {
 		if r.Content == "q" || r.Content == "Q" {
 			if us.Type == "faq" {
 				w.ReplyText("您已经退出智能咨询服务。")
@@ -107,21 +120,6 @@ func MsgTxtHandler(w ResponseWriter, r *Request) {
 			PicUrl:      wf.SysConfig.Qmxcdn + "/images/swordfish/jianyu_weixin.jpg",
 			Url:         "http://mp.weixin.qq.com/s?__biz=MzA5MTk0MTk5Ng==&mid=406103124&idx=1&sn=c12f1cc34899f0c3b36492885567315a#rd",
 		}})
-	} else if r.Content == "开始识别验证码" { //进入人工识别验证码工作
-		w.ReplyText(wf.SysConfig.DistinguishWork["in"].(string))
-		time.AfterFunc(2*time.Second, func() {
-			distinguishWork.Start(openid)
-		})
-	} else if distinguishWork.IsWorking(openid) { //人工识别验证码工作中。。。
-		if r.Content == "结束识别验证码" {
-			w.ReplyText(wf.SysConfig.DistinguishWork["out"].(string))
-			distinguishWork.End(openid)
-		} else if distinguishWork.IsWaitReply(openid) {
-			w.PostText(wf.SysConfig.DistinguishWork["reply"].(string))
-			time.AfterFunc(1*time.Second, func() {
-				distinguishWork.Reply(openid, r.Content)
-			})
-		}
 	} else {
 		now := time.Now()
 		if now.Weekday() == 6 || now.Weekday() == 0 || (now.Hour() > 17 || now.Hour() < 9) {