You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1031 lines
37 KiB
PHP
1031 lines
37 KiB
PHP
<?php
|
|
|
|
class AppConst {
|
|
const appPlds = 'plds';
|
|
const appMsPdd = 'mspdd';
|
|
const appMsPddOd = 'mspddod';
|
|
const appMsPddSp = 'mspddsp';
|
|
const appMsPddOp = 'mspddop';
|
|
const appMsPddOpEbill = 'mspddopebill';
|
|
const appPddDz = 'pdddz';
|
|
const appPddDzSh = 'pdddzsh';
|
|
const appPddDzOd = 'pdddzod';
|
|
const appPddDzSp = 'pdddzsp';
|
|
const appPddDzOp = 'pdddzOp';
|
|
const appPddAgate = 'pddAgate';
|
|
const appPddRuby = 'pddRuby';
|
|
const appPddTaoBaiKe = 'pddTaoBaiKe';
|
|
const appPddOpRuby = 'pddopRuby';
|
|
|
|
const appCategoryJxc = 'jxc';
|
|
const appCategorySh = 'sh';
|
|
const appCategoryOd = 'od';
|
|
const appCategoryOp = 'op';
|
|
const appCategorySp = 'sp';
|
|
|
|
const appModuleGoods = 'goods';
|
|
const appModuleOrder = 'order';
|
|
|
|
const statusNeedBuySp = 'needBuySp';
|
|
const statusNeedLoginSp = 'needLoginSp';
|
|
const statusSuccess = 'success';
|
|
|
|
const pldsAppVersionAdv = 'adv';
|
|
const pldsAppVersionBasic = 'basic';
|
|
|
|
const popStartDate = '2010-01-01';
|
|
const popStartDatetime = '2010-01-01 00:00:00';
|
|
|
|
//免费测试
|
|
const freeAppCycleCode = 'days_7';
|
|
const freeAppVersionCode = 'move_7';
|
|
|
|
const pdddzAppVersion1Yuan = 'version_1yuan';
|
|
const pdddzAppVersionAdv = 'version_adv';
|
|
|
|
const desktopVersion = '1.0.7';
|
|
|
|
const userAgentTypeElectron = 'electron';
|
|
const userAgentTypeBrowser = 'browser';
|
|
|
|
const pushLogTypePageError = 'pageError';
|
|
const pushLogTypeDesktopStartError = 'desktopStartError';
|
|
const pushLogTypeCrashReporter = 'crashReporter';
|
|
|
|
const heartbeatMaxIntervalSecond = 5;
|
|
|
|
const appPlatformSn = 'sn';
|
|
const appPlatformJd = 'jd';
|
|
const appPlatformTb = 'tb';
|
|
const appPlatformPdd = 'pdd';
|
|
const appPlatformKdn = 'Kdn';
|
|
|
|
const dingTalkBizIsvLog = 'isv_log';
|
|
const dingTalkBizJcMasterDb = 'jc_master_db';
|
|
const dingTalkBizMonitorDb = 'monitor_db';
|
|
const dingTalkBizOrderDecrypt = 'order_decrypt';
|
|
const dingTalkBizOutstorage = 'outstorage';
|
|
const dingTalkBizDeleteOss = 'delete_oss';
|
|
const dingTalkBizOrderReport = 'order_report';
|
|
const dingTalkBizPluginRepeatPurchase = 'plugin_repeat_purchase';
|
|
const dingTalkBizFulfillmentOrderMall = 'fulfillment_order_mall';
|
|
const dingTalkBizTestDb = 'test_db';
|
|
const dingTalkAdminDecryptLimit = 'adminDecryptLimit';
|
|
|
|
const appStatusNoAccount = 1;
|
|
const appStatusExpire = 2;
|
|
const appStatusOnline = 3;
|
|
|
|
const authStateDesktop = 'dt';
|
|
|
|
//群控(多店铺操作)类型
|
|
const mallTaskGroupTypeBatchTask = 'batch_task';
|
|
const mallTaskGroupTypeBatchTaskImport = 'batch_task_import';
|
|
|
|
const rubyAffiliateKeduomi = 'keduomi';
|
|
|
|
const dsAppServiceMarketUrl = 'https://pc.1688.com/product/detail.htm?amug_web_biz=fwmkt&amug_web_fl_src=cy&productCode=CvONVXsy8X5d97MORssyLjJ5RHDKAbYRv1a%2BUEOWmyk%3D&productType=GROUP';
|
|
const dsAppAutoPayUrl = 'https://tradeconfig.1688.com/foundation/withhold_manage.htm?amug_web_biz=fwmkt&amug_web_fl_src=cy';
|
|
|
|
const dingTalkApiNotice = 'api_notice';
|
|
const dingTalkReqRateNotice = 'reqRateNotice';
|
|
|
|
const loginClientPc = 'pc';
|
|
const loginClientMobile = 'mobile';
|
|
|
|
public static function getAppCategoryByAppName($appName) {
|
|
if (in_array($appName, [AppConst::appPddDzSh, AppConst::appPddAgate, AppConst::appMsPdd])) {
|
|
return self::appCategorySh;
|
|
} else if (in_array($appName, [AppConst::appPddDzOd, AppConst::appPddRuby, AppConst::appMsPddOd])) {
|
|
return self::appCategoryOd;
|
|
} else if(in_array($appName, [AppConst::appPddDz])) {
|
|
return self::appCategoryJxc;
|
|
} else if(in_array($appName, [AppConst::appMsPddOp, AppConst::appMsPddOpEbill, AppConst::appPddDzOp])){
|
|
return self::appCategoryOp;
|
|
}
|
|
}
|
|
|
|
public static function getRubyAffiliateCode() {
|
|
return $_SERVER['HTTP_AFFILIATECODE'] ?: '';
|
|
}
|
|
|
|
public static function getRubyAffiliateInfo() {
|
|
$affiliateCode = AppConst::getRubyAffiliateCode();
|
|
switch ($affiliateCode) {
|
|
case AppConst::rubyAffiliateKeduomi :
|
|
return [
|
|
'title' => "可多米科技",
|
|
'desc' => "拼多多采购发货-下单采购软件、一键下单、一键拍单、自动发货,支持海量货源平台采购下单、一件代发",
|
|
'keyword' => "拼多多采购发货-下单采购软件、一键下单、一键拍单、自动发货,支持海量货源平台采购下单、一件代发",
|
|
'logo' => 'keduomi-logo.png'
|
|
];
|
|
default:
|
|
return [
|
|
'title' => "聚宝订单",
|
|
'desc' => "拼多多聚宝订单采购发货-下单采购软件、一键下单、一键拍单、自动发货,支持海量货源平台采购下单、一件代发",
|
|
'keyword' => "拼多多聚宝订单采购发货-下单采购软件、一键下单、一键拍单、自动发货,支持海量货源平台采购下单、一件代发",
|
|
'logo' => 'dt-logo.png'
|
|
];
|
|
}
|
|
}
|
|
|
|
public static function checkIsDesktop() {
|
|
if (isset($_SESSION['mockElectron']) && $_SESSION['mockElectron']) {
|
|
return true;
|
|
}
|
|
|
|
if (isset($_SERVER['HTTP_PLATFORM']) && $_SERVER['HTTP_PLATFORM'] === 'desktop') {
|
|
return true;
|
|
}
|
|
|
|
if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/\sElectron\//isU', $_SERVER['HTTP_USER_AGENT'])) {
|
|
return true;
|
|
}
|
|
|
|
if (isset($_SERVER['REQUEST_URI']) && (stripos($_SERVER['REQUEST_URI'], '/desktop/') === 0)) {
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
public static function isDev() {
|
|
return Zc::C('env') != 'live';
|
|
}
|
|
|
|
public static function isTest() {
|
|
return (Zc::C('env') == 'live') && (stripos(gethostname(), '-test') !== false);
|
|
}
|
|
|
|
public static function isPddMsApp() {
|
|
$appName = Zc::C('appName');
|
|
return in_array($appName, [self::appMsPdd, self::appMsPddOd, self::appMsPddOpEbill, self::appMsPddOp, self::appMsPddSp]);
|
|
}
|
|
|
|
public static function isPddMsShApp() {
|
|
return (Zc::C('appName') == self::appMsPdd);
|
|
}
|
|
|
|
public static function isPddMsOdApp() {
|
|
return (Zc::C('appName') == self::appMsPddOd);
|
|
}
|
|
|
|
public static function isPddMsSpApp() {
|
|
return (Zc::C('appName') == self::appMsPddSp);
|
|
}
|
|
|
|
public static function isPddMsOpApp() {
|
|
return (Zc::C('appName') == self::appMsPddOp);
|
|
}
|
|
|
|
public static function isPddMsOpEbillApp() {
|
|
return (Zc::C('appName') == self::appMsPddOpEbill);
|
|
}
|
|
|
|
public static function isPddDzApp() {
|
|
$appName = Zc::C('appName');
|
|
return in_array($appName, [self::appPddDz, self::appPddDzSh, self::appPddDzOd, self::appPddDzSp, self::appPddDzOp]);
|
|
}
|
|
|
|
public static function isPddDzJxcApp() {
|
|
return (Zc::C('appName') == self::appPddDz);
|
|
}
|
|
|
|
public static function isPddDzShApp() {
|
|
return (Zc::C('appName') == self::appPddDzSh);
|
|
}
|
|
|
|
public static function isPddDzOdApp() {
|
|
return (Zc::C('appName') == self::appPddDzOd);
|
|
}
|
|
|
|
public static function isPddDzSpApp() {
|
|
return (Zc::C('appName') == self::appPddDzSp);
|
|
}
|
|
|
|
public static function isPddDzOpApp() {
|
|
return (Zc::C('appName') == self::appPddDzOp);
|
|
}
|
|
|
|
public static function isPddAgateApp() {
|
|
return (Zc::C('appName') == self::appPddAgate);
|
|
}
|
|
|
|
public static function isPddRubyApp() {
|
|
return (Zc::C('appName') == self::appPddRuby);
|
|
}
|
|
|
|
public static function isPddTaoBaiKeApp() {
|
|
return (Zc::C('appName') == self::appPddTaoBaiKe);
|
|
}
|
|
|
|
public static function isPddOpRubyApp() {
|
|
return (Zc::C('appName') == self::appPddOpRuby);
|
|
}
|
|
|
|
public static function isSkipCheckFromJfowApp() {
|
|
return in_array(Zc::C('appName'), [self::appPddOpRuby, self::appPddRuby, self::appPddTaoBaiKe]);
|
|
}
|
|
|
|
public static function isDuoDuoCloud() {
|
|
if (strpos(gethostname(), 'app-') === 0) {
|
|
return true;
|
|
}
|
|
if (stripos($_SERVER['HTTP_HOST'], 'dc.') > -1) {
|
|
return true;
|
|
}
|
|
if (stripos($_SERVER['HTTP_HOST'], 'dc-') > -1) {
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
public static function getAppName()
|
|
{
|
|
return Zc::C('appName') ?: self::appMsPdd;
|
|
}
|
|
|
|
public static function getAppChineseName() {
|
|
$appName = Zc::C('appName') ? : self::appMsPdd;
|
|
return self::getAppNameAndTextConfigMap()[$appName]['chineseName'];
|
|
}
|
|
|
|
public static function getQQLink() {
|
|
return sprintf('http://wpa.qq.com/msgrd?v=3&uin=%s&site=qq&menu=yes;', self::getQQNumber());
|
|
}
|
|
|
|
public static function getQQNumber() {
|
|
$appName = Zc::C('appName') ? : self::appMsPdd;
|
|
return self::getAppNameAndTextConfigMap()[$appName]['QQNumber'];
|
|
}
|
|
|
|
public static function getPhoneNumer() {
|
|
$appName = Zc::C('appName') ? : self::appMsPdd;
|
|
return self::getAppNameAndTextConfigMap()[$appName]['phoneNumber'];
|
|
}
|
|
|
|
public static function getLogoImg() {
|
|
$appName = Zc::C('appName') ? : self::appMsPdd;
|
|
return self::getAppNameAndTextConfigMap()[$appName]['logoImg'];
|
|
}
|
|
|
|
public static function getIco() {
|
|
$appName = Zc::C('appName') ? : self::appMsPdd;
|
|
return self::getAppNameAndTextConfigMap()[$appName]['ico'];
|
|
}
|
|
|
|
public static function getAppNameAndTextConfigMap() {
|
|
return array(
|
|
self::appPddDz => array(
|
|
'chineseName' => '拼多多智能店长',
|
|
'phoneNumber' => '18558617121',
|
|
'QQNumber' => '3163153953',
|
|
'logoImg' => 'img/dz-logo.png',
|
|
'ico' => 'dz.ico',
|
|
),
|
|
|
|
self::appPddDzSh => array(
|
|
'chineseName' => '拼多多智能上货',
|
|
'phoneNumber' => '18558617121',
|
|
'QQNumber' => '3163153953',
|
|
'logoImg' => 'img/dz-logo.png',
|
|
'ico' => 'dz.ico',
|
|
),
|
|
|
|
self::appPddDzOd => array(
|
|
'chineseName' => '拼多多智能下单',
|
|
'phoneNumber' => '18558617121',
|
|
'QQNumber' => '3163153953',
|
|
'logoImg' => 'img/dz-logo.png',
|
|
'ico' => 'dz.ico',
|
|
),
|
|
|
|
self::appPddDzSp => array(
|
|
'chineseName' => '拼多多智能水印',
|
|
'phoneNumber' => '18558617121',
|
|
'QQNumber' => '3163153953',
|
|
'logoImg' => 'img/dz-logo.png',
|
|
'ico' => 'dz.ico',
|
|
),
|
|
|
|
self::appPddDzOp => array(
|
|
'chineseName' => '拼多多智能打单',
|
|
'phoneNumber' => '18558617121',
|
|
'QQNumber' => '3163153953',
|
|
'logoImg' => 'img/dz-logo.png',
|
|
'ico' => 'dz.ico',
|
|
),
|
|
|
|
self::appMsPdd => array(
|
|
'chineseName' => '妙手',
|
|
'phoneNumber' => '13609589263',
|
|
'QQNumber' => '1161839933',
|
|
'logoImg' => 'img/web_logo.png',
|
|
'ico' => 'ms.ico',
|
|
),
|
|
|
|
self::appMsPddOd => array(
|
|
'chineseName' => '妙手采购',
|
|
'phoneNumber' => '13609589263',
|
|
'QQNumber' => '1161839933',
|
|
'logoImg' => 'img/web_logo.png',
|
|
'ico' => 'ms.ico',
|
|
),
|
|
|
|
self::appMsPddSp => array(
|
|
'chineseName' => '妙手商品',
|
|
'phoneNumber' => '13609589263',
|
|
'QQNumber' => '1161839933',
|
|
'logoImg' => 'img/web_logo.png',
|
|
'ico' => 'ms.ico',
|
|
),
|
|
|
|
self::appMsPddOp => array(
|
|
'chineseName' => '妙手打单',
|
|
'phoneNumber' => '13609589263',
|
|
'QQNumber' => '1161839933',
|
|
'logoImg' => 'img/web_logo.png',
|
|
'ico' => 'ms.ico',
|
|
),
|
|
|
|
self::appMsPddOpEbill => array(
|
|
'chineseName' => '妙手电子面单',
|
|
'phoneNumber' => '13609589263',
|
|
'QQNumber' => '1161839933',
|
|
'logoImg' => 'img/web_logo.png',
|
|
'ico' => 'ms.ico',
|
|
),
|
|
|
|
self::appPddRuby => array(
|
|
'chineseName' => '聚宝',
|
|
'phoneNumber' => '',
|
|
'QQNumber' => '1056261133',
|
|
'logoImg' => 'img/ruby/web_logo.png',
|
|
'ico' => 'ruby.ico',
|
|
),
|
|
|
|
self::appPddOpRuby => array(
|
|
'chineseName' => '聚宝打单',
|
|
'phoneNumber' => '',
|
|
'QQNumber' => '1056261133',
|
|
'logoImg' => 'img/ruby/web_logo.png',
|
|
'ico' => 'ruby.ico',
|
|
),
|
|
|
|
self::appPddTaoBaiKe => array(
|
|
'chineseName' => '淘百客助手',
|
|
'phoneNumber' => '',
|
|
'QQNumber' => '',
|
|
'logoImg' => 'img/ruby/web_logo.png',
|
|
'ico' => 'ruby.ico',
|
|
),
|
|
);
|
|
}
|
|
|
|
public static function isJxcAppCategory() {
|
|
return Zc::C('appCategory') === self::appCategoryJxc;
|
|
}
|
|
|
|
public static function isShAppCategory() {
|
|
return Zc::C('appCategory') === self::appCategorySh;
|
|
}
|
|
|
|
public static function isOdAppCategory() {
|
|
return Zc::C('appCategory') === self::appCategoryOd;
|
|
}
|
|
|
|
public static function isOpAppCategory() {
|
|
return Zc::C('appCategory') === self::appCategoryOp;
|
|
}
|
|
|
|
public static function isSpAppCategory() {
|
|
return Zc::C('appCategory') === self::appCategorySp;
|
|
}
|
|
|
|
public static function isOnlineApp() {
|
|
$appName = Zc::C('appName');
|
|
$offlineApps = [AppConst::appPddAgate, AppConst::appPddRuby, AppConst::appMsPddSp, AppConst::appPddDzSp];
|
|
return !in_array($appName, $offlineApps);
|
|
}
|
|
|
|
public static function getShHostUrl() {
|
|
$hostUrl = Zc::C('static.domain');
|
|
return $hostUrl;
|
|
switch (Zc::C('appName')) {
|
|
case self::appPddDz:
|
|
$hostUrl = str_replace("pdddz.", 'sh.pdddz.', $hostUrl);
|
|
break;
|
|
}
|
|
return $hostUrl;
|
|
}
|
|
|
|
public static function getOdHostUrl() {
|
|
$hostUrl = Zc::C('static.domain');
|
|
return $hostUrl;
|
|
switch (Zc::C('appName')) {
|
|
case self::appPddDz:
|
|
$hostUrl = str_replace("pdddz.", 'pdddz-od.', $hostUrl);
|
|
break;
|
|
}
|
|
return $hostUrl;
|
|
}
|
|
|
|
public static function getPdddzHostUrl() {
|
|
$hostUrl = Zc::C('static.domain');
|
|
switch (Zc::C('appName')) {
|
|
case self::appPddDzSh;
|
|
$hostUrl = str_replace("sh.pdddz.", 'pdddz.', $hostUrl);
|
|
break;
|
|
case self::appPddDzOd:
|
|
$hostUrl = str_replace("pdddz-od.", 'pdddz.', $hostUrl);
|
|
break;
|
|
}
|
|
return $hostUrl;
|
|
}
|
|
|
|
public static function isNewVersionPurchase() {
|
|
return $_SESSION[SessionConst::purchaseVersion] != PurchaseOrderConst::purchaseVersionOld;
|
|
}
|
|
|
|
public static function getAppQqLink() {
|
|
$appName = Zc::C('appName');
|
|
switch ($appName) {
|
|
case self::appMsPdd:
|
|
case self::appMsPddOp:
|
|
case self::appMsPddOpEbill:
|
|
$link = 'http://q.url.cn/abI7KP?_type=wpa&qidian=true';
|
|
break;
|
|
case self::appPddDzSh:
|
|
case self::appPddDzOd:
|
|
case self::appPddDz:
|
|
case self::appPddDzOp:
|
|
$link = 'http://q.url.cn/AB6COP?_type=wpa&qidian=true';
|
|
break;
|
|
case self::appPddRuby:
|
|
$link = 'http://wpa.qq.com/msgrd?v=3&uin=1056261133&site=qq&menu=yes';
|
|
break;
|
|
default:
|
|
$link = '';
|
|
}
|
|
return $link;
|
|
}
|
|
|
|
public static function getDdkAuthLink($state = '') {
|
|
if (empty($state) && AppConst::checkIsDesktop()) {
|
|
$state = AppConst::authStateDesktop;
|
|
}
|
|
$pddddkClientId = Zc::C('pddddkClientId');
|
|
$redirectUri = Zc::C('ddkRedirectUri');
|
|
return sprintf('https://jinbao.pinduoduo.com/open.html?client_id=%s&response_type=code&redirect_uri=%s&state=', $pddddkClientId, $redirectUri, $state);
|
|
}
|
|
|
|
public static function getAppServiceMarketLink() {
|
|
$appName = Zc::C('appName');
|
|
switch ($appName) {
|
|
case self::appMsPdd:
|
|
$link = 'https://mms.pinduoduo.com/login/sso?platform=fuwu&redirectUrl=https%3A%2F%2Ffuwu.pinduoduo.com%2Fservice-market%2Fservice-detail%3FdetailId%3D187';
|
|
break;
|
|
case self::appMsPddOd:
|
|
$link = 'https://mms.pinduoduo.com/login/sso?platform=fuwu&redirectUrl=https%3A%2F%2Ffuwu.pinduoduo.com%2Fservice-market%2Fservice-detail%3FdetailId%3D3815';
|
|
break;
|
|
case self::appMsPddSp:
|
|
$link = 'https://mms.pinduoduo.com/login/sso?platform=fuwu&redirectUrl=https%3A%2F%2Ffuwu.pinduoduo.com%2Fservice-market%2Fservice-detail%3FdetailId%3D8569';
|
|
break;
|
|
case self::appPddDzSh:
|
|
$link = 'https://mms.pinduoduo.com/login/sso?platform=fuwu&redirectUrl=https%3A%2F%2Ffuwu.pinduoduo.com%2Fservice-market%2Fservice-detail%3FdetailId%3D3341';
|
|
break;
|
|
case self::appPddDzOd:
|
|
$link = 'https://mms.pinduoduo.com/login/sso?platform=fuwu&redirectUrl=https%3A%2F%2Ffuwu.pinduoduo.com%2Fservice-market%2Fservice-detail%3FdetailId%3D3590';
|
|
break;
|
|
case self::appPddDzSp:
|
|
$link = 'https://mms.pinduoduo.com/login/sso?platform=fuwu&redirectUrl=https%3A%2F%2Ffuwu.pinduoduo.com%2Fservice-market%2Fservice-detail%3FdetailId%3D11202';
|
|
break;
|
|
case self::appPddDz:
|
|
$link = 'https://mms.pinduoduo.com/login/sso?platform=fuwu&redirectUrl=https%3A%2F%2Ffuwu.pinduoduo.com%2Fservice-market%2Fservice-detail%3FdetailId%3D278';
|
|
break;
|
|
case self::appMsPddOp:
|
|
$link = 'https://mms.pinduoduo.com/login/sso?platform=fuwu&redirectUrl=https%3A%2F%2Ffuwu.pinduoduo.com%2Fservice-market%2Fservice-detail%3FdetailId%3D15629';
|
|
break;
|
|
case self::appPddDzOp:
|
|
$link = 'https://mms.pinduoduo.com/login/sso?platform=fuwu&redirectUrl=https%3A%2F%2Ffuwu.pinduoduo.com%2Fservice-market%2Fservice-detail%3FdetailId%3D16099';
|
|
break;
|
|
case self::appPddRuby:
|
|
$link = 'https://fuwu.pinduoduo.com/service-market/service-detail?detailId=30864';
|
|
break;
|
|
default:
|
|
$link = '';
|
|
}
|
|
return $link;
|
|
}
|
|
|
|
public static function getAliYunHost() {
|
|
if (!self::isOpenDdcPart()) {
|
|
return false;
|
|
}
|
|
|
|
$appName = Zc::C('appName');
|
|
switch ($appName) {
|
|
case self::appMsPdd:
|
|
$host = 'pdd.szchengji-inc.com';
|
|
break;
|
|
case self::appPddDzSh:
|
|
$host = 'sh.pdddz.jiancent.com';
|
|
break;
|
|
case self::appPddAgate:
|
|
$host = 'agate-pdd.ry-inc.com';
|
|
break;
|
|
default:
|
|
$host = false;
|
|
}
|
|
return $host;
|
|
}
|
|
|
|
public static function getMobileHost($isMobile = false) {
|
|
if (!$isMobile) {
|
|
return false;
|
|
}
|
|
switch (Zc::C('appName')) {
|
|
case self::appMsPddOd:
|
|
$host = 'pdd-od-m.chengji-inc.com';
|
|
break;
|
|
case self::appPddDzOd:
|
|
$host = 'dcpdddz-od-m.jiancent.com';
|
|
break;
|
|
default:
|
|
$host = false;
|
|
}
|
|
if (!empty($host) && AppConst::isPreEnv()) {
|
|
$host = 'pre-'.$host;
|
|
}
|
|
|
|
return $host;
|
|
}
|
|
|
|
public static function getDuoDuoCloudHost($skipCheck = false, $isOrderModule = false, $isDdcMcHost = false) {
|
|
if (!self::isOpenDdcPart() && !$skipCheck) {
|
|
return false;
|
|
}
|
|
|
|
$appName = Zc::C('appName');
|
|
switch ($appName) {
|
|
case self::appMsPddOd:
|
|
if (self::isPreEnv()) {
|
|
if ($isOrderModule) {
|
|
$host = 'sh.pre-pdd-od.chengji-inc.com';
|
|
} else {
|
|
$host = 'pre-pdd-od.chengji-inc.com';
|
|
}
|
|
} else {
|
|
if ($isOrderModule) {
|
|
$host = 'sh.pdd-od.chengji-inc.com';
|
|
} else {
|
|
$host = 'pdd-od.chengji-inc.com';
|
|
}
|
|
}
|
|
break;
|
|
case self::appMsPdd:
|
|
if (self::isPreEnv()) {
|
|
$host = 'pre-dc.pdd.szchengji-inc.com';
|
|
} else {
|
|
$host = 'dc.pdd.szchengji-inc.com';
|
|
}
|
|
break;
|
|
case self::appMsPddSp:
|
|
if (self::isPreEnv()) {
|
|
$host = 'pre-cpdd-sp.chengji-inc.com';
|
|
} else {
|
|
$host = 'cpdd-sp.chengji-inc.com';
|
|
}
|
|
break;
|
|
case self::appMsPddOp:
|
|
if (self::isPreEnv()) {
|
|
$host = 'pre-pdd-op.chengji-inc.com';
|
|
} else {
|
|
$host = 'pdd-op.chengji-inc.com';
|
|
}
|
|
break;
|
|
case self::appPddDz:
|
|
if (self::isPreEnv()) {
|
|
if ($isOrderModule) {
|
|
$host = 'op.pre-dcpdddz.jiancent.com';
|
|
} else {
|
|
$host = 'pre-dcpdddz.jiancent.com';
|
|
}
|
|
} else {
|
|
if ($isOrderModule) {
|
|
$host = 'op.dcpdddz.jiancent.com';
|
|
} else {
|
|
$host = 'dcpdddz.jiancent.com';
|
|
}
|
|
}
|
|
break;
|
|
case self::appPddDzSp:
|
|
if (self::isPreEnv()) {
|
|
$host = 'pre-dcpdddz-sp.jiancent.com';
|
|
} else {
|
|
$host = 'dcpdddz-sp.jiancent.com';
|
|
}
|
|
break;
|
|
case self::appPddDzSh:
|
|
if (self::isPreEnv()) {
|
|
$host = 'pre-dc.sh.pdddz.jiancent.com';
|
|
} else {
|
|
if ($isDdcMcHost) {
|
|
$host = 'mc-dc.sh.pdddz.jiancent.com';
|
|
} else {
|
|
$host = 'dc.sh.pdddz.jiancent.com';
|
|
}
|
|
}
|
|
break;
|
|
case self::appPddDzOp:
|
|
if (self::isPreEnv()) {
|
|
$host = 'pre-dcpdddz-op.jiancent.com';
|
|
} else {
|
|
$host = 'dcpdddz-op.jiancent.com';
|
|
}
|
|
break;
|
|
case self::appPddRuby:
|
|
if (self::isPreEnv()) {
|
|
if ($isOrderModule) {
|
|
$host = 'pre-dc-ruby-pdd.ry-inc.com';
|
|
} else {
|
|
$host = 'sh.pre-dc-ruby-pdd.ry-inc.com';
|
|
}
|
|
} else {
|
|
if ($isOrderModule) {
|
|
$host = 'dc-ruby-pdd.ry-inc.com';
|
|
} else {
|
|
$host = 'sh.dc-ruby-pdd.ry-inc.com';
|
|
}
|
|
}
|
|
break;
|
|
case self::appPddOpRuby:
|
|
if (self::isPreEnv()) {
|
|
$host = 'pre-dc-op-pdd.ry-inc.com';
|
|
} else {
|
|
$host = 'dc-op-pdd.ry-inc.com';
|
|
}
|
|
break;
|
|
default:
|
|
$host = false;
|
|
}
|
|
return $host;
|
|
}
|
|
|
|
public static function isOpenDdcPart() {
|
|
if (self::isPddDzShApp() || self::isPddAgateApp()) {
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
public static function isRunOutDdc() {
|
|
if (self::isDuoDuoCloud()) {
|
|
return false;
|
|
}
|
|
|
|
return self::isOpenDdcPart();
|
|
}
|
|
|
|
public static function isRunInDdc() {
|
|
if (!self::isDuoDuoCloud()) {
|
|
return false;
|
|
}
|
|
|
|
return self::isOpenDdcPart();
|
|
}
|
|
|
|
public static function isRequestDdcApiProxy() {
|
|
return AppConst::isPddMsShApp() && !AppConst::isDuoDuoCloud() && (rand(1, 100) % 1 === 0);
|
|
}
|
|
|
|
public static function getDcloudTimerInternalHostname($targetAppName = '') {
|
|
$appName = $targetAppName ?: Zc::C('appName');
|
|
switch ($appName) {
|
|
case self::appMsPdd:
|
|
return '100.65.128.217:11002';
|
|
case self::appMsPddOd:
|
|
return '100.65.128.159:10831';
|
|
case self::appMsPddSp:
|
|
if (self::isPreEnv()) {
|
|
return '100.65.129.36:10198';
|
|
}
|
|
return '100.65.129.34:10189';
|
|
case self::appPddDzOd:
|
|
return '100.65.128.162:10851';
|
|
case self::appMsPddOp:
|
|
if (self::isPreEnv()) {
|
|
return '100.65.129.31:10184';
|
|
}
|
|
return '100.65.129.29:10166';
|
|
case self::appPddDz:
|
|
if (self::isPreEnv()) {
|
|
return '100.65.128.176:10889';
|
|
}
|
|
return '100.65.128.157:10812';
|
|
case self::appPddDzSp:
|
|
if (self::isPreEnv()) {
|
|
return '100.65.129.58:10233';
|
|
}
|
|
return '100.65.129.56:10231';
|
|
case self::appPddDzSh:
|
|
if (self::isPreEnv()) {
|
|
return '100.65.129.48:10221';
|
|
}
|
|
return '100.65.129.46:10219';
|
|
case self::appPddDzOp:
|
|
if (self::isPreEnv()) {
|
|
return '100.65.129.53:10227';
|
|
}
|
|
return '100.65.129.51:10225';
|
|
case self::appPddOpRuby:
|
|
if (self::isPreEnv()) {
|
|
return '100.65.130.30:10312';
|
|
}
|
|
return '100.65.130.31:10313';
|
|
}
|
|
}
|
|
|
|
public static function isPreEnv() {
|
|
$appName = Zc::C('appName');
|
|
switch ($appName) {
|
|
case self::appMsPdd:
|
|
case self::appPddDzSh:
|
|
return (stripos(gethostname(), '-pre') !== false) || (stripos($_SERVER['HTTP_HOST'], 'pre-dc.') !== false);
|
|
case self::appMsPddSp:
|
|
return (stripos(gethostname(), '-pre') !== false) || (stripos($_SERVER['HTTP_HOST'], 'pre-cpdd-sp.') !== false) || (stripos($_SERVER['HTTP_HOST'], '100.65.129.36:10198') !== false);
|
|
case self::appMsPddOp:
|
|
return (stripos(gethostname(), '-pre') !== false) || (stripos($_SERVER['HTTP_HOST'], 'pre-pdd-op') !== false) || (stripos($_SERVER['HTTP_HOST'], '100.65.129.31:10184') !== false);
|
|
case self::appMsPddOd:
|
|
return (stripos(gethostname(), '-pre') !== false) || (stripos($_SERVER['HTTP_HOST'], 'pre-pdd-od') !== false) || (stripos($_SERVER['HTTP_HOST'], '100.65.128.165:10859') !== false);
|
|
case self::appPddDz:
|
|
return (stripos(gethostname(), '-pre') !== false) || (stripos($_SERVER['HTTP_HOST'], 'pre-dcpdddz') !== false) || (stripos($_SERVER['HTTP_HOST'], '100.65.128.176:10889') !== false);
|
|
case self::appPddDzSp:
|
|
return (stripos(gethostname(), '-pre') !== false) || (stripos($_SERVER['HTTP_HOST'], 'pre-dcpdddz-sp') !== false) || (stripos($_SERVER['HTTP_HOST'], '100.65.129.58:10233') !== false);
|
|
case self::appPddDzOp:
|
|
return (stripos(gethostname(), '-pre') !== false) || (stripos($_SERVER['HTTP_HOST'], 'pre-dcpdddz-op') !== false) || (stripos($_SERVER['HTTP_HOST'], '100.65.129.53:10227') !== false);
|
|
case self::appPddDzOd:
|
|
return (stripos(gethostname(), '-pre') !== false) || (stripos($_SERVER['HTTP_HOST'], 'pre-dcpdddz-od') !== false) || (stripos($_SERVER['HTTP_HOST'], '100.65.128.179:10897') !== false);
|
|
case self::appPddRuby:
|
|
return (stripos(gethostname(), '-pre') !== false) || (stripos($_SERVER['HTTP_HOST'], 'pre-dc-ruby-pdd') !== false) || (stripos($_SERVER['HTTP_HOST'], '100.65.130.33:10314') !== false);
|
|
case self::appPddOpRuby:
|
|
return (stripos(gethostname(), '-pre') !== false) || (stripos($_SERVER['HTTP_HOST'], 'pre-dc-op-pdd') !== false) || (stripos($_SERVER['HTTP_HOST'], '100.65.130.30:10312') !== false);
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public static function isOpenDcloudOss() {
|
|
if (AppConst::isPddDzJxcApp() || AppConst::isPddMsSpApp() || AppConst::isPddDzSpApp() || AppConst::isPddDzShApp() || AppConst::isPddMsOpApp() || AppConst::isPddDzOpApp()
|
|
|| AppConst::isPddRubyApp() || AppConst::isPddOpRubyApp() || AppConst::isPddTaoBaiKeApp()) {
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
public static function getOrderDtsConf() {
|
|
$appName = Zc::C('appName');
|
|
switch ($appName) {
|
|
case self::appMsPddOd:
|
|
return [
|
|
'rdsId' => 'B5ADC0597BCE9539',
|
|
'historyDays' => 7,
|
|
];
|
|
}
|
|
|
|
return [];
|
|
}
|
|
|
|
public static function isRsyncOrderFromDb() {
|
|
if (!AppConst::isPddMsOdApp()) {
|
|
return false;
|
|
}
|
|
if (Zc::C('env') == 'live') {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public static function isRsyncOrderUseBasicApi() {
|
|
return AppConst::isPddMsShApp() || AppConst::isPddDzShApp();
|
|
}
|
|
|
|
public static function isRunInMsDz() {
|
|
if (stripos(gethostname(), 'ay-msdz-') === 0) {
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
public static function getAppGateHost($targetAppName, $isDdcDomain = true, $isIntraDomain = true, $isDdcMcDomain = false) {
|
|
$hostname = gethostname();
|
|
switch ($targetAppName) {
|
|
case self::appMsPdd:
|
|
if ($isIntraDomain) {
|
|
$host = Zc::C('multi.crawler.domain');
|
|
} else {
|
|
$host = AppConst::isPreEnv() ? 'mc-pdd-pre.chengji-inc.com' : 'mc-pdd.chengji-inc.com';
|
|
}
|
|
break;
|
|
case self::appMsPddOd:
|
|
$host = self::isPreEnv() ? 'pre-pdd-od.chengji-inc.com' : 'pdd-od.chengji-inc.com';
|
|
break;
|
|
case self::appMsPddSp:
|
|
$host = self::isPreEnv() ? 'pre-cpdd-sp.chengji-inc.com' : 'cpdd-sp.chengji-inc.com';
|
|
break;
|
|
case self::appMsPddOp:
|
|
$host = self::isPreEnv() ? 'pre-pdd-op.chengji-inc.com' : 'pdd-op.chengji-inc.com';
|
|
break;
|
|
case self::appPddDz:
|
|
$host = self::isPreEnv() ? 'pre-dcpdddz.jiancent.com' : 'dcpdddz.jiancent.com';
|
|
break;
|
|
case self::appPddDzSh:
|
|
if ($isDdcDomain) {
|
|
if (self::isPreEnv()) {
|
|
$host = 'pre-dc.sh.pdddz.jiancent.com';
|
|
} else {
|
|
if ($isDdcMcDomain) {
|
|
$host = 'mc-dc.sh.pdddz.jiancent.com';
|
|
} else {
|
|
$host = 'dc.sh.pdddz.jiancent.com';
|
|
}
|
|
}
|
|
} else {
|
|
if ($isIntraDomain) {
|
|
$host = Zc::C('multi.crawler.pdddzsh.domain');
|
|
} else {
|
|
$host = self::isPreEnv() ? 'mc-pdddz-pre.jiancent.com' : 'mc-pdddz.jiancent.com';
|
|
}
|
|
}
|
|
break;
|
|
case self::appPddDzSp:
|
|
if (self::isDuoDuoCloud()) {
|
|
$host = self::getDcloudTimerInternalHostname($targetAppName);
|
|
} else {
|
|
$host = self::isPreEnv() ? 'pre-dcpdddz-sp.jiancent.com' : 'dcpdddz-sp.jiancent.com';
|
|
}
|
|
break;
|
|
case self::appPddDzOd:
|
|
$host = self::isPreEnv() ? 'pre-dcpdddz-od.jiancent.com' : 'dcpdddz-od.jiancent.com';
|
|
break;
|
|
case self::appPddDzOp:
|
|
$host = self::isPreEnv() ? 'pre-dcpdddz-op.jiancent.com' : 'dcpdddz-op.jiancent.com';
|
|
break;
|
|
case self::appPddRuby:
|
|
if ($isDdcDomain) {
|
|
$host = self::isPreEnv() ? 'pre-dc-ruby-pdd.ry-inc.com' : 'dc-ruby-pdd.ry-inc.com';
|
|
} else {
|
|
$host = self::isPreEnv() ? 'mc-ruby-pdd-pre.ry-inc.com' : 'mc-ruby-pdd.ry-inc.com';
|
|
}
|
|
break;
|
|
case self::appPddOpRuby:
|
|
if ($isDdcDomain) {
|
|
$host = self::isPreEnv() ? 'pre-dc-op-pdd.ry-inc.com' : 'dc-op-pdd.ry-inc.com';
|
|
} else {
|
|
$host = self::isPreEnv() ? 'mc-ruby-pdd-pre.ry-inc.com' : 'mc-ruby-pdd.ry-inc.com';//打单没有mc
|
|
}
|
|
break;
|
|
case self::appPddTaoBaiKe:
|
|
$host = self::isPreEnv() ? 'pre-dc-pdd-od.baikexm.com' : 'dc-pdd-od.baikexm.com';
|
|
break;
|
|
default:
|
|
$host = false;
|
|
}
|
|
|
|
return $host;
|
|
}
|
|
|
|
public static function getCurProtocol() {
|
|
$notNeedHttpsApps = [
|
|
self::appPddAgate,
|
|
self::appPddRuby,
|
|
self::appPddTaoBaiKe,
|
|
self::appPddOpRuby,
|
|
];
|
|
if (!in_array(Zc::C('appName'), $notNeedHttpsApps) && (Zc::C('env') == 'live')) {
|
|
return 'https';
|
|
}
|
|
|
|
return ZcUrlHelper::getProtocol();
|
|
}
|
|
|
|
public static function isAgateWeb() {
|
|
$isWeb = !AppConst::checkIsDesktop();
|
|
return AppConst::isPddAgateApp() && $isWeb;
|
|
}
|
|
|
|
public static function isRubyWeb() {
|
|
return AppConst::isPddRubyApp() && !AppConst::checkIsDesktop();
|
|
}
|
|
|
|
public static function isRubyDesktop() {
|
|
return AppConst::isPddRubyApp() && AppConst::checkIsDesktop();
|
|
}
|
|
|
|
public static function isUseAppModuleApp() {
|
|
return in_array(Zc::C('appName'), [self::appPddDz, self::appPddRuby, self::appMsPddOd]);
|
|
}
|
|
|
|
public static function isNeedCheckSubAccountPermission() {
|
|
return in_array(Zc::C('appName'), [self::appMsPddOd, self::appPddDzOd, self::appMsPddOp, self::appPddDzOp]);
|
|
}
|
|
|
|
public static function isDuringActiveTime() {
|
|
$nowTime = date('Y-m-d H:i:s');
|
|
return ($nowTime >= '2022-02-24 00:00:00') && ($nowTime <= '2022-02-27 23:59:59');
|
|
}
|
|
|
|
public static function isSupportDsApp () {
|
|
return in_array(Zc::C('appName'), [self::appMsPddOd]);
|
|
}
|
|
|
|
public static function isPre() {
|
|
if (Zc::C('env') == 'live') {
|
|
return (false !== strpos(gethostname(), '-pre'));
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public static function getEnv() {
|
|
return Zc::C('env');
|
|
}
|
|
|
|
public static function isLiveEnv() {
|
|
return self::getEnv() === 'live';
|
|
}
|
|
|
|
public static function isUseDsApiMap() {
|
|
return !self::isShAppCategory() && self::isLiveEnv();
|
|
}
|
|
|
|
public static function getJfPlatformByAppPlatform($appPlatform = null)
|
|
{
|
|
if (empty($appPlatform)) {
|
|
$appPlatform = self::getAppName();
|
|
}
|
|
|
|
switch ($appPlatform) {
|
|
case self::appMsPdd:
|
|
$jfPlatform = \JxJflowClient\lib\AuthApiConst::platformPddMs;
|
|
break;
|
|
case self::appMsPddOd:
|
|
$jfPlatform = \JxJflowClient\lib\AuthApiConst::platformPddMsOrder;
|
|
break;
|
|
case self::appMsPddSp:
|
|
$jfPlatform = \JxJflowClient\lib\AuthApiConst::platformPddMsSp;
|
|
break;
|
|
case self::appMsPddOp:
|
|
$jfPlatform = \JxJflowClient\lib\AuthApiConst::platformPddMsOp;
|
|
break;
|
|
case self::appMsPddOpEbill:
|
|
$jfPlatform = \JxJflowClient\lib\AuthApiConst::platformPddMsOpEbill;
|
|
break;
|
|
case self::appPddDz:
|
|
$jfPlatform = \JxJflowClient\lib\AuthApiConst::platformPddDz;
|
|
break;
|
|
case self::appPddDzSh:
|
|
$jfPlatform = \JxJflowClient\lib\AuthApiConst::platformPddDzSh;
|
|
break;
|
|
case self::appPddDzOd:
|
|
$jfPlatform = \JxJflowClient\lib\AuthApiConst::platformPddDzOd;
|
|
break;
|
|
case self::appPddDzSp:
|
|
$jfPlatform = \JxJflowClient\lib\AuthApiConst::platformPddDzSp;
|
|
break;
|
|
case self::appPddDzOp:
|
|
$jfPlatform = \JxJflowClient\lib\AuthApiConst::platformPddDzOp;
|
|
break;
|
|
case self::appPddRuby:
|
|
$jfPlatform = \JxJflowClient\lib\AuthApiConst::platformPddRuby;
|
|
break;
|
|
case self::appPddTaoBaiKe:
|
|
$jfPlatform = \JxJflowClient\lib\AuthApiConst::platformPddTaoBaiKe;
|
|
break;
|
|
case self::appPddOpRuby:
|
|
$jfPlatform = \JxJflowClient\lib\AuthApiConst::platformPddOpRuby;
|
|
break;
|
|
default:
|
|
$jfPlatform = \JxJflowClient\lib\AuthApiConst::platformOrder;
|
|
break;
|
|
}
|
|
|
|
return $jfPlatform;
|
|
}
|
|
|
|
public static function getLoginClientMap() {
|
|
return [
|
|
self::loginClientMobile => '移动端',
|
|
self::loginClientPc => 'pc端',
|
|
];
|
|
}
|
|
|
|
public static function isSupportDs() {
|
|
return in_array(Zc::C('appName'), [self::appMsPddOd]);
|
|
}
|
|
|
|
const dsApiVersion = 1.0;
|
|
}
|