修改配置

This commit is contained in:
邹景立 2021-03-18 18:50:49 +08:00
parent 7cb50999de
commit bcc0f7156f
6 changed files with 29 additions and 15 deletions

View File

@ -3,23 +3,23 @@
namespace app\data\command;
use app\data\service\UserBalanceService;
use app\data\service\UserUpgradeService;
use app\data\service\UserRebateService;
use think\admin\Command;
use think\admin\Exception;
use think\console\Input;
use think\console\Output;
/**
* 用户余额重算处理
* 用户余额及返利重算处理
* Class UserBalance
* @package app\data\command
*/
class UserBalance extends Command
class UserAmount extends Command
{
protected function configure()
{
$this->setName('xdata:UserBalance');
$this->setDescription('批量重新计算用户余额');
$this->setName('xdata:UserAmount');
$this->setDescription('批量重新计算余额返利');
}
/**
@ -33,9 +33,10 @@ class UserBalance extends Command
try {
[$total, $count] = [$this->app->db->name('DataUser')->count(), 0];
foreach ($this->app->db->name('DataUser')->field('id')->cursor() as $user) {
$this->queue->message($total, ++$count, "正在计算用户 [{$user['id']}] 的余额");
$this->queue->message($total, ++$count, "正在计算用户 [{$user['id']}] 的余额和返利");
UserRebateService::instance()->amount($user['id']);
UserBalanceService::instance()->amount($user['id']);
$this->queue->message($total, $count, "完成计算用户 [{$user['id']}] 的余额", 1);
$this->queue->message($total, $count, "完成计算用户 [{$user['id']}] 的余额和返利", 1);
}
} catch (\Exception $exception) {
$this->queue->error($exception->getMessage());

View File

@ -38,9 +38,6 @@ class User extends Controller
/**
* 数据列表处理
* @param array $data
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
protected function _page_filter(array &$data)
{
@ -48,6 +45,16 @@ class User extends Controller
UserAdminService::instance()->buildByUid($data, 'pid1', 'from');
}
/**
* 重新计算用户余额返利
* @auth true
*/
public function sync()
{
$this->_queue('重新计算用户余额返利', 'xdata:UserAmount');
}
/**
* 修改用户状态
* @auth true

View File

@ -1,7 +1,7 @@
<?php
use app\data\command\OrderClear;
use app\data\command\UserBalance;
use app\data\command\UserAmount;
use app\data\command\UserTransfer;
use app\data\command\UserUpgrade;
use app\data\service\OrderService;
@ -13,7 +13,7 @@ use think\Console;
if (app()->request->isCli()) {
Console::starting(function (Console $console) {
$console->addCommand(OrderClear::class);
$console->addCommand(UserBalance::class);
$console->addCommand(UserAmount::class);
$console->addCommand(UserUpgrade::class);
$console->addCommand(UserTransfer::class);
});

View File

@ -1,5 +1,11 @@
{extend name="../../admin/view/main"}
{block name="button"}
<!--{if auth("sync")}-->
<button data-queue="{:url('sync')}" class='layui-btn layui-btn-sm layui-btn-primary'>刷新用户余额返利</button>
<!--{/if}-->
{/block}
{block name="content"}
<div class="think-box-shadow table-block">
{include file='user/index_search'}

View File

@ -8,7 +8,7 @@
{block name="content"}
<div class="layui-badge layui-bg-cyan text-left notselect block shadow margin-0 padding-10 padding-left-20 border-radius-5 font-s15">
返利统计:累计已产生返利 <b>{$rebate.0|default=0.00}</b> 元( 不含锁定 <b>{$rebate.2|default='0.00'}</b> ,累计已提现 <b>{$total.1|default=0.00}</b> 元。
返利统计:累计已产生返利 <b>{$rebate.0+$rebate.2}</b> ( 含未到账 <b>{$rebate.2|default='0.00'}</b> ),累计已提现 <b>{$total.1|default=0.00}</b> 元。
</div>
<div class="think-box-shadow margin-top-10">
{include file='user_rebate/index_search'}
@ -56,7 +56,7 @@
<div class="layui-badge layui-badge-middle layui-bg-black" style="line-height:14px">{$vo.type|default=''}</div>
<div class="inline-block text-middle">
<div>返利时间:<span class="color-blue">{$vo.create_at|format_datetime}</span></div>
<div>返利描述:{$vo.name|default=''} {if $vo.status}<span class="layui-badge layui-bg-black margin-left-5">未到账</span>{else}<span class="layui-badge layui-bg-green margin-left-5">已到账</span>{/if}</div>
<div>返利描述:{$vo.name|default='-'} {empty name='vo.status'}<span class="layui-badge layui-bg-black margin-left-5">未到账</span>{else}<span class="layui-badge layui-bg-green margin-left-5">已到账</span>{/empty}</div>
<div class="sub-strong-blue">订单 <b>{$vo.order_no|default='--'}</b> 交易 <b>{$vo.order_amount+0}</b> 元返利 <b>{$vo.amount+0}</b> </div>
</div>
</td>

View File

@ -6,7 +6,7 @@
<!--{/if}-->
<!--{if auth("sync")}-->
<button data-queue="{:url('sync')}" data-confirm="确定要刷新用户数据吗?" class='layui-btn layui-btn-sm layui-btn-primary'>刷新用户数据</button>
<button data-queue="{:url('sync')}" class='layui-btn layui-btn-sm layui-btn-primary'>刷新用户数据</button>
<!--{/if}-->
{/block}