作者 耿培杰

添加自动收货定时器

... ... @@ -103,6 +103,11 @@ class OrderDetail extends Backend
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
$row->validateFailException(true)->validate($validate);
}
if (!$row['receivingtime']){
$date = explode('-',date('Y-m-d',strtotime('+ 15day')));
$time = mktime(23,59,00,$date[1],$date[2],$date[0]);
$params['receivingtime'] = $time;
}
$params['status'] = 3;
$result = $row->allowField(true)->save($params);
Db::commit();
... ...
... ... @@ -2,6 +2,7 @@
namespace app\api\controller;
use app\api\model\OrderDetail;
use app\api\model\TeamGroup;
use app\api\model\Ticket;
use app\api\model\UserTicket;
... ... @@ -19,6 +20,19 @@ use think\Config;
class Timing extends Api
{
/**
* @ApiTitle (自动收货)
* @ApiSummary (自动收货 每天执行)
* @ApiMethod (POST)
* @ApiRoute (/api/Timing/automaticReceiving)
* @ApiReturn({
})
*/
public function automaticReceiving(){
$model = new OrderDetail();
$model->where(['status'=>3,'receivingtime'=>['<',time()]])->update(['status'=>4]);
}
/**
* @ApiTitle (修改用户会员状态)
* @ApiSummary (修改用户会员状态 每天执行)
* @ApiMethod (POST)
... ...