初始化项目:添加后端代码、ThinkPHP框架、前端资源
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
<?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';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user