php如何快速进行10万+的数据计算并且修改数据库数据?

使用的框架为 laravle 5.5,目前有一个需求,需要按区域计算用户分红,然后修改用户的分红余额,修改已分红金额等
,数据库结构为:

    //分红记录表
    Schema::create('bonus_queue', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('region')->comment('区域');
            $table->integer('member_id')->comment('会员id');
            $table->decimal('bonus', 12, 2)->comment('应得分红');
            $table->decimal('have_bonus', 12, 2)->comment('已得分红');
            $table->tinyInteger('status')->comment('1正在分红2分红完成');
            $table->timestamps();
        });
     //用户表
    Schema::create('members', function (Blueprint $table) {
            $table->increments('id');
            $table->decimal('bonus', 12, 2)->comment('分红金额');
            $table->timestamps();
        });

谢谢各位大佬提供思路!

繁华开满天机
浏览 776回答 5
5回答

青春有我

写入队列中去异步执行

ABOUTYOU

我在做你一样的项目. 我的思路是 快照用户数据 然后分页处理. 每页处理2000条 不过感觉算法有点low.

哔哔one

没要求时间,那你就慢慢算呗。只要算的比会计快 你的老板就满意。才10万+而已,没多少。

慕村9548890

进队列异步处理。
打开App,查看更多内容
随时随地看视频慕课网APP