|
@@ -0,0 +1,124 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace app\api\controller;
|
|
|
+
|
|
|
+use app\common\controller\Api;
|
|
|
+use app\common\model\BusinessModel;
|
|
|
+use think\Db;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 企业服务
|
|
|
+ */
|
|
|
+class Business extends Api
|
|
|
+{
|
|
|
+ protected $noNeedLogin = ['lists', 'banner', 'listInfo', 'gg', 'parkMessage', 'activity', 'protable', 'protableInfo', 'NoticeInfo', 'GgInfo'];
|
|
|
+ protected $noNeedRight = ['*'];
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 企业服务轮播图
|
|
|
+ */
|
|
|
+ public function banner()
|
|
|
+ {
|
|
|
+ $data = Db::name('business_banner')
|
|
|
+ ->order('sort desc')
|
|
|
+ ->select();
|
|
|
+ foreach ($data as &$v) {
|
|
|
+ $v['image'] = config('site.httpurl') . $v['image'];
|
|
|
+ }
|
|
|
+ return $this->success('', $data);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 企业服务列表
|
|
|
+ * @param string $page 页数
|
|
|
+ * @param string $limit 条数
|
|
|
+ */
|
|
|
+ public function lists()
|
|
|
+ {
|
|
|
+
|
|
|
+ $page = $this->request->get('page');
|
|
|
+
|
|
|
+ $limit = $this->request->get('limit');
|
|
|
+
|
|
|
+ if (!$page) {
|
|
|
+ $pages = '0,10';
|
|
|
+ } else {
|
|
|
+ $page = $page - 1;
|
|
|
+ if ($page < 0) $page = 0;
|
|
|
+ $pages = $page . ',' . $limit;
|
|
|
+ }
|
|
|
+
|
|
|
+ $businessModel = new BusinessModel();
|
|
|
+
|
|
|
+ $data = $businessModel->where('switch', 1)
|
|
|
+ ->order('sort desc')
|
|
|
+ ->limit($pages)
|
|
|
+ ->select();
|
|
|
+
|
|
|
+ return $this->success('', $data);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 企业服务详情
|
|
|
+ * @param string $id id
|
|
|
+ *
|
|
|
+ */
|
|
|
+ public function listInfo()
|
|
|
+ {
|
|
|
+ $id = $this->request->get('id');
|
|
|
+
|
|
|
+ if (!isset($id) || empty($id)) return $this->error('缺少参数');
|
|
|
+
|
|
|
+ $businessModel = new BusinessModel();
|
|
|
+
|
|
|
+ $data = $businessModel
|
|
|
+ ->where('id', $id)
|
|
|
+ ->where('switch', 1)
|
|
|
+ ->order('sort desc')
|
|
|
+ ->find();
|
|
|
+
|
|
|
+ return $this->success('', $data);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 政策入住申请
|
|
|
+ * @ApiMethod (POST)
|
|
|
+ * @param string $lid id
|
|
|
+ * @param string $name id
|
|
|
+ * @param string $mobile id
|
|
|
+ * @param string $notice id
|
|
|
+ *
|
|
|
+ */
|
|
|
+ public function declare()
|
|
|
+ {
|
|
|
+ $data = $this->request->post();
|
|
|
+
|
|
|
+ if (!isset($data['lid']) || empty($data['lid'])) return $this->error('参数错误');
|
|
|
+
|
|
|
+ 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('business_declare')->where('uid',$user['id'])->where('lid',$data['lid'])->find();
|
|
|
+
|
|
|
+ if ($isert) return $this->error('您已经申请过了');
|
|
|
+
|
|
|
+ $add = Db::name('business_declare')->insert($data);
|
|
|
+
|
|
|
+ if ($add ) {
|
|
|
+ return $this->success('提交成功',$data);
|
|
|
+ } else {
|
|
|
+ return $this->error('提交失败');
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|