public function update(Request $request, $id) { //图片上传处理 if ($request->hasFile('url_ori')) { //判断文件存在 //验证图片大小 foreach ($_FILES as $pic) { if ($pic['size'] > $this->uploadSizeLimit) { echo "<script>alert(\"对不起,你上传的图片过大,请重新选择\");history.go(-1);</script>"; exit; } } $file = $request->file('url_ori'); //获取文件 $logo = \App\Tools::upload($file); } $data = ['logo' => isset($logo) ? $logo : '', 'title' => $request->title, 'keyword' => $request->keyword, 'description' => $request->description, 'updated_at' => date('Y-m-d H:i:s', time())]; //同时删除原有的logo图片 $mainModel = ComMainModel::find($id); if (isset($logo) && $mainModel->logo && $mainModel->logo != $this->sefLogo) { unlink(ltrim($mainModel->logo, '/')); } ComMainModel::where('id', $id)->update($data); return redirect('/company/admin/basic'); }
public function __construct() { parent::__construct(); $this->lists['category']['name'] = '综合应用'; $this->lists['category']['url'] = 'general'; $this->lists['func']['name'] = '访问管理'; $this->lists['func']['url'] = 'visit'; $this->model = new VisitlogModel(); //公司页面访问日志刷新频率 $comMainModel = ComMainModel::where('cid', $this->cid)->first(); $this->visitRate = $comMainModel->visitRate; }
public function setVisit() { if (AjaxRequest::ajax()) { $data = Input::all(); //公司页面访问日志刷新频率 $comMainModel = ComMainModel::where('cid', $data['cid'])->first(); $visitRate = $comMainModel->visitRate; if ($data['cid']) { $this->getRedis($data, $visitRate); } } dd('操作有误!'); }
/** * 查询方法 */ public function query() { $datas = ComMainModel::paginate($this->limit); $datas->limit = $this->limit; return $datas; }
/** * 视频发布方信息 */ public function getUserInfo() { $companyMian = ComMainModel::where('uid', $this->uid)->first(); return $companyMian ? $companyMian : ''; }
public function companyMain() { $uid = $this->userid ? $this->userid : 0; return $uid ? ComMainModel::where('uid', $uid)->first() : ''; }
public function getCompanyMain($uid = null) { $comMainInfo = ComMainModel::where('uid', $uid)->first(); return $comMainInfo ? $comMainInfo : ''; }
/** * 获取企业首页的功能显示列表 */ public function getLayoutHomeSwitchs() { $comMainModel = ComMainModel::where('cid', $this->cid)->first(); return unserialize($comMainModel->layoutHome); }
/** * 公司基本信息 */ public function getComMain($cid) { return ComMainModel::where('cid', $cid)->first(); }
/** * 得到访问频率 */ public function getVisitRate() { $comMainModel = ComMainModel::where('cid', $this->cid)->first(); return $comMainModel ? $comMainModel->visitRate : 0; }
/** * 首页开关初始化 */ public function getHomeSwitch($cid) { $comMainModel = new ComMainModel(); foreach ($comMainModel['layoutHomes'] as $k => $layoutHome) { $arr[$layoutHome]['key'] = $k; $arr[$layoutHome]['name'] = $comMainModel['layoutHomeNames'][$k]; $arr[$layoutHome]['value'] = 1; } ComMainModel::where('cid', $cid)->update(['layoutHome' => serialize($arr)]); }
public function getLogo() { $comMainModel = ComMainModel::where('cid', $this->id)->first(); return $comMainModel->logo; }