This commit is contained in:
老道 2023-04-06 09:07:55 +08:00
parent 34057c91dd
commit c1feb5241a
44 changed files with 1589 additions and 731 deletions

Binary file not shown.

View File

@ -108,6 +108,7 @@
this.barButtonItem45 = new DevExpress.XtraBars.BarButtonItem();
this.popupMenu1 = new DevExpress.XtraBars.PopupMenu(this.components);
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.barButtonItem47 = new DevExpress.XtraBars.BarButtonItem();
((System.ComponentModel.ISupportInitialize)(this.gridControl1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.gridView1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.repositoryItemPictureEdit1)).BeginInit();
@ -369,8 +370,9 @@
this.barButtonItem43,
this.barButtonItem44,
this.barButtonItem45,
this.barButtonItem46});
this.barManager1.MaxItemId = 60;
this.barButtonItem46,
this.barButtonItem47});
this.barManager1.MaxItemId = 61;
//
// barDockControlTop
//
@ -481,7 +483,8 @@
new DevExpress.XtraBars.LinkPersistInfo(this.barButtonItem42),
new DevExpress.XtraBars.LinkPersistInfo(this.barButtonItem43),
new DevExpress.XtraBars.LinkPersistInfo(this.barButtonItem44),
new DevExpress.XtraBars.LinkPersistInfo(this.barButtonItem46)});
new DevExpress.XtraBars.LinkPersistInfo(this.barButtonItem46),
new DevExpress.XtraBars.LinkPersistInfo(this.barButtonItem47)});
this.barSubItem2.Name = "barSubItem2";
//
// barButtonItem9
@ -518,7 +521,7 @@
//
// barButtonItem43
//
this.barButtonItem43.Caption = "登录抖音联盟";
this.barButtonItem43.Caption = "登录抖音联盟(旧即将下线)";
this.barButtonItem43.Enabled = false;
this.barButtonItem43.Id = 56;
this.barButtonItem43.ImageOptions.Image = global::FLSystem.Properties.Resources.;
@ -912,6 +915,14 @@
this.timer1.Enabled = true;
this.timer1.Interval = 60000;
//
// barButtonItem47
//
this.barButtonItem47.Caption = "登录抖客联盟全新API需申请";
this.barButtonItem47.Id = 60;
this.barButtonItem47.ImageOptions.Image = global::FLSystem.Properties.Resources.;
this.barButtonItem47.Name = "barButtonItem47";
this.barButtonItem47.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.barButtonItem47_ItemClick);
//
// cps_manage_control
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@ -1013,5 +1024,6 @@
private DevExpress.XtraBars.BarButtonItem barButtonItem44;
private DevExpress.XtraBars.BarButtonItem barButtonItem45;
private DevExpress.XtraBars.BarButtonItem barButtonItem46;
private DevExpress.XtraBars.BarButtonItem barButtonItem47;
}
}

View File

@ -66,6 +66,9 @@ namespace FLSystem.Forms
case CpsType.:
e.Value = Properties.Resources.;
break;
case CpsType.:
e.Value = Properties.Resources.;
break;
default:
e.Value = Properties.Resources._20;
break;
@ -189,7 +192,7 @@ namespace FLSystem.Forms
if (timer.IsRunning) throw new Exception("系统繁忙,请稍后再同步!");
timer.UpdateOrder(new List<fl_cps_member>() { row }, start_time, DateTime.Now);
}
else if (row.cpstype == CpsType.)
else if (row.cpstype == CpsType. || row.cpstype == CpsType.)
{
var timer = TimerTask.GetTimer<DownDouyinTimer>() as DownDouyinTimer;
if (timer.IsRunning) throw new Exception("系统繁忙,请稍后再同步!");
@ -285,7 +288,7 @@ namespace FLSystem.Forms
timer.UpdateOrder(cpss_down, start_time, DateTime.Now);
}
}
else if (row.cpstype == CpsType.)
else if (row.cpstype == CpsType. || row.cpstype == CpsType.)
{
if (cpss_down != null && cpss_down.Count != 0)
{
@ -412,6 +415,18 @@ namespace FLSystem.Forms
}
}
private void barButtonItem47_ItemClick(object sender, ItemClickEventArgs e)
{
try
{
LoginCps(CpsType.);
}
catch (Exception ex)
{
BaseForm.ShowError(ex.Message, "抖音异常");
}
}
private void barButtonItem44_ItemClick(object sender, ItemClickEventArgs e)
{
LoginCps(CpsType.);

View File

@ -58,6 +58,7 @@
this.barButtonItem100 = new DevExpress.XtraBars.BarButtonItem();
this.barButtonItem107 = new DevExpress.XtraBars.BarButtonItem();
this.barButtonItem108 = new DevExpress.XtraBars.BarButtonItem();
this.barButtonItem110 = new DevExpress.XtraBars.BarButtonItem();
this.btn_log_manage = new DevExpress.XtraBars.BarButtonItem();
this.barButtonItem22 = new DevExpress.XtraBars.BarButtonItem();
this.barButtonItem23 = new DevExpress.XtraBars.BarButtonItem();
@ -235,10 +236,10 @@
this.ribbonStatusBar1.ItemLinks.Add(this.barStaticItem7, true);
this.ribbonStatusBar1.ItemLinks.Add(this.barStaticItem8);
this.ribbonStatusBar1.ItemLinks.Add(this.barStaticItem12, true);
this.ribbonStatusBar1.Location = new System.Drawing.Point(0, 669);
this.ribbonStatusBar1.Location = new System.Drawing.Point(0, 664);
this.ribbonStatusBar1.Name = "ribbonStatusBar1";
this.ribbonStatusBar1.Ribbon = this.ribbonControl1;
this.ribbonStatusBar1.Size = new System.Drawing.Size(935, 22);
this.ribbonStatusBar1.Size = new System.Drawing.Size(935, 27);
//
// barHeaderItem4
//
@ -424,9 +425,10 @@
this.barButtonItem105,
this.barButtonItem107,
this.barButtonItem108,
this.barButtonItem109});
this.barButtonItem109,
this.barButtonItem110});
this.ribbonControl1.Location = new System.Drawing.Point(0, 0);
this.ribbonControl1.MaxItemId = 140;
this.ribbonControl1.MaxItemId = 142;
this.ribbonControl1.Name = "ribbonControl1";
this.ribbonControl1.PageCategories.AddRange(new DevExpress.XtraBars.Ribbon.RibbonPageCategory[] {
this.ribbonPageCategory2});
@ -445,7 +447,7 @@
this.repositoryItemPictureEdit1});
this.ribbonControl1.ShowPageHeadersMode = DevExpress.XtraBars.Ribbon.ShowPageHeadersMode.Show;
this.ribbonControl1.ShowToolbarCustomizeItem = false;
this.ribbonControl1.Size = new System.Drawing.Size(935, 150);
this.ribbonControl1.Size = new System.Drawing.Size(935, 152);
this.ribbonControl1.StatusBar = this.ribbonStatusBar1;
this.ribbonControl1.Toolbar.ShowCustomizeItem = false;
this.ribbonControl1.ToolbarLocation = DevExpress.XtraBars.Ribbon.RibbonQuickAccessToolbarLocation.Below;
@ -557,6 +559,7 @@
this.menu_login_cps.ItemLinks.Add(this.barButtonItem100);
this.menu_login_cps.ItemLinks.Add(this.barButtonItem107);
this.menu_login_cps.ItemLinks.Add(this.barButtonItem108);
this.menu_login_cps.ItemLinks.Add(this.barButtonItem110);
this.menu_login_cps.Name = "menu_login_cps";
this.menu_login_cps.Ribbon = this.ribbonControl1;
//
@ -596,7 +599,7 @@
//
// barButtonItem100
//
this.barButtonItem100.Caption = "登录抖音联盟";
this.barButtonItem100.Caption = "登录抖客联盟(旧即将下线)";
this.barButtonItem100.Id = 129;
this.barButtonItem100.ImageOptions.Image = global::FLSystem.Properties.Resources.;
this.barButtonItem100.Name = "barButtonItem100";
@ -618,6 +621,14 @@
this.barButtonItem108.Name = "barButtonItem108";
this.barButtonItem108.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.barButtonItem108_ItemClick);
//
// barButtonItem110
//
this.barButtonItem110.Caption = "登录抖客联盟全新API需申请";
this.barButtonItem110.Id = 141;
this.barButtonItem110.ImageOptions.Image = global::FLSystem.Properties.Resources.;
this.barButtonItem110.Name = "barButtonItem110";
this.barButtonItem110.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.barButtonItem110_ItemClick);
//
// btn_log_manage
//
this.btn_log_manage.Caption = "运行日志";
@ -1717,11 +1728,11 @@
//
this.xtraTabControl1.ClosePageButtonShowMode = DevExpress.XtraTab.ClosePageButtonShowMode.InActiveTabPageHeader;
this.xtraTabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.xtraTabControl1.Location = new System.Drawing.Point(0, 150);
this.xtraTabControl1.Location = new System.Drawing.Point(0, 152);
this.xtraTabControl1.MultiLine = DevExpress.Utils.DefaultBoolean.False;
this.xtraTabControl1.Name = "xtraTabControl1";
this.xtraTabControl1.ShowHeaderFocus = DevExpress.Utils.DefaultBoolean.False;
this.xtraTabControl1.Size = new System.Drawing.Size(935, 519);
this.xtraTabControl1.Size = new System.Drawing.Size(935, 512);
this.xtraTabControl1.TabIndex = 2;
this.xtraTabControl1.SelectedPageChanged += new DevExpress.XtraTab.TabPageChangedEventHandler(this.xtraTabControl1_SelectedPageChanged);
this.xtraTabControl1.CloseButtonClick += new System.EventHandler(this.xtraTabControl1_CloseButtonClick);
@ -2035,5 +2046,6 @@
private DevExpress.XtraBars.BarButtonItem btn_home_manage;
private DevExpress.XtraBars.BarButtonItem barButtonItem108;
private DevExpress.XtraBars.BarButtonItem barButtonItem109;
private DevExpress.XtraBars.BarButtonItem barButtonItem110;
}
}

View File

@ -599,7 +599,6 @@ namespace FLSystem.Forms
}
finally
{
ItemClick(barButtonItem6, null);
//监听刷新
//PluginClient.LodingPlugin();
this.WindowState = FormWindowState.Normal;
@ -607,14 +606,19 @@ namespace FLSystem.Forms
Task.Run(() =>
{
Thread.Sleep(600);
this.SafeInvoke(() =>
{
ItemClick(barButtonItem6, null);
});
Thread.Sleep(1000 * 60);
CheckSystemEventsHandlersForFreeze();
});
}
}
private static void CheckSystemEventsHandlersForFreeze()
{
try
@ -1449,6 +1453,21 @@ namespace FLSystem.Forms
throw new Exception("该功能尚未开发完成,请等待更新!");
}
AddControlPage(btn.Caption, control, img);
if (btn.Caption == "首页公告")
{
try
{
if (control.Parent is XtraTabPage t)
{
t.PageVisible = false;
}
}
catch
{
//
}
}
}
catch (Exception ex)
{
@ -1922,6 +1941,11 @@ namespace FLSystem.Forms
if (LoginCps(CpsType.) != null) ItemClick(btn_cps_manage, e);
}
private void barButtonItem110_ItemClick(object sender, ItemClickEventArgs e)
{
if (LoginCps(CpsType.) != null) ItemClick(btn_cps_manage, e);
}
private void barButtonItem107_ItemClick(object sender, ItemClickEventArgs e)
{
if (LoginCps(CpsType.) != null) ItemClick(btn_cps_manage, e);
@ -2118,6 +2142,23 @@ namespace FLSystem.Forms
{
try
{
var db = ApiClient.GetSession();
var member = db.Queryable<fl_cps_member>().Where(f => f.cpstype == CpsType.).First() ?? new fl_cps_member() { cpstype = CpsType., username = "123456" };
var api = CpsClient.CreateDouyinRequestV3(member);
var pidList = api.FindPidList();
var createPid = api.CreatePid("1231321321", "12313213213");
api.DownOrderApi(DateTime.Now.AddDays(-2),DateTime.Now,"",1, datas =>
{
Console.WriteLine();
});
Console.WriteLine();
//if (ApiClient.Server != null && ApiClient.Server.State == SuperSocket.SocketBase.ServerState.Running)
//{
// ChatClient.PCRobotPool.SendAppUpdate();
@ -2628,6 +2669,7 @@ namespace FLSystem.Forms
if (LoginCps(CpsType.) != null)
ItemClick(btn_cps_manage, e);
}
}
}

View File

@ -96,7 +96,7 @@ on ai1_temp.member_id = ai2_temp.member_id and ai3_temp.member_id = ai2_temp.mem
if (e.Clicks >= 2)
{
var session = ApiClient.GetSession();
var strs = new string[] { "淘宝推广位名称", "拼多多推广位名称", "京东推广位名称", "唯品会推广位名称", "抖音推广位名称" };
var strs = new string[] { "淘宝推广位名称", "拼多多推广位名称", "京东推广位名称", "唯品会推广位名称", "抖音推广位名称", "抖客推广位名称" };
//var pidSortRemark = new string[] { "淘宝私人pid", "拼多多私人pid", "京东私人pid" };//pid类别备注,值顺序不能变
var pidSortRemark = Enum.GetNames(typeof(PrivateAdzoneType));//pid类别备注,值顺序不能变
if (!strs.Contains(e.Column.Caption)) return;
@ -158,6 +158,12 @@ on ai1_temp.member_id = ai2_temp.member_id and ai3_temp.member_id = ai2_temp.mem
if (setAdzoneObj != null)
esbAdzone = pidInfos.Where(f => f.extend == pidSortRemark[4]).FirstOrDefault();
}
else if (e.Column.Caption == strs[5])
{
setAdzoneObj = CpsClient.SelectTuiguangwei(CpsType.);
if (setAdzoneObj != null)
esbAdzone = pidInfos.Where(f => f.extend == pidSortRemark[5]).FirstOrDefault();
}
if (esbAdzone != null && setAdzoneObj != null)
{

View File

@ -1925,11 +1925,12 @@ namespace FLSystem.Forms
#region
this.comboBoxEdit2.Properties.Items.Clear();
var weixinBases = Chat.Framework.ChatClient.WXClient.Values.ToList();
//var weixinBases = Chat.Framework.ChatClient.WXClient.Values.ToList();
var robots = ApiClient.GetSession().FindRobots();
var objList = new List<object>() { "全部平台" };
foreach (var item in weixinBases)
foreach (var item in robots)
{
objList.Add(item.WeixinHao);
objList.Add(item.name);
}
var qqBases = Chat.Framework.ChatClient.QQClients.Values;

View File

@ -249,7 +249,7 @@
this.ToolStripMenuItem,
this.ToolStripMenuItem});
this.contex_1.Name = "contextMenuStrip1";
this.contex_1.Size = new System.Drawing.Size(197, 114);
this.contex_1.Size = new System.Drawing.Size(197, 92);
this.contex_1.Opening += new System.ComponentModel.CancelEventHandler(this.contex_1_Opening);
//
// 增加ToolStripMenuItem
@ -723,7 +723,7 @@
this.tabNavigationPage4.Controls.Add(this.gridControl4);
this.tabNavigationPage4.Controls.Add(this.radioGroup3);
this.tabNavigationPage4.Name = "tabNavigationPage4";
this.tabNavigationPage4.Size = new System.Drawing.Size(803, 547);
this.tabNavigationPage4.Size = new System.Drawing.Size(803, 532);
//
// label2
//
@ -744,7 +744,7 @@
this.gridControl4.Location = new System.Drawing.Point(0, 23);
this.gridControl4.MainView = this.gridView4;
this.gridControl4.Name = "gridControl4";
this.gridControl4.Size = new System.Drawing.Size(803, 524);
this.gridControl4.Size = new System.Drawing.Size(803, 509);
this.gridControl4.TabIndex = 4;
this.gridControl4.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
this.gridView4});
@ -850,7 +850,7 @@
this.tabNavigationPage5.Controls.Add(this.gridControl5);
this.tabNavigationPage5.Controls.Add(this.radioGroup4);
this.tabNavigationPage5.Name = "tabNavigationPage5";
this.tabNavigationPage5.Size = new System.Drawing.Size(803, 547);
this.tabNavigationPage5.Size = new System.Drawing.Size(803, 532);
//
// label1
//
@ -871,7 +871,7 @@
this.gridControl5.Location = new System.Drawing.Point(0, 23);
this.gridControl5.MainView = this.gridView5;
this.gridControl5.Name = "gridControl5";
this.gridControl5.Size = new System.Drawing.Size(803, 524);
this.gridControl5.Size = new System.Drawing.Size(803, 509);
this.gridControl5.TabIndex = 6;
this.gridControl5.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
this.gridView5});
@ -975,7 +975,7 @@
this.tabNavigationPage6.Controls.Add(this.label3);
this.tabNavigationPage6.Controls.Add(this.gridControl6);
this.tabNavigationPage6.Name = "tabNavigationPage6";
this.tabNavigationPage6.Size = new System.Drawing.Size(803, 547);
this.tabNavigationPage6.Size = new System.Drawing.Size(803, 532);
//
// label3
//
@ -996,7 +996,7 @@
this.gridControl6.Location = new System.Drawing.Point(0, 0);
this.gridControl6.MainView = this.gridView6;
this.gridControl6.Name = "gridControl6";
this.gridControl6.Size = new System.Drawing.Size(803, 547);
this.gridControl6.Size = new System.Drawing.Size(803, 532);
this.gridControl6.TabIndex = 1;
this.gridControl6.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
this.gridView6});

View File

@ -709,7 +709,7 @@ namespace FLSystem.Forms
if (e.Clicks >= 2)
{
var session = ApiClient.GetSession();
var strs = new string[] { "淘宝推广位名称", "拼多多推广位名称", "京东推广位名称", "唯品会推广位名称" };
var strs = new string[] { "淘宝推广位名称", "拼多多推广位名称", "京东推广位名称", "唯品会推广位名称", "抖音推广位名称", "抖客推广位名称" };
if (!strs.Contains(e.Column.Caption)) return;
var pidInfos = session.Queryable<fl_adzone_info>().Where(f => f.group_id == groupid && f.custom_type == Resources.GroupSoftwareType).ToList();
@ -746,6 +746,12 @@ namespace FLSystem.Forms
if (setAdzoneObj != null)
esbAdzone = pidInfos.Where(f => f.alliance_id == (int)CpsType.).FirstOrDefault();
}
else if (e.Column.Caption == strs[5])
{
setAdzoneObj = CpsClient.SelectTuiguangwei(CpsType.);
if (setAdzoneObj != null)
esbAdzone = pidInfos.Where(f => f.alliance_id == (int)CpsType.).FirstOrDefault();
}
if (esbAdzone != null && setAdzoneObj != null)
{

View File

@ -18,6 +18,7 @@ using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows.Threading;
using System.Xml;
using PCRobot.Pack;
using UI.Framework.Forms;
namespace FLSystem
@ -123,8 +124,7 @@ namespace FLSystem
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
static void Main() {
//var sign = HttpExtend.GetMD5String("Cc"+ "_*54R56@%");

View File

@ -156,6 +156,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="CMDHelper.cs" />
<Compile Include="ControlExtension.cs" />
<Compile Include="EasySoc_.cs" />
<Compile Include="Entitys\Display_Real.cs" />
@ -218,6 +219,7 @@
<Compile Include="Utils\WeChatActivateHelper.cs" />
<Compile Include="Utils\WeChatActivateHelperV2.cs" />
<Compile Include="Utils\WechatExtend.cs" />
<Compile Include="Utils\WeChatHelper.cs" />
<Compile Include="Utils\ZipArchive.cs" />
<Compile Include="Utils\ZIP\BZip2\BZip2.cs" />
<Compile Include="Utils\ZIP\BZip2\BZip2Constants.cs" />
@ -322,6 +324,7 @@
<None Include="app.manifest" />
<None Include="packages.config" />
<None Include="Properties\app.manifest" />
<None Include="Properties\denyWechatUpdate.bat" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>

View File

@ -41,13 +41,9 @@ namespace PCRobot
{
try
{
WeChatActivateHelperV2.Init(2);
}
catch (Exception exception)
{ }
try
{
//Common.MainExeHandle = this.Handle;
try
@ -155,6 +151,17 @@ namespace PCRobot
MessageBox.Show("异常 = " + ex.Message + " --- " + ex.StackTrace);
}
try
{
//WeChatActivateHelperV2.Init(2);
//注册自动激活微信窗口,防延迟
WeChatHelper.Init(2);
WeChatHelper.RestoreWeChat();
}
catch (Exception exception)
{ }
//try
//{
@ -1063,6 +1070,10 @@ namespace PCRobot
{
try
{
WeChatHelper.ShieldUpdate();
WeChatHelper.RestoreWeChat();
var wtype = WechatType.Xiaoxie;
Wechat_Xiaoxie.Install();

View File

@ -60,6 +60,27 @@ namespace PCRobot.Properties {
}
}
/// <summary>
/// 查找类似 @echo off
///
///reg add &quot;HKEY_CURRENT_USER\Software\Tencent\WeChat&quot; /v &quot;NeedUpdateType&quot; /t reg_dword /d &quot;0&quot; /f &gt;nul 2&gt;nul
///
///del /f /q %USERPROFILE%\AppData\Roaming\Tencent\WeChat\&quot;All Users&quot;\config\update.data &gt;nul 2&gt;nul
///
///md %USERPROFILE%\AppData\Roaming\Tencent\WeChat\&quot;All Users&quot;\config\update.data &gt;nul 2&gt;nul
///
///echo Y|cacls &quot;%USERPROFILE%\AppData\Roaming\Tencent\WeChat\All Users\config\update.data&quot; /T /P %USERNAME%:N &gt;nul 2&gt;nul
///
///rd /s /q %USERPROFILE%\AppData\Roaming\Tencent\WeChat\patch &gt;nul 2&gt;nul
///
///m [字符串的其余部分被截断]&quot;; 的本地化字符串。
/// </summary>
internal static string denyWechatUpdate {
get {
return ResourceManager.GetString("denyWechatUpdate", resourceCulture);
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>

View File

@ -118,6 +118,9 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="denyWechatUpdate" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>denyWechatUpdate.bat;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;gb2312</value>
</data>
<data name="未登录" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\未登录.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>

View File

@ -347,7 +347,7 @@ namespace PCRobot.Utils
ShieldingWeChatUpdateFunction();
//开启自动关闭微信更新进程
//StartCheckUpdateThread();
StartCheckUpdateThread();
return true;
}

View File

@ -89,6 +89,8 @@
<ItemGroup>
<Compile Include="Class1.cs" />
<Compile Include="Config.cs" />
<Compile Include="DaRenHandle.cs" />
<Compile Include="DouKeHandle.cs" />
<Compile Include="Entitys\dyinfo_temp.cs" />
<Compile Include="Entitys\fl_plugin_dyrebate_dytgw.cs" />
<Compile Include="Entitys\fl_plugin_dy_pidhist.cs" />
@ -117,6 +119,7 @@
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>

View File

@ -41,6 +41,17 @@
this.gridColumn5 = new DevExpress.XtraGrid.Columns.GridColumn();
this.gridColumn7 = new DevExpress.XtraGrid.Columns.GridColumn();
this.gridColumn9 = new DevExpress.XtraGrid.Columns.GridColumn();
this.xtraTabPage4 = new DevExpress.XtraTab.XtraTabPage();
this.label2 = new System.Windows.Forms.Label();
this.gridControl2 = new DevExpress.XtraGrid.GridControl();
this.gridView2 = new DevExpress.XtraGrid.Views.Grid.GridView();
this.gridColumn4 = new DevExpress.XtraGrid.Columns.GridColumn();
this.gridColumn6 = new DevExpress.XtraGrid.Columns.GridColumn();
this.gridColumn8 = new DevExpress.XtraGrid.Columns.GridColumn();
this.gridColumn11 = new DevExpress.XtraGrid.Columns.GridColumn();
this.gridColumn12 = new DevExpress.XtraGrid.Columns.GridColumn();
this.gridColumn13 = new DevExpress.XtraGrid.Columns.GridColumn();
this.gridColumn14 = new DevExpress.XtraGrid.Columns.GridColumn();
this.xtraTabPage2 = new DevExpress.XtraTab.XtraTabPage();
this.settingControl1 = new UI.Framework.Controls.SettingControl();
this.xtraTabPage3 = new DevExpress.XtraTab.XtraTabPage();
@ -61,11 +72,15 @@
this.labelControl7 = new DevExpress.XtraEditors.LabelControl();
this.labelControl4 = new DevExpress.XtraEditors.LabelControl();
this.labelControl3 = new DevExpress.XtraEditors.LabelControl();
this.pageControl2 = new UI.Framework.Controls.PageControl();
((System.ComponentModel.ISupportInitialize)(this.xtraTabControl1)).BeginInit();
this.xtraTabControl1.SuspendLayout();
this.xtraTabPage1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.gridControl1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.gridView1)).BeginInit();
this.xtraTabPage4.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.gridControl2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.gridView2)).BeginInit();
this.xtraTabPage2.SuspendLayout();
this.xtraTabPage3.SuspendLayout();
this.groupBox1.SuspendLayout();
@ -84,6 +99,7 @@
this.xtraTabControl1.TabIndex = 7;
this.xtraTabControl1.TabPages.AddRange(new DevExpress.XtraTab.XtraTabPage[] {
this.xtraTabPage1,
this.xtraTabPage4,
this.xtraTabPage2,
this.xtraTabPage3});
//
@ -93,8 +109,8 @@
this.xtraTabPage1.Controls.Add(this.pageControl1);
this.xtraTabPage1.Controls.Add(this.gridControl1);
this.xtraTabPage1.Name = "xtraTabPage1";
this.xtraTabPage1.Size = new System.Drawing.Size(904, 509);
this.xtraTabPage1.Text = " 设 置 推 广 位 ";
this.xtraTabPage1.Size = new System.Drawing.Size(904, 511);
this.xtraTabPage1.Text = " 达 人 推 广 位 ";
//
// label1
//
@ -238,11 +254,155 @@
this.gridColumn9.VisibleIndex = 6;
this.gridColumn9.Width = 66;
//
// xtraTabPage4
//
this.xtraTabPage4.Controls.Add(this.pageControl2);
this.xtraTabPage4.Controls.Add(this.label2);
this.xtraTabPage4.Controls.Add(this.gridControl2);
this.xtraTabPage4.Name = "xtraTabPage4";
this.xtraTabPage4.Size = new System.Drawing.Size(904, 511);
this.xtraTabPage4.Text = " 抖 客 推 广 位 ";
//
// label2
//
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)));
this.label2.AutoSize = true;
this.label2.BackColor = System.Drawing.Color.White;
this.label2.Font = new System.Drawing.Font("黑体", 26.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.Location = new System.Drawing.Point(181, 209);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(537, 35);
this.label2.TabIndex = 9;
this.label2.Text = "尚未登录机器人,请先登录机器人";
//
// gridControl2
//
this.gridControl2.Dock = System.Windows.Forms.DockStyle.Top;
this.gridControl2.Location = new System.Drawing.Point(0, 0);
this.gridControl2.MainView = this.gridView2;
this.gridControl2.Name = "gridControl2";
this.gridControl2.Size = new System.Drawing.Size(904, 470);
this.gridControl2.TabIndex = 5;
this.gridControl2.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
this.gridView2});
//
// gridView2
//
this.gridView2.Appearance.HeaderPanel.Options.UseTextOptions = true;
this.gridView2.Appearance.HeaderPanel.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
this.gridView2.Columns.AddRange(new DevExpress.XtraGrid.Columns.GridColumn[] {
this.gridColumn4,
this.gridColumn6,
this.gridColumn8,
this.gridColumn11,
this.gridColumn12,
this.gridColumn13,
this.gridColumn14});
this.gridView2.GridControl = this.gridControl2;
this.gridView2.Name = "gridView2";
this.gridView2.OptionsView.ShowGroupPanel = false;
this.gridView2.RowCellClick += new DevExpress.XtraGrid.Views.Grid.RowCellClickEventHandler(this.gridView2_RowCellClick);
this.gridView2.CustomColumnDisplayText += new DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventHandler(this.gridView2_CustomColumnDisplayText);
//
// gridColumn4
//
this.gridColumn4.AppearanceCell.Options.UseTextOptions = true;
this.gridColumn4.AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
this.gridColumn4.Caption = "ID";
this.gridColumn4.FieldName = "ID";
this.gridColumn4.Name = "gridColumn4";
this.gridColumn4.Visible = true;
this.gridColumn4.VisibleIndex = 0;
this.gridColumn4.Width = 50;
//
// gridColumn6
//
this.gridColumn6.AppearanceCell.Options.UseTextOptions = true;
this.gridColumn6.AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
this.gridColumn6.Caption = "平台类型";
this.gridColumn6.FieldName = "chattype";
this.gridColumn6.Name = "gridColumn6";
this.gridColumn6.OptionsColumn.AllowEdit = false;
this.gridColumn6.OptionsColumn.AllowFocus = false;
this.gridColumn6.Visible = true;
this.gridColumn6.VisibleIndex = 1;
this.gridColumn6.Width = 99;
//
// gridColumn8
//
this.gridColumn8.AppearanceCell.Options.UseTextOptions = true;
this.gridColumn8.AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
this.gridColumn8.Caption = "账号";
this.gridColumn8.FieldName = "name";
this.gridColumn8.Name = "gridColumn8";
this.gridColumn8.OptionsColumn.AllowEdit = false;
this.gridColumn8.OptionsColumn.AllowFocus = false;
this.gridColumn8.Visible = true;
this.gridColumn8.VisibleIndex = 2;
this.gridColumn8.Width = 148;
//
// gridColumn11
//
this.gridColumn11.AppearanceCell.Options.UseTextOptions = true;
this.gridColumn11.AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
this.gridColumn11.Caption = "账号昵称";
this.gridColumn11.FieldName = "nick";
this.gridColumn11.Name = "gridColumn11";
this.gridColumn11.OptionsColumn.AllowEdit = false;
this.gridColumn11.OptionsColumn.AllowFocus = false;
this.gridColumn11.Visible = true;
this.gridColumn11.VisibleIndex = 3;
this.gridColumn11.Width = 125;
//
// gridColumn12
//
this.gridColumn12.AppearanceCell.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Underline);
this.gridColumn12.AppearanceCell.ForeColor = System.Drawing.Color.Blue;
this.gridColumn12.AppearanceCell.Options.UseFont = true;
this.gridColumn12.AppearanceCell.Options.UseForeColor = true;
this.gridColumn12.AppearanceCell.Options.UseTextOptions = true;
this.gridColumn12.AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
this.gridColumn12.Caption = "主推广账号";
this.gridColumn12.FieldName = "pid_chief_name";
this.gridColumn12.Name = "gridColumn12";
this.gridColumn12.OptionsColumn.AllowEdit = false;
this.gridColumn12.Visible = true;
this.gridColumn12.VisibleIndex = 4;
this.gridColumn12.Width = 149;
//
// gridColumn13
//
this.gridColumn13.AppearanceCell.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Underline);
this.gridColumn13.AppearanceCell.ForeColor = System.Drawing.Color.Blue;
this.gridColumn13.AppearanceCell.Options.UseFont = true;
this.gridColumn13.AppearanceCell.Options.UseForeColor = true;
this.gridColumn13.AppearanceCell.Options.UseTextOptions = true;
this.gridColumn13.AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
this.gridColumn13.Caption = "副推广账号";
this.gridColumn13.FieldName = "pid_deputy_name";
this.gridColumn13.Name = "gridColumn13";
this.gridColumn13.OptionsColumn.AllowEdit = false;
this.gridColumn13.Visible = true;
this.gridColumn13.VisibleIndex = 5;
this.gridColumn13.Width = 158;
//
// gridColumn14
//
this.gridColumn14.AppearanceCell.Options.UseTextOptions = true;
this.gridColumn14.AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
this.gridColumn14.Caption = "禁止使用";
this.gridColumn14.FieldName = "onoff";
this.gridColumn14.Name = "gridColumn14";
this.gridColumn14.OptionsColumn.AllowEdit = false;
this.gridColumn14.Visible = true;
this.gridColumn14.VisibleIndex = 6;
this.gridColumn14.Width = 66;
//
// xtraTabPage2
//
this.xtraTabPage2.Controls.Add(this.settingControl1);
this.xtraTabPage2.Name = "xtraTabPage2";
this.xtraTabPage2.Size = new System.Drawing.Size(904, 509);
this.xtraTabPage2.Size = new System.Drawing.Size(904, 511);
this.xtraTabPage2.Text = " 应 用 设 置 ";
//
// settingControl1
@ -250,14 +410,14 @@
this.settingControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.settingControl1.Location = new System.Drawing.Point(0, 0);
this.settingControl1.Name = "settingControl1";
this.settingControl1.Size = new System.Drawing.Size(904, 509);
this.settingControl1.Size = new System.Drawing.Size(904, 511);
this.settingControl1.TabIndex = 0;
//
// xtraTabPage3
//
this.xtraTabPage3.Controls.Add(this.groupBox1);
this.xtraTabPage3.Name = "xtraTabPage3";
this.xtraTabPage3.Size = new System.Drawing.Size(904, 509);
this.xtraTabPage3.Size = new System.Drawing.Size(904, 511);
this.xtraTabPage3.Text = " 防 撸 设 置 ";
//
// groupBox1
@ -464,6 +624,13 @@
this.labelControl3.TabIndex = 19;
this.labelControl3.Text = "用户购买的商品";
//
// pageControl2
//
this.pageControl2.Location = new System.Drawing.Point(1, 472);
this.pageControl2.Name = "pageControl2";
this.pageControl2.Size = new System.Drawing.Size(900, 36);
this.pageControl2.TabIndex = 10;
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
@ -480,6 +647,10 @@
this.xtraTabPage1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.gridControl1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.gridView1)).EndInit();
this.xtraTabPage4.ResumeLayout(false);
this.xtraTabPage4.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.gridControl2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.gridView2)).EndInit();
this.xtraTabPage2.ResumeLayout(false);
this.xtraTabPage3.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
@ -526,5 +697,17 @@
private DevExpress.XtraEditors.LabelControl labelControl7;
private DevExpress.XtraEditors.LabelControl labelControl4;
private DevExpress.XtraEditors.LabelControl labelControl3;
private DevExpress.XtraTab.XtraTabPage xtraTabPage4;
private System.Windows.Forms.Label label2;
private DevExpress.XtraGrid.GridControl gridControl2;
private DevExpress.XtraGrid.Views.Grid.GridView gridView2;
private DevExpress.XtraGrid.Columns.GridColumn gridColumn4;
private DevExpress.XtraGrid.Columns.GridColumn gridColumn6;
private DevExpress.XtraGrid.Columns.GridColumn gridColumn8;
private DevExpress.XtraGrid.Columns.GridColumn gridColumn11;
private DevExpress.XtraGrid.Columns.GridColumn gridColumn12;
private DevExpress.XtraGrid.Columns.GridColumn gridColumn13;
private DevExpress.XtraGrid.Columns.GridColumn gridColumn14;
private UI.Framework.Controls.PageControl pageControl2;
}
}

View File

@ -81,6 +81,21 @@ namespace DYRebate
#endregion
#region
pageControl2.Bind((page, size) =>
{
var session = ApiClient.GetSession();
var parm = session.NewParamMap();
parm.setPageParamters(page, size);
var result = session.FindPage<dyinfo_temp>($"select ri.id as ID,ri.type as chattype,ri.name as name,ri.nick as nick,flag.* from fl_robot_info ri left join (select ai1_temp.robot_id as id,ai1_temp.onoff as onoff,ai1_temp.adzone_pid_cps_name as pid_chief_cps_name,ai1_temp.adzone_pid as pid_chief,ai1_temp.adzone_name as pid_chief_name,ai2_temp.adzone_pid_cps_name as pid_deputy_cps_name,ai2_temp.adzone_pid as pid_deputy,ai2_temp.adzone_name as pid_deputy_name from (select * from fl_adzone_info ai1 where ai1.alliance_id = '{(int)CpsType.抖客联盟}' and ai1.custom_type = '{Resources.SoftwareTypeDouKe}' and ai1.extend = 'chief') ai1_temp INNER JOIN (select * from fl_adzone_info ai2 where ai2.alliance_id = '{(int)CpsType.抖客联盟}' and ai2.custom_type = '{Resources.SoftwareTypeDouKe}' and ai2.extend='deputy') ai2_temp on ai1_temp.robot_id = ai2_temp.robot_id) flag on ri.id = flag.id", parm);
return new PageControl.SerchResult() { Result = result.DataList, Total = result.Total };
}, gridControl2, 40, true, true);
label2.Visible = gridView2.RowCount == 0;
#endregion
}
catch (Exception ex)
{
@ -123,7 +138,7 @@ namespace DYRebate
adzones = new List<fl_adzone_info>();
foreach (var item in pidNames)
{
var adzoneInfo = CreateAdzoneInfo(string.Empty, string.Empty, string.Empty, id, item);
var adzoneInfo = CreateAdzoneInfo(string.Empty, string.Empty, string.Empty, id, item, CpsType.);
session.SaveOrUpdate(adzoneInfo);
adzones.Add(adzoneInfo);
}
@ -131,7 +146,7 @@ namespace DYRebate
else
{
var unCreate = pidNames.FirstOrDefault(f => f != adzone.extend);//获取数据库中不存在的(主/副)推广位数据,下方添加不存在的对象
var adzoneInfo = CreateAdzoneInfo(string.Empty, string.Empty, string.Empty, id, unCreate);
var adzoneInfo = CreateAdzoneInfo(string.Empty, string.Empty, string.Empty, id, unCreate, CpsType.);
session.SaveOrUpdate(adzoneInfo);
adzones.Add(adzoneInfo);
}
@ -188,7 +203,7 @@ namespace DYRebate
adzones = new List<fl_adzone_info>();
foreach (var item in pidNames)
{
var adzoneInfo = CreateAdzoneInfo(string.Empty, string.Empty, string.Empty, id, item, false);
var adzoneInfo = CreateAdzoneInfo(string.Empty, string.Empty, string.Empty, id, item, CpsType., false);
session.SaveOrUpdate(adzoneInfo);
adzones.Add(adzoneInfo);
}
@ -196,7 +211,7 @@ namespace DYRebate
else
{
var unCreate = pidNames.FirstOrDefault(f => f != adzones[0].extend);//获取数据库中不存在的(主/副)推广位数据,下方添加不存在的对象
var adzoneInfo = CreateAdzoneInfo(string.Empty, string.Empty, string.Empty, id, unCreate, adzones[0].onoff);
var adzoneInfo = CreateAdzoneInfo(string.Empty, string.Empty, string.Empty, id, unCreate, CpsType., adzones[0].onoff);
session.SaveOrUpdate(adzoneInfo);
adzones.Add(adzoneInfo);
}
@ -221,6 +236,139 @@ namespace DYRebate
}
}
/// <summary>
/// 行单元格单击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void gridView2_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e)
{
try
{
#region 广
var selectRow = gridView2.GetSelectedRows()[0];
var id = this.gridView2.GetRowCellValue(selectRow, "ID").ToString();//获取列的数据
//点击数大于2弹出窗体进行推广位的选择
if (e.Clicks >= 2)
{
if (e.Column.FieldName == "pid_chief_name" || e.Column.FieldName == "pid_deputy_name")
{
var tgwObj = CpsClient.SelectTuiguangwei(CpsType.);
if (tgwObj != null)
{
var tgw = tgwObj as Tuiguangwei;
var session = ApiClient.GetSession();
var adzones = session.FindAdzoneInfos(true).Where(f => f.alliance_id == (int)CpsType. && f.custom_type == Resources.SoftwareTypeDouKe && f.robot_id == long.Parse(id)).ToList();
var pidName = e.Column.FieldName == "pid_chief_name" ? "chief" : "deputy";
var adzone = adzones.FirstOrDefault(f => f.extend == pidName);
#region 广(/),()
if (adzones != null && adzones.Count < 2)
{
var pidNames = new string[] { "chief", "deputy" };
if (adzone == null)
{
adzones = new List<fl_adzone_info>();
foreach (var item in pidNames)
{
var adzoneInfo = CreateAdzoneInfo(string.Empty, string.Empty, string.Empty, id, item, CpsType.);
session.SaveOrUpdate(adzoneInfo);
adzones.Add(adzoneInfo);
}
}
else
{
var unCreate = pidNames.FirstOrDefault(f => f != adzone.extend);//获取数据库中不存在的(主/副)推广位数据,下方添加不存在的对象
var adzoneInfo = CreateAdzoneInfo(string.Empty, string.Empty, string.Empty, id, unCreate, CpsType.);
session.SaveOrUpdate(adzoneInfo);
adzones.Add(adzoneInfo);
}
}
#endregion
#region ,
var repetAdzone = adzones.Where(f => f.extend == pidName).ToList();
if (repetAdzone.Count > 1)
{
for (int i = 1; i <= repetAdzone.Count - 1; i++)
{
session.Deleteable(repetAdzone[i]).ExecuteCommand();
}
adzones = session.FindAdzoneInfos(true).Where(f => f.alliance_id == (int)CpsType. && f.custom_type == Resources.SoftwareTypeDouKe && f.robot_id == long.Parse(id)).ToList();
}
#endregion
adzone = adzones.FirstOrDefault(f => f.extend == pidName);
if (adzone != null)//数据库中存在的情况
{
adzone.adzone_pid_cps_name = tgw.Member.username;
adzone.adzone_pid = tgw.Pid;
adzone.adzone_name = tgw.Name;
session.SaveOrUpdate(adzone);
}
pageControl2.GotoPage(1);
label2.Visible = gridView2.RowCount == 0;
session.FindDyInfoTempGroups(true);
session.FindAdzoneInfos(true);
session.FindDoukeAutoBindPid(true);//刷新推广位
}
}
}
#endregion
#region
if (e.Column.FieldName == "onoff")
{
if (e.Clicks == 1)
{
if (!(bool)e.CellValue && MessageBox.Show("该微信推广位确定禁用?", "系统提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
return;
var session = ApiClient.GetSession();
var adzones = session.FindAdzoneInfos(true).Where(f => f.alliance_id == (int)CpsType. && f.custom_type == Resources.SoftwareType && f.robot_id == long.Parse(id)).ToList();
#region 广(/),()
if (adzones != null && adzones.Count < 2)
{
var pidNames = new string[] { "chief", "deputy" };
if (adzones.Count == 0)
{
adzones = new List<fl_adzone_info>();
foreach (var item in pidNames)
{
var adzoneInfo = CreateAdzoneInfo(string.Empty, string.Empty, string.Empty, id, item, CpsType., false);
session.SaveOrUpdate(adzoneInfo);
adzones.Add(adzoneInfo);
}
}
else
{
var unCreate = pidNames.FirstOrDefault(f => f != adzones[0].extend);//获取数据库中不存在的(主/副)推广位数据,下方添加不存在的对象
var adzoneInfo = CreateAdzoneInfo(string.Empty, string.Empty, string.Empty, id, unCreate, CpsType., adzones[0].onoff);
session.SaveOrUpdate(adzoneInfo);
adzones.Add(adzoneInfo);
}
}
#endregion
if (adzones != null)//数据库中存在
session.ExcuteSQL("update fl_adzone_info set onoff = @onoff where robot_id = @robot_id and alliance_id = @alliance_id and custom_type = @custom_type", new { onoff = !adzones[0].onoff, robot_id = id, alliance_id = (int)CpsType., custom_type = Resources.SoftwareType });
session.FindDkInfoTempGroups(true);
pageControl2.GotoPage(1);
label2.Visible = gridView2.RowCount == 0;
session.FindAdzoneInfos(true);
session.FindDoukeAutoBindPid(true);//刷新推广位
}
}
#endregion
}
catch (Exception ex)
{
ShowError(ex);
}
}
/// <summary>
/// 修改显示内容的事件
/// </summary>
@ -239,6 +387,25 @@ namespace DYRebate
}
}
/// <summary>
/// 修改显示内容的事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void gridView2_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
{
try
{
if ((e.Column.FieldName == "pid_chief_name" || e.Column.FieldName == "pid_deputy_name") && (e.Value == null || string.IsNullOrEmpty(e.Value.ToString()))) e.DisplayText = "双击设置";
}
catch (Exception ex)
{
ShowError(ex);
return;
}
}
/// <summary>
/// 创建fl_adzone_info对象
/// </summary>
@ -248,15 +415,15 @@ namespace DYRebate
/// <param name="rid"></param>
/// <param name="item"></param>
/// <returns></returns>
private fl_adzone_info CreateAdzoneInfo(string adzone_name, string adzone_pid, string adzone_pid_cps_name, string rid, string item, bool onoff = false)
private fl_adzone_info CreateAdzoneInfo(string adzone_name, string adzone_pid, string adzone_pid_cps_name, string rid, string item, CpsType cpsType, bool onoff = false)
{
return new fl_adzone_info()
{
custom_type = Resources.SoftwareType, //自定义类型
custom_type = cpsType == CpsType. ? Resources.SoftwareType : Resources.SoftwareTypeDouKe, //自定义类型
adzone_name = adzone_name, //推广位名称
adzone_pid = adzone_pid, //推广位pid
adzone_pid_cps_name = adzone_pid_cps_name, //推广位cps名称
alliance_id = (int)CpsType., //联盟id
alliance_id = (int)cpsType, //联盟id
robot_id = int.Parse(rid), //机器人id
group_id = string.Empty, //群id
member_id = 0, //私人id

View File

@ -6,26 +6,22 @@ using Api.Framework.Model;
using Api.Framework.SDK;
using Api.Framework.Timers;
using Api.Framework.Tools;
using Api.Framework.Utils;
using CsharpHttpHelper;
using DYRebate.Entitys;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using Api.Framework.Utils;
using Api.Framework.Cps;
using static DYRebate.Class1;
namespace DYRebate
{
public class MessageOperation
{
private static List<string> AddMessUsernameList = new List<string>() { "wxid_mjzeh4qj9hio22", "wxid_lrf1mr7ond6622", "wujiahua0876", "wxid_2ufntuf4purl22", "wxid_bua0te17il7i22" };
ReciveIMEvent e = null;
Class1 plugin = null;
object sender = null;
@ -232,21 +228,103 @@ namespace DYRebate
}
#endregion
public bool AnalyseFanLi()
/// <summary>
/// 抖客判断
/// </summary>
/// <returns></returns>
public CpsInfo DouKe()
{
//计算公式
Compute compute = null;
try
{
var db = ApiClient.GetSession();
var memberTmp = e.GetMemberinfo();
var dkefoTemps = db.FindDkInfoTempGroups();
var dyInfoTemp = dkefoTemps.FirstOrDefault(f => f.name == e.RobotInfo.name && f.onoff == false);
if (dyInfoTemp == null)
{
return null;
}
var memberTmp = e.GetMemberinfo();
//推广位
var pid = string.Empty;
fl_cps_member dy_cps = null;
var isDefault = true;
if (!string.IsNullOrWhiteSpace(e.Groupid))//群pid
{
var groupAdzone = db.FindAdzoneInfos().FirstOrDefault(f => f.alliance_id == (int)CpsType. && f.custom_type == PrivateAdzoneCustomType.pid.ToString() && f.group_id == e.Groupid);
if (groupAdzone != null && !string.IsNullOrWhiteSpace(groupAdzone.adzone_pid))
{
pid = groupAdzone.adzone_pid;
dy_cps = CpsClient.Members.FirstOrDefault(f => f.cpstype == CpsType. && f.username == groupAdzone.adzone_pid_cps_name);
isDefault = false;
}
}
if (isDefault)//私人pid
{
var memberAdzone = db.FindAdzoneInfos().FirstOrDefault(f => f.alliance_id == (int)CpsType. && f.custom_type == PrivateAdzoneCustomType.pid.ToString() && f.member_id == memberTmp.id);
if (memberAdzone != null && !string.IsNullOrWhiteSpace(memberAdzone.adzone_pid))//私人推广位
{
pid = memberAdzone.adzone_pid;
dy_cps = CpsClient.Members.FirstOrDefault(f => f.cpstype == CpsType. && f.username == memberAdzone.adzone_pid_cps_name);
isDefault = false;
}
}
if (isDefault)//默认推广位
{
dy_cps = CpsClient.Members.FirstOrDefault(f => f.cpstype == CpsType. && f.username == ((memberTmp.buy_point >= Class1.Config.Point && memberTmp.finish_order >= Class1.Config.OrderNum) ? dyInfoTemp.pid_chief_cps_name : dyInfoTemp.pid_deputy_cps_name));//通过判断用户的购物积分,来判断用户使用哪个推广位
pid = ((memberTmp.buy_point >= Class1.Config.Point && memberTmp.finish_order >= Class1.Config.OrderNum) ? dyInfoTemp.pid_chief : dyInfoTemp.pid_deputy);
}
if (dy_cps == null)
{
throw new Exception("抖音推广位设置异常,请检测后重试!");
}
var api = CpsClient.CreateDouyinRequestV3(dy_cps);
if (api == null)
{
throw new Exception("@创建抖音API请求失败");
}
return new CpsInfo()
{
api = api,
DyCps = dy_cps,
Pid = pid
};
}
catch (Exception ex)
{
this.plugin.OnLog("抖客判断" + ex.Message);
}
return null;
}
/// <summary>
/// 达人判断
/// </summary>
/// <returns></returns>
public CpsInfo DaRen()
{
try
{
var db = ApiClient.GetSession();
var dyinfoTemps = db.FindDyInfoTempGroups();
var dyInfoTemp = dyinfoTemps.FirstOrDefault(f => f.name == e.RobotInfo.name && f.onoff == false);
if (dyInfoTemp == null) return false;
if (dyInfoTemp == null)
{
return null;
}
var message = e.Message.Trim();
var memberTmp = e.GetMemberinfo();
//推广位
var pid = string.Empty;
@ -282,386 +360,64 @@ namespace DYRebate
pid = ((memberTmp.buy_point >= Class1.Config.Point && memberTmp.finish_order >= Class1.Config.OrderNum) ? dyInfoTemp.pid_chief : dyInfoTemp.pid_deputy);
}
if (dy_cps == null) throw new Exception("抖音推广位设置异常,请检测后重试!");
if (dy_cps == null)
{
throw new Exception("抖音推广位设置异常,请检测后重试!");
}
var api = CpsClient.CreateDouyinRequest(dy_cps);
if (api == null) throw new Exception("@创建抖音API请求失败");
//var title = string.Empty;//商品标题
//判断消息中是否包含抖音链接信息
var promotion_id = string.Empty;//促销id
//api.ConvertInstPickSource(e.Message);
//api.GetShareMaterial();
//var itemid = e.Message.Trim();
var itemid = api.GetDyGoodsID(message, out promotion_id);
#region id搜索
if (string.IsNullOrEmpty(itemid))
return false;
if (!ApiClient.Setting.SystemConfig.message_warning_switch)
e.SendMessage(Class1.Config.SearchingTip);
try
if (api == null)
{
//屏蔽商品
if (Class1.Config.ItemIDRestrictList.Contains(itemid))
{
e.SendMessage(Class1.Config.ItemIDRestrictTip.Replace("[商品ID]", itemid));
return true;
}
var items = api.FindItemInfo(itemid);
if (items == null || items.products == null || items.products.Count == 0)
throw new Exception("商品不存在");
var goods = items.products[0];
var shopUrl = string.Empty;
ShareInfo extInfo = null;
var isApiSharable = false;
if (Class1.Config.AllRebateModelSwitch == SwitchType.)
{
if (goods.sharable != "false")
{
try
{
extInfo = api.ConvertUrl(goods.detail_url, pid, $"{e.GetMemberinfo().username}");
isApiSharable = true;
}
catch (Exception)
{ }
}
}
//var rateTmp = 0m;
//if (goods.sharable == "false")//throw new Exception("商品未推广");
if (!isApiSharable)//throw new Exception("商品未推广");
{
var key = $"{itemid}";
var value = Comm.GetCache(key);
if (!string.IsNullOrWhiteSpace(value))
shopUrl = value;
else
{
if (string.IsNullOrWhiteSpace(promotion_id))
throw new Exception("商品未推广");
isApiSharable = false;
if (!api.BindGoods(itemid, promotion_id))
{
throw new Exception("添加商品异常");
}
shopUrl = api.GetShopWindow_PromotionUrlToGoodsId(itemid);
if (string.IsNullOrWhiteSpace(shopUrl))
throw new Exception("未获取推广链接");
//var info = api.FindGoodsInfo(promotion_id);
//if (info != null)
// rateTmp = (decimal)info.data.cos_ratio / 10000m;
Comm.SetCache(key, shopUrl, 15 * 60);
}
}
//店铺名称
var nick = goods.shop_name;
//商品主图
var pict_url = !string.IsNullOrWhiteSpace(goods.cover) ? goods.cover : (goods.imgs != null && goods.imgs.Count != 0) ? goods.imgs[0] : string.Empty;
////商品标题//&lt; &gt;&amp;&quot;&copy; <>&",©;
var title = goods.title.Replace("", "").Replace("&lt;", "<").Replace("&gt;", ">").Replace("&amp;", "&").Replace("&quot;", "\"").Replace(" &copy;", "©");//这里有个看不见的字符,要将其替换掉
//原价
var price = decimal.Parse((goods.price / 100m).ToString());
//减去技术费的总佣金(不用券)
var calcPrice = Math.Round((price * 0.9m), 2, MidpointRounding.AwayFromZero);
//30天销量
var volume = goods.sales;
//佣金率
var commission_rate = (decimal)goods.cos_ratio / 100m;
//if (rateTmp != 0 && commission_rate != rateTmp)
// commission_rate = rateTmp;
//优惠券金额
var coupon_price = 0.00m;
#region xxx
//if (goods.sale_infos != null && goods.sale_infos.Count != 0)
//{
// var coupon_tmp = 0m;
// for (int i = 0; i < goods.sale_infos.Count; i++)
// {
// if (goods.sale_infos[i].title.Contains("减"))
// {
// var splitStrs = goods.sale_infos[i].title.Split(new string[] { "减" }, StringSplitOptions.RemoveEmptyEntries);
// if (splitStrs != null && splitStrs.Length == 2)
// {
// var now = decimal.Parse(splitStrs[0]);
// if (price >= now)
// {
// if (now > coupon_tmp)
// {
// coupon_tmp = now;
// coupon_price = decimal.Parse(splitStrs[1]);
// }
// }
// }
// }
// }
//}
#endregion
//券后价
var endPrice = (decimal)((goods.coupon_price ?? 0) / 100d);
if (endPrice != 0)
{
if (endPrice < price)
coupon_price = price - endPrice;
}
//券后佣金
var useCalcPrice = endPrice * 0.9m;
//用券后 佣金
var useCoupon_totalCommFee = (double)Math.Round(useCalcPrice * commission_rate, 2);
//用券后 给用户的佣金
var useCoupon_commFee = db.FindItemPoint(memberTmp, useCoupon_totalCommFee, 1, CpsType., out compute);
Compute compute1 = null;
//不用券 佣金
var unuseCoupon_totalCommFee = Math.Round(calcPrice * commission_rate, 2);
//不用券 给用户的佣金
var unuseCoupon_commFee = db.FindItemPoint(memberTmp, (double)unuseCoupon_totalCommFee, 1, CpsType., out compute1);
if (compute == null)
compute = compute1;
LogHelper.GetSingleObj().Info("", $"抖音佣金计算:券后价{useCoupon_totalCommFee},佣金:{useCalcPrice} ||| 无券价:{unuseCoupon_totalCommFee},佣金:{unuseCoupon_totalCommFee} @@ 佣金率:{commission_rate} => {itemid}");
// 获取短链接
//var shopShortLink = ApiClient.ShortURL(shopUrl, Class1.Config.Dwz_Type).Result;
//抖音缩短链接
var shopShortLink = string.Empty;
//抖音口令
var password = string.Empty;
if (isApiSharable)
{
if (extInfo == null)
extInfo = api.ConvertUrl(goods.detail_url, pid, $"{e.GetMemberinfo().username}");
if (extInfo == null)
throw new Exception("转链异常");
password = extInfo.dy_password;
var reg = Regex.Match(extInfo.dy_password, "(?<口令>[︽#]{2}[0-9a-zA-Z]{9,}[︽#]{2})", RegexOptions.IgnoreCase | RegexOptions.Multiline);
if (reg.Success)
password = reg.Groups["口令"].ToString();
}
else
{
password = DYHelperV2.CreateKouling(shopUrl);
if (!string.IsNullOrWhiteSpace(password))
{
shopShortLink = DYHelperV2.ShortDyUrl(shopUrl);
shopUrl = string.Empty;
}
else
{
shopShortLink = DYHelperV2.ShortDyUrl(shopUrl);
}
//api.DelGoodsWindowUrl(promotion_id);
var pidhist = db.Queryable<fl_plugin_dy_pidhist>().First(g => g.cpsname == api.Member.username && g.pid == promotion_id);
if (pidhist == null)
pidhist = new fl_plugin_dy_pidhist() { pid = promotion_id, cpsname = api.Member.username };
pidhist.expirestime = DateTime.Now.AddHours(1);
db.Saveable(pidhist).ExecuteCommand();
}
#region
//有券的情况
if (coupon_price != 0)
{
var mess = string.Empty;
if (e.ChatType == ChatType. || e.ChatType == ChatType. || (e.ChatType == ChatType.QQ && string.IsNullOrWhiteSpace(Class1.Config.QQSearchSuccessWithCouponTip)))
{
if (!string.IsNullOrWhiteSpace(shopShortLink))
mess = Class1.Config.SearchSuccessWithCouponTip;
else
mess = Class1.Config.SearchSuccessWithCouponTip_kl;
}
else
{
if (!string.IsNullOrWhiteSpace(shopShortLink))
mess = Class1.Config.QQSearchSuccessWithCouponTip;
else
mess = Class1.Config.QQSearchSuccessWithCouponTip_kl;
}
if (AddMessUsernameList.Contains(e.GetMemberinfo().username))
mess += "[分段][延迟=1]" + shopUrl;
e.SendMessage(mess
.Replace("劵", "券")
.Replace("[商品标题]", mess.Contains("<appmsg") ? title.Replace("<", "").Replace(">", "") : title)
.Replace("[商品原价]", string.Format("{0:F}", price))
.Replace("[商品主图]", $"[图片={pict_url}]")
.Replace("[图片地址]", pict_url)
.Replace("[月销量]", volume.ToString())
.Replace("[店铺名称]", nick)
.Replace("[券后返利]", string.Format("{0:F}", useCoupon_commFee.UserPoint))
.Replace("[弃券返利]", string.Format("{0:F}", unuseCoupon_commFee.UserPoint))
.Replace("[券后价]", string.Format("{0:F}", endPrice))
.Replace("[优惠券金额]", coupon_price.ToString())
.Replace("[购买地址]", shopShortLink)
.Replace("[购买口令]", password.Replace("#", "︽"))
.Replace("[共节省]", ((decimal)coupon_price + (decimal)useCoupon_commFee.UserPoint).ToString())
.Replace("[商品图片]", mess.Contains("[商品图片]") ? "[图片=" + ApiClient.GetQRImage(title, string.Format("{0:F}", price), coupon_price.ToString(), endPrice.ToString(), pict_url, shopShortLink, ApiClient.QrImageType.B, CpsType.) + "]" : string.Empty)
);
}
else//没有券的情况
{
var mess = string.Empty;
if (e.ChatType == ChatType. || e.ChatType == ChatType. || (e.ChatType == ChatType.QQ && string.IsNullOrWhiteSpace(Class1.Config.QQSearchSuccessWithoutCouponTip)))
{
if (!string.IsNullOrWhiteSpace(shopShortLink))
mess = Class1.Config.SearchSuccessWithoutCouponTip;
else
mess = Class1.Config.SearchSuccessWithoutCouponTip_kl;
}
else
{
if (!string.IsNullOrWhiteSpace(shopShortLink))
mess = Class1.Config.QQSearchSuccessWithoutCouponTip;
else
mess = Class1.Config.QQSearchSuccessWithoutCouponTip_kl;
}
if (AddMessUsernameList.Contains(e.GetMemberinfo().username))
mess += "[分段][延迟=1]" + shopUrl;
e.SendMessage(mess
.Replace("[商品标题]", mess.Contains("<appmsg") ? title.Replace("<", "").Replace(">", "") : title)
.Replace("[商品原价]", string.Format("{0:F}", price))
.Replace("[商品主图]", $"[图片={pict_url}]")
.Replace("[图片地址]", pict_url)
.Replace("[月销量]", volume.ToString())
.Replace("[店铺名称]", nick)
.Replace("[返利积分]", string.Format("{0:F}", unuseCoupon_commFee.UserPoint))
.Replace("[购买地址]", shopShortLink)
.Replace("[购买口令]", password.Replace("#", "︽"))
.Replace("[共节省]", string.Format("{0:F}", useCoupon_commFee.UserPoint))
.Replace("[商品图片]", mess.Contains("[商品图片]") ? "[图片=" + ApiClient.GetQRImage(title, price.ToString(), "0", price.ToString(), pict_url, shopShortLink, ApiClient.QrImageType.B, CpsType.) + "]" : string.Empty)
);
}
#endregion
#region ,,,
db.Insertable(new fl_query_hist()
{
crt_time = DateTime.Now,
type = CpsType.,
itemid = itemid,
groupid = e.Groupid,
robot_name = e.RobotName,
robot_type = e.ChatType,
userid = memberTmp.id,
title = title,
adzoneid = dy_cps.username,
mallid = goods.shop_id.ToString(),
compute_configdic = compute == null ? string.Empty : JsonConvert.SerializeObject(compute)
}).ExecuteCommand();
db.UpdateRecord(memberTmp.id);
var shared = new Dictionary<string, object>();
shared["msg_type"] = "查询宝贝";
shared["cps_type"] = CpsType.;
shared["msg_username"] = memberTmp.username;
shared["price"] = string.Format("{0:F}", price);
shared["title"] = title;
shared["coupon_price"] = string.Format("{0:F}", coupon_price);
shared["user_point"] = coupon_price != 0 ? string.Format("{0:F}", useCoupon_commFee.UserPoint) : string.Format("{0:F}", unuseCoupon_commFee.UserPoint);
shared["economize"] = coupon_price != 0 ? string.Format("{0:F}", ((decimal)coupon_price + (decimal)useCoupon_commFee.UserPoint)) : string.Format("{0:F}", useCoupon_commFee.UserPoint);
var sharedEvent = new SharedEvents(shared);
EventClient.OnEvent(sender, sharedEvent);
#endregion
return true;
throw new Exception("@创建抖音API请求失败");
}
catch (Exception ex)
return new CpsInfo()
{
//{"code":90000,"err_no":7,"log_id":"202202271755520101330360171F8980A6","message":"商家已设置该商品仅指定作者可推广,请您更换其他商品","msg":"未知错误此错误会逐步细化明确请不要依赖sub_code或sub_msg做业务判断","sub_code":"isp.unknown-error","sub_msg":"1025:商家已设置该商品仅指定作者可推广,请您更换其他商品"}
if (ex.Message.Contains("商品不存在") || ex.Message.Contains("商品未推广") || ex.Message.Contains("未获取推广链接") || ex.Message.Contains("添加商品异常") | ex.Message.Contains("商家已设置该商品仅指定作者可推广"))
{
e.SendMessage(Class1.Config.SearchNoCommissionTip);//未搜索到提示语
db.UpdateRecord(memberTmp.id);
var shared = new Dictionary<string, object>();
shared["msg_type"] = "查询宝贝";
shared["cps_type"] = CpsType.;
shared["msg_username"] = memberTmp.username;
shared["price"] = "未知";
shared["title"] = message;
shared["coupon_price"] = "未知";
shared["user_point"] = "未知";
shared["economize"] = "未知";
var sharedEvent = new SharedEvents(shared);
EventClient.OnEvent(sender, sharedEvent);
}
else if (ex.Message.Contains("转链异常") || ex.Message.Contains("当前商品暂不支持站外分享"))
{
e.SendMessage(Class1.Config.SearchNoCommissionTip);//未搜索到提示语
throw ex;
}
else
throw ex;
}
#endregion
DyCps = dy_cps,
Pid = pid,
api = api
};
}
catch (Exception ex)
{
if (ex.Message.Contains("商品不存在") || ex.Message.Contains("商品未推广") || ex.Message.Contains("商家已设置该商品仅指定作者可推广"))
{
e.SendMessage(Class1.Config.SearchNoCommissionTip);//未搜索到提示语
ApiClient.GetSession().UpdateRecord(memberTmp.id);
var shared = new Dictionary<string, object>();
shared["msg_type"] = "查询宝贝";
shared["cps_type"] = CpsType.;
shared["msg_username"] = memberTmp.username;
shared["price"] = "未知";
shared["title"] = "未知";
shared["coupon_price"] = "未知";
shared["user_point"] = "未知";
shared["economize"] = "未知";
var sharedEvent = new SharedEvents(shared);
EventClient.OnEvent(sender, sharedEvent);
return true;
}
if (ex.Message.StartsWith("@"))
plugin.OnLog($"W ({e.RobotInfo.nick}【{e.RobotInfo.name}】){ex.Message.Replace("@", "")}");
else
plugin.OnLog($"W({e.RobotInfo.nick}【{e.RobotInfo.name}】){ex.Message} - {ex.StackTrace}");
plugin.OnLog(ApiClient.Setting.SystemConfig.msg_error);
this.plugin.OnLog("达人判断" + ex.Message);
}
return null;
}
public bool AnalyseFanLi()
{
var cpsInfo = DouKe();
if (cpsInfo != null)
{
var douke = new DouKeHandle(sender, e, this.plugin);
var flag = douke.Invok(cpsInfo);
return flag;
}
cpsInfo = DaRen();
if (cpsInfo != null)
{
var douke = new DaRenHandle(sender, e, this.plugin);
var flag = douke.Invok(cpsInfo);
return flag;
}
return false;
}
}
public class CpsInfo
{
public BaseCpsApi api { get; set; }
public fl_cps_member DyCps { get; set; }
public string Pid { get; set; }
}
}

View File

@ -96,6 +96,15 @@ namespace DYRebate.Properties {
}
}
/// <summary>
/// 查找类似 抖客返利 的本地化字符串。
/// </summary>
internal static string SoftwareTypeDouKe {
get {
return ResourceManager.GetString("SoftwareTypeDouKe", resourceCulture);
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>

View File

@ -129,6 +129,9 @@
<data name="SoftwareType" xml:space="preserve">
<value>抖音返利</value>
</data>
<data name="SoftwareTypeDouKe" xml:space="preserve">
<value>抖客返利</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="抖音" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\抖音.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>

View File

@ -16,6 +16,7 @@ namespace DYRebate
public static class SessionExt
{
const string dyinfo_temp_list_dyrebate = "dyinfo_temp_list_dyrebate";
const string dyinfo_temp_list_dkrebate = "dyinfo_temp_list_dkrebate";
/// <summary>
/// 获取fl_adzone_info表的数据集合缓存
@ -35,6 +36,23 @@ namespace DYRebate
return dyinfo_temp_groups;
}
/// <summary>
/// 获取fl_adzone_info表的数据集合缓存
/// </summary>
/// <param name="session"></param>
/// <param name="refresh">刷新</param>
/// <returns></returns>
public static List<dyinfo_temp> FindDkInfoTempGroups(this SqlSugarClient session, bool refresh = false)
{
var dyinfo_temp_groups = ApiClient.Cache.Get<List<dyinfo_temp>>(dyinfo_temp_list_dkrebate);//根据KEY、获得缓存
if (refresh || dyinfo_temp_groups == null)
{
dyinfo_temp_groups = session.Find<dyinfo_temp>($"select ri.id as ID,ri.type as chattype,ri.name as name,ri.nick as nick,flag.* from fl_robot_info ri left join (select ai1_temp.robot_id as id,ai1_temp.onoff as onoff,ai1_temp.adzone_pid_cps_name as pid_chief_cps_name,ai1_temp.adzone_pid as pid_chief,ai1_temp.adzone_name as pid_chief_name,ai2_temp.adzone_pid_cps_name as pid_deputy_cps_name,ai2_temp.adzone_pid as pid_deputy,ai2_temp.adzone_name as pid_deputy_name from (select * from fl_adzone_info ai1 where ai1.alliance_id = '{(int)CpsType.抖客联盟}' and ai1.custom_type = '{Resources.SoftwareTypeDouKe}' and ai1.extend = 'chief') ai1_temp INNER JOIN (select * from fl_adzone_info ai2 where ai2.alliance_id = '{(int)CpsType.抖客联盟}' and ai2.custom_type = '{Resources.SoftwareTypeDouKe}' and ai2.extend='deputy') ai2_temp on ai1_temp.robot_id = ai2_temp.robot_id) flag on ri.id = flag.id");
ApiClient.Cache.Set(dyinfo_temp_list_dkrebate, dyinfo_temp_groups, 60);
}
return dyinfo_temp_groups;
}
public static fl_member_info FindMemberinfo(this SqlSugarClient session, long userid)
{
return session.Find<fl_member_info>("select * from fl_member_info where id = @id", new { id = userid }).FirstOrDefault();

View File

@ -18,6 +18,7 @@ using Newtonsoft.Json.Linq;
using ProductClient.Entitys;
using Chat.Framework.WXSdk.Implement;
using Api.Framework.Tools;
using UtilHelper;
namespace ProductClient
{
@ -121,7 +122,10 @@ namespace ProductClient
//var json = "{\"TaskId\":\"142515582485397504\",\"CollectionSourceId\":\"129505086429724672\",\"IsGoods\":true}";
//{"Code":0,"Result":{"TaskId":"161068119245193216","CollectionSourceId":"129505086429724672","IsGoods":true}}
var jObj = JObject.Parse(json);
var taskId = jObj["TaskId"]?.Value<string>();
if (string.IsNullOrWhiteSpace(taskId))
{
@ -147,12 +151,25 @@ namespace ProductClient
}
CacheDic[taskId] = collectionSourceId;
//var appId = "86574351";
//var appSecret = "403dbc1a571bb3ba65edb799cce12080";
//var t = ZySignHelper.GetTimeStamp();
//var ver = "1.1";
//var uri = new Uri(
// $"http://goods.api.52cmg.cn/api/WechatMomentsGoods-WechatMoments/GetTaskData?taskId={taskId}");
//HttpHelper http = new HttpHelper();
//var item = http.GetItem(uri.ToString());
//item.Header["appid"] = appId;
//item.Header["t"] = t;
//item.Header["ver"] = ver;
//item.Header["sign"] = ZySignHelper.CreateSign(uri, "", appId, appSecret, t, ver);
//var html = http
// .GetHtml(item)
// .Html;
var html = CircleTaskHelper.GetSend($"http://goods.api.52cmg.cn/api/WechatMomentsGoods-WechatMoments/GetTaskData?taskId={taskId}");
HttpHelper http = new HttpHelper();
var html = http
.GetHtml(
$"http://goods.api.52cmg.cn/api/WechatMomentsGoods-WechatMoments/GetTaskData?taskId={taskId}")
.Html;
var result = JsonConvert.DeserializeObject<DaiYunYingCircleTaskData>(html);
if (result == null)
{

View File

@ -101,8 +101,12 @@ namespace ProductClient
//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 html = new HttpHelper().GetHtml(
//"http://goods.api.52cmg.cn/api/WechatMomentsGoods-WechatMoments/GetCollectionSourceAll").Html;
var html = CircleTaskHelper.GetSend("http://goods.api.52cmg.cn/api/WechatMomentsGoods-WechatMoments/GetCollectionSourceAll");
var jObj = JObject.Parse(html);
if (jObj["Code"]?.Value<long>() != 0)

View File

@ -255,9 +255,11 @@ namespace ProductClient
}
// $"{taskId}[分段]{collectionSourceId}"
HttpHelper http = new HttpHelper();
var html = http.GetHtml($"http://goods.api.52cmg.cn/api/WechatMomentsGoods-WechatMoments/GetLastTaskV2", postData: $"SourceId={sourceId}&LastTaskId={taskId}").Html;
//var html = http.GetHtml($"http://goods.api.52cmg.cn/api/WechatMomentsGoods-WechatMoments/GetLastTaskV2", postData: $"SourceId={sourceId}&LastTaskId={taskId}").Html;
var html = CircleTaskHelper.GetSend($"http://goods.api.52cmg.cn/api/WechatMomentsGoods-WechatMoments/GetLastTaskV2", $"SourceId={sourceId}&LastTaskId={taskId}");
//"{\"TaskId\":\"130145086167056384\",\"CollectionSourceId\":\"129505086429724672\",\"IsGoods\":true}"
if (string.IsNullOrWhiteSpace(html))
{
@ -270,7 +272,7 @@ namespace ProductClient
return;
}
var r = JsonConvert.SerializeObject(jObj.Value<Object>());
var r = JsonConvert.SerializeObject(jObj["Result"]);
if (string.IsNullOrWhiteSpace(r))
{
return;

View File

@ -82,6 +82,7 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="CircleTaskHelper.cs" />
<Compile Include="Class1.cs" />
<Compile Include="Config.cs" />
<Compile Include="Entitys\DaiYunYingCircleTaskData.cs" />

View File

@ -1401,4 +1401,7 @@
AEv/2Q==
</value>
</data>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>49</value>
</metadata>
</root>

View File

@ -303,7 +303,20 @@
<Compile Include="Config\OtherConfig.cs" />
<Compile Include="Config\ServerConfig.cs" />
<Compile Include="Config\SystemConfig.cs" />
<Compile Include="Cps\douke_form_login.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Cps\douke_form_login.Designer.cs">
<DependentUpon>douke_form_login.cs</DependentUpon>
</Compile>
<Compile Include="Cps\douke_form_select_tgw.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Cps\douke_form_select_tgw.Designer.cs">
<DependentUpon>douke_form_select_tgw.cs</DependentUpon>
</Compile>
<Compile Include="Cps\DouyinApi.cs" />
<Compile Include="Cps\DouyinApiV3.cs" />
<Compile Include="Cps\DouyinApiV2.cs" />
<Compile Include="Cps\douyin_form_login.cs">
<SubType>Form</SubType>
@ -400,7 +413,9 @@
<Compile Include="Data\TB\TBGoodParsingData.cs" />
<Compile Include="Data\TB\TBItemInfoData.cs" />
<Compile Include="Data\TB\TBPassInfoData.cs" />
<Compile Include="EntityTmp\Douyin\CommonShareParse.cs" />
<Compile Include="EntityTmp\Douyin\DyItemInfo.cs" />
<Compile Include="EntityTmp\Douyin\DyItemInfoV2.cs" />
<Compile Include="EntityTmp\Douyin\DyOrderInfo.cs" />
<Compile Include="EntityTmp\Douyin\KolPidList.cs" />
<Compile Include="EntityTmp\Douyin\ShareInfo.cs" />
@ -558,6 +573,7 @@
<Compile Include="Tools\DouyinGoodsInfo.cs" />
<Compile Include="Tools\DYHelper.cs" />
<Compile Include="Tools\DYHelperV2.cs" />
<Compile Include="Tools\DyRegimentHelper.cs" />
<Compile Include="Tools\KSHelper.cs" />
<Compile Include="Tools\PointManageConfig.cs" />
<Compile Include="Tools\SNHelper.cs" />
@ -593,6 +609,7 @@
<Compile Include="Tools\WPHHelper.cs" />
<Compile Include="Tools\Zip.cs" />
<Compile Include="Tools\ZipHelper.cs" />
<Compile Include="Tools\ZYSignHelper.cs" />
<Compile Include="UIForm\AliQrCordControl.cs">
<SubType>UserControl</SubType>
</Compile>
@ -619,6 +636,12 @@
<DependentUpon>alimama_form_select_tgw.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Cps\douke_form_login.resx">
<DependentUpon>douke_form_login.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Cps\douke_form_select_tgw.resx">
<DependentUpon>douke_form_select_tgw.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Cps\douyin_form_login.resx">
<DependentUpon>douyin_form_login.cs</DependentUpon>
</EmbeddedResource>

View File

@ -1066,7 +1066,30 @@ namespace Api.Framework.Cps
private void GetCouponInfo(JToken data, TBItemInfoData infoData)
{
//优惠券地址
var couponUrl = data["item_url"]?.ToString();
//var couponUrl = data["item_url"]?.ToString();
var couponUrl = data["coupon_click_url"]?.Value<string>() ?? data["item_url"]?.ToString();
if (!string.IsNullOrWhiteSpace(infoData.ActivityId))
{
if (!string.IsNullOrWhiteSpace(couponUrl))
{
couponUrl = Regex.Replace(couponUrl, @"&?activityId=(?<活动ID>[A-Za-z0-9]+)", "");
}
infoData.CouponUrl = couponUrl = $"{couponUrl}&activityId={infoData.ActivityId}";
var activityData = GetActivityInfo(infoData.ItemId, infoData.ActivityId);
if (activityData != null)
{
if (activityData.ConditionPrice <= infoData.Price)
{
infoData.CouponPrice = activityData.CouponPrice;
infoData.UseCouponPrice = infoData.Price - infoData.CouponPrice;
}
infoData.BuyUrl = couponUrl;
}
return;
}
//妈妈券
var mmCouponInfo = data["mm_coupon_info"];
@ -1132,8 +1155,14 @@ namespace Api.Framework.Cps
}
else//没有优惠券
{
if (!string.IsNullOrWhiteSpace(infoData.ActivityId))
{
couponUrl = $"{couponUrl}&activityId={infoData.ActivityId}";
}
infoData.CouponPrice = 0m;
infoData.UseCouponPrice = infoData.Price;
infoData.BuyUrl = couponUrl;
}
infoData.CouponUrl = couponUrl;
@ -1945,10 +1974,11 @@ t = {target}");
}
repeatList.Add(e.Id);
var commonId = e.CommonId.ToLower();
try
{
LogHelper.GetSingleObj().Info("", "域名相关通知 => " + e.Body);
if (e.CommonId == "change_tkurl")
if (commonId == "change_tkurl")
{
var data = JObject.Parse(e.Body);
var newUrl = (data["new"] ?? string.Empty).Value<string>();
@ -1982,11 +2012,11 @@ t = {target}");
TkUrl.UrlCircle[i] = TkUrl.UrlCircle[i].Replace(oldUrl, newUrl);
}
}
else if (e.CommonId == "refreshTkurl")
else if (commonId == "refreshTkurl".ToLower())
{
RefreshTkUrl();
}
else if (e.CommonId == "send" && e.Channel == "circle_goods_task")
else if (commonId == "send" && e.Channel == "circle_goods_task")
{
//{"Id":"122522636742819840","TaskId":"122522636742819840","IsGoods":true}
EventClient.OnDyyNoticeEvent(null, new DyyNoticeEvent() { Data = e.Body });

View File

@ -199,6 +199,7 @@ namespace Api.Framework.Cps
else if (type == typeof(JingdongApi)) target = "jingdong.asmx";
else if (type == typeof(WeipinhuiApi)) target = "weipinhui.asmx";
else if (type == typeof(DouyinApiV2)) target = "douyin.asmx";
else if (type == typeof(DouyinApiV3)) target = "douyin.asmx";
else if (type == typeof(KuaiShouApi)) target = "kuaishou.asmx";
else throw new Exception("暂时不支持类型:" + target);
}
@ -237,7 +238,7 @@ namespace Api.Framework.Cps
}
finally
{
//LogHelper.GetSingleObj().Error("cps请求异常..", $"{result?.message} => {JsonConvert.SerializeObject(end)}");
//LogHelper.GetSingleObj().Error("cps请求异常..", $"{target},{result?.message} => {JsonConvert.SerializeObject(end)}");
}
}

View File

@ -825,7 +825,7 @@ html = {html}");
/// </summary>
/// <param name="goodsid">商品id</param>
/// <returns></returns>
public string GetShopWindow_PromotionUrlToGoodsId(string goodsid)
public string GetShopWindow_PromotionUrlToGoodsId(string goodsid, string promotion_id)
{
var html = string.Empty;
try
@ -894,9 +894,17 @@ html = {html}");
if (jArr.Count != 0)
{
var jTok = jArr[0];
return jTok["detail_url"].ToString();
}
//var shopUrl = jTok["detail_url"].ToString();
//if (!shopUrl.Contains("sec_author_id"))
//{
// var buyin_track = GetBuyinTrack(promotion_id, goodsid);
// shopUrl = $"{shopUrl}&sec_author_id={GetSecAuthorId()}&origin_id={goodsid}_{promotion_id}&buyin_track={buyin_track}";
//}
var shopUrl = GetDetailUrl(promotion_id, goodsid);
return shopUrl;
}
}
else if (code == 9001)
{
@ -945,7 +953,6 @@ html = {html}");
return ck;
}
public static string GetLoginUserInfo(string cookies, string UserAgent)
{
var param = $"PIGEON_BIZ_TYPE=5";
@ -957,7 +964,6 @@ html = {html}");
var xb = GetXbogus(param, UserAgent);
HttpHelper http = new HttpHelper();
HttpItem item = new HttpItem()
{
@ -985,6 +991,95 @@ html = {html}");
return html;
}
/// <summary>
/// 获取抖客账号信息
/// </summary>
/// <param name="cookies"></param>
/// <param name="UserAgent"></param>
/// <returns></returns>
public static string GetDoukeAccessInfo(string cookies, string UserAgent)
{
var param = $"";
var sign = GetSign(param, UserAgent);
if (!string.IsNullOrWhiteSpace(sign))
param = $"_signature={sign}";
var xb = GetXbogus(param, UserAgent);
HttpHelper http = new HttpHelper();
HttpItem item = new HttpItem()
{
URL = $"https://buyin.jinritemai.com/api/hybrid/account/info?{param}&X-Bogus={xb}",
Method = "GET",
Timeout = 5000,
ReadWriteTimeout = 5000 * 2,
IsToLower = false,
Cookie = cookies,
UserAgent = UserAgent,
Accept = "text/html, application/xhtml+xml, */*",
ContentType = "text/html",
Referer = "https://buyin.jinritemai.com/dashboard?new_enter_from=",
Allowautoredirect = false,
AutoRedirectCookie = false,
ResultType = ResultType.String
};
item.Header.Add("Accept-Language", "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2");
item.Header.Add("Accept-Encoding", "deflate");
HttpResult result = http.GetHtml(item);
string html = result.Html;
return html;
}
/// <summary>
/// 获取抖客账号信息
/// </summary>
/// <param name="cookies"></param>
/// <param name="UserAgent"></param>
/// <returns></returns>
public static string GetDoukeUserInfo(string cookies, string UserAgent)
{
var param = $"";
var sign = GetSign(param, UserAgent);
if (!string.IsNullOrWhiteSpace(sign))
param = $"_signature={sign}";
var xb = GetXbogus(param, UserAgent);
HttpHelper http = new HttpHelper();
HttpItem item = new HttpItem()
{
URL = $"https://buyin.jinritemai.com/index/getUser?{param}&X-Bogus={xb}",
Method = "GET",
Timeout = 5000,
ReadWriteTimeout = 5000 * 2,
IsToLower = false,
Cookie = cookies,
UserAgent = UserAgent,
Accept = "application/json, text/plain, */*",
ContentType = "text/html",
Referer = "https://buyin.jinritemai.com/dashboard/douke/merch-picking-hall",
Allowautoredirect = false,
AutoRedirectCookie = false,
ResultType = ResultType.String
};
item.Header.Add("Accept-Language", "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2");
item.Header.Add("Accept-Encoding", "deflate");
HttpResult result = http.GetHtml(item);
string html = result.Html;
return html;
}
/// <summary>
/// 检查抖音App授权时间
/// </summary>
@ -992,18 +1087,18 @@ html = {html}");
/// <returns></returns>
/// <exception cref="BusinessException"></exception>
/// <exception cref="Exception"></exception>
public static bool CheckAppAuthTime(string cookies,string userAgent)
public static bool CheckAppAuthTime(string cookies, string userAgent)
{
var param = $"page=1&page_size=21&auth_status=0";
var sign = GetSign(param,userAgent);
var sign = GetSign(param, userAgent);
if (!string.IsNullOrWhiteSpace(sign))
{
param = $"{param}&_signature={sign}";
}
var xb = GetXbogus(param,userAgent);
var xb = GetXbogus(param, userAgent);
HttpHelper http = new HttpHelper();
HttpItem item = new HttpItem()
@ -1311,6 +1406,120 @@ html = {html}");
private static Dictionary<string, DateTime> SlidingBlockCache = new Dictionary<string, DateTime>();
/// <summary>
/// 用户账号ID缓存
/// </summary>
private static Dictionary<string, string> SecAuthorIdDic = new Dictionary<string, string>();
/// <summary>
/// 获取用户id
/// </summary>
/// <returns></returns>
public string GetSecAuthorId()
{
if (SecAuthorIdDic.ContainsKey(Member.username))
{
return SecAuthorIdDic[Member.username];
}
var id = RequestSecAuthorId();
if (string.IsNullOrWhiteSpace(id))
{
return string.Empty;
}
SecAuthorIdDic[Member.username] = id;
return id;
}
public string RequestSecAuthorId()
{
try
{
var param = "uid=&works_type=1&special_price_id=";
var xb = GetXbogus(param, Member.other);
var url = "https://buyin.jinritemai.com/api/authorStatData/authorProfile?uid=&works_type=1&special_price_id=&X-Bogus=";
HttpHelper http = new HttpHelper();
HttpItem item = new HttpItem()
{
URL = $"{url}{xb}",
Method = "GET",
Cookie = Member.cookies,
UserAgent = Member.other,
Referer = "https://buyin.jinritemai.com/dashboard/merch-picking-hall",
Accept = "application/json, text/plain, */*",
ContentType = "application/json",
Postdata = "",
ResultType = ResultType.String,
Host = "buyin.jinritemai.com"
};
item.Header.Add("Accept-Language", "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2");
item.Header.Add("Accept-Encoding", "deflate");
HttpResult result = http.GetHtml(item);
string html = result.Html;
var jObj = JObject.Parse(html);
var web_homepage_url = jObj["data"]?["web_homepage_url"]?.Value<string>();
var id = web_homepage_url.Replace("https://www.douyin.com/user/", "");
return id;
}
catch (Exception e)
{
LogHelper.GetSingleObj().Debug("抖音返利调试", $@"获取用户账户值异常");
}
return string.Empty;
}
/// <summary>
/// 获取推广链接
/// </summary>
/// <param name="promotion_id"></param>
/// <param name="product_id"></param>
/// <returns></returns>
public string GetDetailUrl(string promotion_id, string product_id)
{
try
{
var param = $"promotion_id={promotion_id}&product_id={product_id}";
var xb = GetXbogus(param, Member.other);
var url = $"https://buyin.jinritemai.com/api/shop/detail?{param}&X-Bogus=";
HttpHelper http = new HttpHelper();
HttpItem item = new HttpItem()
{
URL = $"{url}{xb}",
Method = "GET",
Cookie = Member.cookies,
UserAgent = Member.other,
Referer = "https://buyin.jinritemai.com/dashboard/merch-picking-hall",
Accept = "application/json, text/plain, */*",
ContentType = "application/json",
Postdata = "",
ResultType = ResultType.String,
Host = "buyin.jinritemai.com"
};
item.Header.Add("Accept-Language", "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2");
item.Header.Add("Accept-Encoding", "deflate");
HttpResult result = http.GetHtml(item);
string html = result.Html;
var jObj = JObject.Parse(html);
var detailUrl = jObj["data"]?["detail_url"]?.Value<string>() ?? string.Empty;
//var id = web_homepage_url.Replace("https://www.douyin.com/user/", "");
return detailUrl;
}
catch (Exception e)
{
LogHelper.GetSingleObj().Debug("抖音返利调试", $@"获取用户账户值异常");
}
return string.Empty;
}
#region
private static string SlidingBlock(string ck, string verify_conf)
{
@ -2204,6 +2413,8 @@ html = {html}");
return V8Method(Js_Sign, $"'{Param}','{PostData}','{UserAgent}'", "get_sign_url");
}
private static string GetXbogus(string Param, string UserAgent, string PostData = "")
{
return V8Method(Js_Xbcode, $"'{Param}','{PostData}','{UserAgent}'", "get_x_bogus");
@ -2319,7 +2530,16 @@ html = {html}");
DyOrderInfo order = null;
do
{
var jToken = SendData("buyin.kolOrderAds", new { start_time = start_time.ToString("yyyy-MM-dd HH:mm:ss"), end_time = end_time.ToString("yyyy-MM-dd HH:mm:ss"), pid = pid, size = 20, cursor = cursor, distribution_type = "ProductDetail" });
JToken jToken = null;
if (!string.IsNullOrWhiteSpace(pid))
{
jToken = SendData("buyin.kolOrderAds", new { start_time = start_time.ToString("yyyy-MM-dd HH:mm:ss"), end_time = end_time.ToString("yyyy-MM-dd HH:mm:ss"), pid = pid, size = 20, cursor = cursor, distribution_type = "ProductDetail" });
}
else
{
jToken = SendData("buyin.kolOrderAds", new { start_time = start_time.ToString("yyyy-MM-dd HH:mm:ss"), end_time = end_time.ToString("yyyy-MM-dd HH:mm:ss"), size = 20, cursor = cursor, distribution_type = "ProductDetail" });
}
if (jToken == null) return list;
var data = jToken["data"];
@ -2413,7 +2633,9 @@ html = {html}");
{
try
{
var jToken = SendData("buyin.kolProductShare", new { product_url = product_url, pid = pid, external_info = external_info });
var productUrl = DyRegimentHelper.GetRegimentUrl(product_url);
var jToken = SendData("buyin.kolProductShare", new { product_url = productUrl, pid = pid, external_info = external_info });
if (jToken == null) return null;

View File

@ -76,7 +76,7 @@
this.xtraTabPage1.Controls.Add(this.button1);
this.xtraTabPage1.Controls.Add(this.webControl1);
this.xtraTabPage1.Name = "xtraTabPage1";
this.xtraTabPage1.Size = new System.Drawing.Size(909, 466);
this.xtraTabPage1.Size = new System.Drawing.Size(909, 468);
this.xtraTabPage1.Text = " 扫 码 登 录 ";
//
// button1
@ -96,7 +96,7 @@
this.webControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.webControl1.Location = new System.Drawing.Point(0, 0);
this.webControl1.Name = "webControl1";
this.webControl1.Size = new System.Drawing.Size(909, 466);
this.webControl1.Size = new System.Drawing.Size(909, 468);
this.webControl1.TabIndex = 0;
this.webControl1.Text = "webControl1";
this.webControl1.WebView = this.webView1;
@ -112,7 +112,7 @@
this.xtraTabPage3.Controls.Add(this.groupBox2);
this.xtraTabPage3.Controls.Add(this.groupBox1);
this.xtraTabPage3.Name = "xtraTabPage3";
this.xtraTabPage3.Size = new System.Drawing.Size(909, 466);
this.xtraTabPage3.Size = new System.Drawing.Size(909, 468);
this.xtraTabPage3.Text = " Cookie登录 ";
//
// groupBox2
@ -130,7 +130,6 @@
this.groupBox2.TabIndex = 2;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "第二步 填写授权结果";
this.groupBox2.Visible = false;
//
// simpleButton3
//
@ -224,7 +223,7 @@
this.xtraTabPage2.Controls.Add(this.simpleButton1);
this.xtraTabPage2.Controls.Add(this.memoEdit1);
this.xtraTabPage2.Name = "xtraTabPage2";
this.xtraTabPage2.Size = new System.Drawing.Size(909, 466);
this.xtraTabPage2.Size = new System.Drawing.Size(909, 468);
this.xtraTabPage2.Text = " 同软件登录码 ";
//
// label1
@ -261,7 +260,7 @@
this.ClientSize = new System.Drawing.Size(911, 492);
this.Controls.Add(this.xtraTabControl1);
this.Name = "douyin_form_login";
this.Text = "抖音登录 - (请勿手动关闭窗口,授权成功会自动关闭)";
this.Text = "达人登录 - (请勿手动关闭窗口,授权成功会自动关闭)";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.douyin_form_login_FormClosing);
this.Load += new System.EventHandler(this.douyin_form_login_Load);
((System.ComponentModel.ISupportInitialize)(this.xtraTabControl1)).EndInit();

View File

@ -21,6 +21,7 @@ using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using Api.Framework.SDK;
using UI.Framework.Forms;
namespace Api.Framework.Cps
@ -380,12 +381,12 @@ namespace Api.Framework.Cps
LogHelper.GetSingleObj().Info("抖音登录获取到用户数据", json);
if (CheckLoginCk(json, this.textBox1.Text, UserAgent))
{
IsAuthorization = true;
EventClient.OnEvent("抖音登录", "抖音授权登录成功!");
//IsAuthorization = true;
//EventClient.OnEvent("抖音登录", "抖音授权登录成功!");
this.DialogResult = DialogResult.OK;
//this.DialogResult = DialogResult.OK;
return;
//return;
this.groupBox2.Enabled = true;
BaseForm.ShowSuccessAutoClose("验证成功,您可以继续授权Api");
}

View File

@ -29,11 +29,12 @@ namespace Api.Framework
GuideMembers = new List<fl_cps_member>();
GuideMembers.Add(new fl_cps_member() { abnormal_tip = SwitchType., cpstype = CpsType., is_download = SwitchType., is_valid = true, logintime = DateTime.Now, online = true, username = "1929015", usernick = "w", cookies = "1929015_24223399" });//吴嘉华
GuideMembers.Add(new fl_cps_member() { abnormal_tip = SwitchType., cpstype = CpsType., is_download = SwitchType., is_valid = true, logintime = DateTime.Now, online = true, username = "8701005", usernick = "zyy", cookies = "8701005_194371009" });//张谊玉
GuideMembers.Add(new fl_cps_member() { abnormal_tip = SwitchType., cpstype = CpsType., is_download = SwitchType., is_valid = true, logintime = DateTime.Now, online = true, username = "15528847", usernick = "zl", cookies = "15528847_194372142" });//周雷
//GuideMembers.Add(new fl_cps_member() { abnormal_tip = SwitchType.关闭, cpstype = CpsType.多多进宝, is_download = SwitchType.关闭, is_valid = true, logintime = DateTime.Now, online = true, username = "15528847", usernick = "zl", cookies = "15528847_194372142" });//周雷
GuideMembers.Add(new fl_cps_member() { abnormal_tip = SwitchType., cpstype = CpsType., is_download = SwitchType., is_valid = true, logintime = DateTime.Now, online = true, username = "8364424", usernick = "zcg", cookies = "8364424_194372426" });//钟成刚
GuideMembers.Add(new fl_cps_member() { abnormal_tip = SwitchType., cpstype = CpsType., is_download = SwitchType., is_valid = true, logintime = DateTime.Now, online = true, username = "15529092", usernick = "lcr", cookies = "15529092_194372782" });//廖春容
GuideMembers.Add(new fl_cps_member() { abnormal_tip = SwitchType., cpstype = CpsType., is_download = SwitchType., is_valid = true, logintime = DateTime.Now, online = true, username = "15529109", usernick = "yc", cookies = "15529109_194373136" });//杨灿
//GuideMembers.Add(new fl_cps_member() { abnormal_tip = SwitchType.关闭, cpstype = CpsType.多多进宝, is_download = SwitchType.关闭, is_valid = true, logintime = DateTime.Now, online = true, username = "15529109", usernick = "yc", cookies = "15529109_194373136" });//杨灿
GuideMembers.Add(new fl_cps_member() { abnormal_tip = SwitchType., cpstype = CpsType., is_download = SwitchType., is_valid = true, logintime = DateTime.Now, online = true, username = "15531182", usernick = "lxy", cookies = "15531182_194378363" });//李馨雨
GuideMembers.Add(new fl_cps_member() { abnormal_tip = SwitchType., cpstype = CpsType., is_download = SwitchType., is_valid = true, logintime = DateTime.Now, online = true, username = "32388767", usernick = "yc", cookies = "32388767_194373136" });//李洁
}
catch (Exception ex)
{
@ -123,9 +124,22 @@ namespace Api.Framework
public static DouyinApiV2 CreateDouyinRequest(fl_cps_member member)
{
if (member != null && member.cpstype != CpsType.) throw new Exception("CreateDouyinRequest 失败,您当前账号类型为:" + member.cpstype);
//return new DouyinApiV2(member);
return new DouyinApiV2(member);
}
/// <summary>
/// 创建一个抖音联盟API请求
/// </summary>
/// <param name="member">cps对象</param>
/// <returns></returns>
public static DouyinApiV3 CreateDouyinRequestV3(fl_cps_member member)
{
if (member != null && member.cpstype != CpsType.) throw new Exception("CreateDouyinRequest 失败,您当前账号类型为:" + member.cpstype);
//return new DouyinApiV2(member);
return new DouyinApiV3(member);
}
public static KuaiShouApi CreateKuaiShouRequest(fl_cps_member member)
{
if (member.cpstype != CpsType.) throw new Exception("CreateDouyinRequest 失败,您当前账号类型为:" + member.cpstype);
@ -192,6 +206,13 @@ namespace Api.Framework
member = form.Member;
break;
}
case CpsType.:
{
var form = new douke_form_login();
form.ShowDialog();
member = form.Member;
break;
}
case CpsType.:
{
var form = new suning_form_login1();
@ -288,6 +309,12 @@ namespace Api.Framework
f.ShowDialog();
return f.Tuiguangwei;
}
case CpsType.:
{
var f = new douke_form_select_tgw();
f.ShowDialog();
return f.Tuiguangwei;
}
case CpsType.:
{
var f = new suning_form_select_tgw();

View File

@ -54,5 +54,7 @@ namespace Api.Framework.EntityTmp.Douyin
/// </summary>
public long update_time { get; set; }
}
}

View File

@ -21,6 +21,10 @@ namespace Api.Framework.EntityTmp.Douyin
/// </summary>
public string dy_deeplink { get; set; }
public string dy_zlink { get; set; }
public string share_link { get; set; }
/// <summary>
/// 二维码信息
/// </summary>
@ -44,4 +48,36 @@ namespace Api.Framework.EntityTmp.Douyin
public int height { get; set; }
}
/// <summary>
/// 优惠价推广链接
/// </summary>
public class CouponLink
{
/// <summary>
/// 是否有优惠价&优惠券 0有优惠券 1没有优惠券
/// </summary>
public long coupon_status { get; set; }
/// <summary>
/// 优惠券口令
/// </summary>
public string share_command { get; set; }
/// <summary>
/// deeplink
/// </summary>
public string deeplink { get; set; }
/// <summary>
/// 站外H5领券链接
/// </summary>
public string share_link { get; set; }
/// <summary>
/// 二维码信息
/// </summary>
public DyQrCode qr_code { get; set; }
}
}

View File

@ -18,7 +18,8 @@ namespace Api.Framework.Enums
= 5,
= 6,
= 7,
//考拉联盟 = 8
//考拉联盟 = 8,
= 9
}
/// <summary>

View File

@ -347,7 +347,25 @@ namespace Api.Framework.Model
var list = ApiClient.Cache.Get<List<String>>(key);
if (refresh || list == null)
{
list = session.FindAdzoneInfos().Where(f => f.alliance_id == (int)CpsType. && f.custom_type == Resources.PddSoftwareType).Select(f => f.adzone_pid).ToList();
list = session.FindAdzoneInfos().Where(f => f.alliance_id == (int)CpsType. && f.custom_type == Resources.DySoftwareType).Select(f => f.adzone_pid).ToList();
ApiClient.Cache.Set(key, list, 60);
}
return list;
}
/// <summary>
/// 抖音推广位自动绑定推广位
/// </summary>
/// <param name="session"></param>
/// <param name="refresh">刷新</param>
/// <returns></returns>
public static List<string> FindDoukeAutoBindPid(this SqlSugarClient session, bool refresh = false)
{
string key = "fl_douke_auto_bind_adzone_info";
var list = ApiClient.Cache.Get<List<String>>(key);
if (refresh || list == null)
{
list = session.FindAdzoneInfos().Where(f => f.alliance_id == (int)CpsType. && f.custom_type == Resources.DkSoftwareType).Select(f => f.adzone_pid).ToList();
ApiClient.Cache.Set(key, list, 60);
}
return list;

View File

@ -60,6 +60,24 @@ namespace Api.Framework.Properties {
}
}
/// <summary>
/// 查找类似 抖客返利 的本地化字符串。
/// </summary>
internal static string DkSoftwareType {
get {
return ResourceManager.GetString("DkSoftwareType", resourceCulture);
}
}
/// <summary>
/// 查找类似 抖音返利 的本地化字符串。
/// </summary>
internal static string DySoftwareType {
get {
return ResourceManager.GetString("DySoftwareType", resourceCulture);
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>

View File

@ -155,4 +155,10 @@
<value>快手返利</value>
<comment>fl_adzone_info自定义类型(custom_type)快手返利</comment>
</data>
<data name="DkSoftwareType" xml:space="preserve">
<value>抖客返利</value>
</data>
<data name="DySoftwareType" xml:space="preserve">
<value>抖音返利</value>
</data>
</root>

View File

@ -30,23 +30,12 @@ namespace Api.Framework.Timers
private static object rights = null;
private static readonly object objLock = new object();
//public DownDouyinTimer()
//{
// if (rights == null)
// {
// lock (objLock)
// {
// }
// }
//}
public override void Run(object state, bool timedOut)
{
//TODO 这里的时间还没有用,因为抖音巨量那边还搞不定(通过时间查询)
var update_time = DateTime.Now.AddDays(-1);
var end_time = DateTime.Now;
UpdateOrder(CpsClient.Members.Where(f => f.cpstype == CpsType. && f.is_download == SwitchType.).ToArray(), update_time, end_time);
UpdateOrder(CpsClient.Members.Where(f => (f.cpstype == CpsType. || f.cpstype == CpsType.) && f.is_download == SwitchType.).ToArray(), update_time, end_time);
#region
@ -123,62 +112,409 @@ namespace Api.Framework.Timers
foreach (var item in memberList)
{
var _item = item;
var api = CpsClient.CreateDouyinRequest(_item);
task.AddTask(delegate
if (_item.cpstype == CpsType.)
{
DaRenSync(_item, start_time, end_time, task, timespan, notices);
}
//抖客联盟
else
{
DouKeSync(_item, start_time, end_time, task, timespan, notices);
}
}
task.Start(1, null);
var db = ApiClient.GetSession();
var end_orders = db.Find<fl_order_douyin>("select * from fl_order_douyin where db_status=@db_status and db_endtime<@db_endtime", new { db_status = (int)SystemOrderStatus., db_endtime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }).ToList();
foreach (var db_order in end_orders)
{
UpdateOrder(db_order, notices, db);
}
if (notices.Count != 0)
{
var tasks = TimerTask.GetTimer<Update_NoticeQueue>() as Update_NoticeQueue;
foreach (var item in notices)
{
if (item.Member == null) continue;
var order = item.Order as fl_order_weipinhui;
tasks.Add(item);
}
}
}
#region
public void DouKeSync(fl_cps_member _item, DateTime start_time, DateTime end_time, TaskTool task, TimeSpan timespan, List<OrderNoticeEvent> notices)
{
var api = CpsClient.CreateDouyinRequestV3(_item);
task.AddTask(delegate
{
try
{
var _star = timespan.TotalHours > 12 ? end_time : start_time;//倒叙12小时一个间断
var _end = end_time;
do
{
try
{
if (timespan.TotalHours > 12)
{
_end = _star;
_star = _star.AddHours(-11.99);
}
var session = ApiClient.GetSession();
List<DyOrderInfo> orderList = new List<DyOrderInfo>();
//官方接口已经同步了订单,防止非官方接口再次同步
List<string> orderidCache = new List<string>();
//if (1 != 2)
{
//var pids = session.Find<fl_adzone_info>("select * from fl_adzone_info").Where(f => f.adzone_pid_cps_name == _item.username).Where(f => !string.IsNullOrWhiteSpace(f.adzone_pid)).Select(f => f.adzone_pid).Distinct().ToList();
//if (pids != null & pids.Count != 0)
//{ }
//不填或者填0查询分销订单1查询比价订单
for (int i = 0; i < 2; i++)
{
api.DownOrderApi(_star, _end, "", i, data =>
{
DouKeOrderHandle(data, _item, notices);
});
}
}
}
catch (Exception ex)
{
//The underlying frame is no longer valid - please check the IsValid property before calling!
if (ex.Message.Contains("is no longer valid - please check the IsValid"))
{
api.Member.is_valid = false;
}
}
} while (_star > start_time);
}
catch (Exception ex)
{
//throw ex;
}
});
}
private void DouKeOrderHandle(DyOrderInfo data, fl_cps_member _item, List<OrderNoticeEvent> notices)
{
try
{
Exception _exception = null;
var session = ApiClient.GetSession();
for (int i = 0; i < data.orders.Count; i++)
{
var order = data.orders[i];
if (_exception != null)
{
continue;
}
try
{
var _star = timespan.TotalHours > 12 ? end_time : start_time;//倒叙12小时一个间断
var _end = end_time;
do
//if (order.order_id == "4886104544279610848")
//{
//}
OrderHandleSleep();
var status = order.flow_point;
var db_order = session.FindSingle<fl_order_douyin>("order_id=@order_id and product_id=@product_id", new { order_id = order.order_id, product_id = order.product_id });
if (db_order != null) //跳过相同状态
{
try
if (db_order.order_status == DouyinOrderStatus.REFUND.ToString() || db_order.product_detail == "手动处理")
{
if (timespan.TotalHours > 12)
continue;
}
if (status == db_order.order_status || status != DouyinOrderStatus.PAY_SUCC.ToString())
{
if (db_order.IsFinish()) continue;//是否已经完成
if (db_order.db_status == SystemOrderStatus. && db_order.db_endtime > DateTime.Now) continue;//跳过系统冻结
//if (db_order.order_status != WeipinhuiOrderSubStatusName.已签收 && db_order.order_status == status) continue;//跳过相同状态
if (db_order.order_status == status) continue;//跳过相同状态
}
db_order.order_status = status;
}
else
{
var orderTmp = new fl_order_douyin()
{
order_id = order.order_id,
product_id = order.product_id,
product_name = order.product_name,
total_pay_amount = order.pay_goods_amount,
estimated_comission = (int)order.ads_estimated_commission,
order_status = order.flow_point,
pay_time = HttpExtend.GetTimeStamp(DateTime.Parse(order.pay_success_time))
//...
};
db_order = orderTmp;
db_order.db_cpsname = _item.username;
db_order.db_cpsnick = _item.usernick;
}
try
{
LogHelper.GetSingleObj().Debug("抖音订单: ", $@"抖音Api原始{JsonConvert.SerializeObject(order)}
order = {JsonConvert.SerializeObject(db_order)}");
}
catch (Exception)
{ }
UpdateOrder(db_order, notices, session);
try
{
LogHelper.GetSingleObj().Debug("抖音订单: ", $@"处理完成的 ,需要通知的用户 -> {notices.Count}
order = {JsonConvert.SerializeObject(db_order)}");
}
catch (Exception)
{ }
}
catch (Exception ex)
{
throw ex;
}
finally
{
//session.Close();
}
}
}
catch (Exception ex)
{
LogHelper.GetSingleObj().Debug("抖音订单: ", $"");
}
}
private void OrderHandleSleep()
{
if (ApiClient.Setting.DbConfig.DatabaseType == DatabaseType.SQLITE)
{
Thread.Sleep(100);
}
}
#endregion
#region
public void DaRenSync(fl_cps_member _item, DateTime start_time, DateTime end_time, TaskTool task, TimeSpan timespan, List<OrderNoticeEvent> notices)
{
var api = CpsClient.CreateDouyinRequest(_item);
task.AddTask(delegate
{
try
{
var _star = timespan.TotalHours > 12 ? end_time : start_time;//倒叙12小时一个间断
var _end = end_time;
do
{
try
{
if (timespan.TotalHours > 12)
{
_end = _star;
_star = _star.AddHours(-11.99);
}
var session = ApiClient.GetSession();
List<DyOrderInfo> orderList = new List<DyOrderInfo>();
//官方接口已经同步了订单,防止非官方接口再次同步
List<string> orderidCache = new List<string>();
//if (1 != 2)
{
var pids = session.Find<fl_adzone_info>("select * from fl_adzone_info").Where(f => f.adzone_pid_cps_name == _item.username).Where(f => !string.IsNullOrWhiteSpace(f.adzone_pid)).Select(f => f.adzone_pid).Distinct().ToList();
if (pids != null & pids.Count != 0)
{
_end = _star;
_star = _star.AddHours(-11.99);
}
var session = ApiClient.GetSession();
List<DyOrderInfo> orderList = new List<DyOrderInfo>();
//官方接口已经同步了订单,防止非官方接口再次同步
List<string> orderidCache = new List<string>();
//if (1 != 2)
{
var pids = session.Find<fl_adzone_info>("select * from fl_adzone_info").Where(f => f.adzone_pid_cps_name == _item.username).Where(f => !string.IsNullOrWhiteSpace(f.adzone_pid)).Select(f => f.adzone_pid).Distinct().ToList();
if (pids != null & pids.Count != 0)
foreach (var pid in pids)
{
foreach (var pid in pids)
{
var tmp = api.DownOrderApi(_star, _end, pid);
if (tmp != null)
orderList.AddRange(tmp);
}
var tmp = api.DownOrderApi(_star, _end, pid);
if (tmp != null)
orderList.AddRange(tmp);
}
Exception _exception = null;
Exception _exception = null;
for (int i = 0; i < orderList.Count; i++)
for (int i = 0; i < orderList.Count; i++)
{
var orderInfo = orderList[i];
if (_exception != null) continue;
foreach (var order in orderInfo.orders)
{
var orderInfo = orderList[i];
if (_exception != null) continue;
foreach (var order in orderInfo.orders)
try
{
try
{
//if (order.order_id == "4886104544279610848")
//{
//}
if (ApiClient.Setting.DbConfig.DatabaseType == DatabaseType.SQLITE)
Thread.Sleep(100);
var status = order.flow_point;
var db_order = session.FindSingle<fl_order_douyin>("order_id=@order_id and product_id=@product_id", new { order_id = order.order_id, product_id = order.product_id });
if (db_order != null) //跳过相同状态
{
if (db_order.order_status == DouyinOrderStatus.REFUND.ToString() || db_order.product_detail == "手动处理")
{
continue;
}
if (status == db_order.order_status || status != DouyinOrderStatus.PAY_SUCC.ToString())
{
if (db_order.IsFinish()) continue;//是否已经完成
if (db_order.db_status == SystemOrderStatus. && db_order.db_endtime > DateTime.Now) continue;//跳过系统冻结
//if (db_order.order_status != WeipinhuiOrderSubStatusName.已签收 && db_order.order_status == status) continue;//跳过相同状态
if (db_order.order_status == status) continue;//跳过相同状态
}
db_order.order_status = status;
}
else
{
var orderTmp = new fl_order_douyin()
{
order_id = order.order_id,
product_id = order.product_id,
product_name = order.product_name,
total_pay_amount = order.pay_goods_amount,
estimated_comission = order.estimated_commission,
order_status = order.flow_point,
pay_time = HttpExtend.GetTimeStamp(DateTime.Parse(order.pay_success_time))
//...
};
db_order = orderTmp;
db_order.db_cpsname = _item.username;
db_order.db_cpsnick = _item.usernick;
}
try
{
LogHelper.GetSingleObj().Debug("抖音订单: ", $@"抖音Api原始{JsonConvert.SerializeObject(order)}
order = {JsonConvert.SerializeObject(db_order)}");
}
catch (Exception)
{ }
orderidCache.Add(db_order.order_id);
UpdateOrder(db_order, notices, session);
try
{
LogHelper.GetSingleObj().Debug("抖音订单: ", $@"处理完成的 ,需要通知的用户 -> {notices.Count}
order = {JsonConvert.SerializeObject(db_order)}");
}
catch (Exception)
{ }
}
catch (Exception ex)
{
throw ex;
}
finally
{
//session.Close();
}
}
catch (Exception ex)
{
_exception = ex;
break;
}
}
}
}
//Console.WriteLine();
}
//return;
//int queryCount = 1;
if (api.Member.online)//在为检测是未失效的时候进行同步
{
#region
foreach (DouyinQueryOrderType type in Enum.GetValues(typeof(DouyinQueryOrderType)))
{
try
{
Stopwatch stop = new Stopwatch();
stop.Start();
var json = api.DownOrder(_star, _end, 1, type);
stop.Stop();
//Console.WriteLine($"_star={_star},_end={_end},type={type},用时:{stop.Elapsed.TotalSeconds}");
if (api.Member.online)
{
if (json == null || json.Count == 0 || json[0] == "error")
continue;
var orderObj = JsonConvert.DeserializeObject<DouYinOrder>(json[0]);
if (orderObj.code != 0) continue;
Exception _exception = null;
var data = orderObj.data;
if (data == null) continue;
for (int i = 0; i < data.Count; i++)
{
var order = data[i];
if (_exception != null) continue;
try
{
try
{
//if (order.order_id == "4886104544279610848")
//if (order.order_id == "4933900340490065113")
//{
//}
//else
//if (order.order_id == "4934209762824039641")
//{
//}
//else
//if (order.order_id == "4934212125058641113")
//{
//}
//else
//if (order.order_id == "4934295228379604185")
//{
//}
//else
//if (order.order_id == "4936102872734510874")
//{
//}
//else
//{
// continue;
//}
if (orderidCache.Contains(order.order_id))
continue;
if (ApiClient.Setting.DbConfig.DatabaseType == DatabaseType.SQLITE)
Thread.Sleep(100);
var status = order.flow_point;
var status = order.order_status;
var db_order = session.FindSingle<fl_order_douyin>("order_id=@order_id and product_id=@product_id", new { order_id = order.order_id, product_id = order.product_id });
if (db_order != null) //跳过相同状态
@ -189,7 +525,9 @@ namespace Api.Framework.Timers
}
if (status == db_order.order_status || status != DouyinOrderStatus.PAY_SUCC.ToString())
{
if (db_order.IsFinish()) continue;//是否已经完成
var isFinish = db_order.IsFinish();
if (isFinish && status == db_order.order_status) continue;//是否已经完成
if (db_order.db_status == SystemOrderStatus. && db_order.db_endtime > DateTime.Now) continue;//跳过系统冻结
//if (db_order.order_status != WeipinhuiOrderSubStatusName.已签收 && db_order.order_status == status) continue;//跳过相同状态
if (db_order.order_status == status) continue;//跳过相同状态
@ -198,38 +536,24 @@ namespace Api.Framework.Timers
}
else
{
var orderTmp = new fl_order_douyin()
{
order_id = order.order_id,
product_id = order.product_id,
product_name = order.product_name,
total_pay_amount = order.pay_goods_amount,
estimated_comission = order.estimated_commission,
order_status = order.flow_point,
pay_time = HttpExtend.GetTimeStamp(DateTime.Parse(order.pay_success_time))
//...
};
db_order = orderTmp;
db_order = order;
db_order.db_cpsname = _item.username;
db_order.db_cpsnick = _item.usernick;
}
try
{
LogHelper.GetSingleObj().Debug("抖音订单: ", $@"抖音Api原始:{JsonConvert.SerializeObject(order)}
LogHelper.GetSingleObj().Debug("抖音订单: ", $@"抖音原始:{JsonConvert.SerializeObject(order)}
order = {JsonConvert.SerializeObject(db_order)}");
}
catch (Exception)
{ }
orderidCache.Add(db_order.order_id);
UpdateOrder(db_order, notices, session);
try
{
LogHelper.GetSingleObj().Debug("抖音订单: ", $@"处理完成的 ,需要通知的用 -> {notices.Count}
LogHelper.GetSingleObj().Debug("抖音订单: ", $@"处理完成的 ,需要通知的用 -> {notices.Count}
order = {JsonConvert.SerializeObject(db_order)}");
}
catch (Exception)
@ -251,206 +575,56 @@ order = {JsonConvert.SerializeObject(db_order)}");
}
}
}
else
{
EventClient.OnEvent("", $"抖音账号:{api.Member.usernick}({api.Member.username}),请重新登录");
break;
}
}
//Console.WriteLine();
}
//return;
//int queryCount = 1;
if (api.Member.online)//在为检测是未失效的时候进行同步
{
#region
foreach (DouyinQueryOrderType type in Enum.GetValues(typeof(DouyinQueryOrderType)))
catch (Exception ex)
{
try
{
Stopwatch stop = new Stopwatch();
stop.Start();
var json = api.DownOrder(_star, _end, 1, type);
stop.Stop();
//Console.WriteLine($"_star={_star},_end={_end},type={type},用时:{stop.Elapsed.TotalSeconds}");
/*
{"st":0,"code":9001,"msg":"操作异常","log_id":"2022010221313001020404907424DA1368","data":[]}
*/
//if (ex.Message.Contains("操作异常") || ex.Message.Contains("请重新登录"))
// queryCount++;
//if (queryCount >= 2)
//{
// EventClient.OnEvent("", $"链接订单无法同步,请重新登录抖音:{api.Member.usernick}({api.Member.username})");
// api.Member.online = false;
// ApiClient.GetSession().SaveOrUpdate(api.Member);
if (api.Member.online)
{
if (json == null || json.Count == 0 || json[0] == "error")
continue;
var orderObj = JsonConvert.DeserializeObject<DouYinOrder>(json[0]);
if (orderObj.code != 0) continue;
Exception _exception = null;
var data = orderObj.data;
if (data == null) continue;
for (int i = 0; i < data.Count; i++)
{
var order = data[i];
if (_exception != null) continue;
try
{
try
{
//if (order.order_id == "4933900340490065113")
//{
//}
//else
//if (order.order_id == "4934209762824039641")
//{
//}
//else
//if (order.order_id == "4934212125058641113")
//{
//}
//else
//if (order.order_id == "4934295228379604185")
//{
//}
//else
//if (order.order_id == "4936102872734510874")
//{
//}
//else
//{
// continue;
//}
// var shared = new Dictionary<string, object>();
// shared["msg_type"] = "抖音验证码";
// shared["cps_type"] = CpsType.抖音联盟;
// shared["msg_username"] = api.Member.username;
// shared["msg_usernick"] = api.Member.usernick;
if (orderidCache.Contains(order.order_id))
continue;
if (ApiClient.Setting.DbConfig.DatabaseType == DatabaseType.SQLITE)
Thread.Sleep(100);
var status = order.order_status;
var db_order = session.FindSingle<fl_order_douyin>("order_id=@order_id and product_id=@product_id", new { order_id = order.order_id, product_id = order.product_id });
if (db_order != null) //跳过相同状态
{
if (db_order.order_status == DouyinOrderStatus.REFUND.ToString() || db_order.product_detail == "手动处理")
{
continue;
}
if (status == db_order.order_status || status != DouyinOrderStatus.PAY_SUCC.ToString())
{
var isFinish = db_order.IsFinish();
if (isFinish && status == db_order.order_status) continue;//是否已经完成
if (db_order.db_status == SystemOrderStatus. && db_order.db_endtime > DateTime.Now) continue;//跳过系统冻结
//if (db_order.order_status != WeipinhuiOrderSubStatusName.已签收 && db_order.order_status == status) continue;//跳过相同状态
if (db_order.order_status == status) continue;//跳过相同状态
}
db_order.order_status = status;
}
else
{
db_order = order;
db_order.db_cpsname = _item.username;
db_order.db_cpsnick = _item.usernick;
}
try
{
LogHelper.GetSingleObj().Debug("抖音订单: ", $@"抖音原始:{JsonConvert.SerializeObject(order)}
order = {JsonConvert.SerializeObject(db_order)}");
}
catch (Exception)
{ }
UpdateOrder(db_order, notices, session);
try
{
LogHelper.GetSingleObj().Debug("抖音订单: ", $@"处理完成的 ,需要通知的用不 -> {notices.Count}
order = {JsonConvert.SerializeObject(db_order)}");
}
catch (Exception)
{ }
}
catch (Exception ex)
{
throw ex;
}
finally
{
//session.Close();
}
}
catch (Exception ex)
{
_exception = ex;
break;
}
}
}
else
{
EventClient.OnEvent("", $"抖音账号:{api.Member.usernick}({api.Member.username}),请重新登录");
break;
}
}
catch (Exception ex)
{
/*
{"st":0,"code":9001,"msg":"操作异常","log_id":"2022010221313001020404907424DA1368","data":[]}
*/
//if (ex.Message.Contains("操作异常") || ex.Message.Contains("请重新登录"))
// queryCount++;
//if (queryCount >= 2)
//{
// EventClient.OnEvent("", $"链接订单无法同步,请重新登录抖音:{api.Member.usernick}({api.Member.username})");
// api.Member.online = false;
// ApiClient.GetSession().SaveOrUpdate(api.Member);
// var shared = new Dictionary<string, object>();
// shared["msg_type"] = "抖音验证码";
// shared["cps_type"] = CpsType.抖音联盟;
// shared["msg_username"] = api.Member.username;
// shared["msg_usernick"] = api.Member.usernick;
// var sharedEvent = new SharedEvents(shared);
// EventClient.OnSharedEvent(null, sharedEvent);
// return;
//}
}
// var sharedEvent = new SharedEvents(shared);
// EventClient.OnSharedEvent(null, sharedEvent);
// return;
//}
}
}
#endregion
}
catch (Exception ex)
}
catch (Exception ex)
{
//The underlying frame is no longer valid - please check the IsValid property before calling!
if (ex.Message.Contains("is no longer valid - please check the IsValid"))
{
//The underlying frame is no longer valid - please check the IsValid property before calling!
if (ex.Message.Contains("is no longer valid - please check the IsValid"))
{
api.Member.is_valid = false;
}
api.Member.is_valid = false;
}
} while (_star > start_time);
}
catch (Exception ex)
{
//throw ex;
}
});
}
task.Start(1, null);
var db = ApiClient.GetSession();
var end_orders = db.Find<fl_order_douyin>("select * from fl_order_douyin where db_status=@db_status and db_endtime<@db_endtime", new { db_status = (int)SystemOrderStatus., db_endtime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }).ToList();
foreach (var db_order in end_orders)
{
UpdateOrder(db_order, notices, db);
}
if (notices.Count != 0)
{
var tasks = TimerTask.GetTimer<Update_NoticeQueue>() as Update_NoticeQueue;
foreach (var item in notices)
{
if (item.Member == null) continue;
var order = item.Order as fl_order_weipinhui;
tasks.Add(item);
}
} while (_star > start_time);
}
catch (Exception ex)
{
//throw ex;
}
}
});
}
/// <summary>
@ -1009,6 +1183,8 @@ order = {JsonConvert.SerializeObject(db_order)}");
EventClient.OnEvent(this, "更新抖音联盟订单异常1:" + db_order.db_cpsname + " - " + db_order.order_id + "," + ex.Message + "," + ex.StackTrace);
}
}
#endregion
}
}

View File

@ -366,7 +366,7 @@ Regex.IsMatch(mess, @"\[语音=(.+?)\]")
var id = collection["id"];
var promotion_id = collection["origin_id"]?.Split('_')[1];
var sec_author_id = collection["sec_author_id"];
var buyin_track = collection["buyin_track"];
var buyin_track = collection["buyin_track"] ?? sec_author_id;
return CreateKouling(id, promotion_id, sec_author_id, buyin_track);
}