订单任务调整

main
limu 11 months ago
parent 6964f16a1f
commit c4a78b46c8
  1. 42
      app/command/dayValue.php
  2. 2
      config/console.php
  3. 78
      config/partner.php
  4. 7
      crmeb/jobs/OrderPartnerJob.php

@ -0,0 +1,42 @@
<?php
declare (strict_types=1);
namespace app\command;
use Swoole\Coroutine\MySQL\Exception;
use think\console\Command;
use app\common\model\store\order\StoreOrderContribute;
use think\console\Input;
use think\console\input\Argument;
use think\console\input\Option;
use app\common\model\user\User as userModel;
use app\common\model\user\ValueContributionLog;
use app\common\model\store\product\Spu;
use app\common\model\store\order\StoreOrder;
use think\console\Output;
use think\event\RouteLoaded;
use think\exception\ValidateException;
use think\facade\Cache;
use think\facade\Db;
use think\facade\Route;
use app\common\repositories\system\auth\MenuRepository;
// /www/server/php/74/bin/php /server/wwwroot/crmeb/think dayValue
class dayValue extends Command
{
protected function configure()
{
// 指令配置
$this->setName('dayValue')
->addArgument('dayValue', Argument::OPTIONAL, 'php think menu [1] / [2]')
->setDescription('社区等级结算');
}
protected function execute(Input $input, Output $output)
{
}
}

@ -39,5 +39,7 @@ return [
'change:hotTop' => 'app\command\changeHotTop',
//各种积分转换
'brand' => 'app\command\brand',
//社区贡献值结算
'dayValue' => 'app\command\dayValue',
],
];

@ -16,21 +16,20 @@ return [
// 社区等级配置
'community_level' => [
[
'alias' => '星社区服务商 ',
'level_name' => 'S1',
'min_price' => '30000',
'alias' => '星社区服务商 ',
'level_name' => 'S7',
'min_price' => '100000000',
'pay_community' => '0.03',
],
[
'alias' => '二星社区服务商 ',
'level_name' => 'S2',
'min_price' => '300000',
], [
'alias' => '六星社区服务商 ',
'level_name' => 'S6',
'min_price' => '10000000',
'pay_community' => '0.03',
],
[
'alias' => '星社区服务商 ',
'level_name' => 'S3',
'min_price' => '100000',
'alias' => '星社区服务商 ',
'level_name' => 'S5',
'min_price' => '10000000',
'pay_community' => '0.03',
],
[
@ -38,46 +37,45 @@ return [
'level_name' => 'S4',
'min_price' => '3000000',
'pay_community' => '0.03',
],
[
'alias' => '五星社区服务商 ',
'level_name' => 'S5',
'min_price' => '10000000',
], [
'alias' => '三星社区服务商 ',
'level_name' => 'S3',
'min_price' => '100000',
'pay_community' => '0.03',
],
[
'alias' => '星社区服务商 ',
'level_name' => 'S6',
'min_price' => '10000000',
'alias' => '星社区服务商 ',
'level_name' => 'S2',
'min_price' => '300000',
'pay_community' => '0.03',
],
[
'alias' => '星社区服务商 ',
'level_name' => 'S7',
'min_price' => '100000000',
'alias' => '星社区服务商 ',
'level_name' => 'S1',
'min_price' => '30000',
'pay_community' => '0.03',
],
],
//品牌代理商等级配置
'brand_level' => [
[
'alias' => '品牌体验官',
'level_name' => 'B1',
'min_price' => '10000',
'alias' => '全球品牌代言人',
'level_name' => 'B7',
'min_price' => '1000000',
'pay_community' => '0.3',
'promotion_community' => '0.1'
],
[
'alias' => '品牌推荐官',
'level_name' => 'B2',
'min_price' => '30000',
'alias' => '亚太区品牌代言人',
'level_name' => 'B6',
'min_price' => '500000',
'pay_community' => '0.3',
'promotion_community' => '0.1'
],
[
'alias' => '品牌推广大使',
'level_name' => 'B3',
'min_price' => '50000',
'alias' => '中国区品牌代言人',
'level_name' => 'B5',
'min_price' => '300000',
'pay_community' => '0.3',
'promotion_community' => '0.1'
],
@ -89,23 +87,23 @@ return [
'promotion_community' => '0.1'
],
[
'alias' => '中国区品牌代言人',
'level_name' => 'B5',
'min_price' => '300000',
'alias' => '品牌推广大使',
'level_name' => 'B3',
'min_price' => '50000',
'pay_community' => '0.3',
'promotion_community' => '0.1'
],
[
'alias' => '亚太区品牌代言人',
'level_name' => 'B6',
'min_price' => '500000',
'alias' => '品牌推荐官',
'level_name' => 'B2',
'min_price' => '30000',
'pay_community' => '0.3',
'promotion_community' => '0.1'
],
[
'alias' => '全球品牌代言人',
'level_name' => 'B7',
'min_price' => '1000000',
'alias' => '品牌体验官',
'level_name' => 'B1',
'min_price' => '10000',
'pay_community' => '0.3',
'promotion_community' => '0.1'
],

@ -72,6 +72,7 @@ class OrderPartnerJob implements JobInterface
$mian_flowing = bcadd($mian_flowing, $prodcut_temp[$v['product_id']]['product_price'], 2);
$mian_rate = bcdiv($prodcut_temp[$v['product_id']]['product_price'], $data['pay_price'], 3);
$mian_price = bcmul($data['commission_rate'], $mian_rate, 2);
$mian_flowing = bcadd($mian_flowing, $mian_price, 2);
$mian_price = bcmul($mian_price, 0.667, 2);
$total_price = bcadd($total_price, $mian_price, 2);
}
@ -82,6 +83,7 @@ class OrderPartnerJob implements JobInterface
$ping_flowing = bcadd($ping_flowing, $prodcut_temp[$v['product_id']]['product_price'], 2);
$ping_rate = bcdiv($prodcut_temp[$v['product_id']]['product_price'], $data['pay_price'], 3);
$ping_price = bcmul($data['commission_rate'], $ping_rate, 2);
$ping_flowing = bcadd($ping_flowing, $ping_price, 2);
$ping_price = bcmul($ping_price, 0.667, 2);
$total_price = bcadd($total_price, $ping_price, 2);
}
@ -132,6 +134,8 @@ class OrderPartnerJob implements JobInterface
'street_id' => $address['street_id'] ?? '',
'created_time' => date('Y-m-d H:i:s'),
'baodan_liushui' => $bao_flowing,
'miandan_liushui' => $mian_flowing,
'ping_liushui' => $ping_flowing,
];
StoreOrderContribute::getDB()->insert($contribute_insert);
//订单角色贡献值-30%
@ -275,7 +279,7 @@ class OrderPartnerJob implements JobInterface
->where('is_area', 0)
->where('status', 1)
->select()->toArray();
$role_ids = array_column($common_roles, 'id', );
$role_ids = array_column($common_roles, 'id');
$common_trade_data = array_column($common_roles, null,'id');
$user_list = User::getDB()->alias('u')
->leftJoin('UserPartner p', 'u.uid = p.uid')
@ -310,6 +314,7 @@ class OrderPartnerJob implements JobInterface
//批量增加用户贡献值日志
ValueContributionLog::getDB()->insertAll($user_log_data);
//社区等级判断
echo 'ok';
} catch (\Exception $e) {
Log::info('订单角色贡献值处理失败; error : ' . $e->getMessage());

Loading…
Cancel
Save