pull/5/head
wanghousheng 4 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\UserAddress as UserAddessModel;
use cores\exception\BaseException;
use think\facade\Db;
/**
@ -116,8 +115,6 @@ class Order extends DealerOrderModel
$model = new static;
// 分销商基本设置
$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']) {
return false;
@ -128,7 +125,6 @@ class Order extends DealerOrderModel
if (!$dealerUser['first_user_id']) {
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'])) {
return false;

@ -14,6 +14,7 @@ namespace app\timer\controller\dealer;
use app\timer\controller\Controller;
use app\timer\service\dealer\Order as DealerOrderService;
use think\facade\Db;
/**
* 定时任务:商城订单
@ -26,7 +27,7 @@ class Order extends Controller
private string $taskKey = 'DealerOrder';
// 任务执行间隔时长 (单位:秒)
protected int $taskExpire = 5;
protected int $taskExpire = 60 * 30;
// 当前商城ID
private int $storeId;
@ -38,6 +39,8 @@ class Order extends Controller
public function handle(array $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 () {
echo $this->taskKey . PHP_EOL;
// 标记失效的分销订单

@ -13,10 +13,11 @@ declare (strict_types=1);
namespace app\timer\service\dealer;
use app\common\library\helper;
use app\common\service\BaseService;
use app\timer\library\Tools;
use app\timer\model\dealer\User as DealerUserModel;
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;
/**
@ -57,6 +58,8 @@ class Order extends BaseService
// 获取未结算的分销订单
$model = new DealerOrderModel;
$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);
// 记录日志

Loading…
Cancel
Save