修改任务

This commit is contained in:
邹景立 2021-06-17 13:27:51 +08:00
parent 19eadbcbad
commit 1eaff7a50b
2 changed files with 6 additions and 10 deletions

View File

@ -41,9 +41,7 @@ class OrderClean extends Command
private function _autoCancelOrder()
{
try {
$map = [];
$map[] = ['status', '<', 3];
$map[] = ['payment_status', '=', 0];
$map = [['status', '<', 3], ['payment_status', '=', 0]];
$map[] = ['create_at', '<', date('Y-m-d H:i:s', strtotime('-30 minutes'))];
[$total, $count] = [$this->app->db->name('ShopOrder')->where($map)->count(), 0];
$this->app->db->name('ShopOrder')->where($map)->select()->map(function ($item) use ($total, &$count) {
@ -69,9 +67,7 @@ class OrderClean extends Command
private function _autoRemoveOrder()
{
try {
$map = [];
$map[] = ['status', '=', 0];
$map[] = ['payment_status', '=', 0];
$map = [['status', '=', 0], ['payment_status', '=', 0]];
$map[] = ['create_at', '<', date('Y-m-d H:i:s', strtotime('-3 days'))];
[$total, $count] = [$this->app->db->name('ShopOrder')->where($map)->count(), 0];
foreach ($this->app->db->name('ShopOrder')->where($map)->cursor() as $item) {

View File

@ -20,7 +20,7 @@ class UserAgent extends Command
$this->setName('xdata:UserAgent');
$this->addArgument('uuid', Argument::OPTIONAL, '目标用户', '');
$this->addArgument('puid', Argument::OPTIONAL, '上级代理', '');
$this->setDescription('重新设置用户上级代理, 参数:uuid puid');
$this->setDescription('重新设置用户上级代理, 参数:UUID PUID');
}
/**
@ -34,16 +34,16 @@ class UserAgent extends Command
*/
protected function execute(Input $input, Output $output)
{
[$uuid, $pid] = [$input->getArgument('uuid'), $input->getArgument('pid')];
[$uuid, $puid] = [$input->getArgument('uuid'), $input->getArgument('puid')];
if (empty($uuid)) $this->setQueueError("参数UID无效请传入正确的参数!");
if (empty($pid)) $this->setQueueError("参数PID无效请传入正确的参数!");
if (empty($puid)) $this->setQueueError("参数PID无效请传入正确的参数!");
// 检查当前用户资料
$user = $this->app->db->name('DataUser')->where(['id' => $uuid])->find();
if (empty($user)) $this->setQueueError("读取用户数据失败!");
// 检查上级代理用户
$parant = $this->app->db->name('DataUser')->where(['id' => $pid])->find();
$parant = $this->app->db->name('DataUser')->where(['id' => $puid])->find();
if (empty($parant)) $this->setQueueError('读取代理数据失败!');
// 检查异常关系处理