service = $services; } // 隐私政策 public function privateInfo (Request $request) { $id = $request->param('id/d', ''); $m_article = new SystemArticleModel(); $row = $m_article->where(['type' => 3])->findOrEmpty(); empty($row) && abort(403, '页面异常'); View::assign('row', $row); return View::fetch(); } // 用户协议 public function userAgreementInfo (Request $request) { $id = $request->param('id/d', ''); $m_article = new SystemArticleModel(); $row = $m_article->where(['type' => 4])->findOrEmpty(); empty($row) && abort(403, '页面异常'); View::assign('row', $row); return View::fetch(); } // 帮助中心 public function helpCenter () { $list = Db::name('system_faq')->where('status', 1)->select()->toArray(); $list = array_column($list, null, 'id'); $tree = array(); foreach ($list as $key => $row) { $pid = $row['parent_id']; if ($pid == 0) { $tree[] =& $list[$key]; } else if (isset($list[$pid])) { $parent =& $list[$pid]; $parent['son'][] =& $list[$key]; } } View::assign('list', $tree); return View::fetch(); } /** * 帮助中心详情 * @param Request $request * @return string */ public function helpDetails (Request $request) { $id = $request->param('id', 0, 'intval'); // 详情id !$id && abort(403, '页面异常'); try { $info = Db::name('system_faq')->where('id', $id)->where('status', 1)->find(); View::assign('info', $info); } catch (\Exception $e) { abort(403, '页面异常'); } return View::fetch(); } // 关于我们 public function aboutUs (Request $request) { $id = $request->param('id/d', ''); $m_article = new SystemArticleModel(); $row = $m_article->where(['type' => 5])->findOrEmpty(); empty($row) && abort(403, '页面异常'); View::assign('row', $row); return View::fetch(); } /** * h5注册 * @param Request $request * @return string */ public function registerH5 (Request $request) { if ($request->isPost()) { $data = $request->post(); try { validate(UserValidate::class) ->scene('register') ->check($data); $userserivce = new UserServices(); if (!vertifyPass($data['password'])){ throw new Exception('密码必须包含字母和数字,长度大于8位'); } $param = [ 'invite_code'=>$data['invite_code'], 'code'=>$data['code'], 'mobile'=>$data['mobile'], 'password'=>$data['password'], 'req_type'=>'h5web', 'user_name'=>$data['user_name'] ]; $userserivce->userRegister($param); return api_succ_return('注册成功'); } catch (ValidateException $e) { return api_error_return($e->getMessage()); } catch (\Exception $e) { return api_error_return($e->getMessage()); } } $code = $request->param('code'); if ($code) { !$code && abort(40003, '页面错误'); $is_px = false; $invite = Db::name('user')->where('code', $code)->field('code,id')->find(); if (!$invite){ $invite = Db::name('user')->where('px_code', $code)->field('px_code,id')->find(); $is_px = true; } if (!$invite){ return '邀请码错误,还请核实'; } if ($is_px){ $code = $invite['px_code']; }else{ $code = $invite['code']; } } View::assign([ 'code' => $code, 'appkey' => env('aliyun.verify_appkey'), 'scene' => env('aliyun.verify_scene'), 'downappurl' => getWebUrl().'/api/downapp', 'info'=>[ 'name'=>env('app.name') ] ]); return View::fetch(); } /** * 人机验证 * @return string */ public function loginVerify () { View::assign('appkey', env('aliyun.verify_appkey')); View::assign('scene', env('aliyun.verify_scene')); View::assign('view', input('view', '')); return View::fetch(); } /** * 新手教程 * @return string */ public function newhandurl(Request $request){ $m_article = new SystemArticleModel(); $row = $m_article->where(['type' => 5])->findOrEmpty(); empty($row) && abort(403, '页面异常'); View::assign('row', $row); return View::fetch(); } /** * 新手指引 * @return string */ public function newguideurl(Request $request){ $m_article = new SystemArticleModel(); $row = $m_article->where(['type' => 6])->findOrEmpty(); empty($row) && abort(403, '页面异常'); View::assign('row', $row); return View::fetch(); } /** * 关于福袋 * @return string */ public function aboutboxurl(Request $request){ $m_article = new SystemArticleModel(); $row = $m_article->where(['type' => 7])->findOrEmpty(); empty($row) && abort(403, '页面异常'); View::assign('row', $row); return View::fetch(); } }