Exemplo n.º 1
0
        private string devlopID = "wx6522a9d862ae7a0f"; //微信里面开发者模式:开发者ID

        #endregion Fields

        #region Methods

        public string Event(RequestVO requesXML,string key)
        {
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            string message = string.Empty;
            string strResult = string.Empty;
            Msg msg = new Msg ();
            switch (key)
            {
            case "subscribe":
                message = "感谢您关注【知识产权那点事】微信公众号,我们会定期为你推送我们最新的新闻资讯";
                strResult = msg.SendMsg (requesXML, message);
                // 将关注信息写入follow 表中
                string json = GetInfo (GetAccessToken (), requesXML.fromUserName);
                FollowVO follow = serializer.Deserialize<FollowVO> (json);
                JabinfoKeyValue data = new JabinfoKeyValue ();
                data ["openid"] = follow.openId;
                data ["nickname"] = follow.nickname;
                data ["sex"] = follow.sex;
                data ["province"] = follow.province;
                data ["city"] = follow.city;
                data ["country"] = follow.country;
                data ["headimgurl"] = follow.headimgurl;
                data ["createtime"] = requesXML.createTime.ToString();
                FollowMapper.I.Insert (data);
                break;
            case "unsubscribe":
                message = "取消关注";
                strResult = msg.SendMsg (requesXML, message);
                // 将关注者从数据库中取消
                FollowMapper.I.DeleteByPrimary (requesXML.fromUserName);
                break;
            case "CLICK":
                if (requesXML.EventKey == "inn") {
                    IList<WXArticle> articles = new List<WXArticle> ();
                    WXArticle article = new WXArticle ();
                    article.Description = "上海知识产权研究所,提供最具价值的知识产权资讯";
                    article.PicUrl = "http://www.iprlawyers.com/Files/2014.5.22fugang.jpg";
                    article.Title = "知识产权那点事";
                    article.Url = "http://www.iprlawyers.com/";
                    articles.Add (article);
                    strResult = msg.SendMsg (requesXML, articles);
                }
                break;
            //			case "SCAN":
            //				IList<WXArticle> articles1 = new List<WXArticle> ();
            //				WXArticle item = new WXArticle ();
            //				item.Title = "Kooteam";
            //				item.Description = "KooTeam是一款轻量级的团队时间管理与项目管理的系统,免费提供项目管理,团队协作SaaS解决方案。不需要安装或升级任何软件,您只要注册一个KooTeam账户就马上可以拥有一个多功能、一体化的在线项目管理,团队协作办公系统——无需购买服务器,使用次数不限、使用时长不限、用户数不限、项目数量不限";
            //				item.PicUrl = "http://p.kooteam.com/res/tma/banner/01.jpg";
            //				item.Url = "http://p.kooteam.com";
            //				articles1.Add (item);
            //				strResult = msg.SendMsg (requesXML, articles1);
            //				break;
            default:
                message = "receive a new event:" + requesXML.EventKey;
                strResult = msg.SendMsg (requesXML, message);
                break;
            }
            return strResult;
        }
Exemplo n.º 2
0
 public void add(JabinfoContext context,string parentId)
 {
     if (context.IsPost) {
         string keyword = context.Post ["keyword"].Trim ();
         context.Post ["categoryId"] = Jabinfo.Help.Basic.AutoId ("cat_tag");
         foreach (string name in context.Files.AllKeys) {
             if (context.Files [name].ContentLength > 5) {
                 System.Web.HttpPostedFile temp = context.Files [name];
                 Jabinfo.Help.Image.Save (string.Format ("{0}_{1}", context.Post ["categoryId"], name.Split ('_') [1]), context.Files [name]);
             }
         }
         if (context.Post ["parentId"].Length > 1) {
             CategoryVO categoryVO = CategoryMapper.I.Create (context.Post ["parentId"]);
             if (categoryVO.categoryId == null) {
                 context.Jump ("/crm/category/home/" + parentId, "添加失败,不存在父级分类");
                 return;
             }
             if (categoryVO.childen == "0") {
                 JabinfoKeyValue data = new JabinfoKeyValue ();
                 data ["categoryId"] = context.Post ["parentId"];
                 data ["childen"] = "1";
                 CategoryMapper.I.UpdateByPrimary (data);
             }
             JabinfoKeyValue cate_Data = new JabinfoKeyValue ();
             context.Post ["childen"] = (Convert.ToInt32 (categoryVO.childen) + 1).ToString ();
         }
         CategoryMapper.I.Insert (context.Post);
         context.Jump ("/crm/category/home/" + parentId, "添加成功");
         return;
     }
     context.Variable["parentId"] = parentId;
 }
Exemplo n.º 3
0
 public int Insert(JabinfoKeyValue data)
 {
     return query.Insert ("job").
         Value("job_id", data["jobId"], DataType.Char, 24).
         Value("title", data["title"], DataType.Varchar, 50).
         Value("region", data["region"], DataType.Varchar, 30).
         Value("reads", data["reads"], DataType.Int).
         Value("sex", data["sex"], DataType.Char, 1).
         Value("height", data["height"], DataType.Char, 1).
         Value("overtime", data["overtime"], DataType.Int).
         Value("context", data["context"], DataType.Text).
         Value("j_time", data["jTime"], DataType.Varchar, 50).
         Value("j_address", data["jAddress"], DataType.Varchar, 50).
         Value("mobile", data["mobile"], DataType.Varchar, 20).
         Value("spec", data["spec"], DataType.Varchar, 200).
         Value("note", data["note"], DataType.Text).
         Value("type", data["type"], DataType.Char, 1).
         Value("jtype", data["jtype"], DataType.Varchar, 30).
         Value("people", data["people"], DataType.Int).
         Value("status", data["status"], DataType.Char, 1).
         Value("price", data["price"], DataType.Char, 0).
         Value("city", data["city"], DataType.Varchar, 30).
         Value("extend", data["extend"], DataType.Varchar, 1000).
         Excute ();
 }
Exemplo n.º 4
0
 public int Insert(JabinfoKeyValue data)
 {
     return query.Insert ("msglog").
         Value("msg_id", data["msgId"], DataType.Char, 24).
         Value("errmsg", data["errmsg"], DataType.Varchar, 100).
         Value("errcode", data["errcode"], DataType.Varchar, 30).
         Excute ();
 }
Exemplo n.º 5
0
 public int Insert(JabinfoKeyValue data)
 {
     return query.Insert ("j_type").
         Value("type_id", data["typeId"], DataType.Char, 24).
         Value("title", data["title"], DataType.Varchar, 50).
         Value("index", data["index"], DataType.Int).
         Excute ();
 }
Exemplo n.º 6
0
 public int Insert(JabinfoKeyValue data)
 {
     return query.Insert ("article_detail").
         Value("article_id", data["articleId"], DataType.Char, 24).
         Value("content", data["content"], DataType.Text).
         Value("categorys", data["categorys"], DataType.Varchar, 500).
         Excute ();
 }
Exemplo n.º 7
0
 public int Insert(JabinfoKeyValue data)
 {
     return query.Insert ("animation").
         Value("animation_id", data["animationId"], DataType.Char, 24).
         Value("title", data["title"], DataType.Varchar, 30).
         Value("url", data["url"], DataType.Varchar, 100).
         Value("index", data["index"], DataType.Int).
         Excute ();
 }
Exemplo n.º 8
0
 public int Insert(JabinfoKeyValue data)
 {
     return query.Insert ("company").
         Value("conpany_id", data["conpanyId"], DataType.Char, 24).
         Value("name", data["name"], DataType.Varchar, 30).
         Value("city", data["city"], DataType.Varchar, 10).
         Value("date", data["date"], DataType.Int).
         Value("address", data["address"], DataType.Varchar, 100).
         Excute ();
 }
Exemplo n.º 9
0
 public int Insert(JabinfoKeyValue data)
 {
     return query.Insert ("ticket").
         Value("ticket", data["ticket"], DataType.Varchar, 150).
         Value("url", data["url"], DataType.Varchar, 200).
         Value("createtime", data["createtime"], DataType.Int).
         Value("expire_seconds", data["expireSeconds"], DataType.Int).
         Value("title", data["title"], DataType.Varchar, 30).
         Excute ();
 }
Exemplo n.º 10
0
 public int Insert(JabinfoKeyValue data)
 {
     return query.Insert ("upload").
         Value("upload_id", data["uploadId"], DataType.Char, 24).
         Value("title", data["title"], DataType.Varchar, 30).
         Value("type", data["type"], DataType.Varchar, 10).
         Value("media_id", data["mediaId"], DataType.Varchar, 150).
         Value("created_at", data["createdAt"], DataType.Int).
         Excute ();
 }
Exemplo n.º 11
0
 public int Insert(JabinfoKeyValue data)
 {
     return query.Insert ("feedback").
         Value("feed_id", data["feedId"], DataType.Char, 24).
         Value("context", data["context"], DataType.Text).
         Value("addtime", data["addtime"], DataType.Int).
         Value("name", data["name"], DataType.Varchar, 30).
         Value("email", data["email"], DataType.Varchar, 30).
         Value("mobile", data["mobile"], DataType.Varchar, 30).
         Excute ();
 }
Exemplo n.º 12
0
 public int Insert(JabinfoKeyValue data)
 {
     return query.Insert ("page").
         Value("page_id", data["pageId"], DataType.Char, 24).
         Value("title", data["title"], DataType.Varchar, 100).
         Value("describe", data["describe"], DataType.Varchar, 500).
         Value("ispost", data["ispost"], DataType.Char, 1).
         Value("group", data["group"], DataType.Char, 1).
         Value("index", data["index"], DataType.Int).
         Value("jtype", data["jtype"], DataType.Char, 24).
         Value("content", data["content"], DataType.Text).
         Excute ();
 }
Exemplo n.º 13
0
 public int Insert(JabinfoKeyValue data)
 {
     return query.Insert ("category").
         Value("category_id", data["categoryId"], DataType.Char, 24).
         Value("title", data["title"], DataType.Varchar, 50).
         Value("parent_id", data["parentId"], DataType.Char, 24).
         Value("index", data["index"], DataType.Int).
         Value("childen", data["childen"], DataType.Char, 1).
         Value("pagesize", data["pagesize"], DataType.Int).
         Value("keyword", data["keyword"], DataType.Varchar, 1000).
         Value("describe", data["describe"], DataType.Varchar, 500).
         Excute ();
 }
Exemplo n.º 14
0
 public int Insert(JabinfoKeyValue data)
 {
     return query.Insert ("request").
         Value("request_id", data["requestId"], DataType.Char, 24).
         Value("ToUserName", data["toUserName"], DataType.Varchar, 50).
         Value("FromUserName", data["fromUserName"], DataType.Varchar, 50).
         Value("CreateTime", data["createTime"], DataType.Int).
         Value("MsgType", data["msgType"], DataType.Varchar, 20).
         Value("Content", data["content"], DataType.Text).
         Value("MsgId", data["msgId"], DataType.Char, 64).
         Value("status", data["status"], DataType.Char, 1).
         Value("reply", data["reply"], DataType.Varchar, 500).
         Excute ();
 }
Exemplo n.º 15
0
 /// <summary>
 /// 活动添加
 /// </summary>
 /// <param name="context">Context.</param>
 public void activeadd(JabinfoContext context)
 {
     if (!context.IsPost) {
         context.Variable ["sex"] = Jabinfo.Help.Config.Get ("job_system.sex");
         context.Variable ["cityList"] = CityMapper.I.SelectByPage (0,50);
         return;
     }
     context.Post ["jobId"] = Jabinfo.Help.Basic.AutoId ("crm_id");
     JabinfoKeyValue extend = new JabinfoKeyValue ();
     extend ["contact"] = context.Post ["contact"];
     context.Post ["contact"] = extend.ToString ();
     context.Post["type"]="3";         //type=’3‘  活动
     context.Post ["overtime"] =  Jabinfo.Help.Date.StringToDate (context.Post ["overtime"]).ToString ();
     JobMapper.I.Insert(context.Post);
     context.Jump("/crm/job/activeedit/"+ context.Post["jobId"],"添加成功");
 }
Exemplo n.º 16
0
 public void activeedit(JabinfoContext context,string jobId)
 {
     if (!context.IsPost) {
         context.Variable ["sex"] = Jabinfo.Help.Config.Get ("job_system.sex");
         context.Variable ["cityList"] = CityMapper.I.SelectByPage (0,50);
         context.Variable ["job"] = JobMapper.I.Create (jobId);
         context.Variable ["extend"] = JobMapper.I.Create (jobId).extendKV;
         return;
     }
     JabinfoKeyValue extend = new JabinfoKeyValue ();
     extend ["contact"] = context.Post ["contact"];   //联系人
     context.Post ["extend"] = extend.ToString ();
     context.Post ["overtime"] =  Jabinfo.Help.Date.StringToDate (context.Post ["overtime"]).ToString ();
     JobMapper.I.UpdateByPrimary(context.Post);
     context.Jump("/crm/job/activeedit/"+ context.Post["jobId"],"编辑成功");
 }
Exemplo n.º 17
0
 public void category(JabinfoContext context,string articleId)
 {
     ArticleVO article = null;
     if (!context.IsPost) {
         string[] categorys = new String[0];
         article = ArticleMapper.I.Create(articleId);
         if (!string.IsNullOrEmpty(article.categorys))
             categorys =article.categorys.Split(',');
         string initTag = string.Empty;
         for (int i = 1; i < categorys.Length-1; i++)
         {
             CategoryVO categoryVO = CategoryMapper.I.Create(categorys[i]);
             initTag = string.Format("{0}<li id=\"{1}\"><strong>{2}</strong>&nbsp;", initTag, categoryVO.categoryId, categoryVO.title);
             initTag = string.Format("{0}</li>", initTag);
         }
         context.Variable["initTag"] = initTag;
     //	context.Variable["top_id"] = Jabinfo.Help.Config.Get("core.top", "article");
         context.Variable["article"] =ArticleMapper.I.Create(articleId);
         context.Variable["detail"] = article;
         context.Variable["articleId"] = articleId;
         return;
     }
     article =ArticleMapper.I.Create(context.Post["articleId"]);
     JabinfoKeyValue data = new JabinfoKeyValue();
     data["articleId"] = context.Post["articleId"];
     data["categorys"] = string.IsNullOrEmpty(context.Post["categorys"]) ? "" : string.Format(",{0},", context.Post["categorys"]);
     ArticleDetailMapper.I.UpdateByPrimary (data);
     if (article.iscash == "0" && !string.IsNullOrEmpty(data["categorys"]))
     {
         string[] lt = data["categorys"].Split(',');
         data["categoryId"] = lt[lt.Length - 2];
         ArticleMapper.I.UpdateByPrimary(data);
     }
     context.Alert("保存成功");
     return;
 }
Exemplo n.º 18
0
 public int UpdateByPrimary(JabinfoKeyValue data)
 {
     return query.Update ("j_type").
         Set("title", data["title"], DataType.Varchar, 50).
         Set("index", data["index"], DataType.Int).
         Where("type_id", data["typeId"], DataType.Char, 24).
         Excute ();
 }
Exemplo n.º 19
0
 //获取通行证
 public string GetAccessToken()
 {
     TokenVO token=TokenMapper.I.Create("AccessToken");
     int currentdate=Jabinfo.Help.Date.Now;
     if (currentdate - token.date >= 7000) {    // 7000 防止 误差的产生,改为7000
         string url_token = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + devlopID + "&secret=" + devlogPsw;
         string jsonStr = Jabinfo.Help.Http.GetHttps (url_token);
         AccessToken = GetJsonValue (jsonStr, "access_token");
         JabinfoKeyValue data = new JabinfoKeyValue ();
         data["tokenId"]="AccessToken";
         data ["value"] = AccessToken;
         data ["date"] = Jabinfo.Help.Date.Now.ToString();
         TokenMapper.I.UpdateByPrimary (data);
     } else {
         AccessToken = token.value;
     }
     return AccessToken;
 }
Exemplo n.º 20
0
 /// <summary>
 /// 上传图文
 /// </summary>
 /// <returns>The news.</returns>
 /// <param name="json">Json.</param>
 public void UpNews(string articles,string title)
 {
     JabinfoKeyValue data = new JabinfoKeyValue ();
     string url = "https://api.weixin.qq.com/cgi-bin/media/uploadnews?access_token=" + GetAccessToken ();
     string json = Jabinfo.Help.Http.PostHttps (url, articles);
     data ["uploadId"] = Jabinfo.Help.Basic.JabId;
     data ["title"] = title;
     data["type"]="news";
     data ["mediaId"] = GetJsonValue (json, "media_id");
     data ["createdAt"] =GetJsonValue (json, "created_at");
     UploadMapper.I.Insert (data);
 }
Exemplo n.º 21
0
 public int UpdateByPrimary(JabinfoKeyValue data)
 {
     return query.Update ("ticket").
         Set("url", data["url"], DataType.Varchar, 200).
         Set("createtime", data["createtime"], DataType.Int).
         Set("expire_seconds", data["expireSeconds"], DataType.Int).
         Set("title", data["title"], DataType.Varchar, 30).
         Where("ticket", data["ticket"], DataType.Varchar, 150).
         Excute ();
 }
Exemplo n.º 22
0
 /// <summary>
 /// 分组推送消息
 /// </summary>
 /// <param name="json">Json.</param>
 public string Sendgroup(string str)
 {
     string url = "https://api.weixin.qq.com/cgi-bin/message/mass/sendall?access_token=" + GetAccessToken ();
     string json=Jabinfo.Help.Http.PostHttps(url,str);
     string errorcode = GetJsonValue (json, "errcode");
     JabinfoKeyValue data = new JabinfoKeyValue ();
     data["msgId"]= GetJsonValue (json, "msg_id");
     data ["errmsg"] = GetJsonValue (json, "errmsg");
     data ["errcode"] = GetJsonValue (json, "errcode");
     MsglogMapper.I.Insert (data);
     return errorcode;
 }
Exemplo n.º 23
0
 public int UpdateByPrimary(JabinfoKeyValue data)
 {
     return query.Update ("article_detail").
         Set("content", data["content"], DataType.Text).
         Set("categorys", data["categorys"], DataType.Varchar, 500).
         Where("article_id", data["articleId"], DataType.Char, 24).
         Excute ();
 }
Exemplo n.º 24
0
 public int Insert(JabinfoKeyValue data)
 {
     return query.Insert ("article").
         Value("article_id", data["articleId"], DataType.Char, 24).
         Value("title", data["title"], DataType.Varchar, 200).
         Value("caption", data["caption"], DataType.Varchar, 200).
         Value("author", data["author"], DataType.Varchar, 50).
         Value("model", data["model"], DataType.Varchar, 20).
         Value("pubtime", data["pubtime"], DataType.Int).
         Value("summary", data["summary"], DataType.Varchar, 600).
         Value("reads", data["reads"], DataType.Int).
         Value("ispost", data["ispost"], DataType.Char, 1).
         Value("come_url", data["comeUrl"], DataType.Varchar, 100).
         Value("come", data["come"], DataType.Varchar, 50).
         Value("keyword", data["keyword"], DataType.Varchar, 200).
         Value("uid", data["uid"], DataType.Char, 24).
         Value("categorys", data["categorys"], DataType.Varchar, 200).
         Value("jtype", data["jtype"], DataType.Char, 1).
         Value("category_id", data["categoryId"], DataType.Varchar, 30).
         Value("iscash", data["iscash"], DataType.Char, 1).
         Excute ();
 }
Exemplo n.º 25
0
 public int UpdateByPrimary(JabinfoKeyValue data)
 {
     return query.Update ("msglog").
         Set("errmsg", data["errmsg"], DataType.Varchar, 100).
         Set("errcode", data["errcode"], DataType.Varchar, 30).
         Where("msg_id", data["msgId"], DataType.Char, 24).
         Excute ();
 }
Exemplo n.º 26
0
 public int UpdateByPrimary(JabinfoKeyValue data)
 {
     return query.Update ("company").
         Set("name", data["name"], DataType.Varchar, 30).
         Set("city", data["city"], DataType.Varchar, 10).
         Set("date", data["date"], DataType.Int).
         Set("address", data["address"], DataType.Varchar, 100).
         Where("conpany_id", data["conpanyId"], DataType.Char, 24).
         Excute ();
 }
Exemplo n.º 27
0
 public int UpdateByPrimary(JabinfoKeyValue data)
 {
     return query.Update ("follow").
         Set("nickname", data["nickname"], DataType.Varchar, 30).
         Set("sex", data["sex"], DataType.Char, 1).
         Set("province", data["province"], DataType.Varchar, 20).
         Set("city", data["city"], DataType.Varchar, 20).
         Set("country", data["country"], DataType.Varchar, 10).
         Set("headimgurl", data["headimgurl"], DataType.Varchar, 50).
         Set("group", data["group"], DataType.Varchar, 20).
         Set("createtime", data["createtime"], DataType.Int).
         Where("open_id", data["openId"], DataType.Varchar, 50).
         Excute ();
 }
Exemplo n.º 28
0
 /// <summary>
 /// 实习全职列表
 /// </summary>
 /// <param name="context">Context.</param>
 public void fulladd(JabinfoContext context)
 {
     if (!context.IsPost) {
         context.Variable ["sex"] = Jabinfo.Help.Config.Get ("job_system.sex");
         context.Variable ["cityList"] = CityMapper.I.SelectByPage (0,50);
         context.Variable ["typeList"] = JTypeMapper.I.SelectByPage (0, 50);
         context.Variable ["wageset"] = Jabinfo.Help.Config.Get ("job_system.wageset");
         return;
     }
     context.Post ["jobId"] = Jabinfo.Help.Basic.AutoId ("full_id");
     JabinfoKeyValue extend = new JabinfoKeyValue ();
     context.Post["type"]="2";         //type=’2‘  为全职
     extend ["company"] = context.Post ["company"];
     extend ["contact"] = context.Post ["contact"];
     extend ["wage"] = context.Post ["wage"];
     context.Post ["extend"] = extend.ToString ();
     context.Post ["overtime"] =  Jabinfo.Help.Date.StringToDate (context.Post ["overtime"]).ToString ();
     JobMapper.I.Insert(context.Post);
     context.Jump("/crm/job/fulledit/"+ context.Post["jobId"],"添加成功");
 }
Exemplo n.º 29
0
 public int UpdateByPrimary(JabinfoKeyValue data)
 {
     return query.Update ("animation").
         Set("title", data["title"], DataType.Varchar, 30).
         Set("url", data["url"], DataType.Varchar, 100).
         Set("index", data["index"], DataType.Int).
         Where("animation_id", data["animationId"], DataType.Char, 24).
         Excute ();
 }
Exemplo n.º 30
0
 /// <summary>
 /// 发送消息日志
 /// </summary>
 /// <param name="postString">Post string.</param>
 public void loger(RequestVO request)
 {
     JabinfoKeyValue data = new JabinfoKeyValue ();
     data ["requestId"] = Jabinfo.Help.Basic.JabId;
     data ["toUserName"] = request.toUserName;
     data["fromUserName"]=request.fromUserName;
     data ["createTime"] = request.createTime.ToString();
     data ["msgType"] = request.msgType;
     data ["content"] = request.content;
     data ["msgId"] = request.msgId;
     RequestMapper.I.Insert (data);
 }