| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <?php
- namespace App\Http\Controllers;
- // 基础控制器
- use App\Models\Manager\AdminHistory;
- use Illuminate\Routing\Controller as BaseController;
- /**
- * 控制器总控
- *
- */
- class Controller extends BaseController
- {
- /**
- * 构造方法,初始化
- *
- * */
- public function __construct()
- {
- // 初始化
- if (method_exists($this, '_initialize')) $this->_initialize();
- // 初始化
- if (method_exists($this, '__init')) $this->__init();
- }
- /**
- * 操作错误跳转的快捷方法
- * @param Mixed $msg 提示信息
- * @param String $url 跳转的URL地址
- * @param Int $wait 跳转等待时间
- *
- * @return Void
- */
- protected function error($msg = '', $url = null, $wait = 3)
- {
- if (is_null($url)) {
- $url = request()->ajax() ? '' : 'javascript:history.back(-1);';
- } elseif ('' !== $url) {
- $url = (strpos($url, '://') || 0 === strpos($url, '/')) ? $url : url($url);
- }
- // 返回结果
- return view('error', ['msg' => $msg, 'url' => $url, 'wait' => $wait]);
- }
- /**
- * 保存用户操作历史
- * @param String $admin_menu_name 模块菜单名称
- * @param Int $uid 用户ID
- * @param String $table 操作表
- * @param Int $type 操作类型,1添加,2修改,3=删除
- * @param Array $oldData 旧数据
- * @param Array $oldData 新数据
- * @param String $general_description 操作描述
- *
- */
- protected function addAdminHistory($admin_menu_name, $uid, $is_admin, $table, $type, $oldData, $newData, $general_description = '')
- {
- //记录详细操作历史
- $AdminHistory = (new AdminHistory());
- // 记录数据
- $AdminHistory->addAll($admin_menu_name, $uid, $is_admin, $table, $type, $oldData, $newData, $general_description);
- }
- }
|