|
|
@@ -30,7 +30,7 @@ namespace molilian.core
|
|
|
_end_point = Environment.GetEnvironmentVariable("EndPoint");
|
|
|
}
|
|
|
|
|
|
- public static UnionCpsDTO GetFormattedObject(CpsChannelEnum channel, string ip = "", string oaid = "")
|
|
|
+ public static UnionCpsDTO GetFormattedObject(string channel, string ip = "", string oaid = "")
|
|
|
{
|
|
|
return new()
|
|
|
{
|
|
|
@@ -41,65 +41,26 @@ namespace molilian.core
|
|
|
};
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- #region CPS 相关
|
|
|
- public static async Task<APIResult> EleAsync(string ip, string oaid)
|
|
|
+ #region CPS 相关
|
|
|
+ public static async Task<APIResult> CpsCouponAsync(string channel, string ip, string oaid)
|
|
|
{
|
|
|
- UnionCpsDTO result = GetFormattedObject(CpsChannelEnum.eleme, ip, oaid);
|
|
|
- var config = TkConfigCore.Get();
|
|
|
-
|
|
|
- //============================== 放弃转链-地区过滤 ==============================
|
|
|
- if (CpsShouldIgnoreRequest(config, result.channel, ip, oaid, out string reason))
|
|
|
- {
|
|
|
- result.success = false;
|
|
|
- result.message = "流量控制";
|
|
|
- result.reason = reason;
|
|
|
- _ = TkLogCore.CpsLogAsync(result);
|
|
|
- return new APIResult(new
|
|
|
- {
|
|
|
- result.success,
|
|
|
- result.message,
|
|
|
- result.reason,
|
|
|
- channel = result.channel.ToString(),
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- var account = ElePoolCore.GetOne();
|
|
|
- if (account == null)
|
|
|
+ UnionCpsDTO result = GetFormattedObject(channel, ip, oaid);
|
|
|
+ if (string.IsNullOrEmpty(result.channel))
|
|
|
{
|
|
|
result.success = false;
|
|
|
result.message = "放弃转链";
|
|
|
- result.reason = "没有匹配账号";
|
|
|
+ result.reason = "无效渠道";
|
|
|
_ = TkLogCore.CpsLogAsync(result);
|
|
|
return new APIResult(new
|
|
|
{
|
|
|
result.success,
|
|
|
result.message,
|
|
|
result.reason,
|
|
|
- channel = result.channel.ToString(),
|
|
|
+ channel,
|
|
|
});
|
|
|
}
|
|
|
- result.accountId = account.id;
|
|
|
- result.accountName = account.name;
|
|
|
- result.deeplink_url = account.deeplink;
|
|
|
- result.success = true;
|
|
|
- result.message = "OK";
|
|
|
-
|
|
|
- _ = TkLogCore.CpsLogAsync(result);
|
|
|
- return new APIResult(new
|
|
|
- {
|
|
|
- result.success,
|
|
|
- result.message,
|
|
|
- result.deeplink_url,
|
|
|
- channel = result.channel.ToString(),
|
|
|
- });
|
|
|
- }
|
|
|
|
|
|
- public static async Task<APIResult> MeituanAsync(string ip, string oaid)
|
|
|
- {
|
|
|
- UnionCpsDTO result = GetFormattedObject(CpsChannelEnum.meituan, ip, oaid);
|
|
|
var config = TkConfigCore.Get();
|
|
|
-
|
|
|
//============================== 放弃转链-地区过滤 ==============================
|
|
|
if (CpsShouldIgnoreRequest(config, result.channel, ip, oaid, out string reason))
|
|
|
{
|
|
|
@@ -112,11 +73,11 @@ namespace molilian.core
|
|
|
result.success,
|
|
|
result.message,
|
|
|
result.reason,
|
|
|
- channel = result.channel.ToString(),
|
|
|
+ result.channel,
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- var account = MeituanPoolCore.GetOne();
|
|
|
+ var account = CpsPoolCore.GetOne(result.channel);
|
|
|
if (account == null)
|
|
|
{
|
|
|
result.success = false;
|
|
|
@@ -128,12 +89,15 @@ namespace molilian.core
|
|
|
result.success,
|
|
|
result.message,
|
|
|
result.reason,
|
|
|
- channel = result.channel.ToString(),
|
|
|
+ result.channel,
|
|
|
});
|
|
|
}
|
|
|
result.accountId = account.id;
|
|
|
result.accountName = account.name;
|
|
|
result.deeplink_url = account.deeplink;
|
|
|
+ result.token = account.token;
|
|
|
+ result.category = account.category;
|
|
|
+ result.pid = account.pid;
|
|
|
result.success = true;
|
|
|
result.message = "OK";
|
|
|
|
|
|
@@ -143,11 +107,117 @@ namespace molilian.core
|
|
|
result.success,
|
|
|
result.message,
|
|
|
result.deeplink_url,
|
|
|
- channel = result.channel.ToString(),
|
|
|
+ result.token,
|
|
|
+ result.channel,
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- public static bool CpsShouldIgnoreRequest(TkConfigDTO config, CpsChannelEnum channel, string ip, string oaid, out string reason)
|
|
|
+
|
|
|
+ //public static async Task<APIResult> EleAsync(string ip, string oaid)
|
|
|
+ //{
|
|
|
+ // UnionCpsDTO result = GetFormattedObject(CpsChannelEnum.eleme, ip, oaid);
|
|
|
+ // var config = TkConfigCore.Get();
|
|
|
+
|
|
|
+ // //============================== 放弃转链-地区过滤 ==============================
|
|
|
+ // if (CpsShouldIgnoreRequest(config, result.channel, ip, oaid, out string reason))
|
|
|
+ // {
|
|
|
+ // result.success = false;
|
|
|
+ // result.message = "流量控制";
|
|
|
+ // result.reason = reason;
|
|
|
+ // _ = TkLogCore.CpsLogAsync(result);
|
|
|
+ // return new APIResult(new
|
|
|
+ // {
|
|
|
+ // result.success,
|
|
|
+ // result.message,
|
|
|
+ // result.reason,
|
|
|
+ // channel = result.channel.ToString(),
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+
|
|
|
+ // var account = ElePoolCore.GetOne();
|
|
|
+ // if (account == null)
|
|
|
+ // {
|
|
|
+ // result.success = false;
|
|
|
+ // result.message = "放弃转链";
|
|
|
+ // result.reason = "没有匹配账号";
|
|
|
+ // _ = TkLogCore.CpsLogAsync(result);
|
|
|
+ // return new APIResult(new
|
|
|
+ // {
|
|
|
+ // result.success,
|
|
|
+ // result.message,
|
|
|
+ // result.reason,
|
|
|
+ // channel = result.channel.ToString(),
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // result.accountId = account.id;
|
|
|
+ // result.accountName = account.name;
|
|
|
+ // result.deeplink_url = account.deeplink;
|
|
|
+ // result.success = true;
|
|
|
+ // result.message = "OK";
|
|
|
+
|
|
|
+ // _ = TkLogCore.CpsLogAsync(result);
|
|
|
+ // return new APIResult(new
|
|
|
+ // {
|
|
|
+ // result.success,
|
|
|
+ // result.message,
|
|
|
+ // result.deeplink_url,
|
|
|
+ // channel = result.channel.ToString(),
|
|
|
+ // });
|
|
|
+ //}
|
|
|
+
|
|
|
+ //public static async Task<APIResult> MeituanAsync(string ip, string oaid)
|
|
|
+ //{
|
|
|
+ // UnionCpsDTO result = GetFormattedObject(CpsChannelEnum.meituan, ip, oaid);
|
|
|
+ // var config = TkConfigCore.Get();
|
|
|
+
|
|
|
+ // //============================== 放弃转链-地区过滤 ==============================
|
|
|
+ // if (CpsShouldIgnoreRequest(config, result.channel, ip, oaid, out string reason))
|
|
|
+ // {
|
|
|
+ // result.success = false;
|
|
|
+ // result.message = "流量控制";
|
|
|
+ // result.reason = reason;
|
|
|
+ // _ = TkLogCore.CpsLogAsync(result);
|
|
|
+ // return new APIResult(new
|
|
|
+ // {
|
|
|
+ // result.success,
|
|
|
+ // result.message,
|
|
|
+ // result.reason,
|
|
|
+ // channel = result.channel.ToString(),
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+
|
|
|
+ // var account = MeituanPoolCore.GetOne();
|
|
|
+ // if (account == null)
|
|
|
+ // {
|
|
|
+ // result.success = false;
|
|
|
+ // result.message = "放弃转链";
|
|
|
+ // result.reason = "没有匹配账号";
|
|
|
+ // _ = TkLogCore.CpsLogAsync(result);
|
|
|
+ // return new APIResult(new
|
|
|
+ // {
|
|
|
+ // result.success,
|
|
|
+ // result.message,
|
|
|
+ // result.reason,
|
|
|
+ // channel = result.channel.ToString(),
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // result.accountId = account.id;
|
|
|
+ // result.accountName = account.name;
|
|
|
+ // result.deeplink_url = account.deeplink;
|
|
|
+ // result.success = true;
|
|
|
+ // result.message = "OK";
|
|
|
+
|
|
|
+ // _ = TkLogCore.CpsLogAsync(result);
|
|
|
+ // return new APIResult(new
|
|
|
+ // {
|
|
|
+ // result.success,
|
|
|
+ // result.message,
|
|
|
+ // result.deeplink_url,
|
|
|
+ // channel = result.channel.ToString(),
|
|
|
+ // });
|
|
|
+ //}
|
|
|
+
|
|
|
+ public static bool CpsShouldIgnoreRequest(TkConfigDTO config, string channel, string ip, string oaid, out string reason)
|
|
|
{
|
|
|
reason = string.Empty;
|
|
|
try
|