|
|
@@ -2,11 +2,12 @@
|
|
|
|
|
|
namespace App\Services;
|
|
|
|
|
|
-use App\Facilitator;
|
|
|
+use App\Role;
|
|
|
use App\Traits\ServiceAppAop;
|
|
|
use App\DischargeTask;
|
|
|
use Carbon\Carbon;
|
|
|
use Illuminate\Database\Eloquent\Collection;
|
|
|
+use Illuminate\Support\Facades\Auth;
|
|
|
|
|
|
class DischargeTaskService
|
|
|
{
|
|
|
@@ -57,12 +58,18 @@ class DischargeTaskService
|
|
|
unset($param['owner'],$param['income_at']);
|
|
|
|
|
|
if ($param['id']) unset($param['id']);
|
|
|
- if ($dischargeTask->status >= 1) return ['success' => false, 'message' => '当前任务状态不可修改'];
|
|
|
+
|
|
|
+ $roles = Role::query()->where('name','like','人事%')->get();
|
|
|
+ $personnel = app(UserService::class)->hasRoles(Auth::user(),$roles);
|
|
|
+ if(array_search(Auth::user()["name"],config("users.superAdmin"))!==false){
|
|
|
+ $personnel = true;
|
|
|
+ }
|
|
|
+ if ($dischargeTask->status >= 1 && $personnel == false) return ['success' => false, 'message' => '当前任务状态不可修改'];
|
|
|
if (empty($param['expenditure_at'])) $param['expenditure_at'] = now();
|
|
|
if (empty($param['status'])) $param['status'] = 1;
|
|
|
|
|
|
$param['expenditure_total_cost'] = $param['expenditure_unit_price'] * $param['expenditure_amount'];
|
|
|
-
|
|
|
+ // Authority
|
|
|
$bool = $dischargeTask->update($param);
|
|
|
|
|
|
if ($bool == 1) {
|