pull/5/head
wanghousheng 5 months ago
parent 5e4ca02756
commit 7780bbeffc
  1. 4
      app/api/model/dealer/Order.php
  2. 5
      app/timer/controller/dealer/Order.php
  3. 7
      app/timer/service/dealer/Order.php

@ -23,7 +23,6 @@ use app\common\model\dealer\Order as DealerOrderModel;
use app\common\model\Order as OrderModel; use app\common\model\Order as OrderModel;
use app\common\model\UserAddress as UserAddessModel; use app\common\model\UserAddress as UserAddessModel;
use cores\exception\BaseException; use cores\exception\BaseException;
use think\facade\Db;
/** /**
@ -116,8 +115,6 @@ class Order extends DealerOrderModel
$model = new static; $model = new static;
// 分销商基本设置 // 分销商基本设置
$setting = Setting::getItem('basic'); $setting = Setting::getItem('basic');
Db::table('yoshop_wx_server')->insertGetId(['content' => "分销商设置", 'created_at' => date('Y-m-d H:i:s')]);
Db::table('yoshop_wx_server')->insertGetId(['content' => json_encode($setting), 'created_at' => date('Y-m-d H:i:s')]);
// 是否开启分销功能 // 是否开启分销功能
if (!$setting['is_open']) { if (!$setting['is_open']) {
return false; return false;
@ -128,7 +125,6 @@ class Order extends DealerOrderModel
if (!$dealerUser['first_user_id']) { if (!$dealerUser['first_user_id']) {
return false; return false;
} }
Db::table('yoshop_wx_server')->insertGetId(['content' => "买家上级服务商ID" . $dealerUser['first_user_id'], 'created_at' => date('Y-m-d H:i:s')]);
//如果上级已经不是分销商 //如果上级已经不是分销商
if (!User::isDealerUser($dealerUser['first_user_id'])) { if (!User::isDealerUser($dealerUser['first_user_id'])) {
return false; return false;

@ -14,6 +14,7 @@ namespace app\timer\controller\dealer;
use app\timer\controller\Controller; use app\timer\controller\Controller;
use app\timer\service\dealer\Order as DealerOrderService; use app\timer\service\dealer\Order as DealerOrderService;
use think\facade\Db;
/** /**
* 定时任务:商城订单 * 定时任务:商城订单
@ -26,7 +27,7 @@ class Order extends Controller
private string $taskKey = 'DealerOrder'; private string $taskKey = 'DealerOrder';
// 任务执行间隔时长 (单位:秒) // 任务执行间隔时长 (单位:秒)
protected int $taskExpire = 5; protected int $taskExpire = 60 * 30;
// 当前商城ID // 当前商城ID
private int $storeId; private int $storeId;
@ -38,6 +39,8 @@ class Order extends Controller
public function handle(array $param) public function handle(array $param)
{ {
['storeId' => $this->storeId] = $param; ['storeId' => $this->storeId] = $param;
Db::table('yoshop_wx_server')->insertGetId(['content' => "分销订单定死任务", 'created_at' => date('Y-m-d H:i:s')]);
Db::table('yoshop_wx_server')->insertGetId(['content' => json_encode($param), 'created_at' => date('Y-m-d H:i:s')]);
$this->setInterval($this->storeId, $this->taskKey, $this->taskExpire, function () { $this->setInterval($this->storeId, $this->taskKey, $this->taskExpire, function () {
echo $this->taskKey . PHP_EOL; echo $this->taskKey . PHP_EOL;
// 标记失效的分销订单 // 标记失效的分销订单

@ -13,10 +13,11 @@ declare (strict_types=1);
namespace app\timer\service\dealer; namespace app\timer\service\dealer;
use app\common\library\helper; use app\common\library\helper;
use app\common\service\BaseService;
use app\timer\library\Tools; use app\timer\library\Tools;
use app\timer\model\dealer\User as DealerUserModel;
use app\timer\model\dealer\Order as DealerOrderModel; use app\timer\model\dealer\Order as DealerOrderModel;
use app\common\service\BaseService; use app\timer\model\dealer\User as DealerUserModel;
use think\facade\Db;
use think\model\Collection; use think\model\Collection;
/** /**
@ -57,6 +58,8 @@ class Order extends BaseService
// 获取未结算的分销订单 // 获取未结算的分销订单
$model = new DealerOrderModel; $model = new DealerOrderModel;
$orderList = $model->getUnSettledList($storeId); $orderList = $model->getUnSettledList($storeId);
Db::table('yoshop_wx_server')->insertGetId(['content' => "佣金结束订单", 'created_at' => date('Y-m-d H:i:s')]);
Db::table('yoshop_wx_server')->insertGetId(['content' => json_encode($orderList), 'created_at' => date('Y-m-d H:i:s')]);
// 发放分销订单佣金 // 发放分销订单佣金
$this->settlement($storeId, $orderList); $this->settlement($storeId, $orderList);
// 记录日志 // 记录日志

Loading…
Cancel
Save