<?php

namespace app\workerapi\controller;

use app\workerapi\lists\MasterWorkerAccountLogLists;
use app\workerapi\lists\MasterWorkerCaseOutLogLists;
use app\workerapi\logic\AccountLogic;
use app\workerapi\validate\AccountLogValidate;

class AccountController extends BaseApiController
{
    public function totalAssets()
    {
        $result = AccountLogic::totalAssets(['worker_id' => $this->userId]);
        if (false === $result) {
            return $this->fail(AccountLogic::getError());
        }
        return $this->success('操作成功',$result, 1, 0);
    }

    public function accountLogLists()
    {
        return $this->dataLists(new MasterWorkerAccountLogLists());
    }

    public function caseOutLists()
    {
        return $this->dataLists(new MasterWorkerCaseOutLogLists());
    }

    public function monthAccountWithCaseOutTotal()
    {
        $params = (new AccountLogValidate())->get()->goCheck('monthAccountWithCaseOutTotal',['worker_id'=>$this->userId]);
        $result = AccountLogic::monthAccountWithCaseOutTotal($params);
        if (false === $result) {
            return $this->fail(AccountLogic::getError());
        }
        return $this->success('操作成功',$result, 1, 0);
    }
}