/** * 视频预览 */ public function video($cid, $id, $videoid) { $company = \App\Models\CompanyModel::find($cid); $data = GoodsModel::find($id); $result = ['data' => $data, 'video' => \App\Models\Base\VideoModel::find($videoid), 'uid' => $company->uid, 'videoName' => $data->name]; return view('layout.videoPre', $result); }
public function company($cid, $url) { //判断cid if (!$cid && !\Session::has('user.cid')) { echo "<script>alert('参数错误,或者没有权限!');history.go(-1);</script>"; exit; } elseif ($cid && !\Session::has('user.cid')) { $this->cid = $cid; $this->company = CompanyModel::find($cid); $this->userid = $this->company->uid; } elseif ((!$cid || $cid) && \Session::has('user.cid')) { $this->userid = \Session::get('user.uid'); $this->cid = \Session::get('user.cid'); $this->company = unserialize(\Session::get('user.company')); } define('CID', $this->cid); //公司页面访问日志刷新频率 $comMain = ComMainModel::where('cid', $this->cid)->first(); define('VISITRATE', $comMain->visitRate); $this->getComModules($this->cid); $this->topmenus = LinkModel::where('cid', $this->cid)->where('type_id', 2)->where('isshow', 1)->orderBy('sort', 'desc')->orderBy('id', 'desc')->paginate(8); //拼接url if ($url) { $this->prefix_url = DOMAIN . 'c/' . $this->cid . '/' . $url; } else { $this->prefix_url = DOMAIN . 'c/' . $this->cid . $url; } return array('uid' => $this->userid, 'cid' => $this->cid, 'company' => $this->company, 'topmenus' => $this->topmenus); }
/** * 资料更新 */ public function update(Request $request, $id) { //基本信息 if (!$request->isuser) { echo "<script>alert('用户类型必选!');history.go(-1);</script>"; exit; } $user = ['email' => $request->email, 'qq' => $request->qq, 'tel' => $request->tel, 'mobile' => $request->mobile, 'isuser' => $request->isuser, 'isauth' => 1]; UserModel::where('id', $id)->update($user); if (in_array($request->isuser, [1, 3])) { //个人信息 if (!$request->realname) { echo "<script>alert('真实名字必填!');history.go(-1);</script>"; exit; } if (!$request->idcard) { echo "<script>alert('身份证号码必填!');history.go(-1);</script>"; exit; } $person = ['realname' => $request->realname, 'sex' => $request->sex, 'idcard' => $request->idcard, 'uid' => $id, 'created_at' => time()]; PersonModel::create($person); } else { //公司信息 $company = ['name' => $request->name, 'area' => $request->area, 'address' => $request->address, 'yyzzid' => $request->yyzzid, 'uid' => $id, 'created_at' => time()]; CompanyModel::create($company); //插入搜索表 $companyModel = CompanyModel::where($company)->first(); \App\Models\Home\SearchModel::change($companyModel, 5, 'create'); } return redirect(DOMAIN . 'member/setting'); }
public function index($cid) { $company = $this->company($cid, $this->list['func']['url']); $companyModel = CompanyModel::find($company['cid']); $result = ['datas' => $this->query($company['cid']), 'company' => $companyModel, 'comMain' => $this->getComMain($company['cid']), 'topmenus' => $this->topmenus, 'prefix_url' => $this->prefix_url]; return view('company.recruit.index', $result); }
public function index($cid) { $key = 'Tj1ciyqmG0quiNgpr0nmAimUCCMB5qMk'; //自己申请的百度地图api的key $company = $this->company($cid, $this->list['func']['url']); $result = ['data' => CompanyModel::find($company['cid']), 'comMain' => $this->getComMain($company['cid']), 'topmenus' => $this->topmenus, 'prefix_url' => $this->prefix_url, 'ak' => $key]; return view('company.contact.index', $result); }
public function dologin() { $userModel = UserModel::where('username', Input::get('username'))->first(); //查看是否有此用户 if (!$userModel) { echo "<script>alert('没有此用户!');history.go(-1);</script>"; exit; } //验证密码正确否 if (!Hash::check(Input::get('password'), $userModel->password)) { echo "<script>alert('密码错误!');history.go(-1);</script>"; exit; } //查看2次密码输入是否一致 if (Input::get('password') != Input::get('password2')) { echo "<script>alert('2次密码输入不一致!');history.go(-1);</script>"; exit; } //验证码验证 $rules = ['captcha' => 'required|captcha']; $messages = ['captcha.required' => '请输入验证码', 'captcha.captcha' => '验证码错误,请重试']; $validator = Validator::make(Input::all(), $rules, $messages); if ($validator->fails()) { echo "<script>alert('验证码错误!');history.go(-1);</script>"; exit; } //个人资料 if (in_array($userModel->isuser, [1, 3])) { $personModel = PersonModel::where('uid', $userModel->id)->first(); $persons['per_id'] = $personModel->id; $persons['realname'] = $personModel->realname; $persons['sex'] = $personModel->sex; $persons['idcard'] = $personModel->idcard; $persons['idfront'] = $personModel->idfront; } $userperson = isset($persons) ? serialize($persons) : []; //企业资料 if (in_array($userModel->isuser, [2, 4])) { $companyModel = CompanyModel::where('uid', $userModel->id)->first(); $companys['cid'] = $companyModel->id; $companys['name'] = $companyModel->name; $companys['area'] = $companyModel->area; $companys['address'] = $companyModel->address; $companys['yyzzid'] = $companyModel->yyzzid; } $usercompany = isset($companys) ? serialize($companys) : []; $serial = date('YmdHis', time()) . rand(0, 10000); $userInfo = ['uid' => $userModel->id, 'username' => Input::get('username'), 'email' => $userModel->email, 'userType' => $userModel->isuser, 'serial' => $serial, 'area' => $userModel->area, 'address' => $userModel->address, 'cid' => isset($companyModel) ? $companyModel->id : '', 'loginTime' => time(), 'person' => $userperson, 'company' => $usercompany]; Session::put('user', $userInfo); //登陆加入用户日志表 $ip = \App\Tools::getIp(); $ipaddress = \App\Tools::getCityByIp($ip); $userlog = ['uid' => $userModel->id, 'uname' => Input::get('username'), 'genre' => 1, 'serial' => $serial, 'ip' => $ip, 'ipaddress' => $ipaddress, 'action' => $_SERVER['REQUEST_URI'], 'loginTime' => time(), 'created_at' => $userModel->created_at]; LogModel::create($userlog); //最近登录更新 UserModel::where('id', $userModel->id)->update(['lastLogin' => time()]); return redirect(DOMAIN . 'member'); }
public function query($genre) { if ($genre) { $datas = CompanyModel::where('genre', $genre)->paginate($this->limit); } else { $datas = CompanyModel::paginate($this->limit); } $datas->limit = $this->limit; return $datas; }
public function index($cid, $type = 1) { $company = $this->company($cid, $this->list['func']['url']); $moduleid = $this->getModuleId($company['cid'], $this->genre); $result = ['model' => $this->model, 'company' => CompanyModel::find($company['cid']), 'comMain' => $this->getComMain($company['cid']), 'topmenus' => $this->topmenus, 'prefix_url' => $this->prefix_url, 'type' => $type]; if (in_array($type, [1, 2])) { $result['data'] = $this->query($company['cid'], $moduleid, $type); } elseif (in_array($type, [3, 4])) { $result['datas'] = $this->query($company['cid'], $moduleid, $type); } return view('company.about.index', $result); }
public function show($id) { $curr['name'] = $this->crumb['show']['name']; $curr['url'] = $this->crumb['show']['url']; $userModel = UserModel::find($id); if (in_array($userModel->isuser, [2, 4])) { $personModel = PersonModel::where('uid', $id)->first(); } elseif (in_array($userModel->isuser, [2, 5, 6, 7])) { $companyModel = CompanyModel::where('uid', $id)->first(); } $result = ['data' => $userModel, 'personModel' => isset($personModel) ? $personModel : '', 'companyModel' => isset($companyModel) ? $companyModel : '', 'crumb' => $this->crumb, 'curr' => $curr]; return view('admin.user.show', $result); }
public function query() { $data = new \stdClass(); //type==1公司简介,2历程,3新闻,4资讯,5服务,6团队,7招聘,21单页 $data->abouts = ComFuncModel::where('type', '<', 5)->where('cid', $this->cid)->get(); $data->products = GoodsModel::where('genre', 1)->where('type', 4)->get(); $data->teams = ComFuncModel::where('type', 6)->where('cid', $this->cid)->get(); $data->jobs = ComFuncModel::where('type', 7)->where('cid', $this->cid)->get(); //公司联系方式 $data->contactFields = ['area', 'point', 'address', 'tel', 'qq', 'web', 'fax', 'email']; $data->contactFieldNames = ['地区', '坐标', '地址', '电话', 'qq', '网址', '传真', '邮箱']; $data->contact = 0; $comMainModel = CompanyModel::find($this->cid); $comMainModel = Tools::objectToArray($comMainModel); foreach ($data->contactFields as $contactField) { if ($comMainModel[$contactField]) { $data->contact++; } } $data->parts = GoodsModel::where('genre', 2)->where('type', 4)->get(); $data->firms = ComFuncModel::where('type', 5)->where('cid', $this->cid)->get(); return $data; }
/** * 用于初始化 * 组合关键字 */ public function getKeyword($data, $genre) { $model = new SearchModel(); if ($genre == 'product') { $keyword = $data->name . $data->uname; $genre = 1; } elseif ($genre == 'goods') { $keyword = $data->name . $data->uname . $model['cates2'][$data->cate] . $data->money . '元'; $genre = 2; } elseif ($genre == 'idea') { $keyword = $data->name . $data->uname . $model['cates2'][$data->cate] . $data->money . '元'; $genre = 3; } elseif ($genre == 'storyboard') { $keyword = $data->name . $data->uname . $model['cates2'][$data->cate] . $data->money . '元'; $genre = 4; } elseif ($genre == 'company') { $companyModel = new CompanyModel(); $genreName = array_key_exists($data->genre, $companyModel['genres']) ? $companyModel['genres'][$data->genre] : ''; $keyword = $data->name . $data->uname . $genreName . $companyModel->getAreaName($data->area) . $data->address; $genre = 5; } elseif ($genre == 'works') { $keyword = $data->name . $model['cates2'][$data->cate]; $genre = 6; } elseif ($genre == 'actor') { $education = new StaffModel(); $keyword = $data->name . $data->realname . $data->origin . $education['educations'][$data->education] . $data->school . $education->getAreaName($data->area); $genre = 7; } elseif ($genre == 'rent') { $rentModel = new RentModel(); $keyword = $data->name . $rentModel->getAreaName($data->area) . $data->money . '元'; $genre = 8; } elseif ($genre == 'design') { $keyword = $data->name . $model['cates1'][$data->cate] . $data->money . '元'; $genre = 9; } return array('keyword' => $keyword, 'genre' => $genre); }
public function company() { return $this->cid ? \App\Models\CompanyModel::find($this->cid) : ''; }
public function company($uid) { $companyModel = CompanyModel::where('uid', $uid)->first(); return $companyModel ? $companyModel : ''; }
/** * 将对这些表的操作,插入或更新到数据库 * genre==1创作,2样片,3创意,4分镜,5企业,6影视,7演员,8设备,9设计, */ public static function change($data, $genre, $oper) { $model = new SearchModel(); if ($oper == 'create') { if ($genre == 'product') { $keyword = $data->name . $data->uname; SearchModel::intoDB($keyword, 1, $data->id); } elseif ($genre == 'goods') { $keyword = $data->name . $data->uname . $model['cates2'][$data->cate] . $data->money . '元'; SearchModel::intoDB($keyword, 2, $data->id); } elseif ($genre == 'idea') { $keyword = $data->name . $data->uname . $model['cates2'][$data->cate] . $data->money . '元'; SearchModel::intoDB($keyword, 3, $data->id); } elseif ($genre == 'storyboard') { $keyword = $data->name . $data->uname . $model['cates2'][$data->cate] . $data->money . '元'; SearchModel::intoDB($keyword, 4, $data->id); } elseif ($genre == 'company') { $companyModel = new CompanyModel(); $genreName = array_key_exists($data->genre, $companyModel['genres']) ? $companyModel['genres'][$data->genre] : ''; $keyword = $data->name . $data->uname . $genreName . $companyModel->getAreaName($data->area) . $data->address; SearchModel::intoDB($keyword, 5, $data->id); } elseif ($genre == 'works') { $keyword = $data->name . $model['cates2'][$data->cate]; SearchModel::intoDB($keyword, 6, $data->id); } elseif ($genre == 'actor') { $education = new StaffModel(); $keyword = $data->name . $data->realname . $data->origin . $education['educations'][$data->education] . $data->school . $education->getAreaName($data->area); SearchModel::intoDB($keyword, 7, $data->id); } elseif ($genre == 'rent') { $rentModel = new RentModel(); $keyword = $data->name . $rentModel->getAreaName($data->area) . $data->money . '元'; SearchModel::intoDB($keyword, 8, $data->id); } elseif ($genre == 'design') { $keyword = $data->name . $model['cates1'][$data->cate] . $data->money . '元'; SearchModel::intoDB($keyword, 9, $data->id); } } elseif ($oper == 'update') { if ($genre == 'product') { $keyword = $data->name . $data->uname; SearchModel::updateDB($keyword, 1, $data->id); } elseif ($genre == 'goods') { $keyword = $data->name . $data->uname . $model['cates2'][$data->cate] . $data->money . '元'; SearchModel::updateDB($keyword, 2, $data->id); } elseif ($genre == 'idea') { $keyword = $data->name . $data->uname . $model['cates2'][$data->cate] . $data->money . '元'; SearchModel::updateDB($keyword, 3, $data->id); } elseif ($genre == 'storyboard') { $keyword = $data->name . $data->uname . $model['cates2'][$data->cate] . $data->money . '元'; SearchModel::updateDB($keyword, 4, $data->id); } elseif ($genre == 'company') { $companyModel = new CompanyModel(); $keyword = $data->name . $data->uname . $companyModel['genres'][$data->genre] . $companyModel->getAreaName($data->area) . $data->address; SearchModel::updateDB($keyword, 5, $data->id); } elseif ($genre == 'works') { $keyword = $data->name . $model['cates2'][$data->cate]; SearchModel::updateDB($keyword, 6, $data->id); } elseif ($genre == 'actor') { $education = new StaffModel(); $keyword = $data->name . $data->realname . $data->origin . $education['educations'][$data->education] . $data->school . $education->getAreaName($data->area); SearchModel::updateDB($keyword, 7, $data->id); } elseif ($genre == 'rent') { $rentModel = new RentModel(); $keyword = $data->name . $rentModel->getAreaName($data->area) . $data->money . '元'; SearchModel::updateDB($keyword, 8, $data->id); } elseif ($genre == 'design') { $keyword = $data->name . $model['cates1'][$data->cate] . $data->money . '元'; SearchModel::updateDB($keyword, 9, $data->id); } } elseif ($oper == 'del') { } }
/** * 获取供应单位 */ public function getCompanys($limit) { return CompanyModel::orderBy('sort', 'desc')->orderBy('id', 'desc')->paginate($limit); }
public function query() { return CompanyModel::where('uid', $this->userid)->first(); }
public function company() { $uid = $this->userid ? $this->userid : 0; return $uid ? CompanyModel::where('uid', $uid)->first() : ''; }
public function company() { $uid = $this->uid ? $this->uid : '0'; $companyModel = CompanyModel::where('uid', $uid)->first(); return $companyModel ? $companyModel : ''; }
public function getUser($uid) { $userModel = UserModel::find($uid); if (in_array($userModel->isuser, [2, 4, 5, 6])) { $userModel->company = CompanyModel::where('uid', $uid)->get(); } else { $userModel->company = ''; } return $userModel ? $userModel : ''; }
/** * 由uid得到 公司信息 */ public function getCompany($uid = null) { $companyInfo = CompanyModel::where('uid', $uid)->first(); return $companyInfo ? $companyInfo : ''; }
/** * 被访问的企业名称 */ public function getCName() { $cid = $this->cid ? $this->cid : 0; $companyModel = CompanyModel::find($cid); return $companyModel ? $companyModel->name : ''; }
/** * 收集数据 */ public function getData($data) { $serial = date('YmdHis', time()) . rand(0, 10000); $ip = Tools::getIp(); $ipaddress = Tools::getCityByIp($ip); $companyModel = CompanyModel::find($data['cid']); $userModel = UserModel::find($data['uid']); return array('cid' => $data['cid'], 'cname' => $companyModel->name, 'visit_id' => $data['uid'], 'uname' => $userModel->username, 'action' => $data['visit_url'], 'ip' => $ip, 'ipaddress' => $ipaddress, 'serial' => $serial, 'loginTime' => time()); }
public function company() { return $this->cid ? CompanyModel::find($this->cid)->name : ''; }