12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?php
- namespace app\api\controller;
- use app\admin\model\policy\Type;
- use app\common\controller\Api;
- use app\common\model\Activity;
- use app\common\model\City;
- use app\common\model\Message;
- use app\common\model\Park;
- use app\common\model\PolicyModel;
- use app\common\model\Protable;
- use app\common\model\ServiiceModel;
- use think\Db;
- /**
- * 在线客服
- */
- class Service extends Api
- {
- protected $noNeedLogin = ['lists', 'info', 'listInfo', 'gg', 'parkMessage', 'type', 'protable', 'protableInfo', 'NoticeInfo', 'GgInfo'];
- protected $noNeedRight = ['*'];
- /**
- * 常见问题
- */
- public function lists()
- {
- $serviceModel = new ServiiceModel();
- $data = $serviceModel->where('switch',1)->order('sort desc')->field('id,title')->select();
- return $this->success('',$data);
- }
- /**
- * 详情
- *
- * @param string $id 问题id
- */
- public function info()
- {
- $id = $this->request->get('id');
- if(!isset($id) || empty($id)) return $this->error('参数错误');
- $serviceModel = new ServiiceModel();
- $data = $serviceModel->where('id',$id)->find();
- return $this->success('',$data);
- }
- /**
- * 在线提问
- * @ApiMethod (POST)
- * @param string $title 问题标题
- * @param string $content 内容
- * @param string $images 多图,号分割
- */
- public function question()
- {
- $data = $this->request->post();
- if (!isset($data['title']) || empty($data['title'])) return $this->error('参数错误101');
- if (!isset($data['content']) || empty($data['content'])) return $this->error('参数错误102');
- if (!isset($data['images']) || empty($data['images'])) return $this->error('参数错误103');
- $user = $this->auth->getUser();
- $data['uid'] = $user['id'];
- $data['create_time'] = date('Y-m-d H:i:s',time());
- $save = Db::name('service_qustion')->insert($data);
- if ($save) {
- return $this->success('提交成功');
- } else {
- return $this->error('提交失败!请退出重新提交');
- }
- }
- }
|