parent
e9f3486ab1
commit
7ebea57edd
@ -0,0 +1,53 @@ |
||||
<?php |
||||
|
||||
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 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 dayUserGrowth |
||||
class dayUserGrowth extends Command |
||||
{ |
||||
protected function configure() |
||||
{ |
||||
// 指令配置 |
||||
$this->setName('dayUserValue') |
||||
->addArgument('dayValue', Argument::OPTIONAL, 'php think menu [1] / [2]') |
||||
->setDescription('用户贡献度根据增值积分转化'); |
||||
} |
||||
|
||||
protected function execute(Input $input, Output $output) |
||||
{ |
||||
try { |
||||
$user = userModel::getDB()->where('status', 1)->select()->toArray(); |
||||
foreach ($user as $k => $v) { |
||||
if ($v['all_value'] > 0) { |
||||
$growth_num = bcdiv($v['all_value'], $v['growth_rate'], 2); |
||||
userModel::getDB() |
||||
->where('uid', $v['uid']) |
||||
->update(['all_value' => 0, 'brokerage_price' => $growth_num]); |
||||
} |
||||
|
||||
} |
||||
} catch (\Exception $e) { |
||||
print_r($e->getMessage()); |
||||
} |
||||
echo 'ok'; |
||||
|
||||
} |
||||
|
||||
|
||||
} |
Loading…
Reference in new issue