<?php
namespace app\workerapi\logic;
use app\common\enum\worker\WorkerAccountLogEnum;
use app\common\logic\BaseLogic;
use app\common\model\master_worker\MasterWorker;
use app\common\model\master_worker\MasterWorkerRetentionMoneyLog;

/**
 * @author 林海涛
 * @date 2024/7/28 上午10:32
 */
class RetentionMoneyLogic extends BaseLogic
{
    public static function totalAmount($params)
    {
        try{
            $model = MasterWorker::findOrEmpty($params['worker_id']);
            if($model->isEmpty()){
                throw new \Exception('用户不存在');
            }
            $data['earnest_money_usable'] =  $model->earnest_money_usable;
            $data['earnest_money_freeze'] = $model->earnest_money_freeze;
            $data['retention_money_status'] = $model->retention_money_status;
            $data['retention_money_status_text'] = $model->retention_money_status_text;
            $data['retention_pay_status'] = $model->retention_pay_status;
            $data['retention_pay_status_text'] = $model->retention_pay_status_text;
            $data['earnest_money'] = $model->earnest_money;
            return $data;
        } catch(\Exception $e){
            self::setError($e->getMessage());
            return false;
        }
    }

}
