Browse Source

验证码

wangchuanjin 9 years ago
parent
commit
f4d5127199
2 changed files with 12 additions and 34 deletions
  1. 4 4
      weixin/src/config.json
  2. 8 30
      weixin/src/qfw/weixin/distinguishwork.go

+ 4 - 4
weixin/src/config.json

@@ -10,9 +10,9 @@
 	"rpcport":"83",
 	"serviceTip":"服务指南",
 	"appcontext":"weixin",
-	"appid":"wx9852f95aa927e646",
+	"appid":"wx76e1309b01a7b17e",
 	"token":"topnet2015",
-	"appsecret":"d4624c36b6795d1d99dcf0547af5443d",
+	"appsecret":"dd00e71cb2370432d9de848b674eb8e7",
     "aboutmeurl":"http://www.qimingxing.info/article/aboutme",
     "conactusurl":"http://www.qimingxing.info/article/contactus",
 	"wsqurl": "http://s.p.qq.com/pub/jump?d=AAAXeGLZ",
@@ -24,10 +24,10 @@
 	"loginTip":"您已经成功登录企明星。",
 	"freezeTip":"您的帐号已经冻结,请联系管理员。",
 	"messagetpl":{
-		"identifytplid":"sKn4r0or615ETYC-aI5OACPO_Q4-B8GYmgWoqcDghN4",
+		"identifytplid":"zqi2LoEAFgiwHjfeWJNnI18UmuOk3M1Rz9uSU-GxDek",
 		"offLinemsgtplid":"ExIeyFfoDNVJXhRDq09JbsjH_zbEJCB6gw6rxcV7atw",
 		"msgnotifytplid":"fcke7PqteAtclzHV3ScdiePH48vxaH6M5aJF0O_7by8",
-		"managernotifytplid":"DIwMrPQToOhGfa6ZAQCCrqquzbLKajiXsKY0K_lQtWQ"
+		"managernotifytplid":"Iky7z3veZ6hy-ISchmQSgBvRd-34KzSyuYr0_fUbesE"
 	},
 	"activity":{
 	"activitycode":"topcj",

+ 8 - 30
weixin/src/qfw/weixin/distinguishwork.go

@@ -19,7 +19,7 @@ import (
 
 const (
 	status_rest      = 0 //闲时,没有任务
-	status_working   = 1 //闲时,没有任务
+	status_working   = 1 //进入工作状态
 	status_waitReply = 2 //收到验证码,等待回复
 )
 
@@ -45,7 +45,12 @@ func processevent(p *util.Packet) {
 		if ret := make(map[string]interface{}); json.Unmarshal(p.GetBusinessData(), &ret) == nil {
 			flag, _ := ret["flag"].(bool)
 			if flag {
-				img, err := json.Marshal(ret["img"])
+				imgTmp, err := json.Marshal(ret["img"])
+				if err != nil {
+					return
+				}
+				var img []byte
+				err = json.Unmarshal(imgTmp, &img)
 				if err != nil {
 					return
 				}
@@ -80,34 +85,6 @@ func (a *DistinguishWork) Start(openId string) {
 	toWork(nil)
 }
 
-func (a *DistinguishWork) Test() {
-	//发送验证码图片
-	var itm qrpc.ImgTextMsg
-	itm.ToUser = "oJULtw8sMXxZX7b-DvqpxIdl47zg"
-
-	var als qrpc.Articles
-	als.Title = "title"
-	als.Description = "description"
-	als.Url = "http://cdn2.qmx.top:9002/images/logo.png"
-	als.Picurl = "http://cdn2.qmx.top:9002/images/logo.png"
-
-	itm.News.Articles = append(itm.News.Articles, als)
-
-	qfwutil.Try(func() {
-		client, err := rpc.DialHTTP("tcp", wf.SysConfig.Rpcserver)
-		defer client.Close()
-		if err != nil {
-			log.Println(err.Error())
-			return
-		}
-		var repl qrpc.RpcResult
-		err = client.Call("WeiXinRpc.SendImgTextMsg", itm, &repl)
-		if err != nil {
-			log.Println(err.Error())
-		}
-	}, func(e interface{}) {})
-}
-
 //结束工作,删除工作人
 func (a *DistinguishWork) End(openId string) {
 	deleteWorker(openId)
@@ -292,6 +269,7 @@ func createImg(msgId string, img []byte) (string, error) {
 		log.Println("创建验证码图片出错:", err)
 		return "", err
 	}
+	log.Println(img)
 	_, err = file.Write(img)
 	if err != nil {
 		log.Println("写入验证码图片出错:", err)