当前位置: 首页 > news >正文

小说网站建设做pc端网站咨询

小说网站建设,做pc端网站咨询,江苏省建筑培训网,免费做网站的一.系统介绍 基于ThinkPHPUniapp开发的代驾软件。系统源码全开源#xff0c;代驾软件的主要功能包括预约代驾、在线抢单、一键定位、在线支付、车主登记和代驾司机实名登记等‌。用户可以通过小程序预约代驾服务#xff0c;系统会估算代驾价格并推送附近代驾司机供用户选择Uniapp开发的代驾软件。系统源码全开源代驾软件的主要功能包括预约代驾、在线抢单、一键定位、在线支付、车主登记和代驾司机实名登记等‌。用户可以通过小程序预约代驾服务系统会估算代驾价格并推送附近代驾司机供用户选择司机接到订单后会自动生成路线方便快速找到车主服务结束后用户可以直接在线支付。 二.搭建环境教程 系统环境CentOS、 运行环境宝塔 Linux 网站环境Nginx 1.21 MySQL 5.7.46 PHP-74 常见插件fileinfo redis 系统搭建测试图片仅供参考无运营 系统源码全开源可二次开发。后端common/api文件代码 ?phpnamespace app\common\controller;use app\common\library\Auth; use think\Config; use think\exception\HttpResponseException; use think\exception\ValidateException; use think\Hook; use think\Lang; use think\Loader; use think\Request; use think\Response; use think\Route; use think\Validate;/*** API控制器基类*/ class Api {/*** var Request Request 实例*/protected $request;/*** var bool 验证失败是否抛出异常*/protected $failException false;/*** var bool 是否批量验证*/protected $batchValidate false;/*** var array 前置操作方法列表*/protected $beforeActionList [];/*** 无需登录的方法,同时也就不需要鉴权了* var array*/protected $noNeedLogin [];/*** 无需鉴权的方法,但需要登录* var array*/protected $noNeedRight [];/*** 权限Auth* var Auth*/protected $auth null;/*** 默认响应输出类型,支持json/xml* var string*/protected $responseType json;/*** 构造方法* access public* param Request $request Request 对象*/public function __construct(Request $request null){$this-request is_null($request) ? Request::instance() : $request;// 控制器初始化$this-_initialize();// 前置操作方法if ($this-beforeActionList) {foreach ($this-beforeActionList as $method $options) {is_numeric($method) ?$this-beforeAction($options) :$this-beforeAction($method, $options);}}}/*** 初始化操作* access protected*/protected function _initialize(){//跨域请求检测check_cors_request();// 检测IP是否允许check_ip_allowed();//移除HTML标签$this-request-filter(trim,strip_tags,htmlspecialchars);$this-auth Auth::instance();$modulename $this-request-module();$controllername Loader::parseName($this-request-controller());$actionname strtolower($this-request-action());// token$token $this-request-server(HTTP_TOKEN, $this-request-request(token, \think\Cookie::get(token)));$path str_replace(., /, $controllername) . / . $actionname;// 设置当前请求的URI$this-auth-setRequestUri($path);// 检测是否需要验证登录if (!$this-auth-match($this-noNeedLogin)) {//初始化$this-auth-init($token);//检测是否登录if (!$this-auth-isLogin()) {$this-error(__(Please login first), null, 401);}// 判断是否需要验证权限if (!$this-auth-match($this-noNeedRight)) {// 判断控制器和方法判断是否有对应权限if (!$this-auth-check($path)) {$this-error(__(You have no permission), null, 403);}}} else {// 如果有传递token才验证是否登录状态if ($token) {$this-auth-init($token);}}$upload \app\common\model\Config::upload();// 上传信息配置后Hook::listen(upload_config_init, $upload);Config::set(upload, array_merge(Config::get(upload), $upload));// 加载当前控制器语言包$this-loadlang($controllername);}/*** 加载语言文件* param string $name*/protected function loadlang($name){$name Loader::parseName($name);$name preg_match(/^([a-zA-Z0-9_\.\/])\$/i, $name) ? $name : index;$lang $this-request-langset();$lang preg_match(/^([a-zA-Z\-_]{2,10})\$/i, $lang) ? $lang : zh-cn;Lang::load(APP_PATH . $this-request-module() . /lang/ . $lang . / . str_replace(., /, $name) . .php);}/*** 操作成功返回的数据* param string $msg 提示信息* param mixed $data 要返回的数据* param int $code 错误码默认为1* param string $type 输出类型* param array $header 发送的 Header 信息*/protected function success($msg , $data null, $code 1, $type null, array $header []){$this-result($msg, $data, $code, $type, $header);}/*** 操作失败返回的数据* param string $msg 提示信息* param mixed $data 要返回的数据* param int $code 错误码默认为0* param string $type 输出类型* param array $header 发送的 Header 信息*/protected function error($msg , $data null, $code 0, $type null, array $header []){$this-result($msg, $data, $code, $type, $header);}/*** 返回封装后的 API 数据到客户端* access protected* param mixed $msg 提示信息* param mixed $data 要返回的数据* param int $code 错误码默认为0* param string $type 输出类型支持json/xml/jsonp* param array $header 发送的 Header 信息* return void* throws HttpResponseException*/protected function result($msg, $data null, $code 0, $type null, array $header []){$result [code $code,msg $msg,time Request::instance()-server(REQUEST_TIME),data $data,];// 如果未设置类型则使用默认类型判断$type $type ? : $this-responseType;if (isset($header[statuscode])) {$code $header[statuscode];unset($header[statuscode]);} else {//未设置状态码,根据code值判断$code $code 1000 || $code 200 ? 200 : $code;}$response Response::create($result, $type, $code)-header($header);throw new HttpResponseException($response);}/*** 前置操作* access protected* param string $method 前置操作方法名* param array $options 调用参数 [only[...]] 或者 [except[...]]* return void*/protected function beforeAction($method, $options []){if (isset($options[only])) {if (is_string($options[only])) {$options[only] explode(,, $options[only]);}if (!in_array($this-request-action(), $options[only])) {return;}} elseif (isset($options[except])) {if (is_string($options[except])) {$options[except] explode(,, $options[except]);}if (in_array($this-request-action(), $options[except])) {return;}}call_user_func([$this, $method]);}/*** 设置验证失败后是否抛出异常* access protected* param bool $fail 是否抛出异常* return $this*/protected function validateFailException($fail true){$this-failException $fail;return $this;}/*** 验证数据* access protected* param array $data 数据* param string|array $validate 验证器名或者验证规则数组* param array $message 提示信息* param bool $batch 是否批量验证* param mixed $callback 回调方法闭包* return array|string|true* throws ValidateException*/protected function validate($data, $validate, $message [], $batch false, $callback null){if (is_array($validate)) {$v Loader::validate();$v-rule($validate);} else {// 支持场景if (strpos($validate, .)) {list($validate, $scene) explode(., $validate);}$v Loader::validate($validate);!empty($scene) $v-scene($scene);}// 批量验证if ($batch || $this-batchValidate) {$v-batch(true);}// 设置错误信息if (is_array($message)) {$v-message($message);}// 使用回调验证if ($callback is_callable($callback)) {call_user_func_array($callback, [$v, $data]);}if (!$v-check($data)) {if ($this-failException) {throw new ValidateException($v-getError());}return $v-getError();}return true;}/*** 刷新Token*/protected function token(){$token $this-request-param(__token__);//验证Tokenif (!Validate::make()-check([__token__ $token], [__token__ require|token])) {$this-error(__(Token verification error), [__token__ $this-request-token()]);}//刷新Token$this-request-token();} }
http://www.pierceye.com/news/494761/

相关文章:

  • 设计 企业网站罗湖网站-建设深圳信科
  • 太原自助模板建站手机版电脑qq登录入口
  • 公司网站建设哪家比较好app 网站
  • 建设银行个人网站打不开个人主页模板下载
  • 山西建设公司网站wordpress视频适应手机端
  • 原型样网站做一般的公司门户网站投资额
  • 南宁百度网站公司电话网站配置优化
  • 德州网站建设的公司免费注册公司怎么注册
  • 成都开发网站建设中国建设规划采购网站
  • 企业网站建设应避免数据孤岛深圳东莞网站建设
  • pk10网站怎么做郑州seo费用
  • 菏泽市建设局网站电话网站建设服务咨询
  • 购物网站模版广州外贸网络推广
  • 高碑店网站网站建设手机软件开发的模式
  • 公司网站开发国内外现状网络营销外包团队哪些好
  • 淘客网站怎么建立如何用api做网站
  • 合肥网站建设ahyedawordpress主题安全
  • 网站建设实训室介绍东莞seo广告宣传
  • 公职人员可以做公益网站吗aws网站建设
  • 什么叫高端网站定制广州建筑公司
  • 全新网站如何做百度竞价网站制作现状解决方案
  • 阿里云esc建设网站近三天时政热点
  • 怎样做公司网站介绍仿站网站源码下载
  • 电子商务网站规划与建设摘要软件app定制开发
  • 天水做网站的公司kj6699的seo综合查询
  • 找工程项目信息网站早那么做商城网站
  • 做网站优化销售管理系统排名
  • wordpress导入网站模板wordpress部分图片
  • 无锡做网站365caiyi秘密直播
  • 无锡企业网站制作报价公司做网站需要哪些手续