瀏覽代碼

wes 多宝福袋 合并提交

wesmiler 3 年之前
父節點
當前提交
1fb233e27f

+ 0 - 58
app/api/command/AutoOpenBoxAction.php

@@ -1,58 +0,0 @@
-<?php
-declare (strict_types = 1);
-
-namespace app\api\command;
-
-use AlibabaCloud\SDK\OSS\OSS\SelectObjectRequest\body\selectRequest;
-use app\api\services\ThirdPayServices;
-use app\api\services\UserServices;
-use app\common\model\BoxMidHandleModel;
-use app\common\model\BoxModel;
-use app\common\model\CouponAreaModel;
-use app\common\model\CouponPlanLogModel;
-use app\common\model\CouponPlanModel;
-use app\common\model\ShopGoodsModel;
-use app\common\model\UserModel;
-use PhpOffice\PhpSpreadsheet\IOFactory;
-use think\console\Command;
-use think\console\Input;
-use think\console\Output;
-use think\db\Where;
-use think\Exception;
-use think\facade\Db;
-
-class AutoOpenBoxAction extends Command
-{
-    protected function configure()
-    {
-        // 用户自动拆袋
-        $this->setName('auto_open_box_action')
-            ->setDescription('the auto_open_box_action command');
-    }
-
-    protected function execute(Input $input, Output $output)
-    {
-        Db::startTrans();
-        try {
-
-            $list = Db::name('box_mid_handle')->where('status', 1)->field('uid')->group('uid')->select();
-            $model = new BoxMidHandleModel();
-            foreach ($list as $key=>$val){
-                $user_info = Db::name('user')->where('id', $val['uid'])->find();
-                $model->openBoxOnline($val['uid'], [], $user_info);
-            }
-
-
-            Db::commit();
-        }catch (\Exception $e){
-            Db::rollback();
-
-            return 22;
-        }
-
-        return 22;
-
-
-    }
-
-}

+ 0 - 52
app/api/command/GetUserTeamMoney.php

@@ -1,52 +0,0 @@
-<?php
-declare (strict_types = 1);
-
-namespace app\api\command;
-
-use think\console\Command;
-use think\console\Input;
-use think\console\Output;
-use think\facade\Db;
-
-/**
- * 结算今日奖金 by wes
- * Class GetUserTeamMoney
- * @package app\api\command
- */
-class GetUserTeamMoney extends Command
-{
-    protected function configure()
-    {
-        // 获取用户今日奖金
-        $this->setName('get_user_team_money')
-            ->setDescription('the get_user_team_money command');
-    }
-
-    protected function execute(Input $input, Output $output)
-    {
-
-
-        Db::startTrans();
-        try {
-            $list = Db::name('user')->where('today_money', '>', 0)->select();
-            foreach ($list as $key=>$val){
-                edit_user_money(6, $val['id'], $val['today_money']);
-                // 累计奖金
-                Db::name('user')->where('id', $val['id'])->inc('todayaward_money', floatval($val['today_money']))->update();
-            }
-
-            Db::name('user')->where('today_money', '>', 0)->save(['today_money'=>0]);
-            Db::commit();
-        }catch (\Exception $e){
-            Db::rollback();
-
-            $output->writeln('key'.$e->getMessage());
-            return 22;
-        }
-
-        return 22;
-
-
-    }
-
-}

+ 0 - 257
app/api/command/MiddleOpenBox.php

@@ -1,257 +0,0 @@
-<?php
-declare (strict_types = 1);
-
-namespace app\api\command;
-
-use AlibabaCloud\SDK\OSS\OSS\SelectObjectRequest\body\selectRequest;
-use app\api\services\ThirdPayServices;
-use app\api\services\UserServices;
-use app\common\model\BoxMidHandleModel;
-use app\common\model\BoxModel;
-use app\common\model\CouponAreaModel;
-use app\common\model\CouponPlanLogModel;
-use app\common\model\CouponPlanModel;
-use app\common\model\ShopGoodsModel;
-use app\common\model\UserModel;
-use PhpOffice\PhpSpreadsheet\IOFactory;
-use think\cache\driver\Redis;
-use think\console\Command;
-use think\console\Input;
-use think\console\Output;
-use think\db\Where;
-use think\Exception;
-use think\facade\Db;
-
-class MiddleOpenBox extends Command
-{
-    protected function configure()
-    {
-        // 后台确定开奖
-        $this->setName('middle_open_box')
-            ->setDescription('the middle_open_box command');
-    }
-
-    protected function execute(Input $input, Output $output)
-    {
-
-
-
-
-        Db::startTrans();
-        try {
-
-            // 添加用户数据
-//            $this->addUser();
-
-            // 自动预约福袋
-//            $this->buyBoxBefore();
-
-
-//            $list = Db::name('box_mid_handle')->where('id', '>', 0)->select();
-//            foreach ($list as $key=>$val){
-//                $output->writeln('key'.$key);
-//                if (!Db::name('shop_goods')->where('goods_id', $val['goods_id'])->find()){
-//                    sr_throw('error:'.$val['goods_id']);
-//                }
-//            }
-
-            // 后台匹配开奖
-//            $this->systemHandleBox($input, $output);
-
-            // 匹配开奖
-            $this->recordBoxAppointToMiddle($input, $output);
-
-
-            Db::commit();
-        }catch (\Exception $e){
-            Db::rollback();
-
-            $output->writeln('error:'.$e->getMessage());
-        }
-
-        return 22;
-    }
-
-    protected function recordBoxAppointToMiddle($input, $output){
-
-        // 总共用户的盒子累计 计算
-        $list1 = Db::name('box_record')->where('status', 1)->group('uid')->field('uid')->select();
-        foreach ($list1 as $key=>$val){
-            $total = Db::name('box_record')->where('status', 1)->where('uid', $val['uid'])->sum('num');
-            $box10 = Db::name('box_record')->where('status', 1)->where('uid', $val['uid'])->sum('box10');
-            $box20 = Db::name('box_record')->where('status', 1)->where('uid', $val['uid'])->sum('box20');
-            $box30 = Db::name('box_record')->where('status', 1)->where('uid', $val['uid'])->sum('box30');
-            $box40 = Db::name('box_record')->where('status', 1)->where('uid', $val['uid'])->sum('box40');
-            if ($total> ($box10+$box20+$box30+$box40)){
-                $null_count = $total- ($box10+$box20+$box30+$box40);
-                // 如果有空盒
-                Db::name('user')->where('id', $val['uid'])->inc('total_null_box', $null_count)->update();
-            }
-
-            // 增加其他盒子个数
-            Db::name('user')->where('id', $val['uid'])->inc('box10', $box10)->inc('box20', $box20)->inc('box30', $box30)->inc('box40', $box40)->update();
-
-        }
-
-
-
-        $list = Db::name('box_record')->where('status', 1)->select()->toArray();
-
-        $mid_arrs = [];
-        $r_ids = [];
-
-
-        $cur_time = sr_getcurtime(time());
-        $model = new ShopGoodsModel();
-        $goods_arr20 = $model
-            ->where('box_type', 20)
-            ->where('goods_type', 2)
-            ->where('can_open', 0)
-            ->field('goods_id,box_type,goods_img,price,goods_name')
-            ->page(1, 20)
-            ->select();
-
-        foreach ($list as $key=>$val){
-            $total_goodsbox = $val['box10'] + $val['box20'] + $val['box30'] + $val['box40'];
-
-            $r_goodsids = '';
-
-            // 如果有空盒
-            if ($val['num'] > $total_goodsbox){
-                for ($i=0;$i < $val['num']-$total_goodsbox;$i++){
-                    $mid_arrs[] = [
-                        'h_sn'=>createdHandleOrderSn(),
-                        'uid'=>$val['uid'],
-                        'rid'=>$val['id'],
-                        'goods_id'=>0,
-                        'create_time'=>$cur_time,
-                        'box_type'=>0,
-                        'goods_price'=>0,
-                        'pay_type'=>$val['pay_type']
-                    ];
-                }
-            }
-
-//            if (1 == 1){
-//                sr_throw();
-//            }
-            // 其他盒子
-            $box_arrs = [10, 20, 30, 40];
-            foreach ($box_arrs as $key1=>$val1){
-
-                $key_string = strval('box'.$val1);
-                $box_goodsnum = $val[$key_string];
-
-                $goods_arr = $model
-                    ->where('box_type', $val1)
-                    ->where('goods_type', 2)
-                    ->where('can_open', 1)
-                    ->field('goods_id,box_type,goods_img,price,goods_name')
-                    ->page(1, 20)
-                    ->select();
-
-
-
-
-//                sr_throw(json_encode($goods_arr));
-
-                if ($box_goodsnum > 0){
-
-                    // 如果后期要调整  取值 直接 排序 goods_arr
-                    for ($i = 0; $i < $box_goodsnum;$i++){
-                        $rand_num = mt_rand(0, count($goods_arr)-1);
-                        $goods = $goods_arr[$rand_num];
-
-                        if ($val1 == 20){
-                            // 如果有指定 稀有
-                            if ($i == 0 && $val['hs_xy']==1){
-                                $rand_num = mt_rand(0, count($goods_arr20)-1);
-                                $goods = $goods_arr20[$rand_num];
-                            }
-                        }
-
-                        $mid_arrs[] = [
-                            'h_sn'=>createdHandleOrderSn(),
-                            'uid'=>$val['uid'],
-                            'rid'=>$val['id'],
-                            'goods_id'=>$goods['goods_id'],
-                            'create_time'=>$cur_time,
-                            'box_type'=>$val1,
-                            'goods_price'=>$goods['price'],
-                            'pay_type'=>$val['pay_type']
-                        ];
-                        $r_goodsids .= ((empty($r_goodsids)?'':',').$goods['goods_id']);
-                    }
-
-                }
-            }
-
-
-            Db::name('box_record')->where('id', $val['id'])->save([
-                'status'=>2,
-                'goods_ids'=>$r_goodsids
-            ]);
-        }
-
-        $model = new BoxMidHandleModel();
-        $model->insertAll($mid_arrs);
-
-    }
-
-    public function systemHandleBox(Input $input, Output $output){
-
-    }
-
-    public function addUser(){
-
-        $users = $this->randomPhone(100);
-        foreach ($users as $key=>$val){
-            if (!Db::name('user')->where('mobile', $val)->find()){
-                $services = new UserServices();
-                $services->userRegister([
-                        'user_name'=>'db-'.$val,
-                        'invite_code'=>'03284278',
-                        'code'=>'111111',
-                        'password'=>"TDFyZ3n\/5GksjKtjhj2G1w==",
-                        'mobile'=>$val
-                    ]
-                );
-            }
-
-
-        }
-
-
-
-    }
-
-
-    public function buyBoxBefore(){
-        return ;
-        $users = Db::name('user')->where('money', '>', 0)->paginate(50)->toArray();
-
-
-        $model = new BoxModel();
-        foreach ($users['data'] as $key=>$val){
-            $count = rand(0, 10);
-            $model->beforeBuyBox($val['id'], ['box_id'=>23422, 'buy_count'=>$count, 'pay_type'=>rand(1,2)]);
-        }
-
-
-    }
-
-//随机生成n条手机号
-    function randomPhone($n = 100)
-    {
-        $tel_arr = array(
-            '130', '131', '132', '133', '134', '135', '136', '137', '138', '139', '144', '147', '150', '151', '152', '153', '155', '156', '157', '158', '159', '176', '177', '178', '180', '181', '182', '183', '184', '185', '186', '187', '188', '189',
-        );
-        for ($i = 0; $i < $n; $i++) {
-            $tmp[] = $tel_arr[array_rand($tel_arr)] . mt_rand(1000, 9999) . mt_rand(1000, 9999);
-        }
-        return array_unique($tmp);
-    }
-
-
-
-}

+ 0 - 84
app/api/command/OnedayUserDataupdate.php

@@ -1,84 +0,0 @@
-<?php
-declare (strict_types=1);
-
-namespace app\api\command;
-
-use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\AddShortUrlResponseBody\data;
-use app\common\model\PaymentModel;
-use app\common\model\ShopGoodsModel;
-use app\common\model\ShopOrderGoodsModel as OrderGoods;
-use app\common\model\ShopOrderModel;
-use app\common\model\UserModel;
-use think\console\Command;
-use think\console\Input;
-use think\console\Output;
-use think\facade\Db;
-
-class OnedayUserDataupdate extends Command
-{
-    protected function configure()
-    {
-        // 每天刷新用户一些用户信息
-        $this->setName('oneday_user_dataupdate')
-            ->setDescription('the oneday_user_dataupdate command');
-    }
-
-    protected function execute(Input $input, Output $output)
-    {
-        Db::startTrans();
-        try {
-
-            $this->updateUserData();
-            Db::commit();
-        } catch (\Exception $e) {
-            Db::rollback();
-
-            $output->writeln('error:' . $e->getMessage());
-        }
-
-        return 22;
-
-
-    }
-
-
-    public function updateUserData()
-    {
-
-        // 更新用户所有昨日今日数据
-        $list = Db::name('money_log')->where('type', 6)->whereDay('create_at', 'yesterday')->field('uid')->group('uid')->select();
-        foreach ($list as $key => $val) {
-            $money = Db::name('money_log')->where('type', 6)->whereDay('create_at', 'yesterday')->where('uid', $val['uid'])->sum('money');
-            Db::name('user')->where('id', $val['uid'])->save([
-                'yesterday_money' => $money
-            ]);
-        }
-
-        Db::name('user')->where('today_box', '>', 0)->save(['today_box' => 0]);
-        Db::name('user')->where('today_team_box', '>', 0)->save(['today_team_box' => 0]);
-
-        // 开启下一期 福袋预约
-        $max_id = Db::name('box')->where('status', 1)->max('id');
-        $info = Db::name('box')->where('id', $max_id)->find();
-
-        if ($info) {
-            Db::name('box')->where('status', 1)->save([
-                'status' => 2
-            ]);
-
-            $count = $info['buy_most'] * (1 + env('boxsetting.ONCEDAY_ADD_SCALE') / 100);
-            Db::name('box')->insert([
-                'buy_most' => intval($count / 10) * 10,
-                'once_buy' => $info['once_buy'],
-                'qi_count' => $info['qi_count'] + 1,
-                'time_set' => $info['time_set'],
-                'box_img' => $info['box_img'],
-                'box_title' => $info['box_title'],
-                'create_time' => sr_getcurtime(time()),
-                'appoint_day' => sr_getcurtime(time(), 'Y-m-d')
-            ]);
-        }
-
-    }
-
-}

+ 0 - 216
app/api/command/TeamDymicFree.php

@@ -1,216 +0,0 @@
-<?php
-declare (strict_types=1);
-
-namespace app\api\command;
-
-use app\common\model\UserModel;
-use think\console\Command;
-use think\console\Input;
-use think\console\Output;
-use think\facade\Db;
-
-class TeamDymicFree extends Command
-{
-
-    private $arr_addinc = [];
-
-    protected function configure()
-    {
-        // 团队收益
-        $this->setName('team_dymic_free')
-            ->setDescription('the team_cymic_free command');
-    }
-
-    protected function execute(Input $input, Output $output)
-    {
-
-
-        // 给用户添加today_money 数组
-        $this->arr_addinc = array();
-        Db::startTrans();
-        try {
-
-            $list = Db::name('box_handle')->where('is_team_handle', '0')->order('id desc')->select();
-
-            $model_user = new UserModel();
-
-            $id_backs = [];
-            foreach ($list as $key => &$val) {
-                // 这是测试 上线要干掉
-                $output->writeln('key' . $key);
-                $user_info = Db::name('user')->where('id', $val['uid'])->find();
-                if ($user_info && $user_info['pid'] > 0) {
-
-//                $output->writeln('key'.$val['id']);
-                    $id_backs[] = $val['id'];
-
-
-//                $total_income = $val['num'] * env('boxsetting.ONE_BOX_PRICE');
-
-//                $output->writeln(json_encode($setting_arr));
-
-                    $settings = Db::name('level_setting')->order('id asc')->field('level,dynamic_scale,zt_money')->select()->toArray();
-                    $setting_arr = array();
-                    $setting_arr_zt = array();
-
-                    foreach ($settings as $key1 => $val1) {
-                        $setting_arr[$val1['level']] = $val1['dynamic_scale'];
-                        $setting_arr_zt[$val1['level']] = $val1['zt_money'];
-                    }
-
-//                $output->writeln('key'.json_encode($setting_arr));
-//                $output->writeln('key'.json_encode($setting_arr_zt));
-
-
-                    // 计算直推收益
-                    $pidinfo = $model_user->where('id', $user_info['pid'])->find();
-//                    $output->writeln('key'.$pidinfo['level']);
-                    if ($pidinfo['has_fd'] == 1) {
-
-                        if ($pidinfo['level'] == 0) {
-                            $money = env('TEAMSETTING.DICRECT_MONEY');
-                            edit_user_money(5, $pidinfo['id'], $money, 0, $val['id']);
-//                            Db::name('user')->where('id', $pidinfo['id'])->inc('today_money', floatval($money))->update();
-                            $this->setUserIncMoney($pidinfo['id'], floatval($money), $input, $output);
-                        } else {
-
-//                            sr_throw(json_encode($setting_arr_zt));
-                            $money = $setting_arr_zt[$pidinfo['level']];
-                            edit_user_money(5, $pidinfo['id'], $money, 0, $val['id']);
-//                            Db::name('user')->where('id', $pidinfo['id'])->inc('today_money', floatval($money))->update();
-
-                            $this->setUserIncMoney($pidinfo['id'], floatval($money), $input, $output);
-                        }
-
-                    }
-
-
-                    $path = $user_info['path'];
-                    // 计算团队并且  除开扶持号
-                    if (!empty($path)) {
-                        $arr = explode(',', $path);
-                        $arr = array_reverse($arr);
-                        $ids = $arr;
-                        $ids = implode(',', $ids);
-                        $order = 'field(id,' . $ids . ')';
-
-                        $users = Db::name('user')->where('id', 'in', $arr)->field('id,level')->order(Db::raw($order))->select()->toArray();
-
-
-                        // 分钱的数组  ['uid'=>'money']
-                        $get_money_arr = array();
-                        $cur_bobi = 0;
-                        $cur_maxlevel = 0;
-
-                        foreach ($users as $key1 => $val1) {
-                            if ($key1 == 0) {
-                                if ($val1['level'] > 0) {
-                                    $bobi = $setting_arr[$val1['level']];
-                                    $get_money_arr[$val1['id']] = $bobi;
-                                    $cur_maxlevel = $val1['level'];
-                                    $cur_bobi += $bobi;
-                                }
-                            } else {
-
-                                if ($val1['level'] > $users[$key1 - 1]['level']) {
-                                    if ($val1['level'] > $cur_maxlevel) {
-                                        $bobi = $setting_arr[$val1['level']] - $cur_bobi;
-                                        if ($bobi > 0) {
-                                            $get_money_arr[$val1['id']] = $bobi;
-                                            $cur_bobi += $bobi;
-                                        }
-                                    }
-                                } else {
-
-                                }
-                            }
-
-                        }
-
-//        $output->writeln('get_money:'.json_encode($get_money_arr));
-
-                        // 计算前面相同等级收益
-                        foreach ($users as $key1 => $val1) {
-                            if ($key1 != 0) {
-                                if ($val1['level'] == $users[$key1 - 1]['level']) {
-                                    if (isset($get_money_arr[$users[$key1 - 1]['id']])) {
-                                        if ($get_money_arr[$users[$key1 - 1]['id']] > 0) {
-                                            $last_bobi = $get_money_arr[$users[$key1 - 1]['id']];
-                                            $get_money_arr[$val1['id']] = $last_bobi * 0.1;
-                                        }
-
-                                    }
-                                }
-                            }
-                        }
-
-                        // $get_money_arr 用户团队最终金额
-                        foreach ($get_money_arr as $key1 => $val1) {
-//                        $get_money_arr[$key1] = sprintf("%.4f",substr(sprintf("%.5f", $val1/100*$total_income), 0, -2));
-                            $get_money_arr[$key1] = sprintf("%.4f", substr(sprintf("%.5f", $val1), 0, -2));
-
-                        }
-
-
-//                    $output->writeln(json_encode($get_money_arr));
-
-                        foreach ($get_money_arr as $key1 => $val1) {
-//                            $get_money_arr  里面是计算百分比
-                            $cur_info = Db::name('user')->where('id', $key1)->find();
-                            if ($cur_info['has_fd'] == 1) {
-                                edit_user_money(7, $key1, $val1);
-//                                Db::name('user')->where('id', $key1)->inc('today_money', floatval($val1))->update();
-
-                                $this->setUserIncMoney($key1, floatval($val1), $input, $output);
-                            }
-
-                        }
-                    }
-
-
-                } else {
-                    $id_backs[] = $val['id'];
-                }
-
-
-            }
-
-
-            //                     改变所有已经处理状态
-            Db::name('box_handle')->whereIn('id', $id_backs)->save([
-                'is_team_handle' => 1
-            ]);
-
-
-//            sr_throw(json_encode($this->arr_addinc));
-            foreach ($this->arr_addinc as $key => $val) {
-                Db::name('user')->where('id', $key)->inc('today_money', floatval($val))->update();
-            }
-
-            Db::commit();
-        } catch (\Exception $e) {
-
-            Db::rollback();
-
-            $output->writeln('error:' . $e->getMessage());
-
-        }
-
-
-        return 22;
-
-
-    }
-
-    private function setUserIncMoney($key, $money, $input, $output)
-    {
-//        $output->writeln('key'.$key.'--money:'.$money);
-        if (isset($this->arr_addinc[strval($key)]) && $this->arr_addinc[strval($key)] > 0) {
-            $this->arr_addinc[strval($key)] = ($this->arr_addinc[strval($key)] + $money);
-        } else {
-            $this->arr_addinc[strval($key)] = $money;
-        }
-    }
-
-
-}

+ 0 - 804
app/api/command/UserAddMachine.php

@@ -1,804 +0,0 @@
-<?php
-declare (strict_types = 1);
-
-namespace app\api\command;
-
-use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\AddShortUrlResponseBody\data;
-use AlibabaCloud\SDK\OSS\OSS\SelectObjectRequest\body\selectRequest;
-use app\api\services\ThirdPayServices;
-use app\api\services\UserServices;
-use app\common\model\BoxMidHandleModel;
-use app\common\model\BoxModel;
-use app\common\model\CouponAreaModel;
-use app\common\model\CouponPlanLogModel;
-use app\common\model\CouponPlanModel;
-use app\common\model\ShopGoodsModel;
-use app\common\model\UserModel;
-use data\model\HealhwordExcelModel;
-use jianyan\excel\Excel;
-use PhpOffice\PhpSpreadsheet\IOFactory;
-use think\Config;
-use think\console\Command;
-use think\console\Input;
-use think\console\Output;
-use think\db\Where;
-use think\Exception;
-use think\facade\Db;
-use PHPExcel;
-
-class UserAddMachine extends Command
-{
-
-
-
-    protected function configure()
-    {
-        // 测试脚本
-        $this->setName('user_add_machine')
-            ->setDescription('the user_add_machine command');
-    }
-
-    protected function execute(Input $input, Output $output)
-    {
-//        $list = Db::name('money_log')->whereDay('create_at', 'today')->where('type', 6)->where('create_at', '>', '2023-02-15 08:58:23')->count('id');
-//        $output->writeln('key'.$list);
-
-        #==========================================================     扣除多余一次
-        Db::startTrans();
-        try {
-
-
-            $list = Db::name('money_log')->whereDay('create_at', 'today')->where('type', 6)->field('uid')->group('uid')->select();
-
-            foreach ($list as $key=>$val){
-                $count = Db::name('money_log')->whereDay('create_at', 'today')->where('type', 6)->where('uid', $val['uid'])->count('id');
-//            if ($count != 2){
-//
-//            }
-//            $output->writeln('uid:'.$count);
-                if ($count == 2){
-                    $logs = Db::name('money_log')->whereDay('create_at', 'today')->where('type', 6)->where('uid', $val['uid'])->select();
-                    if ($logs[0]['money'] == $logs[1]['money']){
-//                    $output->writeln('0mongey:'.$logs[0]['money'].'--'.'1money:'.$logs[1]['money']);
-//                    $output->writeln('uid:'.$val['uid']);
-                        $user_info = Db::name('user')->where('id',$val['uid'])->find();
-                        if ($user_info['money'] < $logs[0]['money']){
-                            sr_throw('不够扣除');
-                        }else{
-                            edit_user_money(14, $val['uid'], $logs[0]['money']);
-                        }
-
-                }
-                }
-            }
-            Db::commit();
-        }catch (\Exception $e){
-            Db::rollback();
-            $output->writeln('error:'.$e->getMessage());
-
-        }
-
-
-        return 22;
-
-        #==========================================================     扣除多余一次
-
-        #==========================================================     扣除多余一次
-
-
-
-
-
-        // 团队跑数据
-//        Db::name('box_handle')->whereDay('create_time', 'yesterday')->save(['is_team_handle'=>0]);
-//        return 33;
-
-        // 减去领取团队奖金错误数据
-//        Db::startTrans();
-//        try {
-//
-//            $list = Db::name('money_log1')->where('id', '>', 0)->select();
-//            foreach ($list as $key=>$val){
-//                $user_info = Db::name('user')->where('id', $val['uid'])->find();
-//                if ($user_info['today_money'] >= $val['money']){
-//                    Db::name('user')->where('id', $val['uid'])->dec('today_money', floatval($val['money']))->update();
-//                    Db::name('user')->where('id', $val['uid'])->dec('todayaward_money', floatval($val['money']))->update();
-//                }else{
-//                    $output->writeln('error:'.$val['id']);
-//                }
-//
-//            }
-//
-//            Db::commit();
-//        }catch (\Exception $e){
-//            Db::rollback();
-//            $output->writeln('error:'.$e->getMessage());
-//
-//        }
-//
-//
-//        return 33;
-
-
-
-
-
-
-//        Db::startTrans();
-//        try {
-//
-//            // 总共用户的盒子累计 计算
-//            $list1 = Db::name('box_record')->group('uid')->field('uid')->select();
-//            foreach ($list1 as $key=>$val){
-//                $output->writeln('key'.$key);
-//                $total = Db::name('box_record')->where('uid', $val['uid'])->sum('num');
-//                $box10 = Db::name('box_record')->where('uid', $val['uid'])->sum('box10');
-//                $box20 = Db::name('box_record')->where('uid', $val['uid'])->sum('box20');
-//                $box30 = Db::name('box_record')->where('uid', $val['uid'])->sum('box30');
-//                $box40 = Db::name('box_record')->where('uid', $val['uid'])->sum('box40');
-//                if ($total> ($box10+$box20+$box30+$box40)){
-//                    $null_count = $total- ($box10+$box20+$box30+$box40);
-//                    // 如果有空盒
-//                    Db::name('user')->where('id', $val['uid'])->inc('total_null_box', $null_count)->update();
-//                }
-//
-//                // 增加其他盒子个数
-//                Db::name('user')->where('id', $val['uid'])->inc('box10', $box10)->inc('box20', $box20)->inc('box30', $box30)->inc('box40', $box40)->update();
-//
-//            }
-//
-//
-//            Db::commit();
-//        }catch (\Exception $e){
-//            Db::rollback();
-//
-//            $output->writeln('key'.$e->getMessage());
-//        }
-//
-//        return 33;
-
-
-// 所有用户领取 奖金
-//     Db::startTrans();
-//     try {
-//         // 所有用户领取 奖金
-//         $model_user = new UserModel();
-//         $list = $model_user->where('today_money', '>', 0)->field('*')->select();
-//         $output->writeln('key'.count($list));
-//
-//         foreach ($list as $key=>$val){
-//             $output->writeln('key'.$key);
-//             edit_user_money(6, $val['id'], $val['today_money']);
-//             Db::name('user')->where('id', $val['id'])->save([
-//                 'today_money'=>0
-//             ]);
-//             // 累计奖金
-//             Db::name('user')->where('id', $val['id'])->inc('todayaward_money', floatval($val['today_money']))->update();
-//         }
-//
-//         Db::commit();
-//     }catch (\Exception $e){
-//         Db::rollback();
-//         $output->writeln('key'.$e->getMessage());
-//
-//     }
-//        return 44;
-
-
-
-        // 提现失败两次回调数据(1.直接扣除  2.标记)
-        Db::startTrans();
-        try {
-            $this->getCoupon($input, $output);
-            Db::commit();
-        }catch (\Exception $e){
-            Db::rollback();
-
-            $output->writeln('error:'.$e->getMessage());
-
-        }
-        return 33;
-
-
-
-        $money = Db::name('user')->where('id', '>', 0)->sum('money');
-         $score = Db::name('user')->where('id', '>', 0)->sum('score');
-         $output->writeln('money:'.$money.',score:'.$score);
-        return 33;
-
-        Db::name('box_record')->where('create_time', '>', '2023-02-13 10:48:17')->save([
-            'status'=>1
-        ]);
-
-        return 33;
-        Db::startTrans();
-        try {
-
-
-            $model = new ShopGoodsModel();
-            $goods_arr = $model
-                ->where('box_type', 20)
-                ->where('goods_type', 2)
-                ->where('goods_id', 'not in', explode('|', env('APP.NOT_OPEN_GOODS_ID')))
-                ->field('goods_id,box_type,goods_img,price,goods_name')
-//            ->field('goods_id,box_type')
-                ->page(1, 20)
-                ->select();
-
-
-
-            $datas = Db::name('box_mid_handle')->where('status', 1)->where('goods_id', 346)->select();
-
-            foreach ($datas as $key=>$val){
-                $rand_num = random_int(0, 16);
-                $goods_info = $goods_arr[$rand_num];
-                Db::name('box_mid_handle')->where('id', $val['id'])->save([
-                    'goods_price'=>$goods_info['price'],
-                    'goods_id'=>$goods_info['goods_id']
-                ]);
-
-            }
-
-            Db::commit();
-        }catch (\Exception $e){
-            Db::rollback();
-
-            $output->writeln('error:'.$e->getMessage());
-        }
-//        $output->writeln('key'.count($datas));
-
-
-
-
-//        $output->writeln(json_encode($goods_arr));
-
-        return 33;
-
-
-        Db::name('user')->where('id', '>', 0)->save([
-            'total_team_withdraw'=>0
-        ]);
-
-
-        Db::startTrans();
-        try {
-            $list = Db::name('withdraw_log')->where('status', 1)->select();
-            foreach ($list as $key=>$val){
-                $user = Db::name('user')->where('id', $val['uid'])->find();
-                Db::name('user')->whereIn('id', $user['path'])->inc('total_team_withdraw', $val['apply_money'])->update();
-                Db::name('user')->whereIn('id', $user['id'])->inc('total_team_withdraw', $val['apply_money'])->update();
-
-//                $output->writeln('key'.$key);
-//                $count = Db::name('box_handle')->where('uid', $val['id'])->count('id');
-//                if ($count>0){
-//                    Db::name('user')->where('id', 'in', $val['path'])->inc('total_team_box', $count)->update();
-//                    Db::name('user')->where('id', 'in', $val['path'])->inc('today_team_box', $count)->update();
-//                    Db::name('user')->where('id', $val['id'])->inc('total_box', $count)->inc('total_team_box', $count)->update();
-//                }
-            }
-
-            Db::commit();
-        }catch (\Exception $e){
-            Db::rollback();
-
-            $output->writeln('key'.$e->getMessage());
-        }
-
-
-
-        return 33;
-
-
-
-        return 33;
-
-
-
-
-        Db::startTrans();
-        try {
-            $list = Db::name('user')->where('id', '>', 0)->select();
-            foreach ($list as $key=>$val){
-                $output->writeln('key'.$key);
-                $count = Db::name('box_handle')->where('uid', $val['id'])->count('id');
-                if ($count>0){
-                    Db::name('user')->where('id', 'in', $val['path'])->inc('total_team_box', $count)->update();
-                    Db::name('user')->where('id', 'in', $val['path'])->inc('today_team_box', $count)->update();
-                    Db::name('user')->where('id', $val['id'])->inc('total_box', $count)->inc('total_team_box', $count)->update();
-                }
-            }
-
-            Db::commit();
-        }catch (\Exception $e){
-            Db::rollback();
-
-            $output->writeln('key'.$e->getMessage());
-        }
-
-
-
-        return 33;
-
-
-
-
-        Db::startTrans();
-        try {
-
-            $list = Db::name('box_mid_handle')->where('goods_id', 0)->where('status', 2)->select();
-
-
-            foreach ($list as $key=>$val){
-                edit_user_score(2, $val['uid'], env('boxsetting.ONE_BOX_PRICE'), $val['id']);
-            }
-            Db::commit();
-        }catch (\Exception $e){
-            Db::rollback();
-
-            $output->writeln('key'.$e->getMessage());
-        }
-
-
-
-
-
-
-        return 33;
-        Db::startTrans();
-        try {
-            // 批量设置用户等级
-            $this->settingUserLevels();
-
-            // 添加用户数据
-//            $this->addUser($input, $output);
-
-            // 自动预约福袋
-//            $this->buyBoxBefore();
-
-
-//            $list = Db::name('box_mid_handle')->where('id', '>', 0)->select();
-//            foreach ($list as $key=>$val){
-//                $output->writeln('key'.$key);
-//                if (!Db::name('shop_goods')->where('goods_id', $val['goods_id'])->find()){
-//                    sr_throw('error:'.$val['goods_id']);
-//                }
-//            }
-
-            // 后台匹配开奖
-//            $this->systemHandleBox($input, $output);
-
-            // 匹配开奖
-//            $this->recordBoxAppointToMiddle($input, $output);
-
-            // 更正中间表数据问题
-//            $this->updateMiddleExcelData($input, $output);
-
-            // 所有用户添加 积余额
-//            Db::name('user')->where('id', '>', 0)->inc('money', 20000)->update();
-//            Db::name('user')->where('id', '>', 0)->inc('score', 20000)->update();
-
-
-            Db::commit();
-        }catch (\Exception $e){
-            Db::rollback();
-
-            $output->writeln('error:'.$e->getMessage());
-        }
-
-        return 22;
-    }
-
-    protected function getCoupon(Input $input, Output $output){
-
-        // 扣除提现失败扣除钱
-        $arr = [['uid'=>5344726,'money'=>'2925'],
-            ['uid'=>5346144,'money'=>'4275.5'],
-            ['uid'=>5346574,'money'=>'1386'],
-            ['uid'=>5345815,'money'=>'1386'],
-            ['uid'=>5346314,'money'=>'6444'],
-            ['uid'=>5346169,'money'=>'1296'],
-            ['uid'=>5344735,'money'=>'7902'],
-            ['uid'=>5344962,'money'=>'1620'],
-            ['uid'=>5345983,'money'=>'1476'],
-            ['uid'=>5346095,'money'=>'1476'],
-            ['uid'=>5346630,'money'=>'1026'],
-            ['uid'=>5345797,'money'=>'333'],
-            ['uid'=>5344556,'money'=>'1080'],
-            ['uid'=>5346487,'money'=>'2772'],
-            ['uid'=>5346035,'money'=>'5517'],
-            ['uid'=>5346577,'money'=>'1728'],
-            ['uid'=>5346194,'money'=>'1314'],
-            ['uid'=>5346153,'money'=>'1125'],
-            ['uid'=>5344956,'money'=>'3240'],
-            ['uid'=>5346602,'money'=>'1386'],
-            ['uid'=>5346174,'money'=>'1080'],
-            ['uid'=>5346083,'money'=>'1476'],
-            ['uid'=>5345569,'money'=>'1440'],
-            ['uid'=>5345972,'money'=>'999'],
-            ['uid'=>5346595,'money'=>'1386'],
-            ['uid'=>5346491,'money'=>'1530'],
-            ['uid'=>5346604,'money'=>'864'],
-            ['uid'=>5346543,'money'=>'1080'],
-            ['uid'=>5344866,'money'=>'1620'],
-            ['uid'=>5345936,'money'=>'2736'],
-            ['uid'=>5346610,'money'=>'4239'],
-            ['uid'=>5344527,'money'=>'1260'],
-            ['uid'=>5344734,'money'=>'1035'],
-            ['uid'=>5345960,'money'=>'864'],
-            ['uid'=>5345622,'money'=>'2790'],
-            ['uid'=>5345876,'money'=>'7299'],
-            ['uid'=>5345926,'money'=>'1620'],
-            ['uid'=>5346163,'money'=>'2016'],
-            ['uid'=>5346102,'money'=>'864'],
-            ['uid'=>5345812,'money'=>'1890'],
-            ['uid'=>5344948,'money'=>'1080']];
-
-
-        $sum = 0;
-        foreach ($arr as $key=>$val){
-            $output->writeln('key'.$key);
-            $user_info = Db::name('user')->where('id', $val['uid'])->find();
-            $users_money = $user_info['money']+$user_info['score'];
-
-            $withdraing = Db::name('withdraw_log')->where('uid', $val['uid'])->where('status', 0)->sum('apply_money');
-
-
-            if ($val['money'] > ($users_money+$withdraing)){
-//                $sum += ($val['money']-$users_money-$withdraing);
-//                $output->writeln('uid:'.$val['uid']);
-                // 标记路线
-                Db::name('user')->where('id', $val['uid'])->save(['luzi_money'=>$val['money']]);
-            }else{
-                // 够扣除
-                // 退还提现申请到余额
-                $list = Db::name('withdraw_log')->where('uid', $val['uid'])->where('status', 0)->select();
-                foreach ($list as $key1=>$val1){
-                    Db::name('withdraw_log')->where('id', $val1['id'])->save(['status'=> 3, 'fail_log'=>'提现多次返回']);
-                    edit_user_money(10, $val1['uid'], $val1['apply_money']);
-                    $output->writeln('提现处理:id:'.$val1['id']);
-                }
-
-                $cur_score = $user_info['score'];
-                // 是否还是扣除余额
-                $has_lessmoney = false;
-
-                if ($val['money'] > $cur_score){
-                    edit_user_score(4, $val['uid'], $cur_score);
-                    $has_lessmoney = true;
-                }else{
-                    edit_user_score(4, $val['uid'], $val['money']);
-                }
-
-
-
-                if ($has_lessmoney){
-                    edit_user_money(11, $val['uid'], ($val['money']-$cur_score));
-                }
-
-
-//                $less_money = $val['money']-$cur_score;
-            }
-        }
-
-//        $output->writeln('亏损:'.$sum);
-
-
-        return 33;
-
-//        $list = Db::name('withdraw_log')->where('status', 3)->where('create_at', '>', '2023-02-13 23:23:45')->select();
-        $list = Db::name('withdraw_log')->where('status', 3)->select();
-        $arr = [];
-        foreach ($list as $key =>$val){
-//            $count = Db::name('money_log')->where('uid', $val['uid'])->where('create_at', '>', '2023-02-13 23:23:45')->where('type', 10)->count();
-            $count = Db::name('money_log')->where('uid', $val['uid'])->where('type', 10)->count();
-
-            if ($count > 1){
-                if (!isset($arr[$val['uid']])){
-                    $arr[$val['uid']] = 1;
-                }
-
-            }
-        }
-
-        $output->writeln(json_encode(array_keys($arr)));
-
-
-        return 33;
-
-
-        $arr = [
-            ['number'=>'WD534657849545610251','name'=>'杨玉婷','zfb_number'=>'19169946597'],
-            ['number'=>'WD534473598565349555','name'=>'刘芳','zfb_number'=>'2765728677@qq.com'],
-            ['number'=>'WD534581550101505556','name'=>'刘健','zfb_number'=>'15698096367'],
-            ['number'=>'WD534495657509850999','name'=>'张镇强','zfb_number'=>'15374723581'],
-            ['number'=>'WD534648753545510148','name'=>'周鹏','zfb_number'=>'18549818699'],
-            ['number'=>'WD534649152994855515','name'=>'汪川','zfb_number'=>'15961266732'],
-            ['number'=>'WD534592655981001019','name'=>'郭景辉','zfb_number'=>'19922439523'],
-            ['number'=>'WD534496848535749545','name'=>'陈伟','zfb_number'=>'499558005@qq.com'],
-            ['number'=>'WD534630256991001005','name'=>'1630','zfb_number'=>'13265262521'],
-            ['number'=>'WD534494850989898544','name'=>'魏秀军','zfb_number'=>'13543736731'],
-            ['number'=>'WD534618452575697519','name'=>'薛永浩','zfb_number'=>'19865924544'],
-            ['number'=>'WD534683810150521005','name'=>'尹荐','zfb_number'=>'18686073199'],
-            ['number'=>'WD534455655981015552','name'=>'吴浩友','zfb_number'=>'15959096295'],
-            ['number'=>'WD534619410250495557','name'=>'岳庆庆','zfb_number'=>'15935905192'],
-            ['number'=>'WD534587610050100985','name'=>'郝健','zfb_number'=>'244788081@qq.com'],
-            ['number'=>'WD534660248101524910','name'=>'朱兰','zfb_number'=>'18661245016'],
-            ['number'=>'WD534473551485255971','name'=>'刘芳','zfb_number'=>'17836372202'],
-            ['number'=>'WD534473599515197501','name'=>'刘芳','zfb_number'=>'17836372202'],
-            ['number'=>'WD534654348555397545','name'=>'潘细舟','zfb_number'=>'18071855406'],
-            ['number'=>'WD534660210299975198','name'=>'朱兰','zfb_number'=>'18661245016'],
-            ['number'=>'WD534472651495357481','name'=>'丁小文','zfb_number'=>'13983952207'],
-            ['number'=>'WD534455649100975548','name'=>'吴浩友','zfb_number'=>'15959096295'],
-            ['number'=>'WD534473556559852539','name'=>'刘芳','zfb_number'=>'2765728677@qq.com'],
-            ['number'=>'WD534619410299102995','name'=>'岳庆庆','zfb_number'=>'15935905192'],
-            ['number'=>'WD534472650571025699','name'=>'丁小文','zfb_number'=>'13983952207'],
-            ['number'=>'WD534593656519852101','name'=>'王毅','zfb_number'=>'13128820934'],
-            ['number'=>'WD534615354985156505','name'=>'相安家','zfb_number'=>'407113438@qq.com'],
-            ['number'=>'WD534641951100535649','name'=>'覃程','zfb_number'=>'15878811470'],
-            ['number'=>'WD534533810151575699','name'=>'何喜','zfb_number'=>'何喜'],
-            ['number'=>'WD534472657575149995','name'=>'丁小文','zfb_number'=>'13983952207'],
-            ['number'=>'WD534592654101525653','name'=>'郭景辉','zfb_number'=>'19922439523'],
-            ['number'=>'WD534603599101565797','name'=>'粟明伟','zfb_number'=>'18520698032'],
-            ['number'=>'WD534503510250999753','name'=>'魏国杰','zfb_number'=>'13861684504'],
-            ['number'=>'WD534608399491015250','name'=>'林凯伦','zfb_number'=>'13829526420'],
-            ['number'=>'WD534473456535410149','name'=>'贺柳涛','zfb_number'=>'17347590878'],
-            ['number'=>'WD534450149485410155','name'=>'冯永枭','zfb_number'=>'18957811849'],
-            ['number'=>'WD534496253549949975','name'=>'卢芹芳','zfb_number'=>'13764869782'],
-            ['number'=>'WD534451657100569952','name'=>'刘媛媛','zfb_number'=>'18875230706'],
-            ['number'=>'WD534514049525310298','name'=>'任细虹','zfb_number'=>'15159758937'],
-            ['number'=>'WD534616998505010151','name'=>'刘桂杰','zfb_number'=>'15624852973'],
-            ['number'=>'WD534631454561005252','name'=>'刘光荣','zfb_number'=>'15625282199'],
-            ['number'=>'WD534609555525198100','name'=>'吴优','zfb_number'=>'13664011167'],
-            ['number'=>'WD534472899515549981','name'=>'王静','zfb_number'=>'18696475281'],
-            ['number'=>'WD534657455985310157','name'=>'余汉','zfb_number'=>'15672642936'],
-            ['number'=>'WD534610253509997481','name'=>'马钰琪','zfb_number'=>'18047125331'],
-            ['number'=>'WD534599557555410256','name'=>'吴优','zfb_number'=>'13664011167'],
-            ['number'=>'WD534495657535110099','name'=>'张镇强','zfb_number'=>'13850404031'],
-            ['number'=>'WD534581551101541024','name'=>'刘健','zfb_number'=>'15698096367'],
-            ['number'=>'WD534617410049525198','name'=>'李小松','zfb_number'=>'www424684642@163.com'],
-            ['number'=>'WD534562254505210153','name'=>'郑毅','zfb_number'=>'18972923284'],
-            ['number'=>'WD534598898545597579','name'=>'马钰琪','zfb_number'=>'18047125331'],
-            ['number'=>'WD534592653504949529','name'=>'郭景辉','zfb_number'=>'19922439523'],
-            ['number'=>'WD534598352505656100','name'=>'吴优','zfb_number'=>'13664011167'],
-            ['number'=>'WD534452799101535797','name'=>'罗鱼谜','zfb_number'=>'17612872572'],
-            ['number'=>'WD534452754575753539','name'=>'罗鱼谜','zfb_number'=>'17612872572'],
-            ['number'=>'WD534450110110052100','name'=>'冯永枭','zfb_number'=>'18957811849'],
-            ['number'=>'WD534619497495510254','name'=>'岳庆庆','zfb_number'=>'15935905192'],
-            ['number'=>'WD534615348995554101','name'=>'岳庆庆','zfb_number'=>'15935905192'],
-            ['number'=>'WD534625157101511005','name'=>'王山','zfb_number'=>'13356299904'],
-            ['number'=>'WD534614410053995310','name'=>'万福宝','zfb_number'=>'18813135231'],
-            ['number'=>'WD534642356515610153','name'=>'凌思林','zfb_number'=>'15279507826'],
-            ['number'=>'WD534461710251515248','name'=>'刘海武','zfb_number'=>'15858128789'],
-            ['number'=>'WD534593650564910255','name'=>'王毅','zfb_number'=>'13128820934'],
-            ['number'=>'WD534593648975156505','name'=>'王金柱','zfb_number'=>'13139522808'],
-            ['number'=>'WD534631450499810010','name'=>'刘光荣','zfb_number'=>'15625282199'],
-            ['number'=>'WD534660410197515048','name'=>'洪芳芳','zfb_number'=>'13922282065'],
-            ['number'=>'WD534617497575253985','name'=>'李小松','zfb_number'=>'15829099670'],
-            ['number'=>'WD534614454974856981','name'=>'万福宝','zfb_number'=>'18813135231'],
-            ['number'=>'WD534556956534910210','name'=>'楚强强','zfb_number'=>'18656948213'],
-            ['number'=>'WD534593699102515257','name'=>'王金柱','zfb_number'=>'13139522808'],
-            ['number'=>'WD534608557971019849','name'=>'陈伟','zfb_number'=>'17874017301'],
-            ['number'=>'WD534655751975797519','name'=>'杨玉婷','zfb_number'=>'19169946597'],
-            ['number'=>'WD534603510099101485','name'=>'粟明伟','zfb_number'=>'18520698032'],
-            ['number'=>'WD534485055994910049','name'=>'谢谊春','zfb_number'=>'1515354567@qq.com'],
-            ['number'=>'WD534649150975650541','name'=>'汪川','zfb_number'=>'15961266732'],
-            ['number'=>'WD534661055545751984','name'=>'程利峰','zfb_number'=>'17320678688'],
-            ['number'=>'WD534663010054100100','name'=>'吴优','zfb_number'=>'16271845555'],
-            ['number'=>'WD534615299511025199','name'=>'岳庆庆','zfb_number'=>'15935905192'],
-            ['number'=>'WD534597254501029710','name'=>'楚强强','zfb_number'=>'18788877745'],
-            ['number'=>'WD534657749505348571','name'=>'宋杨','zfb_number'=>'15232797156'],
-            ['number'=>'WD534581297102489849','name'=>'魏大江','zfb_number'=>'18883588210'],
-            ['number'=>'WD534486656485298545','name'=>'王姣','zfb_number'=>'13731201128'],
-            ['number'=>'WD534676453979799545','name'=>'伍锦胜','zfb_number'=>'13432206140'],
-            ['number'=>'WD534587653545556531','name'=>'郝健','zfb_number'=>'18562365150'],
-            ['number'=>'WD534579749975397569','name'=>'吴小亮','zfb_number'=>'15298603353'],
-            ['number'=>'WD534650998505752519','name'=>'董妍','zfb_number'=>'15021300080'],
-            ['number'=>'WD534494851535510153','name'=>'魏秀军','zfb_number'=>'13543736731'],
-            ['number'=>'WD534583810054100565','name'=>'王奋强','zfb_number'=>'13387137935'],
-            ['number'=>'WD534596054100574810','name'=>'邵小斌','zfb_number'=>'18393825795'],
-            ['number'=>'WD534616356101995298','name'=>'马梓浩','zfb_number'=>'17710404082'],
-            ['number'=>'WD534659551495755985','name'=>'楚强强','zfb_number'=>'396746095@qq.com'],
-            ['number'=>'WD534593610051525655','name'=>'王毅','zfb_number'=>'13128820934'],
-            ['number'=>'WD534654355975548995','name'=>'邓丽','zfb_number'=>'18171692670'],
-            ['number'=>'WD534451652535050101','name'=>'刘媛媛','zfb_number'=>'18875230706'],
-            ['number'=>'WD534631450545652575','name'=>'刘光荣','zfb_number'=>'15625282199'],
-            ['number'=>'WD534603510010010010','name'=>'唐慧','zfb_number'=>'1693770147@qq.com']
-        ];
-
-        $count = 0;
-        foreach ($arr as $key=>$val){
-            if (!Db::name('withdraw_log')->where('status', 3)->where('create_at', '>', '2023-02-13 23:30:30')->where('zfb_number', $val['zfb_number'])->find()){
-//                ++$count;
-                $output->writeln('number:'.$val['number']);
-            }
-        }
-
-        $output->writeln('count:'.$count);
-
-    }
-
-    public static function get_date_by_excel($date){
-        if (!$date || $date == '0000-00-00') return null;
-
-        $unix_time = \PHPExcel_Shared_Date::ExcelToPHP($date);
-
-        return gmdate('Y-m-d H:i',$unix_time);
-
-    }
-
-
-
-    protected function updateMiddleExcelData($input, $output){
-
-        $list = Db::name('box_mid_handle')->where('id', '>', 0)->select();
-//        $output->writeln('key'.json_encode($list));
-//        sr_throw();
-        foreach ($list as $key=>$val){
-
-            $output->writeln('key'.$key);
-
-            if (empty($val['pay_type'])){
-                $pay_type = Db::name('box_record')->where('id', $val['rid'])->value('pay_type');
-//                sr_throw($pay_type);
-                Db::name('box_mid_handle')->where('id', $val['id'])->save(['pay_type'=>$pay_type]);
-            }
-        }
-    }
-
-    protected function recordBoxAppointToMiddle($input, $output){
-
-        $list = Db::name('box_record')->where('status', 1)->select()->toArray();
-
-        $mid_arrs = [];
-        $r_ids = [];
-
-        $cur_time = sr_getcurtime(time());
-        foreach ($list as $key=>$val){
-            $total_goodsbox = $val['box10'] + $val['box20'] + $val['box30'] + $val['box40'];
-
-            $r_goodsids = '';
-
-            // 如果有空盒
-            if ($val['num'] > $total_goodsbox){
-                for ($i=0;$i < $val['num']-$total_goodsbox;$i++){
-                    $mid_arrs[] = [
-                        'h_sn'=>createdHandleOrderSn(),
-                        'uid'=>$val['uid'],
-                        'rid'=>$val['id'],
-                        'goods_id'=>0,
-                        'create_time'=>$cur_time,
-                        'box_type'=>0,
-                        'goods_price'=>0
-                    ];
-                }
-            }
-
-//            if (1 == 1){
-//                sr_throw();
-//            }
-            // 其他盒子
-            $box_arrs = [10, 20, 30, 40];
-            foreach ($box_arrs as $key1=>$val1){
-
-                $key_string = strval('box'.$val1);
-                $box_goodsnum = $val[$key_string];
-                $model = new ShopGoodsModel();
-                $goods_arr = $model
-                    ->where('box_type', $val1)
-                    ->where('goods_type', 2)
-                    ->field('goods_id,box_type,goods_img,price,goods_name')
-                    ->page(1, 20)
-                    ->select();
-//                    ->select();
-//                sr_throw(json_encode($goods_arr));
-
-                if ($box_goodsnum > 0){
-
-                    // 如果后期要调整  取值 直接 排序 goods_arr
-                    for ($i = 0; $i < $box_goodsnum;$i++){
-                        $rand_num = mt_rand(0, count($goods_arr)-1);
-
-
-                        $goods = $goods_arr[$rand_num];
-
-                        $mid_arrs[] = [
-                            'h_sn'=>createdHandleOrderSn(),
-                            'uid'=>$val['uid'],
-                            'rid'=>$val['id'],
-                            'goods_id'=>$goods['goods_id'],
-                            'create_time'=>$cur_time,
-                            'box_type'=>$val1,
-                            'goods_price'=>$goods['price']
-                        ];
-                        $r_goodsids .= ((empty($r_goodsids)?'':',').$goods['goods_id']);
-                    }
-
-                }
-            }
-
-
-            Db::name('box_record')->where('id', $val['id'])->save([
-                'status'=>2,
-                'goods_ids'=>$r_goodsids
-            ]);
-        }
-
-        $model = new BoxMidHandleModel();
-        $model->insertAll($mid_arrs);
-
-    }
-
-    public function systemHandleBox(Input $input, Output $output){
-
-    }
-
-    public function addUser(Input $input, Output $output){
-
-        $users = $this->randomPhone(10);
-
-        $pid_invitecode = 0;
-        foreach ($users as $key=>$val){
-            if (!Db::name('user')->where('mobile', $val)->find()){
-                $services = new UserServices();
-                $output->writeln('key'.$key);
-                $uid = $services->userRegister([
-                        'user_name'=>'db-'.$val,
-                        'invite_code'=>($pid_invitecode==0?'03284278':$pid_invitecode),
-                        'code'=>'111111',
-                        'password'=>"TDFyZ3n\/5GksjKtjhj2G1w==",
-                        'mobile'=>$val
-                    ]
-                );
-
-                $user_info = Db::name('user')->where('id', $uid)->find();
-                $pid_invitecode = $user_info['code'];
-            }
-
-
-        }
-
-
-
-    }
-
-
-    public function buyBoxBefore(){
-        $users = Db::name('user')->where('money', '>', 0)->paginate(50)->toArray();
-
-
-        $model = new BoxModel();
-        foreach ($users['data'] as $key=>$val){
-            $count = rand(0, 10);
-            $model->beforeBuyBox($val['id'], ['box_id'=>23422, 'buy_count'=>$count, 'pay_type'=>rand(1,2)]);
-        }
-
-
-    }
-
-//随机生成n条手机号
-    function randomPhone($n = 20)
-    {
-        $tel_arr = array(
-            '130', '131', '132', '133', '134', '135', '136', '137', '138', '139', '144', '147', '150', '151', '152', '153', '155', '156', '157', '158', '159', '176', '177', '178', '180', '181', '182', '183', '184', '185', '186', '187', '188', '189',
-        );
-        for ($i = 0; $i < $n; $i++) {
-            $tmp[] = $tel_arr[array_rand($tel_arr)] . mt_rand(1000, 9999) . mt_rand(1000, 9999);
-        }
-        return array_unique($tmp);
-    }
-
-    function settingUserLevels(){
-//        $levels = [0, 1, 1, 3, 0, 2, 3, 1, 0];
-//        $levels = [2, 3, 0, 3, 2, 1, 0, 3, 0];
-//        $levels = [3, 0, 3, 2, 1, 2, 0, 3, 1];
-//        $levels = [0, 3, 0, 3, 2, 3, 3, 0, 2];
-//        $levels = [1, 2, 2, 1, 3, 0, 2, 1, 3];
-        $levels = [3,0,3,2,2,3,0,3,1];
-        $zero_uid = 5344487;
-        foreach ($levels as $key=>$val){
-            Db::name('user')->where('id', $zero_uid-$key)->save(['level'=>$val]);
-        }
-    }
-
-
-}