PHP multiple judgment optimization (different conditions)

problem description

scenario: multiple loops with different rules, go back to level 7 online.
defined rules (written in config)

related codes

Rule definition (written in config)

 "distribution" =>[
        "vip"   =>[//VIP
            "vip_platinum" => "0.05", //5%
            "vip_platinum_platinum" => "0.02", //2%
            "vip_diamond" => "0.07", //7%
            "vip_diamond_diamond" => "0.04", //4%
            "vip_diamond_platinum" => "0.02", //2%
            "vip_two" => "0.03", //3%
            "vip_two_two" => "0.01", //1%;
        ],
        "platinum" => [//
            "platinum_platinum" => "0.02", //2%
            "platinum_platinum_diamond" => "0.05", //   2%5%
            "platinum_diamond" => "0.05", //5%
            "platinum_diamond_diamond" => "0.02", //2%
        ],
        "diamond" => [//
            "diamond_diamond" => "0.04", //4%
        ],
        "two" => [//
            "two_two" => "0.01", // 1% 
            "two_one" => "0.01",//1 %
        ],
    ],

stupid method

Infinite judgment. Each level judges the level of the superior. If it is not satisfied, trace it back to the seventh level

.

Smart method

is there any other clever way?

Php
Jan.15,2022

does not understand the description of your problem. Can you refine it?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e5dcbe-4daf5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e5dcbe-4daf5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?