From 7ebea57edd5862e25456afcf32ae6c9045c6ffc0 Mon Sep 17 00:00:00 2001 From: limu Date: Tue, 26 Dec 2023 17:11:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=AF=8F=E6=97=A5=E7=94=A8=E6=88=B7=E8=B4=A1?= =?UTF-8?q?=E7=8C=AE=E5=80=BC=E8=BD=AC=E5=A2=9E=E5=80=BC=E7=A7=AF=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/command/dayUserGrowth.php | 53 +++++++++++++++++++++++++++++++++++ app/command/dayValue.php | 3 +- config/console.php | 2 ++ 3 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 app/command/dayUserGrowth.php diff --git a/app/command/dayUserGrowth.php b/app/command/dayUserGrowth.php new file mode 100644 index 0000000..a82ca87 --- /dev/null +++ b/app/command/dayUserGrowth.php @@ -0,0 +1,53 @@ +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'; + + } + + +} diff --git a/app/command/dayValue.php b/app/command/dayValue.php index 7659f0d..58e312c 100644 --- a/app/command/dayValue.php +++ b/app/command/dayValue.php @@ -38,8 +38,6 @@ class dayValue extends Command { $yesterdayStart = date('Y-m-d H:i:s', strtotime('yesterday')); $yesterdayEnd = date('Y-m-d H:i:s', strtotime('tomorrow') - 1); - $yesterdayStart = '2023-12-18 00:00:00'; - $yesterdayEnd = '2023-12-20 00:00:00'; $level = config('partner.community_level') ?? []; $back_level = User::getDB()->where('community_level', '>', '0')->column('uid'); $userOrder = StoreOrderContribute::getDB()->field('uid,sum(order_profit) as user_profit') @@ -154,6 +152,7 @@ class dayValue extends Command } catch (\Exception $e) { print_r($e->getLine() . "-" . $e->getMessage()); } + echo '执行结束'; } diff --git a/config/console.php b/config/console.php index 9c6dbd3..47b478b 100644 --- a/config/console.php +++ b/config/console.php @@ -43,5 +43,7 @@ return [ 'dayValue' => 'app\command\dayValue', //每日兑换率生成 'dayUserValue' => 'app\command\dayUserValue', + //每日贡献值转增值积分 + 'dayUserGrowth' => 'app\command\dayUserGrowth', ], ];