添加稻虾流向管理操作日志
parent
b9ea4698c9
commit
eb6e59e783
|
|
@ -9,6 +9,8 @@ use App\Models\RiceShrimpFlow;
|
||||||
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 RiceShrimpFlowController extends Controller
|
class RiceShrimpFlowController extends Controller
|
||||||
{
|
{
|
||||||
|
|
@ -52,6 +54,8 @@ class RiceShrimpFlowController extends Controller
|
||||||
$riceShrimpFlow->updated_by = $user->id;
|
$riceShrimpFlow->updated_by = $user->id;
|
||||||
$riceShrimpFlow->save();
|
$riceShrimpFlow->save();
|
||||||
|
|
||||||
|
(new OperationLogService())->inLog(OperationType::Create, '', $riceShrimpFlow, $request->input());
|
||||||
|
|
||||||
return RiceShrimpFlowResource::make(
|
return RiceShrimpFlowResource::make(
|
||||||
$riceShrimpFlow->setRelations([
|
$riceShrimpFlow->setRelations([
|
||||||
'createdBy' => $user,
|
'createdBy' => $user,
|
||||||
|
|
@ -88,6 +92,8 @@ class RiceShrimpFlowController extends Controller
|
||||||
|
|
||||||
$riceShrimpFlow->save();
|
$riceShrimpFlow->save();
|
||||||
|
|
||||||
|
(new OperationLogService())->inLog(OperationType::Update, '', $riceShrimpFlow, $request->input());
|
||||||
|
|
||||||
return RiceShrimpFlowResource::make(
|
return RiceShrimpFlowResource::make(
|
||||||
$riceShrimpFlow->loadMissing(['createdBy', 'updatedBy'])
|
$riceShrimpFlow->loadMissing(['createdBy', 'updatedBy'])
|
||||||
);
|
);
|
||||||
|
|
@ -105,6 +111,8 @@ class RiceShrimpFlowController extends Controller
|
||||||
|
|
||||||
$riceShrimpFlow->delete();
|
$riceShrimpFlow->delete();
|
||||||
|
|
||||||
|
(new OperationLogService())->inLog(OperationType::Delete, '', $riceShrimpFlow);
|
||||||
|
|
||||||
return response()->json(null);
|
return response()->json(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,4 +13,12 @@ class OperationLogFilter extends ModelFilter
|
||||||
public function user($user){
|
public function user($user){
|
||||||
return $this->where('user_id', $user);
|
return $this->where('user_id', $user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function startTime($startTime){
|
||||||
|
return $this->where('created_at', '>=', $startTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function endTime($endTime){
|
||||||
|
return $this->where('created_at', '<=', $endTime);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ use App\Models\FriendLink;
|
||||||
use App\Models\RiceShrimpPrice;
|
use App\Models\RiceShrimpPrice;
|
||||||
use App\Models\RiceShrimpFlow;
|
use App\Models\RiceShrimpFlow;
|
||||||
use App\Models\RiceShrimpIndustry;
|
use App\Models\RiceShrimpIndustry;
|
||||||
|
use App\Models\Materiel;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
AdminRole::class => "角色",
|
AdminRole::class => "角色",
|
||||||
|
|
@ -22,4 +23,5 @@ return [
|
||||||
RiceShrimpPrice::class => "稻虾价格",
|
RiceShrimpPrice::class => "稻虾价格",
|
||||||
RiceShrimpFlow::class => "稻虾流向",
|
RiceShrimpFlow::class => "稻虾流向",
|
||||||
RiceShrimpIndustry::class => "稻虾产业",
|
RiceShrimpIndustry::class => "稻虾产业",
|
||||||
|
Materiel::class => "大宗物资",
|
||||||
];
|
];
|
||||||
Loading…
Reference in New Issue