Commit 61a8ef93 authored by 万继龙's avatar 万继龙

Merge branch 'develop' into 'test'

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

See merge request bp/pay!16
parents 98d04de9 744c36fd
......@@ -2,6 +2,7 @@
use App\Base\Base;
use App\Models\order\mysql\PayOrderItem;
use App\Services\pay\PayService;
use App\Services\refund\RefundService;
use App\Models\order\mysql\CallbackLog;
......@@ -64,4 +65,32 @@ class CallbackController extends Base
$ret = $refundSrv->call_back($data);
$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
'app_id'=>'merchant-c',
'environ'=>Application::app()->environ(),
'order_id'=>$order_id,
'goods_sku_id'=>[],
'goods'=>[],
'order_item_id'=>[],
];
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']);
}
......
......@@ -15,11 +15,12 @@ class Wallet implements DaemonServiceInterface
{
$where['can_notify_account'] = 1;
$where['notify_account_times[<]'] = 5;
$where['can_notify_account_time[>]'] = time() - 86400;
$where['ORDER'] = 'can_notify_account_time ASC';
$where['can_notify_account_time[>]'] = date('Y-m-d', time() - 3 * 86400);
$where['ORDER'] = ['can_notify_account_time'=>'ASC'];
$where['LIMIT'] = [0, 50];
$list = PayOrderItem::selectMaster('*', $where);
$payService = new PayService();
foreach ($list as $row) {
$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