18143453325 在线咨询 在线咨询
18143453325 在线咨询
所在位置: 首页 > 营销资讯 > 网站运营 > 类似百度文库类的在线网站开发建设 第十二篇

类似百度文库类的在线网站开发建设 第十二篇

时间:2023-04-29 05:51:01 | 来源:网站运营

时间:2023-04-29 05:51:01 来源:网站运营

类似百度文库类的在线网站开发建设 第十二篇:前面已经发不了不是篇章关于在线文库网站项目的的开发建设内容了,今天接着上面的内容,继续发布,希望本文章可以帮到大家的学习和使用。

电脑版的模块效果图

手机版的模块效果图

分类模块开发:


namespace app/index/controller;use app/Base;use think/App;use think/facade/Cache;use think/Request;use think/facade/View;use think/facade/Db;use app/index/model/Index as Indexmodel;use app/index/service/UserInfo as UserInfoService;class Common extends Base{ public function __construct() { parent::__construct(); $user_info = Db::name('user') ->where(['uid' => session('user')['uid']])->find(); $controller = Request()->controller(); $action = Request()->action(); $lang_all = config('console')['lang']; $array_config = Db::name('webconfig')->where(['type'=>0])->select(); $web_config = array(); foreach ($array_config as $k => $v) { $web_config[$v['code']] = $v['value']; } //首页顶级分类展示 $cate_parent = (new Indexmodel())->geTparentCateGory(); foreach ($cate_parent as $k => $val ){ $son = Db::name('category')->where('parent_id',$val['id'])->select(); $cate_parent[$k]['son'] = $son; }// halt($cate_parent); // 首页子分类展示 $cate_list = (new Indexmodel())->geTcateGory();// halt($cate_list); //底部文章的查询 $article = Db::name('new')->select(); //个人信息的查询 $user_where['uid'] = session('user')['uid']; $user_info = (new UserInfoService())->getUser($user_where); if(!empty($user_info['uid'])){ $is_login = 1; }else{ $is_login = 0; } //友情链接 $link = Db::name('link')->select(); // 热门搜索 $HotSearch = Db::name('search')->order('search_number','desc')->limit(5)->select(); //系统处理 $articledd = Db::name('article')->where('uid',session('user')['uid'])->where('status','7')->count(); //处理失败 $articled2 = Db::name('article')->where('uid',session('user')['uid'])->where('status','8')->count(); //待自审 $articled3 = Db::name('article')->where('uid',session('user')['uid'])->where('status','9')->count(); //后台审核 $articled4 = Db::name('article')->where('uid',session('user')['uid'])->where('status','1')->count(); //审核被拒 $articled5 = Db::name('article')->where('uid',session('user')['uid'])->where('status','3')->count(); //已上架 $articled6 = Db::name('article')->where('uid',session('user')['uid'])->where('status','2')->count(); //已下架 $articled7 = Db::name('article')->where('uid',session('user')['uid'])->where('status','0')->count(); //我的消息 $allmsg = Db::name('notification')->alias('n')->where('n.recipient_uid',session('user')['uid'])->join(['aws_notification_data'=>'b'],'n.notification_id = b.notification_id')->where('read_flag','0')->count(); $id = session('user')['uid']; $where[] = ['recipient_uid','like',"%{$id}%"]; $mail = Db::name('webmaster_msg')->where($where)->where('read_flag','0')->count(); $countmsg = $allmsg+$mail; //企业认证状态 $company_status =Db::name('user_company')->where('uid',session('user')['uid'])->find(); //个人认证状态 $authentication =Db::name('user_authentication')->where('uid',session('user')['uid'])->order('a_add_time','desc')->limit(1)->select(); View::assign([ 'cate_list'=>$cate_list, 'user_info' => $user_info, 'controller' => $controller, 'action' => $action, 'lang_all'=>$lang_all, 'lang_cookie'=> cookie('think_lang'), 'user_session'=>session('user'), 'web_config'=>$web_config, 'link'=>$link, 'article'=>$article, 'cate_parent'=>$cate_parent, 'is_login' =>$is_login, 'HotSearch' => $HotSearch, 'articledd' => $articledd, 'articled2' => $articled2, 'articled3' => $articled3, 'articled4' => $articled4, 'articled5' => $articled5, 'articled6' => $articled6, 'articled7' => $articled7, 'countmsg' => $countmsg, 'company_status' => $company_status, 'authentication' => $authentication, ]); }语言包切换

public function langSwitch(){ $post = input('post.'); $lang = $post['lang']; cookie('think_lang',$lang); return 1; }验证手机号码

function is_mobile($user_mobile){// $chars = "/^((/(/d{2,3}/))|(/d{3}/-))?1(3|5|8|9)/d{9}$/"; $chars = "/^0?(13|14|15|17|18)[0-9]{9}$/"; if (preg_match($chars, $user_mobile)){ return true; }else{ return false; } }猜你喜欢

public function guessLove(){ $user = Db::name('users')->orderRand() ->limit(6) ->alias('u') ->join('user_profile p', 'p.uid = u.id') ->select()->all(); $year_b = date('Y'); foreach ($user as $k => $v) { if ($v['age'] == 0) { $user[$k]['age'] = '0'; } else { $user[$k]['age'] = $year_b - $v['age']; } if(!empty($v['provinceid'])){ $address = Db::name('district')->where(['id'=>$v['provinceid']])->find(); $user[$k]['address'] = $address['text']; }else{ $user[$k]['address'] = '未填写'; } } return json($user); }地区选择

public function district(){ $id = input('id'); $district = Db::name('district')->where(['pid'=>$id])->select(); return json($district); } public function userAddress($provinceid = '',$cityid = '',$ereaid = ''){ $province = Db::name('district')->where(['id'=>$provinceid])->find(); $city = Db::name('district')->where(['id'=>$cityid])->find(); $area = Db::name('district')->where(['id'=>$ereaid])->find(); if(!empty($provinceid) && empty($cityid) && empty($ereaid)){ $user_address = $province['text']; }elseif(!empty($provinceid) && !empty($cityid) && empty($ereaid)){ $user_address = $province['text'].' '.$city['text']; }elseif(!empty($provinceid) && !empty($cityid) && !empty($ereaid)){ $user_address = $province['text'].' '.$city['text'].' '.$area['text']; }else{ $user_address = '未填写'; } return $user_address; }}大家如果有什么问题,随时可以联系我,私聊我也是,希望这些能够帮到大家,后面会接着继续更新。

关键词:建设,文库

74
73
25
news

版权所有© 亿企邦 1997-2025 保留一切法律许可权利。

为了最佳展示效果,本站不支持IE9及以下版本的浏览器,建议您使用谷歌Chrome浏览器。 点击下载Chrome浏览器
关闭