assign('appName',config('site.name')); return $this->view->fetch(); } /** * 注册会员 */ public function register() { $this->assign('appName',config('site.name')); return $this->view->fetch(); } /** * 注册会员 */ public function registersms() { $this->assign('appName',config('site.name')); return $this->view->fetch(); } public function getInvitationInfo() { $invite_code = request()->param('code','','trim'); $ModelUser = new ModelUser(); $user = $ModelUser->field('id,nickname,avatar,invitation_code,status')->where(['invitation_code' => $invite_code])->find(); $info = [ 'appName' => config('site.name'), 'user' => empty($user) ? [] : $user, 'userAgreement' => request()->domain()."/index/index/user_agreement", 'privacyAgreement' =>request()->domain()."/index/index/privacy_agreement", "logo"=> cdnurl(config('site.logo')), 'beian' => config('site.beian'), 'appAndroidDownUrl' => config('site.appAndroidDownUrl'), 'appIosDownUrl' => config('site.appIosDownUrl'), ]; if($user['status'] != 'normal')json(['code' => 1, 'msg' => '用户已被禁用或注销','info' => $info]); return json(['code' => 0, 'msg' => '获取成功','info' => $info]); } public function phoneIsRegister(){ $mobile = request()->param('phone','','trim'); if(empty($mobile)) return json(['code' => 1, 'msg' => '手机号不能为空','info' =>[]]); $ModelUser = new ModelUser(); $user = $ModelUser->where(['mobile'=>$mobile])->find(); return json(['code' => 0, 'msg' =>'获取成功','is_registered' => empty($user) ? 0 : 1]); } public function attachment() { //设置过滤方法 $this->request->filter(['strip_tags']); if ($this->request->isAjax()) { $mimetypeQuery = []; $where = []; $filter = $this->request->request('filter'); $filterArr = (array)json_decode($filter, true); if (isset($filterArr['mimetype']) && preg_match("/(\/|\,|\*)/", $filterArr['mimetype'])) { $this->request->get(['filter' => json_encode(array_diff_key($filterArr, ['mimetype' => '']))]); $mimetypeQuery = function ($query) use ($filterArr) { $mimetypeArr = array_filter(explode(',', $filterArr['mimetype'])); foreach ($mimetypeArr as $index => $item) { $query->whereOr('mimetype', 'like', '%' . str_replace("/*", "/", $item) . '%'); } }; } elseif (isset($filterArr['mimetype'])) { $where['mimetype'] = ['like', '%' . $filterArr['mimetype'] . '%']; } if (isset($filterArr['filename'])) { $where['filename'] = ['like', '%' . $filterArr['filename'] . '%']; } if (isset($filterArr['createtime'])) { $timeArr = explode(' - ', $filterArr['createtime']); $where['createtime'] = ['between', [strtotime($timeArr[0]), strtotime($timeArr[1])]]; } $search = $this->request->get('search'); if ($search) { $where['filename'] = ['like', '%' . $search . '%']; } $model = new Attachment(); $offset = $this->request->get("offset", 0); $limit = $this->request->get("limit", 0); $total = $model ->where($where) ->where($mimetypeQuery) ->where('user_id', $this->auth->id) ->order("id", "DESC") ->count(); $list = $model ->where($where) ->where($mimetypeQuery) ->where('user_id', $this->auth->id) ->order("id", "DESC") ->limit($offset, $limit) ->select(); $cdnurl = preg_replace("/\/(\w+)\.php$/i", '', $this->request->root()); foreach ($list as $k => &$v) { $v['fullurl'] = ($v['storage'] == 'local' ? $cdnurl : $this->view->config['upload']['cdnurl']) . $v['url']; } unset($v); $result = array("total" => $total, "rows" => $list); return json($result); } $mimetype = $this->request->get('mimetype', ''); $mimetype = substr($mimetype, -1) === '/' ? $mimetype . '*' : $mimetype; $this->view->assign('mimetype', $mimetype); $this->view->assign("mimetypeList", \app\common\model\Attachment::getMimetypeList()); return $this->view->fetch(); } }