<?php

namespace app\common\logic;

use app\common\model\platform_rule\PerformanceWorkerRules;

/**
 * 加单金额判定和结算处理
 */
class WorkAddMoneyLogic extends BaseLogic
{
    public static function checkAddWork($work,$worker_price)
    {
        if($work->work_type != 2){
            return 0;
        }
        $rule = PerformanceWorkerRules::where('goods_category_ids','find in set',$work->goods_category_id)->findOrEmpty();
        if($rule->isEmpty()){
            return 0;
        }
        return bcmul($worker_price, $rule['rate'],2);
    }
}