|
|
|
@ -0,0 +1,42 @@ |
|
|
|
<?php |
|
|
|
|
|
|
|
namespace app\service; |
|
|
|
|
|
|
|
use app\model\Process; |
|
|
|
use app\model\Resource; |
|
|
|
|
|
|
|
class ProcessService |
|
|
|
{ |
|
|
|
public $resource_status_map; |
|
|
|
|
|
|
|
public function __construct() |
|
|
|
{ |
|
|
|
$this->resource_status_map = Resource::STATUS_MAP; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param $insert_audit_flag 是否需要插入审核表 |
|
|
|
* @return int |
|
|
|
* 通过流程表 获取资源上传后的状态 |
|
|
|
*/ |
|
|
|
public function getResouceUploadStatus($resource, $insert_audit_flag = false) |
|
|
|
{ |
|
|
|
$status = $this->resource_status_map['not']; |
|
|
|
|
|
|
|
$process = (Process::where('flag', 'resource_upload')->find()); |
|
|
|
//流程停用开启 上传后状态直接是审核通过
|
|
|
|
if ($process->stop_using == 1) { |
|
|
|
$status = $this->resource_status_map['success']; |
|
|
|
} |
|
|
|
|
|
|
|
//自动发起开启 上传后状态直接是等待审核
|
|
|
|
if ($process->auto_propose == 1) { |
|
|
|
$status = $this->resource_status_map['wait']; |
|
|
|
if ($insert_audit_flag) { |
|
|
|
(new AuditService())->addAudit([$resource->id], 1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return $status; |
|
|
|
} |
|
|
|
} |