Files
amb_wechatapp/application/callback/controller/app/physical/Physical.php
T

41 lines
1.4 KiB
PHP

<?php
namespace app\callback\controller\app\physical;
/**
* 实物商品订单
*/
class Physical
{
/**
* 实物商品自动确认收货
* @return bool
*/
public function autoConfirmReceive()
{
$physicalConfig = \app\common\model\app\Config::getConfig('physical');
$autoConfirmDays = $physicalConfig['auto_confirm_days'] ?? 7;
$showSales = $physicalConfig['show_sales'] ?? 1;
$autoConfirmTime = $autoConfirmDays * 86400;
$orderModel = new \app\admin\model\order\Order;
$list = $orderModel->where([
'order_type' => 'physical',
'status' => \app\common\constant\order\Status::STATUS_UNRECEIVE,
'createtime' => ['<', time() - $autoConfirmTime]
])->field(['id', 'order_no'])->select();
foreach ($list as $item) {
$orderModel->where([
'id' => $item['id']
])->update([
'status' => \app\common\constant\order\Status::STATUS_SUCCESS
]);
\app\common\model\order\Log::set($item['id'], "系统自动确认收货");
}
return 'ok';
}
}