|
|
<?php
|
|
|
|
|
|
class DsAppTool {
|
|
|
|
|
|
public static function getDsApiFailReason($reason, $memberAuthUrl) {
|
|
|
$newReason = $reason;
|
|
|
|
|
|
if (stripos($reason, 'authorized') !== false) {
|
|
|
$newReason = sprintf('【%s】授权已过期,请重新授权,<a href="%s" target="_blank" class="btn btn-sm btn-warning"><b>立即授权</b></a>', DsConst::getDsAppChineseName(), $memberAuthUrl);
|
|
|
}
|
|
|
|
|
|
if (stripos($reason, '已下架') !== false) {
|
|
|
$newReason = '1688商品已下架,请更换货源后采购';
|
|
|
}
|
|
|
|
|
|
if (stripos($reason, '已删除') !== false) {
|
|
|
$newReason = '1688商品已删除,请更换货源后采购';
|
|
|
}
|
|
|
|
|
|
return $newReason;
|
|
|
}
|
|
|
|
|
|
|
|
|
public static function rebuildCheckDsAppAuthExpireRet($ret, $loginUserId) {
|
|
|
$ret['loginUserId'] = $loginUserId;
|
|
|
$memberAuthUrl = $ret['memberAuthUrl'];
|
|
|
|
|
|
foreach ($ret['userIdAndCheckRetMap'] as $userId => &$checkRet) {
|
|
|
if (CommonTool::isSuccessRet($checkRet)) {
|
|
|
continue;
|
|
|
}
|
|
|
if ($checkRet['code'] == DsConst::authExpireTypeOrderExpire) {
|
|
|
$checkRet['solution'] = sprintf('1688%s已过期,为了避免影响正常发货和使用,请<a target="_blank" href="%s">重新订购</a>', DsConst::getDsAppChineseName(), DsConst::getDsAppServiceMarketUrl());
|
|
|
$checkRet['tip'] = sprintf('1688%s订购过期,为了避免影响正常发货和使用,请<a target="_blank" href="%s">先去订购</a>', DsConst::getDsAppChineseName(), DsConst::getDsAppServiceMarketUrl());
|
|
|
} elseif ($checkRet['code'] == DsConst::authExpireTypeAuthExpire) {
|
|
|
$checkRet['solution'] = sprintf('1688%s授权失效,为了避免影响正常发货和使用,请<a target="_blank" href="%s">重新授权</a>', DsConst::getDsAppChineseName(), $memberAuthUrl);
|
|
|
$checkRet['tip'] = sprintf('1688%s授权失效,为了避免影响正常发货和使用,请<a target="_blank" href="%s">重新授权</a>', DsConst::getDsAppChineseName(), $memberAuthUrl);
|
|
|
} else {
|
|
|
$checkRet['solution'] = $checkRet['reason'];
|
|
|
}
|
|
|
}
|
|
|
unset($checkRet);
|
|
|
|
|
|
return $ret;
|
|
|
}
|
|
|
} |