1.代运营增加跟发来源设置项

This commit is contained in:
老道 2023-01-27 17:53:21 +08:00
parent 194fcaa10b
commit 5355352f07
4 changed files with 142 additions and 3 deletions

View File

@ -102,7 +102,7 @@ namespace ProductClient
private static Dictionary<string, string> CacheDic = new Dictionary<string, string>(); private static Dictionary<string, string> CacheDic = new Dictionary<string, string>();
private void EventClient_DyyNoticeEvent(object sender, Api.Framework.Events.DyyNoticeEvent e) private void EventClient_DyyNoticeEvent(object sender, DyyNoticeEvent e)
{ {
try try
{ {
@ -110,6 +110,8 @@ namespace ProductClient
var json = e.Data; var json = e.Data;
//{"Id":"122522636742819840","TaskId":"122522636742819840","IsGoods":true} //{"Id":"122522636742819840","TaskId":"122522636742819840","IsGoods":true}
//var json = "{\"TaskId\":\"133038429393911808\",\"CollectionSourceId\":\"129505086429724672\",\"IsGoods\":true}";
var jObj = JObject.Parse(json); var jObj = JObject.Parse(json);
var taskId = jObj["TaskId"]?.Value<string>(); var taskId = jObj["TaskId"]?.Value<string>();
if (string.IsNullOrWhiteSpace(taskId)) if (string.IsNullOrWhiteSpace(taskId))
@ -121,7 +123,16 @@ namespace ProductClient
{ {
return; return;
} }
CacheDic[taskId] = taskId;
//发送任务来源Id
var collectionSourceId = jObj["CollectionSourceId"]?.Value<string>();
if (Config.sourceId != collectionSourceId)
{
return;
}
CacheDic[taskId] = collectionSourceId;
HttpHelper http = new HttpHelper(); HttpHelper http = new HttpHelper();
var html = http var html = http

View File

@ -21,6 +21,11 @@ namespace ProductClient
public DwzType dwzType { get; set; } public DwzType dwzType { get; set; }
/// <summary>
/// 商品采集源Id
/// </summary>
public string sourceId { get; set; }
public string tbPid { get; set; } public string tbPid { get; set; }
public string pddPid { get; set; } public string pddPid { get; set; }

View File

@ -61,6 +61,8 @@
this.labelControl1 = new DevExpress.XtraEditors.LabelControl(); this.labelControl1 = new DevExpress.XtraEditors.LabelControl();
this.xtraTabPage3 = new DevExpress.XtraTab.XtraTabPage(); this.xtraTabPage3 = new DevExpress.XtraTab.XtraTabPage();
this.label2 = new System.Windows.Forms.Label(); 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(); ((System.ComponentModel.ISupportInitialize)(this.xtraTabControl1)).BeginInit();
this.xtraTabControl1.SuspendLayout(); this.xtraTabControl1.SuspendLayout();
this.xtraTabPage1.SuspendLayout(); this.xtraTabPage1.SuspendLayout();
@ -74,6 +76,7 @@
((System.ComponentModel.ISupportInitialize)(this.textEdit2.Properties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.textEdit2.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.textEdit1.Properties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.textEdit1.Properties)).BeginInit();
this.xtraTabPage3.SuspendLayout(); this.xtraTabPage3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.comboBoxEdit3.Properties)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// xtraTabControl1 // xtraTabControl1
@ -110,6 +113,8 @@
// //
// xtraTabPage2 // xtraTabPage2
// //
this.xtraTabPage2.Controls.Add(this.comboBoxEdit3);
this.xtraTabPage2.Controls.Add(this.labelControl11);
this.xtraTabPage2.Controls.Add(this.label3); this.xtraTabPage2.Controls.Add(this.label3);
this.xtraTabPage2.Controls.Add(this.checkBox2); this.xtraTabPage2.Controls.Add(this.checkBox2);
this.xtraTabPage2.Controls.Add(this.memoEdit1); this.xtraTabPage2.Controls.Add(this.memoEdit1);
@ -417,6 +422,25 @@
this.label2.TabIndex = 0; this.label2.TabIndex = 0;
this.label2.Text = "内测中..."; 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 // MainForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
@ -446,6 +470,7 @@
((System.ComponentModel.ISupportInitialize)(this.textEdit1.Properties)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.textEdit1.Properties)).EndInit();
this.xtraTabPage3.ResumeLayout(false); this.xtraTabPage3.ResumeLayout(false);
this.xtraTabPage3.PerformLayout(); this.xtraTabPage3.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.comboBoxEdit3.Properties)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
} }
@ -485,5 +510,7 @@
private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label3;
private DevExpress.XtraEditors.TextEdit textEdit4; private DevExpress.XtraEditors.TextEdit textEdit4;
private DevExpress.XtraEditors.LabelControl labelControl10; private DevExpress.XtraEditors.LabelControl labelControl10;
private DevExpress.XtraEditors.ComboBoxEdit comboBoxEdit3;
private DevExpress.XtraEditors.LabelControl labelControl11;
} }
} }

View File

@ -5,8 +5,13 @@ using Api.Framework.Tools;
using DevExpress.XtraEditors; using DevExpress.XtraEditors;
using ProductClient.Properties; using ProductClient.Properties;
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Windows.Forms; using System.Windows.Forms;
using CsharpHttpHelper;
using DevExpress.Utils.Filtering.Internal;
using Newtonsoft.Json.Linq;
using UI.Framework.Forms; using UI.Framework.Forms;
using static Api.Framework.ApiClient; using static Api.Framework.ApiClient;
@ -52,12 +57,99 @@ namespace ProductClient
this.comboBoxEdit2.Properties.Items.AddRange(Enum.GetNames(typeof(DwzType))); this.comboBoxEdit2.Properties.Items.AddRange(Enum.GetNames(typeof(DwzType)));
comboBoxEdit2.SelectedIndex = (int)Class1.Config.dwzType; comboBoxEdit2.SelectedIndex = (int)Class1.Config.dwzType;
SetComboBox_GetCollectionSource();
comboBoxEdit1.SelectedIndex = (int)Class1.Config.qrImageType; comboBoxEdit1.SelectedIndex = (int)Class1.Config.qrImageType;
memoEdit1.Text = Class1.Config.appendComment; memoEdit1.Text = Class1.Config.appendComment;
} }
/// <summary>
/// 赋值采集源
/// </summary>
private void SetComboBox_GetCollectionSource()
{
if (Class1.Config.sourceId == null)
{
Class1.Config.sourceId = "129505086429724672";
}
var collectionSources = GetCollectionSourceAll();
if (collectionSources != null)
{
int index = 0;
foreach (var item in collectionSources)
{
this.comboBoxEdit3.Properties.Items.Add(item);
this.comboBoxEdit3.SelectedText = item.Nick;
if (Class1.Config.sourceId == item.SourceId)
{
comboBoxEdit3.SelectedIndex = index;
}
index++;
}
}
}
/// <summary>
/// 获取代运营朋友圈采集源头
/// </summary>
/// <returns></returns>
public List<CollectionSourceResult> GetCollectionSourceAll()
{
//http://goods.api.52cmg.cn/api/WechatMomentsGoods-WechatMoments/GetCollectionSourceAll
//{"Code":0,"Result":[{"Id":"129505086429724672","NickName":"壮壮"}]}
var html = new HttpHelper().GetHtml(
"http://goods.api.52cmg.cn/api/WechatMomentsGoods-WechatMoments/GetCollectionSourceAll").Html;
var jObj = JObject.Parse(html);
if (jObj["Code"]?.Value<long>() != 0)
{
return null;
}
var list = new List<CollectionSourceResult>();
var jArr = jObj["Result"]?.ToArray();
if (jArr != null && jArr.Length > 0)
{
foreach (var jToken in jArr)
{
var item = new CollectionSourceResult();
item.SourceId = jToken["Id"]?.Value<string>();
item.Nick = jToken["NickName"]?.Value<string>();
list.Add(item);
}
}
return list;
}
/// <summary>
/// 朋友圈采集源头数据
/// </summary>
public class CollectionSourceResult
{
/// <summary>
/// 来源Id
/// </summary>
public string SourceId { get; set; }
/// <summary>
/// 昵称
/// </summary>
public string Nick { get; set; }
/// <summary>返回表示当前对象的字符串。</summary>
/// <returns>表示当前对象的字符串。</returns>
public override string ToString()
{
return Nick;
}
}
private void hyperlinkLabelControl_Click(object sender, EventArgs e) private void hyperlinkLabelControl_Click(object sender, EventArgs e)
{ {
try try
@ -117,6 +209,10 @@ namespace ProductClient
Class1.Config.qrImageType = (QrImageType)comboBoxEdit1.SelectedIndex; Class1.Config.qrImageType = (QrImageType)comboBoxEdit1.SelectedIndex;
Class1.Config.Monitor_Interval = (int)numericUpDown1.Value; Class1.Config.Monitor_Interval = (int)numericUpDown1.Value;
Class1.Config.dwzType = (DwzType)comboBoxEdit2.SelectedIndex; Class1.Config.dwzType = (DwzType)comboBoxEdit2.SelectedIndex;
if (comboBoxEdit3.SelectedItem != null)
{
Class1.Config.sourceId = ((CollectionSourceResult)comboBoxEdit3.SelectedItem)?.SourceId;
}
Class1.Config.isPyTkl = checkBox1.Checked; Class1.Config.isPyTkl = checkBox1.Checked;
Class1.Config.isPl = checkBox2.Checked; Class1.Config.isPl = checkBox2.Checked;
Class1.Config.appendComment = memoEdit1.Text; Class1.Config.appendComment = memoEdit1.Text;