<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台（PHP版）
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码，建议反馈是我们前进的动力
// | 开源版本可自由商用，可去除界面版权logo
// | gitee下载：https://gitee.com/likeshop_gitee/likeadmin
// | github下载：https://github.com/likeshop-github/likeadmin
// | 访问官网：https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------

namespace app\api\logic;

use app\common\enum\PayEnum;
use app\common\logic\BaseLogic;
use app\common\model\master_worker\MasterWorkerTeam;
use app\common\model\recharge\RechargeOrder;
use app\common\model\tenant\TenantRatingCommission;
use app\common\model\user\User;
use app\common\service\ConfigService;


/**
 * 服务分抽成
 * Class TenantRatingCommissionLogic
 * @package app\shopapi\logic
 */
class TenantRatingCommissionLogic extends BaseLogic
{

    /**
     * 获取抽成比例
     *  eg:
     *  3.5 <= 3.8 < 4.0
     *
     */
    public static function getCommissionByTenantId($tenant_id)
    {
        $comprehensive_score = MasterWorkerTeam::where('tenant_id',$tenant_id)->value('comprehensive_score')??0;
        return TenantRatingCommission::where('tenant_id',$tenant_id)
            ->where('rating_start','<=',$comprehensive_score)
            ->where('rating_end','>',$comprehensive_score)->value('commission')??0;
    }

}