You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
crmeb_php/app/command/brand.php

99 lines
3.7 KiB

<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\command;
use Swoole\Coroutine\MySQL\Exception;
use think\console\Command;
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 brand
class brand extends Command
{
protected function configure()
{
// 指令配置
$this->setName('clearCache')
->addArgument('cacheType', Argument::OPTIONAL, 'php think menu [1] / [2]')
->setDescription('各种积分转换');
}
/**
* TODO
* @param Input $input
* @param Output $output
* @return int|void|null
* @author Qinii
* @day 4/24/22
*/
protected function execute(Input $input, Output $output)
{
echo systemConfig('beian_sn');die;
//获取所有用户
$userList = userModel::getDB()->where('status', 1)->field('uid,brand_integral,super_days')->select()->toArray();
$start = date('Y-m-d', strtotime("-1 day")).' 00:00:00';
$end = date('Y-m-d', strtotime("-1 day")).' 23:59:59';
//全网报单区流水昨日24小时的
$baodanall = StoreOrder::getDB()
->alias('a')
->leftJoin('StoreStoreProduct b', 'a.order_id = B.order_id')
->leftJoin('StoreSpu c', 'a.order_id = B.order_id')
->where('a.paid', 1)
->where('a.pay_time', '>=',$start)
->where('a.pay_time', '<=',$end)
->sum('a.cost');
var_dump($baodanall);die;
//全网品宣贡献值之和
$allBrandValue = userModel::getDB()->where('status', 1)->sum('brand_integral');
Db::startTrans();
foreach ($userList as $k => $v) {
try {
//用户的品宣贡献值=本人当前品宣积分之和÷全网品宣积分之和×全网报单流水×1%
Db::commit();
} catch (\Exception $exception) {
Db::rollback();
}
}
die;
echo env('brand.brand_integral', '100');
die;
}
}