<?php


namespace Daemon;


use Api\PhpServices\Daemon\DaemonServiceInterface;
use App\Models\marketing\mysql\Marketing as MarketingDao;
use Api\PhpUtils\Log\DaemonLog;
class Marketing implements DaemonServiceInterface
{
  
    public function run()
    {
        sleep(2);
        $orderData = [
            'online_status' => 1,
            'end_time[<]' => date("Y-m-d H:i:s",time()),
            'LIMIT' => 100,
        ];
        $orderInfoList = MarketingDao::getMarketingList($orderData);
        DaemonLog::info('DaemonServiceInterface_marketing', json_encode($orderInfoList));
        foreach ($orderInfoList as $key => $value) {
            $where = [];
            $where['marketing_id'] = !empty($value['marketing_id']) ? $value['marketing_id'] : '';
            $colums = [
                'online_status' => 3,
            ];  
            MarketingDao::updateRecord($colums, $where);
        }
    }


}