Compare commits

...

2 Commits

Author SHA1 Message Date
vine_liutk afe617a23b 添加剩余管理操作日志 2022-11-15 11:03:08 +08:00
vine_liutk 3850bcd0a3 添加大宗物资管理操作日志 2022-11-15 10:55:23 +08:00
4 changed files with 29 additions and 0 deletions

View File

@ -9,6 +9,8 @@ use App\Models\Materiel;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\ResourceCollection; use Illuminate\Http\Resources\Json\ResourceCollection;
use App\Services\OperationLogService;
use App\Enums\OperationType;
class MaterielController extends Controller class MaterielController extends Controller
{ {
@ -54,6 +56,8 @@ class MaterielController extends Controller
$materiel->updated_by = $user->id; $materiel->updated_by = $user->id;
$materiel->save(); $materiel->save();
(new OperationLogService())->inLog(OperationType::Create, '', $materiel, $request->input());
return MaterielResource::make( return MaterielResource::make(
$materiel->setRelations([ $materiel->setRelations([
'createdBy' => $user, 'createdBy' => $user,
@ -92,6 +96,8 @@ class MaterielController extends Controller
$materiel->save(); $materiel->save();
(new OperationLogService())->inLog(OperationType::Update, '', $materiel, $request->input());
return MaterielResource::make( return MaterielResource::make(
$materiel->loadMissing(['createdBy', 'updatedBy']) $materiel->loadMissing(['createdBy', 'updatedBy'])
); );
@ -109,6 +115,8 @@ class MaterielController extends Controller
$materiel->delete(); $materiel->delete();
(new OperationLogService())->inLog(OperationType::Delete, '', $materiel);
return response()->json(null); return response()->json(null);
} }
} }

View File

@ -9,6 +9,8 @@ use App\Models\RiceShrimpIndustry;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\ResourceCollection; use Illuminate\Http\Resources\Json\ResourceCollection;
use App\Services\OperationLogService;
use App\Enums\OperationType;
class RiceShrimpIndustryController extends Controller class RiceShrimpIndustryController extends Controller
{ {
@ -53,6 +55,8 @@ class RiceShrimpIndustryController extends Controller
$riceShrimpIndustry->updated_by = $user->id; $riceShrimpIndustry->updated_by = $user->id;
$riceShrimpIndustry->save(); $riceShrimpIndustry->save();
(new OperationLogService())->inLog(OperationType::Create, '', $riceShrimpIndustry, $request->input());
return RiceShrimpIndustryResource::make( return RiceShrimpIndustryResource::make(
$riceShrimpIndustry->setRelations([ $riceShrimpIndustry->setRelations([
'createdBy' => $user, 'createdBy' => $user,
@ -90,6 +94,8 @@ class RiceShrimpIndustryController extends Controller
$riceShrimpIndustry->save(); $riceShrimpIndustry->save();
(new OperationLogService())->inLog(OperationType::Update, '', $riceShrimpIndustry, $request->input());
return RiceShrimpIndustryResource::make( return RiceShrimpIndustryResource::make(
$riceShrimpIndustry->loadMissing(['createdBy', 'updatedBy']) $riceShrimpIndustry->loadMissing(['createdBy', 'updatedBy'])
); );
@ -107,6 +113,8 @@ class RiceShrimpIndustryController extends Controller
$riceShrimpIndustry->delete(); $riceShrimpIndustry->delete();
(new OperationLogService())->inLog(OperationType::Delete, '', $riceShrimpIndustry);
return response()->json(null); return response()->json(null);
} }
} }

View File

@ -9,6 +9,8 @@ use App\Models\RiceShrimpPrice;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\ResourceCollection; use Illuminate\Http\Resources\Json\ResourceCollection;
use App\Services\OperationLogService;
use App\Enums\OperationType;
class RiceShrimpPriceController extends Controller class RiceShrimpPriceController extends Controller
{ {
@ -55,6 +57,8 @@ class RiceShrimpPriceController extends Controller
'updatedBy' => $user, 'updatedBy' => $user,
]); ]);
(new OperationLogService())->inLog(OperationType::Create, '', $riceShrimpPrice, $request->input());
return RiceShrimpPriceResource::make($riceShrimpPrice); return RiceShrimpPriceResource::make($riceShrimpPrice);
} }
@ -85,6 +89,8 @@ class RiceShrimpPriceController extends Controller
$riceShrimpPrice->save(); $riceShrimpPrice->save();
(new OperationLogService())->inLog(OperationType::Update, '', $riceShrimpPrice, $request->input());
return RiceShrimpPriceResource::make( return RiceShrimpPriceResource::make(
$riceShrimpPrice->loadMissing(['createdBy', 'updatedBy']) $riceShrimpPrice->loadMissing(['createdBy', 'updatedBy'])
); );
@ -102,6 +108,8 @@ class RiceShrimpPriceController extends Controller
$riceShrimpPrice->delete(); $riceShrimpPrice->delete();
(new OperationLogService())->inLog(OperationType::Delete, '', $riceShrimpPrice);
return response()->json(null); return response()->json(null);
} }
} }

View File

@ -3,6 +3,8 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Http\Requestes\RestPasswordRequest; use App\Http\Requestes\RestPasswordRequest;
use App\Services\OperationLogService;
use App\Enums\OperationType;
class UserController extends Controller class UserController extends Controller
{ {
@ -21,6 +23,9 @@ class UserController extends Controller
$user->password = bcrypt($input['password']); $user->password = bcrypt($input['password']);
$user->save(); $user->save();
$statusMsg = '修改密码';
(new OperationLogService())->inLog(OperationType::Update, $statusMsg.'-用户【'.$user->name.'】');
//退出所有端 //退出所有端
$user->tokens()->delete(); $user->tokens()->delete();