| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?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 Int $uid 用户ID
- * @param String $table 操作表
- * @param Int $type 操作类型
- * @param Array $oldData 旧数据
- * @param Array $oldData 新数据
- *
- */
- protected function addAdminHistory($uid,$table,$id,$type,$oldData,$newData) {
- //记录详细操作历史
- $AdminHistory = (new AdminHistory());
- // 记录数据
- $AdminHistory->addAll($uid,$table,$id,$type,$oldData,$newData);
- }
- }
|