|
|
@@ -388,14 +388,6 @@ class ShopController extends BaseController {
|
|
|
|
|
|
return http_response_code(200);
|
|
|
} else {
|
|
|
- // 发送预警通知
|
|
|
- $alarm = [
|
|
|
- 'stance' => 5,
|
|
|
- 'brand' => 'MSG',
|
|
|
- 'message' => sprintf('跨境商品支付回调失败. 订单号[%s], error[%s]', $oderSn, json_encode($formModel->getErrors())),
|
|
|
- ];
|
|
|
- Alarm::reportAlarm($alarm);
|
|
|
-
|
|
|
LoggerTool::error(Form::formatErrorsForApi($formModel->getErrors()));
|
|
|
return http_response_code(500);
|
|
|
}
|
|
|
@@ -513,14 +505,12 @@ class ShopController extends BaseController {
|
|
|
*/
|
|
|
public function actionLogisticsAuto()
|
|
|
{
|
|
|
-// $createdAtStart = strtotime('yesterday');
|
|
|
$createdAtEnd = strtotime(date('Y-m-d')) - 1;
|
|
|
// 早0点推送,前一天0-24点的订单
|
|
|
$orderList = Order::find()
|
|
|
->where(
|
|
|
'(CREATED_AT <= :CREATED_AT_END) AND STATUS=:STATUS AND SEND_AT=:SEND_AT AND PAY_TYPE=:PAY_TYPE AND IS_DELETE = 0',
|
|
|
[
|
|
|
-// ':CREATED_AT_START' => $createdAtStart,
|
|
|
':CREATED_AT_END' => $createdAtEnd,
|
|
|
':STATUS' => \Yii::$app->params['orderStatus']['paid']['value'],
|
|
|
':SEND_AT' => 0,
|
|
|
@@ -531,9 +521,9 @@ class ShopController extends BaseController {
|
|
|
->all();
|
|
|
|
|
|
if (!$orderList) {
|
|
|
- LoggerTool::info(['跨境商品推送淘布斯系统终止,原因:无订单', $createdAtEnd]);
|
|
|
// 发送预警通知
|
|
|
$alarm = [
|
|
|
+ 'stance' => 2,
|
|
|
'brand' => 'MSG',
|
|
|
'message' => '跨境商品推送淘布斯系统终止,原因:无订单',
|
|
|
];
|
|
|
@@ -555,7 +545,6 @@ class ShopController extends BaseController {
|
|
|
} else {
|
|
|
// 记录推送结果
|
|
|
$orderSnFailed[] = $order['SN'];
|
|
|
- LoggerTool::error(sprintf('跨境商品推送淘布斯系统失败. 订单号[%s], error[%s]', $order['SN'], $response));
|
|
|
// 发送预警通知
|
|
|
$alarm = [
|
|
|
'stance' => 5,
|
|
|
@@ -566,20 +555,25 @@ class ShopController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ $notify = '跨境商品推送淘布斯系统结束. ';
|
|
|
// 更新db中订单推送成功状态
|
|
|
if (count($orderSnSuccess) > 0) {
|
|
|
$orderSnSuccessIds = implode("','", $orderSnSuccess);
|
|
|
Order::updateAll(['SEND_AT' => time()], "SN IN ('" . $orderSnSuccessIds . "')");
|
|
|
+ $notify .= sprintf('成功订单数{%d}, 订单号[%s];', count($orderSnSuccess), implode(', ', $orderSnSuccess));
|
|
|
+ }
|
|
|
+ if (count($orderSnFailed) > 0) {
|
|
|
+ $notify .= sprintf('失败订单数{%d}, 订单号[%s]', count($orderSnFailed), implode(', ', $orderSnFailed));
|
|
|
}
|
|
|
|
|
|
// 发送预警通知
|
|
|
$alarm = [
|
|
|
'stance' => 2,
|
|
|
'brand' => 'MSG',
|
|
|
- 'message' => sprintf('跨境商品推送淘布斯系统结束. 成功订单数{%d}, 订单号[%s]; 失败订单数{%d}, 订单号[%s]', count($orderSnSuccess), implode(', ', $orderSnSuccess), count($orderSnFailed), implode(', ', $orderSnFailed)),
|
|
|
+ 'message' => $notify,
|
|
|
];
|
|
|
Alarm::reportAlarm($alarm);
|
|
|
|
|
|
- return static::notice(sprintf('跨境商品推送淘布斯系统结束. 成功订单数{%d}, 订单号[%s]; 失败订单数{%d}, 订单号[%s]', count($orderSnSuccess), implode(', ', $orderSnSuccess), count($orderSnFailed), implode(', ', $orderSnFailed)));
|
|
|
+ return static::notice($notify);
|
|
|
}
|
|
|
}
|