/// <summary> /// 机器人教育 /// </summary> /// <param name="userDate">用户信息</param> /// <returns>返回信息</returns> private Hashtable[] funcTeach(Hashtable userDate ) { Hashtable[] rt = new Hashtable[1]; rt[0] = new Hashtable(); rt[0]["id"] = 0; rt[0]["messageType"] = 2; rt[0]["title"] = "教左邻回答\"" + userDate["@body"].ToString() + "\""; rt[0]["body"] = "你刚说了\"" + userDate["@body"].ToString() + "\",但是我现在还不知道该怎么回答这个问题……\n"+ "教教我应该怎么回答好不好【撒娇】,\n"+ "以后定西只要再有人和我这么说,我就照你教我的回答Ta。"; rt[0]["picSmall"] = getPicUrl(false); rt[0]["picBig"] = "http://www.ai0932.com/images/weixin/teach.jpg"; rt[0]["url"] = "http://www.ai0932.com/mobile/robot-teach.aspx?q="+ HttpUtility.UrlEncode(userDate["@body"].ToString()) ; rt[0]["orders"] = 90; Robot.Main myRobot = new Robot.Main(); int uid = getWeiUserId(userDate["@FromUserName"].ToString()); myRobot.questionAdd(userDate["@body"].ToString(), uid); Information.group myGroup = new Information.group(); myGroup.topicNewByWeixin("求调教", "教左邻回答“" + userDate["@body"].ToString() + "”", -1, uid, "我刚对左邻说“<span style=\"color:red;\">" + userDate["@body"].ToString() + "</span>”但是她不知道该怎么回答我,<a href=\"robot-teach.aspx?q=" + HttpUtility.UrlEncode(userDate["@body"].ToString()) + "\">点击这里</a>去调教她!"); return rt; }
private void loadTeach() { Hashtable[] items; Robot.Main myRobot = new Robot.Main(); int last = Convert.ToInt32(theContext.Request.Form["last"]); if (theContext.Request.Form["type"].ToString() == "noAnswer") { items = myRobot.questionsGet(last, 15); } else if (theContext.Request.Form["type"].ToString() == "answerByMe") { items = myRobot.getTeachListByUser(Convert.ToInt32(theContext.Session["id"]), last, 15); } else { items = myRobot.getTeachList(last, 15); } StringBuilder sb = new StringBuilder(); foreach (Hashtable item in items) { if (theContext.Request.Form["type"].ToString() == "noAnswer") { sb.Append("<li class=\"teachItems padding10 bg-color-blueLight\" data-id=\"" + item["id"] + "\">"); sb.Append("<h4><i class=\"icon-help\"></i> " + item["question"] + "</h4>"); sb.Append("<a href=\"robot-teach.aspx?q=" + HttpUtility.UrlEncode(item["question"].ToString()) + "\">点这里去调教</a>"); sb.Append("</li>"); } else { sb.Append("<li class=\"teachItems padding10 bg-color-blueLight\" data-id=\"" + item["id"] + "\">"); sb.Append("<h4><i class=\"icon-help\"></i> " + item["keyWord"] + "</h4>"); sb.Append("<div class=\"padding10 bg-color-light-yellow fg-color-darken\">"); sb.Append(item["body"] + " ——By:<span class=\"fg-color-red\">" + (item["niceName"].ToString() == "" ? "匿名用户" : item["niceName"].ToString())); sb.Append("</span></div>"); sb.Append("</li>"); } } theContext.Response.Write(sb); }