Browse Source

ssdb恢复task。恢复自动取消订单。

master
weigang 5 years ago
parent
commit
49bd95679e
  1. 6
      app/Crontab/AutoCancelOrder.php
  2. 2
      app/Libs/SimpleSSDB.php
  3. 5
      app/Service/v3/Implementations/OrderOnlineService.php
  4. 4
      app/TaskWorker/SSDBTask.php

6
app/Crontab/AutoCancelOrder.php

@ -6,9 +6,9 @@ use App\Service\v3\Interfaces\OrderOnlineServiceInterface;
use Hyperf\Crontab\Annotation\Crontab; use Hyperf\Crontab\Annotation\Crontab;
use Hyperf\Di\Annotation\Inject; use Hyperf\Di\Annotation\Inject;
// /**
// * @Crontab(name="autocancelorder", rule="*\/1 * * * *", callback="execute", memo="自定取消15分钟过期订单")
// */
/**
* @Crontab(name="autocancelorder", rule="*\/10 * * * * *", callback="execute", memo="自定取消15分钟过期订单")
*/
class AutoCancelOrder class AutoCancelOrder
{ {
/** /**

2
app/Libs/SimpleSSDB.php

@ -26,7 +26,7 @@ class SSDBTimeoutException extends SSDBException
*/ */
class SimpleSSDB extends SSDB class SimpleSSDB extends SSDB
{ {
function __construct($host, $port, $timeout_ms=2000){
function __construct($host, $port, $timeout_ms=10000){
parent::__construct($host, $port, $timeout_ms); parent::__construct($host, $port, $timeout_ms);
$this->easy(); $this->easy();
} }

5
app/Service/v3/Implementations/OrderOnlineService.php

@ -683,8 +683,9 @@ class OrderOnlineService implements OrderOnlineServiceInterface
try { try {
$orderMains = OrderMain::query() $orderMains = OrderMain::query()
->where(['state' => OrderState::UNPAID])
->where('created_at', '<', time()-900)
->where(['state' => OrderState::UNPAID, 'type' => OrderType::ONLINE])
->where('created_at', '<', time()-600)
->orderBy('created_at', 'asc')
->limit(100) ->limit(100)
->get(); ->get();

4
app/TaskWorker/SSDBTask.php

@ -13,7 +13,9 @@ class SSDBTask
*/ */
public $ss = null; public $ss = null;
/**
* @Task
*/
public function exec($method,...$args) public function exec($method,...$args)
{ {
$result = $this->client()->__call($method,$args); $result = $this->client()->__call($method,$args);

Loading…
Cancel
Save