where('switch',1)->order('sort desc')->find(); $data['activity'] = Activity::where('index_show',1)->where('switch',1)->order('sort desc')->find(); $this->success('请求成功',$data); } /** * 消息判断 */ public function message() { $user = $this->auth->getUser(); $status = 0; if (!$user) return $this->success('',['status'=>0]); $userCommunity = CommunityModel::where('uid',$user['id'])->column('id'); $str = implode(',',$userCommunity); $comment = Db::name('community_comment') ->where('c_id',"in",$str) ->order('create_time desc')->select(); if (!empty($comment)) { foreach ($comment as $k=>$v) { if (strtotime($v['create_time']) > $user['see_message_time']) $status = 1; } } $data = Db::name('admin_message')->order('create_time desc')->select(); foreach ($data as $m=>$n) { if (strtotime($n['create_time'])>$user['see_message_time']) $status=1; } return $this->success('',['status'=>$status]); } /** * 轮播图 * */ public function banner() { $data['banner'] = Db::name('banner')->select(); foreach ( $data['banner'] as &$v) { $v['image'] = config('site.httpurl').$v['image']; } $user = $this->auth->getUser(); if ($user) { $park = Park::where('id',$user['p_id'])->find(); if ($park) { $data['park_name'] = $park['name']; } else { $data['park_name'] = ''; } } else { $data['park_name'] = ''; } return $this->success('',$data); } /** * 公告 * @param string $page 页数 * @param string $limit 条数 */ public function notice() { $page = $this->request->get('page'); $limit = $this->request->get('limit'); if (!$page) { $fen = '0,10'; } else { $page = $page - 1; if ($page<0) $page = 0; $fen = $page.','.$limit; } $data = Db::name('notice') ->where('switch',1) ->limit($fen) ->order('sort desc') ->select(); foreach ( $data as &$v) { $v['create_time'] = date('Y-m-d',$v['create_time']); $v['content'] = str_replace('src="','src="'.config('site.httpurl'),$v['content']); } return $this->success('',$data); } /** * 公告详情 * * @param string $id 广告id */ public function NoticeInfo() { $id = $this->request->get('id'); $data = Db::name('notice') ->where('id',$id) ->find(); $data['create_time'] = date('Y-m-d',$data['create_time']); $data['content'] = str_replace('src="','src="'.config('site.httpurl'),$data['content']); return $this->success('',$data); } /** * 广告位 * @param string $page 页数 * @param string $limit 条数 */ public function gg() { $page = $this->request->get('page'); $limit = $this->request->get('limit'); if (!$page) { $fen = '0,10'; } else { $page = $page - 1; if ($page<0) $page = 0; $fen = $page.','.$limit; } $data = Db::name('gg') ->where('switch',1) ->order('sort desc') ->limit($fen) ->select(); foreach ($data as &$v) { $v['image'] = config('site.httpurl').$v['image']; $v['images'] = config('site.httpurl').$v['images']; $v['content'] = str_replace('src="','src="'.config('site.httpurl'),$v['content']); } return $this->success('',$data); } /** * 广告详情 * * @param string $id 广告id */ public function GgInfo() { $id = $this->request->get('id'); $data = Db::name('gg') ->where('id',$id) ->find(); $data['image'] = config('site.httpurl').$data['image']; $data['images'] = explode(',',$data['images']); foreach ($data['images'] as &$v) { $v = config('site.httpurl').$v; } $data['content'] = str_replace('src="','src="'.config('site.httpurl'),$data['content']); return $this->success('',$data); } /** * 广告位申请 * @ApiMethod (POST) * @param string $name id * @param string $mobile id * @param string $notice id * */ public function shenqing() { $data = $this->request->post(); if (!isset($data['name']) || empty($data['name'])) return $this->error('请输入姓名'); if (!isset($data['mobile']) || empty($data['mobile'])) return $this->error('请输入手机号'); if (!isset($data['notice']) || empty($data['notice'])) return $this->error('请输入具体需求'); $user = $this->auth->getUser(); if (!$user) return $this->error(__('Please login first'), null, 401); $data['uid'] = $user['id']; $data['create_time'] = date('Y-m-d H:i:s',time()); // $isert = Db::name('gg_shenqing')->where('uid',$user['id'])->find(); // // if ($isert) return $this->error('您已经申请过了'); $add = Db::name('gg_shenqing')->insert($data); return $this->error('提交失败'); } /** * 便携号码 * @param string $page 页数 * @param string $limit 条数 */ public function protable() { $page = $this->request->get('page'); $limit = $this->request->get('limit'); if (!$page) { $fen = '0,10'; } else { $page = $page - 1; if ($page<0) $page = 0; $fen = $page.','.$limit; } $tableModel = new Protable(); $data = $tableModel->where('switch',1) ->limit($fen) ->order('sort desc') ->field('id,name,name_eng,image') ->select(); return $this->success('暂无数据',$data); } /** * 便携号码详情 * * @param string $id 号码id */ public function protableInfo() { $id = $this->request->get('id'); if (!isset($id) || empty($id)) return $this->error('参数错误'); $protableModel = new Protable(); $data = $protableModel->where('id',$id) ->field('id,title1,mobile1,title2,mobile2') ->find(); $data['info'] = Db::name('protable_info') ->where('p_id',$data['id']) ->where('switch',1) ->order('sort desc') ->select(); return $this->success('暂无数据',$data); } }