<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Shop\Support; use Carbon\Carbon; abstract class BaseOrderWorker { public $orderWorker; public $order; public $orderGoods; private $lastResult; public abstract function run(); public function setLastResult($l_bLV) { $this->lastResult = $l_bLV; } public function markRunning() { $this->markStatus(OrderWorkerStatus::RUNNING); } public function markFailed() { $this->markStatus(OrderWorkerStatus::FAILED); } public function markCompleted() { $this->markStatus(OrderWorkerStatus::COMPLETED); } public function saveLastResult() { $this->orderWorker = ModelUtil::update('order_worker', array('id' => $this->orderWorker['id']), array('lastResult' => $this->lastResult)); } private function markStatus($Zz43T) { if (empty($this->orderWorker)) { throw new \Exception('OrderWorker empty'); } $this->orderWorker = ModelUtil::update('order_worker', array('id' => $this->orderWorker['id']), array('status' => $Zz43T, 'runTime' => Carbon::now())); } }