From 18588f82e1171817915d389827f918017a03496c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=85=88=E6=A3=AE=E5=90=B4?= <8402134@qq.com>
Date: Mon, 30 Jan 2023 14:04:32 +0800
Subject: [PATCH] =?UTF-8?q?1.=E4=BB=A3=E8=BF=90=E8=90=A5=E4=BA=8C=E7=BB=B4?=
=?UTF-8?q?=E7=A0=81=E5=9B=BE=E7=89=87?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
应用/ProductClient/Class1.cs | 26 +-
应用/ProductClient/MainForm.Designer.cs | 72 ++-
应用/ProductClient/MonitorThread.cs | 691 ++++++++++++------------
3 files changed, 407 insertions(+), 382 deletions(-)
diff --git a/应用/ProductClient/Class1.cs b/应用/ProductClient/Class1.cs
index e20495d..fb70207 100644
--- a/应用/ProductClient/Class1.cs
+++ b/应用/ProductClient/Class1.cs
@@ -273,7 +273,31 @@ namespace ProductClient
}
var tkl = MonitorThread.AlimamaConvertLink(comment.ItemData,
- comment.ItemData.ActivityId, out var zjyUrl, out var buyPassNoFrills); //阿里妈妈
+ comment.ItemData.ActivityId, true, out var zjyUrl, out var buyPassNoFrills, out string compositeQRCode); //阿里妈妈
+
+ #region 朋友圈内容中追加图片
+ if (!string.IsNullOrWhiteSpace(compositeQRCode))
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.Append("");
+ sb.Append("" + Tools.GenerateRandomCode(20) + "");
+ sb.Append("2");
+ sb.Append("");
+ sb.Append("");
+ sb.Append("0");
+ sb.Append("[图片=" + compositeQRCode + "]");
+ sb.Append("[图片=" + compositeQRCode + "]");
+ sb.Append("");
+ sb.Append("");
+
+ var index = content.IndexOf("");
+ if (index != -1)
+ {
+ content = content.Insert(index, sb.ToString());
+ }
+ }
+ #endregion
+
////处理转链,替换变量
//if (isTB == true && !Class1.Config.isPyTkl && comment.Contains(Resources.BuyAddress))
diff --git a/应用/ProductClient/MainForm.Designer.cs b/应用/ProductClient/MainForm.Designer.cs
index 48e3352..79360b1 100644
--- a/应用/ProductClient/MainForm.Designer.cs
+++ b/应用/ProductClient/MainForm.Designer.cs
@@ -32,6 +32,8 @@
this.xtraTabPage1 = new DevExpress.XtraTab.XtraTabPage();
this.label1 = new System.Windows.Forms.Label();
this.xtraTabPage2 = new DevExpress.XtraTab.XtraTabPage();
+ this.comboBoxEdit3 = new DevExpress.XtraEditors.ComboBoxEdit();
+ this.labelControl11 = new DevExpress.XtraEditors.LabelControl();
this.label3 = new System.Windows.Forms.Label();
this.checkBox2 = new System.Windows.Forms.CheckBox();
this.memoEdit1 = new DevExpress.XtraEditors.MemoEdit();
@@ -61,12 +63,11 @@
this.labelControl1 = new DevExpress.XtraEditors.LabelControl();
this.xtraTabPage3 = new DevExpress.XtraTab.XtraTabPage();
this.label2 = new System.Windows.Forms.Label();
- this.comboBoxEdit3 = new DevExpress.XtraEditors.ComboBoxEdit();
- this.labelControl11 = new DevExpress.XtraEditors.LabelControl();
((System.ComponentModel.ISupportInitialize)(this.xtraTabControl1)).BeginInit();
this.xtraTabControl1.SuspendLayout();
this.xtraTabPage1.SuspendLayout();
this.xtraTabPage2.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.comboBoxEdit3.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.memoEdit1.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.comboBoxEdit2.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
@@ -76,7 +77,6 @@
((System.ComponentModel.ISupportInitialize)(this.textEdit2.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.textEdit1.Properties)).BeginInit();
this.xtraTabPage3.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.comboBoxEdit3.Properties)).BeginInit();
this.SuspendLayout();
//
// xtraTabControl1
@@ -85,7 +85,7 @@
this.xtraTabControl1.Location = new System.Drawing.Point(0, 0);
this.xtraTabControl1.Name = "xtraTabControl1";
this.xtraTabControl1.SelectedTabPage = this.xtraTabPage1;
- this.xtraTabControl1.Size = new System.Drawing.Size(584, 435);
+ this.xtraTabControl1.Size = new System.Drawing.Size(565, 435);
this.xtraTabControl1.TabIndex = 0;
this.xtraTabControl1.TabPages.AddRange(new DevExpress.XtraTab.XtraTabPage[] {
this.xtraTabPage1,
@@ -96,7 +96,7 @@
//
this.xtraTabPage1.Controls.Add(this.label1);
this.xtraTabPage1.Name = "xtraTabPage1";
- this.xtraTabPage1.Size = new System.Drawing.Size(582, 409);
+ this.xtraTabPage1.Size = new System.Drawing.Size(563, 409);
this.xtraTabPage1.Text = " 公 告 ";
//
// label1
@@ -143,9 +143,28 @@
this.xtraTabPage2.Controls.Add(this.hyperlinkLabelControl2);
this.xtraTabPage2.Controls.Add(this.labelControl1);
this.xtraTabPage2.Name = "xtraTabPage2";
- this.xtraTabPage2.Size = new System.Drawing.Size(582, 409);
+ this.xtraTabPage2.Size = new System.Drawing.Size(563, 409);
this.xtraTabPage2.Text = " 朋 友 圈 代 运 营 ";
//
+ // comboBoxEdit3
+ //
+ this.comboBoxEdit3.EditValue = "";
+ this.comboBoxEdit3.Location = new System.Drawing.Point(158, 166);
+ this.comboBoxEdit3.Name = "comboBoxEdit3";
+ this.comboBoxEdit3.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
+ new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
+ this.comboBoxEdit3.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
+ this.comboBoxEdit3.Size = new System.Drawing.Size(245, 20);
+ this.comboBoxEdit3.TabIndex = 27;
+ //
+ // labelControl11
+ //
+ this.labelControl11.Location = new System.Drawing.Point(65, 169);
+ this.labelControl11.Name = "labelControl11";
+ this.labelControl11.Size = new System.Drawing.Size(72, 14);
+ this.labelControl11.TabIndex = 26;
+ this.labelControl11.Text = "商品采集源:";
+ //
// label3
//
this.label3.AutoSize = true;
@@ -159,7 +178,7 @@
// checkBox2
//
this.checkBox2.AutoSize = true;
- this.checkBox2.Location = new System.Drawing.Point(330, 184);
+ this.checkBox2.Location = new System.Drawing.Point(330, 206);
this.checkBox2.Name = "checkBox2";
this.checkBox2.Size = new System.Drawing.Size(74, 18);
this.checkBox2.TabIndex = 23;
@@ -169,15 +188,15 @@
//
// memoEdit1
//
- this.memoEdit1.Location = new System.Drawing.Point(159, 208);
+ this.memoEdit1.Location = new System.Drawing.Point(159, 237);
this.memoEdit1.Name = "memoEdit1";
- this.memoEdit1.Size = new System.Drawing.Size(245, 83);
+ this.memoEdit1.Size = new System.Drawing.Size(245, 60);
this.memoEdit1.TabIndex = 22;
//
// checkBox1
//
this.checkBox1.AutoSize = true;
- this.checkBox1.Location = new System.Drawing.Point(159, 184);
+ this.checkBox1.Location = new System.Drawing.Point(159, 206);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(158, 18);
this.checkBox1.TabIndex = 21;
@@ -239,7 +258,7 @@
// comboBoxEdit1
//
this.comboBoxEdit1.EditValue = "模板A";
- this.comboBoxEdit1.Location = new System.Drawing.Point(627, 149);
+ this.comboBoxEdit1.Location = new System.Drawing.Point(158, 197);
this.comboBoxEdit1.Name = "comboBoxEdit1";
this.comboBoxEdit1.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
@@ -250,11 +269,10 @@
this.comboBoxEdit1.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
this.comboBoxEdit1.Size = new System.Drawing.Size(245, 20);
this.comboBoxEdit1.TabIndex = 16;
- this.comboBoxEdit1.Visible = false;
//
// labelControl9
//
- this.labelControl9.Location = new System.Drawing.Point(54, 209);
+ this.labelControl9.Location = new System.Drawing.Point(54, 238);
this.labelControl9.Name = "labelControl9";
this.labelControl9.Size = new System.Drawing.Size(84, 14);
this.labelControl9.TabIndex = 15;
@@ -270,12 +288,11 @@
//
// labelControl4
//
- this.labelControl4.Location = new System.Drawing.Point(534, 152);
+ this.labelControl4.Location = new System.Drawing.Point(65, 200);
this.labelControl4.Name = "labelControl4";
this.labelControl4.Size = new System.Drawing.Size(72, 14);
this.labelControl4.TabIndex = 15;
this.labelControl4.Text = "优惠券模板:";
- this.labelControl4.Visible = false;
//
// textEdit4
//
@@ -408,7 +425,7 @@
this.xtraTabPage3.Controls.Add(this.label2);
this.xtraTabPage3.Name = "xtraTabPage3";
this.xtraTabPage3.PageEnabled = false;
- this.xtraTabPage3.Size = new System.Drawing.Size(582, 409);
+ this.xtraTabPage3.Size = new System.Drawing.Size(563, 409);
this.xtraTabPage3.Text = " 微 信 群 产 品 直 播 ";
//
// label2
@@ -422,30 +439,11 @@
this.label2.TabIndex = 0;
this.label2.Text = "内测中...";
//
- // comboBoxEdit3
- //
- this.comboBoxEdit3.EditValue = "";
- this.comboBoxEdit3.Location = new System.Drawing.Point(158, 171);
- this.comboBoxEdit3.Name = "comboBoxEdit3";
- this.comboBoxEdit3.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
- new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
- this.comboBoxEdit3.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
- this.comboBoxEdit3.Size = new System.Drawing.Size(245, 20);
- this.comboBoxEdit3.TabIndex = 27;
- //
- // labelControl11
- //
- this.labelControl11.Location = new System.Drawing.Point(65, 177);
- this.labelControl11.Name = "labelControl11";
- this.labelControl11.Size = new System.Drawing.Size(72, 14);
- this.labelControl11.TabIndex = 26;
- this.labelControl11.Text = "商品采集源:";
- //
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(584, 435);
+ this.ClientSize = new System.Drawing.Size(565, 435);
this.Controls.Add(this.xtraTabControl1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
@@ -460,6 +458,7 @@
this.xtraTabPage1.PerformLayout();
this.xtraTabPage2.ResumeLayout(false);
this.xtraTabPage2.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.comboBoxEdit3.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.memoEdit1.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.comboBoxEdit2.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
@@ -470,7 +469,6 @@
((System.ComponentModel.ISupportInitialize)(this.textEdit1.Properties)).EndInit();
this.xtraTabPage3.ResumeLayout(false);
this.xtraTabPage3.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.comboBoxEdit3.Properties)).EndInit();
this.ResumeLayout(false);
}
diff --git a/应用/ProductClient/MonitorThread.cs b/应用/ProductClient/MonitorThread.cs
index 7e8c98d..01f574d 100644
--- a/应用/ProductClient/MonitorThread.cs
+++ b/应用/ProductClient/MonitorThread.cs
@@ -233,7 +233,7 @@ namespace ProductClient
/// 阿里妈妈转连接
///
///
- public static string AlimamaConvertLink(ItemData itemData, string activityId, out string zjyUrl, out string buyPassNoFrills /*bool appendQrcode, /*out string compositeQRCode*/)
+ public static string AlimamaConvertLink(ItemData itemData, string activityId, bool appendQrcode, out string zjyUrl, out string buyPassNoFrills, out string compositeQRCode)
{
//compositeQRCode = string.Empty;
//ZJYUrl = string.Empty;
@@ -263,7 +263,7 @@ namespace ProductClient
// throw new Exception($"@解析淘宝商品Id失败:{itemUrl}");
//}
- var title = string.Empty;//商品标题
+ //var title = string.Empty;//商品标题
//#region 检测连接中是否包含优惠券信息
//var activityId = string.Empty;
@@ -298,12 +298,15 @@ namespace ProductClient
if (string.IsNullOrWhiteSpace( /*ZJYUrl*/zjyUrl))
{
throw new Exception("生成防屏蔽连接为空,终止操作");
+ }
+ if (appendQrcode)
+ {
+ compositeQRCode = ApiClient.GetQRImage(turnItem.ItemTitle, turnItem.Price.ToString("0.00"), turnItem.CouponPrice.ToString("0"), turnItem.UseCouponPrice.ToString("0.00"), turnItem.ImageUrl, zjyUrl, Class1.Config.qrImageType);
+ }
+ else
+ {
+ compositeQRCode = string.Empty;
}
- //if (appendQrcode)
- //{
- // compositeQRCode = ApiClient.GetQRImage(title, turnItem.Price.ToString("0.00"), turnItem.CouponPrice.ToString("0"), turnItem.UseCouponPrice.ToString("0.00"), turnItem.ImageUrl, ZJYUrl, Class1.Config.qrImageType);
- //}
-
return tkl;
}
@@ -312,361 +315,361 @@ namespace ProductClient
///
///
private string PinDuoDuoConvertLink(string itemUrl, bool appendQrcode, out string compositeQRCode)
+{
+ var goods_id = PDDHelper.GetPddGoodsID(itemUrl);
+ if (string.IsNullOrWhiteSpace(goods_id)) throw new Exception("@解析拼多多商品Id失败,操作终止");
+ var session = ApiClient.GetSession();
+
+ if (string.IsNullOrWhiteSpace(Class1.Config.pddPid)) throw new Exception("未设置拼多多推广位,终止操作");
+ var reg = Regex.Match(Class1.Config.pddPid, @"(?\d+)_(\d+)");
+ if (!reg.Success) throw new Exception("拼多多推广位不符合格式,终止操作");
+ var cpsname = reg.Groups["cpsname"].ToString();
+ var adzone_pid = Class1.Config.pddPid;
+
+ var cps = new fl_cps_member() { username = cpsname, usernick = string.Empty, cookies = string.Empty, cpstype = CpsType.多多进宝, abnormal_tip = SwitchType.关闭, is_download = SwitchType.关闭, online = true };
+
+ PinduoduoApi api = CpsClient.CreatePinduoduoRequest(cps);
+
+ if (api == null) throw new Exception("创建多多进宝API请求失败,终止操作");
+
+ ArrayList goods_details = null;
+
+ var isBind = false;
+ var result = api.SendPinduoduo("pdd.ddk.oauth.member.authority.query", new { pid = adzone_pid });
+ if (result.ContainsKey("authority_query_response"))
+ {
+ var authority_query_response = result["authority_query_response"] as Dictionary;
+ if (authority_query_response != null && authority_query_response.Count != 0)
+ isBind = int.Parse(authority_query_response["bind"].ToString()) == 1;//1-已绑定;0-未绑定
+ }
+
+ goods_details = PDDHelper.FindSendGuideGoodsInfo(api, adzone_pid, goods_id, isBind);
+
+
+ //没有查到返利提示
+ if (goods_details == null || goods_details.Count == 0)
+ throw new Exception("该商品无返利,操作终止");
+
+ foreach (var item in goods_details)
+ {
+ var temp = item as Dictionary;
+
+ string mall_id = string.Empty;
+ if (temp.ContainsKey("mall_id")) mall_id = temp["mall_id"].ToString();
+
+ var goods_sign = temp["goods_sign"].ToString();
+
+ var goods_name = (temp["goods_name"] ?? string.Empty).ToString().Replace("", "").Replace("<", "<").Replace(">", ">").Replace("&", "&").Replace(""", "\"").Replace(" ©", "©"); //获取商品标签
+ var goods_desc = (temp["goods_desc"] ?? string.Empty).ToString(); //商品描述
+ var goods_thumbnail_url = (temp["goods_thumbnail_url"] ?? string.Empty).ToString(); //商品主图
+
+ var min_group_price = Math.Round(temp["min_group_price"] == null ? 0 : (double.Parse(temp["min_group_price"].ToString()) / 100.00), 2); //最低价sku的拼团价,单位为分
+ //var min_normal_price = Math.Round(temp["min_normal_price"] == null ? 0 : (double.Parse(temp["min_normal_price"].ToString()) / 100.00), 2); //最低价sku的单买价,单位为分
+
+ var _coupon_discount = double.Parse((temp["coupon_discount"] ?? 0).ToString());
+ var coupon_discount = _coupon_discount == 0 ? 0 : Math.Round(_coupon_discount / 100.00, 2); //优惠券面额,单位为分
+
+ var pddHelper = new PDDHelper();
+
+ var manyShoppingUrl = pddHelper.GetShoppingUrl(api, new { p_id = adzone_pid, goods_sign_list = $"[\"{goods_sign}\"]", multi_group = true, generate_short_url = true, generate_weapp_webview = true, force_duo_id = true, generate_authority_url = !isBind, generate_schema_url = true });
+
+ if (appendQrcode)
+ compositeQRCode = ApiClient.GetQRImage(goods_name, min_group_price.ToString(), coupon_discount.ToString(), ((decimal)min_group_price - (decimal)coupon_discount).ToString(), goods_thumbnail_url, manyShoppingUrl, Class1.Config.qrImageType, CpsType.多多进宝, goods_desc);
+ else compositeQRCode = string.Empty;
+ return manyShoppingUrl;
+ }
+
+ //EventClient.OnEvent(this, $"朋友圈代运营拼多多转链异常:{ex.Message} - {ex.StackTrace}");
+
+ compositeQRCode = string.Empty;
+ return string.Empty;
+}
+
+///
+/// 京东联盟转连接
+///
+///
+private string JingDongConvertLink(string itemUrl, bool appendQrcode, out string compositeQRCode)
+{
+ var itemId = JDHelper.GetJingdongItemId(itemUrl);//匹配京东链接获取京东宝贝ID
+ if (string.IsNullOrEmpty(itemId)) throw new Exception($"@解析京东商品Id失败:{itemUrl}");
+
+ var session = ApiClient.GetSession();
+ //var adzone = session.FindAdzoneInfos().FirstOrDefault(f => f.custom_type == Resources.SoftwareType && f.alliance_id == (int)CpsType.京东联盟);
+ //if (adzone == null) throw new Exception("未设置京东推广位,终止操作");
+ if (string.IsNullOrWhiteSpace(Class1.Config.jdPid)) throw new Exception("未设置京东推广位,终止操作");
+ var reg = Regex.Match(Class1.Config.jdPid, @"(?(?\d+)_\d+_(?\d+))_(?.+)");
+ if (!reg.Success) throw new Exception("推广位格式不正确");
+ var cpsname = reg.Groups["cpsname"].ToString();
+ var key = reg.Groups["key"].ToString();
+ //var pid = reg.Groups["pid"].ToString();
+ var positionId = reg.Groups["positionId"].ToString();
+
+ var cps = new fl_cps_member() { username = key, usernick = cpsname, cpstype = CpsType.京东联盟, online = true, cookies = string.Empty, abnormal_tip = SwitchType.关闭, is_download = SwitchType.关闭 };
+
+ //var cps = CpsClient.Members.FirstOrDefault(f => f.cpstype == CpsType.京东联盟 && f.username == adzone.adzone_pid_cps_name);
+ //if (cps == null) throw new Exception("京东账号异常,终止操作");
+ var api = new JingdongApi(cps);
+ if (api == null) throw new Exception("创建京东联盟API请求失败,终止操作");
+
+ var goodInfoResult = api.SendJingdong("jd.union.open.goods.query", new { goodsReqDTO = new { skuIds = new string[] { itemId } } });
+
+ var goodData = goodInfoResult.ConvertToObj();
+ if (goodData.data == null) throw new Exception("京东无返利信息");
+
+ foreach (Dictionary _goodinfo in goodData.data)
+ {
+ var goodinfo = _goodinfo.ConvertToObj();
+ goodinfo.skuName = goodinfo.skuName.Replace("", "").Replace("<", "<").Replace(">", ">").Replace("&", "&").Replace(""", "\"").Replace(" ©", "©");
+
+ if (goodinfo.commissionInfo.Count != 0)//有佣金
{
- var goods_id = PDDHelper.GetPddGoodsID(itemUrl);
- if (string.IsNullOrWhiteSpace(goods_id)) throw new Exception("@解析拼多多商品Id失败,操作终止");
- var session = ApiClient.GetSession();
+ var isJdSale = goodinfo.isJdSale == 0 ? false : true;//是否已是京东自营
- if (string.IsNullOrWhiteSpace(Class1.Config.pddPid)) throw new Exception("未设置拼多多推广位,终止操作");
- var reg = Regex.Match(Class1.Config.pddPid, @"(?\d+)_(\d+)");
- if (!reg.Success) throw new Exception("拼多多推广位不符合格式,终止操作");
- var cpsname = reg.Groups["cpsname"].ToString();
- var adzone_pid = Class1.Config.pddPid;
+ double price = double.Parse(goodinfo.priceInfo["price"].ToString()); //商品价格
- var cps = new fl_cps_member() { username = cpsname, usernick = string.Empty, cookies = string.Empty, cpstype = CpsType.多多进宝, abnormal_tip = SwitchType.关闭, is_download = SwitchType.关闭, online = true };
+ var commissionshare = decimal.Parse(goodinfo.commissionInfo["commissionShare"].ToString()) / 100m;//普通用户佣金比例 ,通用接口中的佣金比例
- PinduoduoApi api = CpsClient.CreatePinduoduoRequest(cps);
-
- if (api == null) throw new Exception("创建多多进宝API请求失败,终止操作");
-
- ArrayList goods_details = null;
-
- var isBind = false;
- var result = api.SendPinduoduo("pdd.ddk.oauth.member.authority.query", new { pid = adzone_pid });
- if (result.ContainsKey("authority_query_response"))
- {
- var authority_query_response = result["authority_query_response"] as Dictionary;
- if (authority_query_response != null && authority_query_response.Count != 0)
- isBind = int.Parse(authority_query_response["bind"].ToString()) == 1;//1-已绑定;0-未绑定
- }
-
- goods_details = PDDHelper.FindSendGuideGoodsInfo(api, adzone_pid, goods_id, isBind);
-
-
- //没有查到返利提示
- if (goods_details == null || goods_details.Count == 0)
- throw new Exception("该商品无返利,操作终止");
-
- foreach (var item in goods_details)
- {
- var temp = item as Dictionary;
-
- string mall_id = string.Empty;
- if (temp.ContainsKey("mall_id")) mall_id = temp["mall_id"].ToString();
-
- var goods_sign = temp["goods_sign"].ToString();
-
- var goods_name = (temp["goods_name"] ?? string.Empty).ToString().Replace("", "").Replace("<", "<").Replace(">", ">").Replace("&", "&").Replace(""", "\"").Replace(" ©", "©"); //获取商品标签
- var goods_desc = (temp["goods_desc"] ?? string.Empty).ToString(); //商品描述
- var goods_thumbnail_url = (temp["goods_thumbnail_url"] ?? string.Empty).ToString(); //商品主图
-
- var min_group_price = Math.Round(temp["min_group_price"] == null ? 0 : (double.Parse(temp["min_group_price"].ToString()) / 100.00), 2); //最低价sku的拼团价,单位为分
- //var min_normal_price = Math.Round(temp["min_normal_price"] == null ? 0 : (double.Parse(temp["min_normal_price"].ToString()) / 100.00), 2); //最低价sku的单买价,单位为分
-
- var _coupon_discount = double.Parse((temp["coupon_discount"] ?? 0).ToString());
- var coupon_discount = _coupon_discount == 0 ? 0 : Math.Round(_coupon_discount / 100.00, 2); //优惠券面额,单位为分
-
- var pddHelper = new PDDHelper();
-
- var manyShoppingUrl = pddHelper.GetShoppingUrl(api, new { p_id = adzone_pid, goods_sign_list = $"[\"{goods_sign}\"]", multi_group = true, generate_short_url = true, generate_weapp_webview = true, force_duo_id = true, generate_authority_url = !isBind, generate_schema_url = true });
-
- if (appendQrcode)
- compositeQRCode = ApiClient.GetQRImage(goods_name, min_group_price.ToString(), coupon_discount.ToString(), ((decimal)min_group_price - (decimal)coupon_discount).ToString(), goods_thumbnail_url, manyShoppingUrl, Class1.Config.qrImageType, CpsType.多多进宝, goods_desc);
- else compositeQRCode = string.Empty;
- return manyShoppingUrl;
- }
-
- //EventClient.OnEvent(this, $"朋友圈代运营拼多多转链异常:{ex.Message} - {ex.StackTrace}");
-
- compositeQRCode = string.Empty;
- return string.Empty;
- }
-
- ///
- /// 京东联盟转连接
- ///
- ///
- private string JingDongConvertLink(string itemUrl, bool appendQrcode, out string compositeQRCode)
- {
- var itemId = JDHelper.GetJingdongItemId(itemUrl);//匹配京东链接获取京东宝贝ID
- if (string.IsNullOrEmpty(itemId)) throw new Exception($"@解析京东商品Id失败:{itemUrl}");
-
- var session = ApiClient.GetSession();
- //var adzone = session.FindAdzoneInfos().FirstOrDefault(f => f.custom_type == Resources.SoftwareType && f.alliance_id == (int)CpsType.京东联盟);
- //if (adzone == null) throw new Exception("未设置京东推广位,终止操作");
- if (string.IsNullOrWhiteSpace(Class1.Config.jdPid)) throw new Exception("未设置京东推广位,终止操作");
- var reg = Regex.Match(Class1.Config.jdPid, @"(?(?\d+)_\d+_(?\d+))_(?.+)");
- if (!reg.Success) throw new Exception("推广位格式不正确");
- var cpsname = reg.Groups["cpsname"].ToString();
- var key = reg.Groups["key"].ToString();
- //var pid = reg.Groups["pid"].ToString();
- var positionId = reg.Groups["positionId"].ToString();
-
- var cps = new fl_cps_member() { username = key, usernick = cpsname, cpstype = CpsType.京东联盟, online = true, cookies = string.Empty, abnormal_tip = SwitchType.关闭, is_download = SwitchType.关闭 };
-
- //var cps = CpsClient.Members.FirstOrDefault(f => f.cpstype == CpsType.京东联盟 && f.username == adzone.adzone_pid_cps_name);
- //if (cps == null) throw new Exception("京东账号异常,终止操作");
- var api = new JingdongApi(cps);
- if (api == null) throw new Exception("创建京东联盟API请求失败,终止操作");
-
- var goodInfoResult = api.SendJingdong("jd.union.open.goods.query", new { goodsReqDTO = new { skuIds = new string[] { itemId } } });
-
- var goodData = goodInfoResult.ConvertToObj();
- if (goodData.data == null) throw new Exception("京东无返利信息");
-
- foreach (Dictionary _goodinfo in goodData.data)
- {
- var goodinfo = _goodinfo.ConvertToObj();
- goodinfo.skuName = goodinfo.skuName.Replace("", "").Replace("<", "<").Replace(">", ">").Replace("&", "&").Replace(""", "\"").Replace(" ©", "©");
-
- if (goodinfo.commissionInfo.Count != 0)//有佣金
- {
- var isJdSale = goodinfo.isJdSale == 0 ? false : true;//是否已是京东自营
-
- double price = double.Parse(goodinfo.priceInfo["price"].ToString()); //商品价格
-
- var commissionshare = decimal.Parse(goodinfo.commissionInfo["commissionShare"].ToString()) / 100m;//普通用户佣金比例 ,通用接口中的佣金比例
-
- #region 这里主要是获取改商品的实际佣金比例,上面的佣金比例是通用的佣金比例,会不准一些
- try
- {
- var goodResult = api.SendJingdong("jd.union.open.goods.promotiongoodsinfo.query", new { skuIds = itemId });
- if (goodResult != null && goodResult.ContainsKey("data"))
- {
- var _goodData = goodResult["data"] as ArrayList;
- if (_goodData != null && _goodData.Count != 0)
- {
- foreach (Dictionary data in _goodData)
- {
- if (data.ContainsKey("commisionRatioWl"))
- {
- commissionshare = decimal.Parse(data["commisionRatioWl"].ToString()) / 100m; //接口中该商品的实际佣金,比较准一些,
- break;
- }
- }
- }
- }
- }
- catch (Exception)
- { }
- #endregion
-
- ItemPoint usecoupon_commfee = null;//普通用户 用优惠券后积分信息
- //ItemPoint usecoupon_commfee_plus = null;//plus用户 用优惠券后积分信息
- string couponlike = string.Empty; //优惠券链接
- double discount = 0; //优惠券金额
- if (goodinfo.couponInfo.Count != 0)
- {
- //goodinfo.couponInfo[0].couponList[0];
- var couponList = goodinfo.couponInfo["couponList"] as ArrayList;
- if (couponList.Count != 0)//有优惠券
- {
- foreach (Dictionary coupon in couponList)
- {
- var quota = double.Parse(coupon["quota"].ToString()); //券消费限额
- if (quota > price) break;//优惠券面额大于商品单价时终止
- discount = double.Parse(coupon["discount"].ToString());
- couponlike = coupon["link"].ToString(); //优惠券链接
- break;//TODO 这里难道有多个优惠券?先不管,直接获取第一个
- }
- }
- }
-
- var buyshorturl = string.Empty; //转连后的地址
- #region 转连(生成自己推广的链接 [有券链接(二合一)或无券链接])
- Dictionary conversionlinkresult = null; //查询到的转换链接对象
- //var positionId = adzone.adzone_pid.Substring(adzone.adzone_pid.LastIndexOf("_") + 1);
- if (string.IsNullOrWhiteSpace(couponlike))
- {
- conversionlinkresult = api.SendJingdong("jd.union.open.promotion.byunionid.get", new { promotionCodeReq = new { materialId = $@"https://item.m.jd.com/product/{itemId}.html", positionId = positionId, unionId = cps.usernick } });//宝贝id 和 用户的目标推客的联盟id
- }
- else
- {
- try
- {
- conversionlinkresult = api.SendJingdong("jd.union.open.promotion.byunionid.get", new { promotionCodeReq = new { materialId = $@"https://item.m.jd.com/product/{itemId}.html", positionId = positionId, unionId = cps.usernick, couponUrl = couponlike } });
- }
- catch (Exception)
- {
- conversionlinkresult = api.SendJingdong("jd.union.open.promotion.byunionid.get", new { promotionCodeReq = new { materialId = $@"https://item.m.jd.com/product/{itemId}.html", positionId = positionId, unionId = cps.usernick } });//宝贝id 和 用户的目标推客的联盟id
- couponlike = string.Empty;
- }
- }
- if (conversionlinkresult != null)
- {
- if (conversionlinkresult["code"].ToString() != "200") throw new Exception($"京东查询接口调用失败:{conversionlinkresult["message"].ToString()}");//抛出错误信息
- if (conversionlinkresult.ContainsKey("data"))
- {
- var data = conversionlinkresult["data"] as Dictionary;
- if (data.ContainsKey("shortURL")) buyshorturl = data["shortURL"].ToString();//购买短连接
- }
- if (string.IsNullOrWhiteSpace(buyshorturl)) throw new Exception("京东转链失败,请稍后重试");
- }
- #endregion
-
- var imageList = goodinfo.imageInfo["imageList"] as ArrayList;
- string imageUrl = string.Empty;
- if (imageList.Count > 0)
- imageUrl = (imageList[0] as Dictionary)["url"].ToString(); //宝贝主图
-
- if (appendQrcode)
- compositeQRCode = ApiClient.GetQRImage(goodinfo.skuName, price.ToString(), discount.ToString(), ((decimal)price - (decimal)discount).ToString(), imageUrl, buyshorturl, Class1.Config.qrImageType, CpsType.京东联盟);
- else compositeQRCode = string.Empty;
- return buyshorturl;
- }
- }
-
- //EventClient.OnEvent(this, $"朋友圈代运营京东转链异常:{ex.Message} - {ex.StackTrace}");
-
- compositeQRCode = string.Empty;
- return string.Empty;
- }
-
- /////
- ///// 执行发送任务
- /////
- //private void _ExecuteSend(string objectDesc, string comment)
- //{
- // try
- // {
- // if (string.IsNullOrWhiteSpace(objectDesc)) return;
- // var clients = Chat.Framework.ChatClient.WXClient.Values.ToList().Where(f => (f.WeixinType == WeixinType.Grpc微信 || f.WeixinType == WeixinType.Hook微信) && f.Status == WxStatus.在线).ToList();
- // if (clients.Count != 0)
- // {
- // foreach (var _item in clients)
- // {
- // var item = _item;
- // //Task.Run(() =>
- // //{
- // try
- // {
- // //objectDesc = Regex.Replace(objectDesc, @"videomd5=""(.{32})""", @"videomd5=""" + Util.GetMD5Hash(Guid.NewGuid().ToByteArray()) + @"""");
- // //objectDesc = Regex.Replace(objectDesc, @"md5=""(.{32})""", @"md5=""" + Util.GetMD5Hash(Guid.NewGuid().ToByteArray()) + @"""");
-
- // objectDesc = objectDesc.Replace("[活动口令]", Class1.Config.actionLink);
-
- // var json = item.SendCircle(objectDesc);//发送朋友圈的主内容
- // if (string.IsNullOrWhiteSpace(json))
- // EventClient.OnEvent(this, $"【代运营朋友圈】 => {item.WeixinHao},转发失败");
- // else
- // EventClient.OnEvent(this, $"【代运营朋友圈】 => {item.WeixinHao},转发成功");
-
- // if (!Class1.Config.isPl)
- // {
- // var reg = Regex.Match(json.Replace("", ""), @"(?\d{15,})");//获取返回的朋友圈id
- // if (reg.Success && !string.IsNullOrWhiteSpace(comment))
- // {
- // var id = reg.Groups["id"].Value;
- // var commentStr = string.Empty;
- // if (string.IsNullOrWhiteSpace(Class1.Config.appendComment))
- // commentStr = string.Join("[分段]", comment);
- // else
- // commentStr = string.Join("[分段]", comment, Class1.Config.appendComment);
- // if (!string.IsNullOrWhiteSpace(commentStr))
- // item.SendCircleComment(item.User.Username, id, commentStr.Replace("[活动口令]", Class1.Config.actionLink));
- // }
- // }
- // }
- // catch (Exception ex)
- // {
- // EventClient.OnEvent(this, $"【代运营朋友圈】 发送异常:{ex.Message} - {ex.StackTrace}");
- // }
- // //});
- // }
-
- // if (Class1.Config.Monitor_Interval != 0)
- // {
- // Class1.Config.LastSendTime = DateTime.Now;
- // Util.Save(Class1.Config);
- // }
- // EventClient.OnEvent(this, $"【代运营朋友圈】 所有账号发送完毕");
- // }
- // }
- // catch (Exception ex)
- // {
- // EventClient.OnEvent(this, $"【代运营朋友圈】 发送失败:{ex.Message} - {ex.StackTrace}");
- // }
- //}
-
-
- ///
- /// 执行发送任务
- ///
- public static void _ExecuteSend(string objectDesc, List comments, bool isGoods, string taskId)
- {
+ #region 这里主要是获取改商品的实际佣金比例,上面的佣金比例是通用的佣金比例,会不准一些
try
{
- if (string.IsNullOrWhiteSpace(objectDesc))
+ var goodResult = api.SendJingdong("jd.union.open.goods.promotiongoodsinfo.query", new { skuIds = itemId });
+ if (goodResult != null && goodResult.ContainsKey("data"))
{
- return;
- }
- comments.Add(Class1.Config.appendComment);
- var commentStr = string.Join("[分段]", comments);
-
- var clients = Chat.Framework.ChatClient.WXClient.Values.ToList().Where(f => (f.WeixinType == WeixinType.Grpc微信 || f.WeixinType == WeixinType.Hook微信) && f.Status == WxStatus.在线).ToList();
- if (clients.Count != 0)
- {
- foreach (var _item in clients)
+ var _goodData = goodResult["data"] as ArrayList;
+ if (_goodData != null && _goodData.Count != 0)
{
- var item = _item;
- //Task.Run(() =>
- //{
- try
+ foreach (Dictionary data in _goodData)
{
- //objectDesc = Regex.Replace(objectDesc, @"videomd5=""(.{32})""", @"videomd5=""" + Util.GetMD5Hash(Guid.NewGuid().ToByteArray()) + @"""");
- //objectDesc = Regex.Replace(objectDesc, @"md5=""(.{32})""", @"md5=""" + Util.GetMD5Hash(Guid.NewGuid().ToByteArray()) + @"""");
-
- objectDesc = objectDesc.Replace("[活动口令]", Class1.Config.actionLink);
-
- var json = item.SendCircle(objectDesc);//发送朋友圈的主内容
- if (string.IsNullOrWhiteSpace(json))
- EventClient.OnEvent(null, $"【代运营朋友圈】 => {item.WeixinHao},转发失败");
- else
- EventClient.OnEvent(null, $"【代运营朋友圈】 => {item.WeixinHao},转发成功");
-
- //if (!Class1.Config.isPl)
- //{
- var reg = Regex.Match(json.Replace("", ""), @"(?\d{15,})");//获取返回的朋友圈id
- if (reg.Success && !string.IsNullOrWhiteSpace(commentStr))
+ if (data.ContainsKey("commisionRatioWl"))
{
- var id = reg.Groups["id"].Value;
- EventClient.OnEvent(null, $"【代运营朋友圈】 => {item.WeixinHao},评论内容:{commentStr}");
-
- if (!string.IsNullOrWhiteSpace(commentStr))
- {
- item.SendCircleComment(item.User.Username, id, commentStr.Replace("[活动口令]", Class1.Config.actionLink));
- }
-
- if (isGoods)
- {
- #region 上报发送成功
- HttpHelper http = new HttpHelper();
- var html = http.GetHtml($"http://goods.api.52cmg.cn/api/WechatMomentsGoods-WechatMoments/RecordSending?taskId={taskId}").Html;
- #endregion
- }
+ commissionshare = decimal.Parse(data["commisionRatioWl"].ToString()) / 100m; //接口中该商品的实际佣金,比较准一些,
+ break;
}
- //}
}
- catch (Exception ex)
- {
- EventClient.OnEvent(null, $"【代运营朋友圈】 发送异常:{ex.Message} - {ex.StackTrace}");
- }
- //});
}
-
- if (Class1.Config.Monitor_Interval != 0)
- {
- Class1.Config.LastSendTime = DateTime.Now;
- Util.Save(Class1.Config);
- }
- EventClient.OnEvent(null, $"【代运营朋友圈】 所有账号发送完毕");
}
}
- catch (Exception ex)
+ catch (Exception)
+ { }
+ #endregion
+
+ ItemPoint usecoupon_commfee = null;//普通用户 用优惠券后积分信息
+ //ItemPoint usecoupon_commfee_plus = null;//plus用户 用优惠券后积分信息
+ string couponlike = string.Empty; //优惠券链接
+ double discount = 0; //优惠券金额
+ if (goodinfo.couponInfo.Count != 0)
{
- EventClient.OnEvent(null, $"【代运营朋友圈】 发送失败:{ex.Message} - {ex.StackTrace}");
+ //goodinfo.couponInfo[0].couponList[0];
+ var couponList = goodinfo.couponInfo["couponList"] as ArrayList;
+ if (couponList.Count != 0)//有优惠券
+ {
+ foreach (Dictionary coupon in couponList)
+ {
+ var quota = double.Parse(coupon["quota"].ToString()); //券消费限额
+ if (quota > price) break;//优惠券面额大于商品单价时终止
+ discount = double.Parse(coupon["discount"].ToString());
+ couponlike = coupon["link"].ToString(); //优惠券链接
+ break;//TODO 这里难道有多个优惠券?先不管,直接获取第一个
+ }
+ }
}
+
+ var buyshorturl = string.Empty; //转连后的地址
+ #region 转连(生成自己推广的链接 [有券链接(二合一)或无券链接])
+ Dictionary conversionlinkresult = null; //查询到的转换链接对象
+ //var positionId = adzone.adzone_pid.Substring(adzone.adzone_pid.LastIndexOf("_") + 1);
+ if (string.IsNullOrWhiteSpace(couponlike))
+ {
+ conversionlinkresult = api.SendJingdong("jd.union.open.promotion.byunionid.get", new { promotionCodeReq = new { materialId = $@"https://item.m.jd.com/product/{itemId}.html", positionId = positionId, unionId = cps.usernick } });//宝贝id 和 用户的目标推客的联盟id
+ }
+ else
+ {
+ try
+ {
+ conversionlinkresult = api.SendJingdong("jd.union.open.promotion.byunionid.get", new { promotionCodeReq = new { materialId = $@"https://item.m.jd.com/product/{itemId}.html", positionId = positionId, unionId = cps.usernick, couponUrl = couponlike } });
+ }
+ catch (Exception)
+ {
+ conversionlinkresult = api.SendJingdong("jd.union.open.promotion.byunionid.get", new { promotionCodeReq = new { materialId = $@"https://item.m.jd.com/product/{itemId}.html", positionId = positionId, unionId = cps.usernick } });//宝贝id 和 用户的目标推客的联盟id
+ couponlike = string.Empty;
+ }
+ }
+ if (conversionlinkresult != null)
+ {
+ if (conversionlinkresult["code"].ToString() != "200") throw new Exception($"京东查询接口调用失败:{conversionlinkresult["message"].ToString()}");//抛出错误信息
+ if (conversionlinkresult.ContainsKey("data"))
+ {
+ var data = conversionlinkresult["data"] as Dictionary;
+ if (data.ContainsKey("shortURL")) buyshorturl = data["shortURL"].ToString();//购买短连接
+ }
+ if (string.IsNullOrWhiteSpace(buyshorturl)) throw new Exception("京东转链失败,请稍后重试");
+ }
+ #endregion
+
+ var imageList = goodinfo.imageInfo["imageList"] as ArrayList;
+ string imageUrl = string.Empty;
+ if (imageList.Count > 0)
+ imageUrl = (imageList[0] as Dictionary)["url"].ToString(); //宝贝主图
+
+ if (appendQrcode)
+ compositeQRCode = ApiClient.GetQRImage(goodinfo.skuName, price.ToString(), discount.ToString(), ((decimal)price - (decimal)discount).ToString(), imageUrl, buyshorturl, Class1.Config.qrImageType, CpsType.京东联盟);
+ else compositeQRCode = string.Empty;
+ return buyshorturl;
}
+ }
+
+ //EventClient.OnEvent(this, $"朋友圈代运营京东转链异常:{ex.Message} - {ex.StackTrace}");
+
+ compositeQRCode = string.Empty;
+ return string.Empty;
+}
+
+/////
+///// 执行发送任务
+/////
+//private void _ExecuteSend(string objectDesc, string comment)
+//{
+// try
+// {
+// if (string.IsNullOrWhiteSpace(objectDesc)) return;
+// var clients = Chat.Framework.ChatClient.WXClient.Values.ToList().Where(f => (f.WeixinType == WeixinType.Grpc微信 || f.WeixinType == WeixinType.Hook微信) && f.Status == WxStatus.在线).ToList();
+// if (clients.Count != 0)
+// {
+// foreach (var _item in clients)
+// {
+// var item = _item;
+// //Task.Run(() =>
+// //{
+// try
+// {
+// //objectDesc = Regex.Replace(objectDesc, @"videomd5=""(.{32})""", @"videomd5=""" + Util.GetMD5Hash(Guid.NewGuid().ToByteArray()) + @"""");
+// //objectDesc = Regex.Replace(objectDesc, @"md5=""(.{32})""", @"md5=""" + Util.GetMD5Hash(Guid.NewGuid().ToByteArray()) + @"""");
+
+// objectDesc = objectDesc.Replace("[活动口令]", Class1.Config.actionLink);
+
+// var json = item.SendCircle(objectDesc);//发送朋友圈的主内容
+// if (string.IsNullOrWhiteSpace(json))
+// EventClient.OnEvent(this, $"【代运营朋友圈】 => {item.WeixinHao},转发失败");
+// else
+// EventClient.OnEvent(this, $"【代运营朋友圈】 => {item.WeixinHao},转发成功");
+
+// if (!Class1.Config.isPl)
+// {
+// var reg = Regex.Match(json.Replace("", ""), @"(?\d{15,})");//获取返回的朋友圈id
+// if (reg.Success && !string.IsNullOrWhiteSpace(comment))
+// {
+// var id = reg.Groups["id"].Value;
+// var commentStr = string.Empty;
+// if (string.IsNullOrWhiteSpace(Class1.Config.appendComment))
+// commentStr = string.Join("[分段]", comment);
+// else
+// commentStr = string.Join("[分段]", comment, Class1.Config.appendComment);
+// if (!string.IsNullOrWhiteSpace(commentStr))
+// item.SendCircleComment(item.User.Username, id, commentStr.Replace("[活动口令]", Class1.Config.actionLink));
+// }
+// }
+// }
+// catch (Exception ex)
+// {
+// EventClient.OnEvent(this, $"【代运营朋友圈】 发送异常:{ex.Message} - {ex.StackTrace}");
+// }
+// //});
+// }
+
+// if (Class1.Config.Monitor_Interval != 0)
+// {
+// Class1.Config.LastSendTime = DateTime.Now;
+// Util.Save(Class1.Config);
+// }
+// EventClient.OnEvent(this, $"【代运营朋友圈】 所有账号发送完毕");
+// }
+// }
+// catch (Exception ex)
+// {
+// EventClient.OnEvent(this, $"【代运营朋友圈】 发送失败:{ex.Message} - {ex.StackTrace}");
+// }
+//}
+
+
+///
+/// 执行发送任务
+///
+public static void _ExecuteSend(string objectDesc, List comments, bool isGoods, string taskId)
+{
+ try
+ {
+ if (string.IsNullOrWhiteSpace(objectDesc))
+ {
+ return;
+ }
+ comments.Add(Class1.Config.appendComment);
+ var commentStr = string.Join("[分段]", comments);
+
+ var clients = Chat.Framework.ChatClient.WXClient.Values.ToList().Where(f => (f.WeixinType == WeixinType.Grpc微信 || f.WeixinType == WeixinType.Hook微信) && f.Status == WxStatus.在线).ToList();
+ if (clients.Count != 0)
+ {
+ foreach (var _item in clients)
+ {
+ var item = _item;
+ //Task.Run(() =>
+ //{
+ try
+ {
+ //objectDesc = Regex.Replace(objectDesc, @"videomd5=""(.{32})""", @"videomd5=""" + Util.GetMD5Hash(Guid.NewGuid().ToByteArray()) + @"""");
+ //objectDesc = Regex.Replace(objectDesc, @"md5=""(.{32})""", @"md5=""" + Util.GetMD5Hash(Guid.NewGuid().ToByteArray()) + @"""");
+
+ objectDesc = objectDesc.Replace("[活动口令]", Class1.Config.actionLink);
+
+ var json = item.SendCircle(objectDesc);//发送朋友圈的主内容
+ if (string.IsNullOrWhiteSpace(json))
+ EventClient.OnEvent(null, $"【代运营朋友圈】 => {item.WeixinHao},转发失败");
+ else
+ EventClient.OnEvent(null, $"【代运营朋友圈】 => {item.WeixinHao},转发成功");
+
+ //if (!Class1.Config.isPl)
+ //{
+ var reg = Regex.Match(json.Replace("", ""), @"(?\d{15,})");//获取返回的朋友圈id
+ if (reg.Success && !string.IsNullOrWhiteSpace(commentStr))
+ {
+ var id = reg.Groups["id"].Value;
+ EventClient.OnEvent(null, $"【代运营朋友圈】 => {item.WeixinHao},评论内容:{commentStr}");
+
+ if (!string.IsNullOrWhiteSpace(commentStr))
+ {
+ item.SendCircleComment(item.User.Username, id, commentStr.Replace("[活动口令]", Class1.Config.actionLink));
+ }
+
+ if (isGoods)
+ {
+ #region 上报发送成功
+ HttpHelper http = new HttpHelper();
+ var html = http.GetHtml($"http://goods.api.52cmg.cn/api/WechatMomentsGoods-WechatMoments/RecordSending?taskId={taskId}").Html;
+ #endregion
+ }
+ }
+ //}
+ }
+ catch (Exception ex)
+ {
+ EventClient.OnEvent(null, $"【代运营朋友圈】 发送异常:{ex.Message} - {ex.StackTrace}");
+ }
+ //});
+ }
+
+ if (Class1.Config.Monitor_Interval != 0)
+ {
+ Class1.Config.LastSendTime = DateTime.Now;
+ Util.Save(Class1.Config);
+ }
+ EventClient.OnEvent(null, $"【代运营朋友圈】 所有账号发送完毕");
+ }
+ }
+ catch (Exception ex)
+ {
+ EventClient.OnEvent(null, $"【代运营朋友圈】 发送失败:{ex.Message} - {ex.StackTrace}");
+ }
+}
}
}
\ No newline at end of file