public static void login(CmsForm cmsForm, WeiboBean weiboBean) { //WeiboLogin.login(cmsForm, weiboBean.user_name.Trim(), weiboBean.pwd.Trim()); string out_cookie = ""; string body = WeiboUtil.login(cmsForm, weiboBean.user_name.Trim(), weiboBean.pwd.Trim(), out out_cookie); if (!string.IsNullOrEmpty(out_cookie)) { WeiboUtil.update_weibo_list(cmsForm, weiboBean.user_name, out_cookie); } //LogUtil.log_call(cmsForm,"----"+ body); //HttpUpload httpUpload = new HttpUpload(); //httpUpload.SetFieldValue("type","json"); //FileStream fs = new FileStream(@"E:\work\cs\好品推\Release\config\临时文件夹\selhotshare\20161101091218\20161102010514273.jpg", FileMode.Open); //byte[] buffer = new byte[fs.Length]; //httpUpload.SetFieldValue("pic", "20161102010514273.jpg", "image/png", buffer); //string cotent = ""; //httpUpload.Upload("http://m.weibo.cn/mblogDeal/addPic", out_cookie, out body); //LogUtil.log_call(cmsForm, "----" + body); //LogUtil.log_call(cmsForm, "----" + fs.Length); //Dictionary<string, string> formDataDic = new Dictionary<string, string>(); //formDataDic.Add("type", "json"); //body = HttpUpload.CreateHttpUploadFile(cmsForm,"http://m.weibo.cn/mblogDeal/addPic", fs, "pic", "image/png" // , out_cookie, formDataDic //); //LogUtil.log_call(cmsForm, "----" + body); ////LogUtil.log_call(cmsForm, "----" + out_cookie); //body = WeiboUtil.post(cmsForm, "aadfasdfsd","", out_cookie); //LogUtil.log_call(cmsForm, "----" + body); }
public static void send(CmsForm cmsForm, string content, string content_img, ArrayList imgList, CouponContent couponContent, int url_type, int goods_type) { string out_log = ""; try { if (cmsForm.appBean.weibo_list == null || cmsForm.appBean.weibo_list.Count == 0) { LogUtil.log_call(cmsForm, "没有微博账号!"); return; } int i = 0; while (i < cmsForm.appBean.weibo_list.Count) { if (!cmsForm.appBean.send_status && !cmsForm.appBean.qunfa_genfa_qunfa_status) { out_log = "群发被强制停止"; return; } else { WeiboBean item = (WeiboBean)cmsForm.appBean.weibo_list[i]; if (item.status == 1) { string picId = ""; if (imgList != null && imgList.Count > 0) { int img_i = 0; while (img_i < imgList.Count) { string item_img = (string)imgList[img_i]; string pic_id = WeiboUtil.upload(cmsForm, item_img, item.cookie); if (!string.IsNullOrEmpty(pic_id)) { if (!string.IsNullOrEmpty(picId)) { picId = picId + ","; } picId = picId + pic_id; } img_i = +1; } } content = content.Replace("<BR>", "\n"); WeiboUtil.post(cmsForm, string.Concat(content, QqUtil.weiba(cmsForm, out out_log)), picId, item.cookie); } } i = i + 1; } LogUtil.log_call(cmsForm, "微博发完成!"); } catch (Exception exception) { LogUtil.log_call(cmsForm, string.Concat("[autoSendweibo]出错:", exception.ToString())); } return; }
public static void qunfa_shoudong_fasong(CmsForm cmsForm, string content) { try { content = UrlUtil.parseContentWenan(cmsForm, content); ContentItem contentItem = UrlUtil.parseContent(cmsForm, content, null, cmsForm.checkBox_qunfa_pid.Checked, true, 0); if ((contentItem.urlList == null || contentItem.urlList.Count == 0) && cmsForm.checkBox_qunfa_link.Checked) { LogUtil.log_call(cmsForm, "没有连接,跳过发送!"); ((IHTMLDocument2)cmsForm.webBrowser_send_content.Document.DomDocument).body.innerHTML = ""; return; } if (contentItem.status < 1) { if (cmsForm.checkBox_qunfa_qq_boolean.Checked) //开启了qq发送 { LogUtil.log_call(cmsForm, "开始qq群的发送!"); string content_send = contentItem.content_send; content_send = UrlUtil.template_qq(cmsForm, contentItem, PidUtil.get_qq_com_pid_call(cmsForm, cmsForm.appBean.member_id), cmsForm.checkBox_qunfa_pid.Checked, cmsForm.appBean.qq_template); content_send = UrlUtil.copyImgContent(cmsForm, content_send, null); //if (this.checkBox_qunfa_qq_kouling_boolean.Checked == true) //{ // string kouling = UrlUtil.parseContent_kouling(this, contentItem, PidUtil.get_qq_com_pid(this, this.appBean.member_id), true); // content_send = content_send + kouling; //} QqUtil.send(cmsForm, content_send, content, contentItem.url_type, 1); //QqUtil.send(this, contentItem.content_send); } if (cmsForm.checkBox_qunfa_weixin_boolean.Checked) //开启了qq发送 { UrlUtil.parseContent_weixin(cmsForm, contentItem, null, cmsForm.checkBox_qunfa_pid.Checked); UrlUtil.template_qq(cmsForm, contentItem, PidUtil.get_weixin_pid_call(cmsForm, cmsForm.appBean.member_id), cmsForm.checkBox_qunfa_pid.Checked, cmsForm.appBean.weixin_template); LogUtil.log_call(cmsForm, "开始微信群的发送!"); WeixinUtil.send(cmsForm, contentItem.content_weixin, contentItem.content_weixin_img, contentItem.imgList, content, contentItem.url_type, 1); } if (cmsForm.checkBox_qunfa_weibo_boolean.Checked) //开启了qq发送 { UrlUtil.parseContent_weixin(cmsForm, contentItem, PidUtil.get_weibo_pid_call(cmsForm, cmsForm.appBean.member_id), cmsForm.checkBox_qunfa_pid.Checked); UrlUtil.template_qq(cmsForm, contentItem, PidUtil.get_weibo_pid_call(cmsForm, cmsForm.appBean.member_id), cmsForm.checkBox_qunfa_pid.Checked, cmsForm.appBean.weibo_template); LogUtil.log_call(cmsForm, "开始微博的发送!"); WeiboUtil.send(cmsForm, contentItem.content_weixin, contentItem.content_weixin_img, contentItem.imgList, content, contentItem.url_type, 1); } } else if (contentItem.status == 1) { LogUtil.log_call(cmsForm, "优惠券小于最低优惠券要求,跳过发送!"); } else if (contentItem.status == 2) { LogUtil.log_call(cmsForm, "佣金比例小于设置的最低比例,跳过发送!"); } else if (contentItem.status == 2) { LogUtil.log_call(cmsForm, "所发的链接转换失败,跳过发送!"); } try { ((IHTMLDocument2)cmsForm.webBrowser_send_content.Document.DomDocument).body.innerHTML = ""; } catch (Exception exception) { } } catch (Exception exception) { LogUtil.log_call(cmsForm, "发动异常:" + exception.ToString()); //MessageBox.Show("[messageForThread]出错:" + exception.ToString()); } }