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; }
public void edit(JabinfoContext context, String categoryId) { if (categoryId == null) { CategoryVO category = CategoryMapper.I.Create(context.Post["categoryId"]); string keyword = context.Post["keyword"].Trim(); if (keyword.Contains(",") || keyword == "") { CategoryMapper.I.UpdateByPrimary(context.Post); foreach (string name in context.Files.AllKeys) { if (context.Files[name].ContentLength > 5) { Jabinfo.Help.Image.Save(string.Format("{0}_{1}", context.Post["categoryId"], name.Split('_')[1]), context.Files[name]); } } context.Jump("crm/category/home/"+category.parentId, "修改成功"); return; } else { context.Jump("crm/category/home/"+category.parentId, "关键字请用逗号隔开"); return; } } context.Variable["category"] = CategoryMapper.I.Create(categoryId); }
public void msg(JabinfoContext context,string requestId) { if (!context.IsPost) { context.Variable ["requestId"] = requestId; return; } Weixin wx = new Weixin (); StringBuilder str=new StringBuilder("{ \r\n"); StringBuilder con = new StringBuilder (); string msg = context.Post ["context"]; str.Append(" \"touser\":[ \r\n"); con.Append (string.Format ("\"{0}\",\r\n", context.Post["openId"])); string main = con.ToString (); string text = main.Substring (0, main.Length - 3); str.Append (text); str.Append(" ], \r\n"); str.Append ("\"msgtype\": \"text\", \r\n"); //您好,宾弗科技微信公众号推出两款新功能,关键字搜索文章查看,资讯推送,感谢你的关注! str.Append (" \"text\": { \"content\": \""+msg+"\"}"); str.Append("} \r\n"); string result = wx.Sendmsg (str.ToString ()); context.Post ["status"] = "1"; RequestMapper.I.UpdateByPrimary (context.Post); context.Alert ("回复成功"); }
public void add(JabinfoContext context) { Weixin weixin = new Weixin (); Utils util = new Utils (); if (!context.IsPost) { return; } context.Post ["uploadId"] = Jabinfo.Help.Basic.JabId; string type = context.Post ["type"]; string fileName = context.Files ["afile"].FileName; string model=fileName.Substring(fileName.LastIndexOf('.') + 1); Jabinfo.Help.Upload.Save (context.Post ["uploadId"], context.Files["afile"],model); string file = Jabinfo.Help.Upload.PysPath (context.Post ["uploadId"],model); string url = "http://file.api.weixin.qq.com/cgi-bin/media/upload?access_token="+weixin.GetAccessToken(); url = url + "&type=" + type; string json = util.HttpUpload (url, file); context.Post ["mediaId"] = weixin.GetJsonValue (json,"media_id"); context.Post ["createdAt"] = weixin.GetJsonValue(json,"created_at"); if (!string.IsNullOrEmpty (weixin.GetJsonValue (json, "errcode"))) { context.Jump ("/article/upload/home","无效媒体类型,请重新上传"); return; } UploadMapper.I.Insert(context.Post); context.Refresh (); }
public void add(JabinfoContext context) { bool istemp = true; Weixin wx = new Weixin (); JavaScriptSerializer serializer = new JavaScriptSerializer (); if (!context.IsPost) { return; } int sceneId = Convert.ToInt32(context.Post ["sceneId"]); string action = context.Post ["action"]; if (action == "false") istemp = false; string resutl= wx.QRCodeTicket (istemp, sceneId); if (resutl == "0") { context.Alert ("添加失败"); return; } string seconds = istemp ? wx.GetJsonValue (resutl, "expire_seconds") : "0"; //如果用为用二维码;则二维码时间为 100000000; TicketVO tk= serializer.Deserialize<TicketVO> (resutl); context.Post ["createtime"] = Jabinfo.Help.Date.Now.ToString(); context.Post ["ticket"] = tk.ticket; context.Post ["url"] = tk.url; context.Post ["expireSeconds"] = seconds; TicketMapper.I.Insert(context.Post); context.Refresh (); }
public void home(JabinfoContext context, int index) { int size = 30; context.Variable ["total"] = JTypeMapper.I.CountAll (); context.Variable ["size"] = size; context.Variable ["index"] = index; context.Variable ["jTypeList"] = JTypeMapper.I.SelectByPage (index, size); }
/// <summary> /// 子目录 /// </summary> /// <param name="context">Context.</param> /// <param name="meunId">Meun identifier.</param> public void dire(JabinfoContext context,string meunId) { context.Variable ["total"] = MenuMapper.I.DireCount (meunId); context.Variable ["parentId"] = meunId; context.Variable ["title"] = MenuMapper.I.Create (meunId).name; context.Variable["type"]=Jabinfo.Help.Config.Get("wx_system.type"); context.Variable ["menuList"] = MenuMapper.I.DireList (meunId); }
public void add(JabinfoContext context) { if (!context.IsPost) { return; } context.Post ["typeId"] = Jabinfo.Help.Basic.JabId; JTypeMapper.I.Insert(context.Post); context.Refresh (); }
public void edit(JabinfoContext context, String cityId) { if (!context.IsPost) { context.Variable ["city"] = CityMapper.I.Create (cityId); return; } CityMapper.I.UpdateByPrimary(context.Post); context.Refresh (); }
public void add(JabinfoContext context) { if (!context.IsPost) { return; } context.Post ["cityId"] = Jabinfo.Help.Basic.AutoId ("cat_tag"); CityMapper.I.Insert(context.Post); context.Refresh (); }
/// <summary> /// 反馈信息 /// </summary> /// <param name="context">Context.</param> public void feed(JabinfoContext context) { if (!context.IsPost) return; context.Post ["feedId"] = Jabinfo.Help.Basic.JabId; context.Post ["addtime"] = Jabinfo.Help.Date.Now.ToString (); FeedbackMapper.I.Insert (context.Post); context.Refresh (); }
/// <summary> /// 文章分类 /// </summary> /// <param name="context">Context.</param> public void category(JabinfoContext context,string categoryId,int index) { int size = 20; context.Variable ["index"] = index; context.Variable ["size"] = size; context.Variable ["title"] = CategoryMapper.I.Create (categoryId).title; context.Variable ["articleList"] = ArticleModel.I.Category (categoryId, index, size); context.Variable ["total"] = ArticleModel.I.Ctotal (categoryId); }
public void edit(JabinfoContext context, String articleId) { if (!context.IsPost) { context.Variable ["articleDetail"] = ArticleDetailMapper.I.Create (articleId); return; } ArticleDetailMapper.I.UpdateByPrimary(context.Post); context.Refresh (); }
public void edit(JabinfoContext context, String typeId) { if (!context.IsPost) { context.Variable ["jType"] = JTypeMapper.I.Create (typeId); return; } JTypeMapper.I.UpdateByPrimary(context.Post); context.Refresh (); }
public void edit(JabinfoContext context, String feedId) { if (!context.IsPost) { context.Variable ["feedback"] = FeedbackMapper.I.Create (feedId); return; } FeedbackMapper.I.UpdateByPrimary(context.Post); context.Refresh (); }
public void edit(JabinfoContext context, String ticket) { if (!context.IsPost) { context.Variable ["ticket"] = TicketMapper.I.Create (ticket); return; } TicketMapper.I.UpdateByPrimary(context.Post); context.Refresh (); }
public void edit(JabinfoContext context, String tokenId) { if (!context.IsPost) { context.Variable ["token"] = TokenMapper.I.Create (tokenId); return; } TokenMapper.I.UpdateByPrimary(context.Post); context.Refresh (); }
public void add(JabinfoContext context) { if (!context.IsPost) { return; } context.Post ["articleId"] = Jabinfo.Help.Basic.JabId; ArticleDetailMapper.I.Insert(context.Post); context.Refresh (); }
public void edit(JabinfoContext context, String menuId) { if (!context.IsPost) { context.Variable ["menu"] = MenuMapper.I.Create (menuId); return; } MenuMapper.I.UpdateByPrimary(context.Post); context.Refresh (); }
public void edit(JabinfoContext context, String uploadId) { if (!context.IsPost) { context.Variable ["upload"] = UploadMapper.I.Create (uploadId); return; } UploadMapper.I.UpdateByPrimary(context.Post); context.Refresh (); }
public void home(JabinfoContext context, int index) { int size = 30; context.Variable ["total"] = FollowMapper.I.CountAll (); context.Variable ["size"] = size; context.Variable ["index"] = index; context.Functions.Add ("category", this.category); context.Variable ["followList"] = FollowMapper.I.SelectByPage (index, size); }
public void edit(JabinfoContext context, String openId) { if (!context.IsPost) { context.Variable ["follow"] = FollowMapper.I.Create (openId); return; } FollowMapper.I.UpdateByPrimary(context.Post); context.Refresh (); }
public void edit(JabinfoContext context, String basicId) { if (!context.IsPost) { context.Variable ["basic"] = BasicMapper.I.Create (basicId); return; } BasicMapper.I.UpdateByPrimary(context.Post); context.Refresh (); }
public void edit(JabinfoContext context, String requestId) { if (!context.IsPost) { context.Variable ["request"] = RequestMapper.I.Create (requestId); return; } RequestMapper.I.UpdateByPrimary(context.Post); context.Refresh (); }
public void home(JabinfoContext context, int index) { int size = 30; Weixin weixin = new Weixin (); context.Variable ["total"] = UploadMapper.I.CountAll (); context.Variable ["size"] = size; context.Variable ["index"] = index; context.Variable ["access_token"] = weixin.GetAccessToken (); context.Variable ["uploadList"] = UploadMapper.I.SelectByPage (index, size); }
/// <summary> /// 培训活动 /// </summary> /// <param name="context">Context.</param> public void activehome(JabinfoContext context,int index) { int size = 30; context.Variable ["total"] = JobMapper.I.typeCount("3"); context.Variable ["size"] = size; context.Variable ["index"] = index; context.Variable ["sex"] = Jabinfo.Help.Config.Get ("job_system.sex"); context.Variable ["status"] = Jabinfo.Help.Config.Get ("job_system.status"); context.Variable ["jobList"] = JobMapper.I.typeSelect("3",index, size); }
public void home(JabinfoContext context, int index) { int size = 30; context.Variable ["total"] = RequestMapper.I.CountAll (); context.Variable ["size"] = size; context.Variable ["index"] = index; context.Functions.Add ("info", this.info); context.Variable ["status"] = Jabinfo.Help.Config.Get ("article.post"); context.Variable ["requestList"] = RequestMapper.I.SelectByPage (index, size); }
public void remove(JabinfoContext context, String msgId) { Weixin wx = new Weixin (); string url = "https://api.weixin.qq.com/cgi-bin/message/mass/delete?access_token=" + wx.GetAccessToken (); string con = "{\n \"msg_id\":" + msgId + "\n}"; string json = Jabinfo.Help.Http.PostHttps (url, con); if (wx.GetJsonValue (json, "errcode") == "0") { MsglogMapper.I.DeleteByPrimary (msgId); context.Alert ("删除成功"); } }
/// <summary> /// 成为开发者的第一步,验证并相应服务器的数据 /// </summary> public void Auth(JabinfoContext context) { string echoStr =context.Request.QueryString["echoStr"]; if (CheckSignature(context)) { if (!string.IsNullOrEmpty(echoStr)) { context.Print(echoStr); context.End (); } } }
public void add(JabinfoContext context,string categoryId) { if (!context.IsPost) { context.Variable["categoryId"] = categoryId; context.Variable ["now"] = Jabinfo.Help.Date.Now; return; } context.Post ["articleId"] = Jabinfo.Help.Basic.JabId; context.Post ["pubtime"] = Jabinfo.Help.Date.StringToDate (context.Post ["pubtime"]).ToString (); context.Post ["uid"] = context.Role.Uid; //上传图片 if (context.Files["image"] != null && context.Files["image"].ContentLength > 10) { Jabinfo.Help.Image.Save(context.Post["articleId"], context.Files["image"]); JabinfoKeyValue sizes = Jabinfo.Help.Config.Get("article.photosize"); foreach (string key in sizes.Keys) { string[] size = sizes[key].Split('x'); Jabinfo.Help.Image.Resize(string.Format("{0}_{1}", context.Post["articleId"], key), context.Post["articleId"], Convert.ToInt32(size[0]), Convert.ToInt32(size[1])); } context.Post["attach"] = "1";//有预览图 } else { context.Post["attach"] = "0"; } //上传文件 if (context.Files["afile"] != null && context.Files["afile"].ContentLength > 10) { string fileName = context.Files["afile"].FileName; context.Post["model"] = fileName.Substring(fileName.LastIndexOf('.') + 1); Jabinfo.Help.Upload.Save(context.Post["article_id"] + "_file", context.Files["afile"], context.Post["model"]); } if (string.IsNullOrEmpty(context.Post["summary"])) { string content = Jabinfo.Help.Formate.HtmlClear(context.Post["content"]); if (content.Length < 200) context.Post["summary"] = content; else context.Post["summary"] = content.Substring(0, 200); } ArticleMapper.I.Insert(context.Post); ArticleDetailMapper.I.Insert(context.Post); if (context.Post ["category_id"] == string.Empty) { context.Jump (string.Format ("/article/article/category/{0}", context.Post ["articleId"]), "添加成功,请设置文章分类"); return; } else { context.Jump(string.Format("article/article/edit/{0}", context.Post["articleId"]),"添加成功"); return; } }