Commit 744c36fd authored by wanjilong's avatar wanjilong

add: 修复守护程序,增加处理工具

parent 951b3afe
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
use App\Base\Base; use App\Base\Base;
use App\Models\order\mysql\PayOrderItem;
use App\Services\pay\PayService; use App\Services\pay\PayService;
use App\Services\refund\RefundService; use App\Services\refund\RefundService;
use App\Models\order\mysql\CallbackLog; use App\Models\order\mysql\CallbackLog;
...@@ -64,4 +65,32 @@ class CallbackController extends Base ...@@ -64,4 +65,32 @@ class CallbackController extends Base
$ret = $refundSrv->call_back($data); $ret = $refundSrv->call_back($data);
$this->success(['result'=>$ret]); $this->success(['result'=>$ret]);
} }
public function daemonAction() {
$params = $this->params;
$date = $params['date'] ?? date('Y-m-d');
$timestamp = strtotime($date);
$start = date('Y-m-d', $timestamp);
$end = date('Y-m-d', $timestamp + 86400);
$where['can_notify_account'] = 1;
$where['notify_account_times[<]'] = 5;
$where['can_notify_account_time[<>]'] = [$start, $end];
$where['ORDER'] = ['can_notify_account_time'=>'ASC'];
$where['LIMIT'] = [0, 100];
$list = PayOrderItem::selectMaster('*', $where);
$payService = new PayService();
foreach ($list as $row) {
$payService->sync_account_wallet($row['order_item_id']);
}
$step = empty($list) ? 120 : 5;
$this->success(['result'=>$list, 'step'=>$step]);
}
} }
...@@ -53,11 +53,12 @@ class PayService ...@@ -53,11 +53,12 @@ class PayService
'app_id'=>'merchant-c', 'app_id'=>'merchant-c',
'environ'=>Application::app()->environ(), 'environ'=>Application::app()->environ(),
'order_id'=>$order_id, 'order_id'=>$order_id,
'goods_sku_id'=>[], 'goods'=>[],
'order_item_id'=>[], 'order_item_id'=>[],
]; ];
foreach ($data['result']['order_item_list'] as $item) { foreach ($data['result']['order_item_list'] as $item) {
array_push($metadata['goods_sku_id'], $item['goods_sku_id']);
$metadata['goods'][$item['goods_sku_id']] = $item['goods_num'];
array_push($metadata['order_item_id'], $item['order_item_id']); array_push($metadata['order_item_id'], $item['order_item_id']);
} }
......
...@@ -15,11 +15,12 @@ class Wallet implements DaemonServiceInterface ...@@ -15,11 +15,12 @@ class Wallet implements DaemonServiceInterface
{ {
$where['can_notify_account'] = 1; $where['can_notify_account'] = 1;
$where['notify_account_times[<]'] = 5; $where['notify_account_times[<]'] = 5;
$where['can_notify_account_time[>]'] = time() - 86400; $where['can_notify_account_time[>]'] = date('Y-m-d', time() - 3 * 86400);
$where['ORDER'] = 'can_notify_account_time ASC'; $where['ORDER'] = ['can_notify_account_time'=>'ASC'];
$where['LIMIT'] = [0, 50]; $where['LIMIT'] = [0, 50];
$list = PayOrderItem::selectMaster('*', $where); $list = PayOrderItem::selectMaster('*', $where);
$payService = new PayService(); $payService = new PayService();
foreach ($list as $row) { foreach ($list as $row) {
$payService->sync_account_wallet($row['order_item_id']); $payService->sync_account_wallet($row['order_item_id']);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment