Load.php
783 字节
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2020/5/25
* Time: 14:10
*/
namespace app\index\controller;
use app\common\controller\Frontend;
use app\index\model\OrderDetail;
use think\Db;
/**
* 定时任务
* Class Load
* @package app\index\controller
*/
class Load extends Frontend
{
/**
* 待收货15天后自动改为已收货
*/
public function index(){
$orderDetailModel = new OrderDetail();
$data = $orderDetailModel->where(['status'=>'3']);
$ids = [];
foreach($data as $key => $vo){
if($vo['deliverytime']*15*24*60*60 >= time()){
$ids[] = $vo['id'];
}
}
Db::name('order_detail')->where(['id'=>['in',$ids]])->update(['status'=>'6']);
}
}