Merge branch 'main' of http://git.njrzwl.cn:3000/wangmingchuan/crmeb_php
commit
2cfe01b70d
@ -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'; |
||||
|
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,43 @@ |
||||
<?php |
||||
|
||||
// +---------------------------------------------------------------------- |
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ] |
||||
// +---------------------------------------------------------------------- |
||||
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved. |
||||
// +---------------------------------------------------------------------- |
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权 |
||||
// +---------------------------------------------------------------------- |
||||
// | Author: CRMEB Team <admin@crmeb.com> |
||||
// +---------------------------------------------------------------------- |
||||
|
||||
|
||||
namespace app\common\model\user; |
||||
|
||||
|
||||
use app\common\model\BaseModel; |
||||
|
||||
class CommunityAccrue extends BaseModel |
||||
{ |
||||
|
||||
/** |
||||
* @return string |
||||
* @author xaboy |
||||
* @day 2020-03-30 |
||||
*/ |
||||
public static function tablePk(): string |
||||
{ |
||||
return 'id'; |
||||
} |
||||
|
||||
/** |
||||
* @return string |
||||
* @author xaboy |
||||
* @day 2020-03-30 |
||||
*/ |
||||
public static function tableName(): string |
||||
{ |
||||
return 'community_accrue'; |
||||
} |
||||
|
||||
|
||||
} |
Loading…
Reference in new issue