123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194 |
- <?php
- // +----------------------------------------------------------------------
- // | ThinkAdmin
- // +----------------------------------------------------------------------
- // | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
- // +----------------------------------------------------------------------
- // | 官方网站: http://demo.thinkadmin.top
- // +----------------------------------------------------------------------
- // | 开源协议 ( https://mit-license.org )
- // +----------------------------------------------------------------------
- // | gitee 代码仓库:https://gitee.com/zoujingli/ThinkAdmin
- // | github 代码仓库:https://github.com/zoujingli/ThinkAdmin
- // +----------------------------------------------------------------------
- namespace app\index\controller;
- use library\Controller;
- use think\Db;
- use app\index\controller\Api;
- /**
- * 用户信息
- * Class User
- * @package app\index\controller
- */
- class User extends Api
- {
- /**
- * 施工照片
- */
- public function userImage()
- {
- $user = $this->geiUserInfo();
- $data = Db::name('user_image')->where('uid',$user['id'])->select();
- if (!$data) return $this->success();
- foreach ($data as &$v) {
- $v['image'] = explode('|',$v['image']);
- }
- return $this->success('',$data);
- }
- /**
- * 线上预约
- * name 姓名
- * phone 手机号
- * address 城市
- * address_info 详细地址
- */
- public function appinotment()
- {
- $data = $this->request->post();
- if (!isset($data['name']) || empty($data['name'])) return $this->error('请输入姓名');
- if (!isset($data['phone']) || empty($data['phone'])) return $this->error('请输入手机号');
- if (!isset($data['address']) || empty($data['address'])) return $this->error('请输入所造地区');
- if (!isset($data['address_info']) || empty($data['address_info'])) return $this->error('请输入详细地址');
- if(strlen($data['name'])<3 || strlen($data['name'])>12) return $this->error('姓名长度为3-12位');
- if(!preg_match("/^1[34578]\d{9}$/", $data['phone'])) return $this->error('手机号格式不正确');
- $user = $this->geiUserInfo();
- $data['uid'] = $user['id'];
- $data['number'] = date('Y',time()).date('m',time()).date('d',time()).date('H',time()).date('i',time()).rand(100000,999999);
- $data['create_time'] = date('Y-m-d H:i',time());
- $save = Db::name('user_appointment')->insert($data);
- if ($save) {
- return $this->success('提交成功');
- } else {
- return $this->error('提交失败');
- }
- }
- /**
- * 跟进反馈
- * content 文字
- * image 图片
- */
- public function feedback()
- {
- $data = $this->request->post();
- if (!isset($data['content']) && empty($data['image'])) return $this->error('请输入有效信息');
- $user = $this->geiUserInfo();
- $data['uid'] = $user['id'];
- $data['create_time'] = date('Y-m-d H:i',time());
- $save = Db::name('user_feedback')->insert($data);
- if ($save) {
- return $this->success('提交成功');
- } else {
- return $this->error('提交失败');
- }
- }
- /**
- * 施工订单
- * type 1进行中2已完成
- */
- public function order()
- {
- $type = $this->request->get('type');
- $user = $this->geiUserInfo();
- $data = Db::name('user_appointment')->where('status',$type)->where('uid',$user['id'])->select();
- return $this->success('',$data);
- }
- /**
- * 维修和报备
- * name 姓名
- * phone 手机号
- * address 城市
- * address_info 详细地址
- * type 1维修2报备
- */
- public function weixiuBaobei()
- {
- $data = $this->request->post();
- if (!isset($data['name']) || empty($data['name'])) return $this->error('请输入姓名');
- if (!isset($data['phone']) || empty($data['phone'])) return $this->error('请输入手机号');
- if (!isset($data['address']) || empty($data['address'])) return $this->error('请输入所造地区');
- if (!isset($data['address_info']) || empty($data['address_info'])) return $this->error('请输入详细地址');
- if(strlen($data['name'])<3 || strlen($data['name'])>12) return $this->error('姓名长度为3-12位');
- if(!preg_match("/^1[34578]\d{9}$/", $data['phone'])) return $this->error('手机号格式不正确');
- $user = $this->geiUserInfo();
- $data['uid'] = $user['id'];
- $data['number'] = date('Y',time()).date('m',time()).date('d',time()).date('H',time()).date('i',time()).rand(100000,999999);
- $data['create_time'] = date('Y-m-d H:i',time());
- $save = Db::name('user_weixiu_baobei')->insert($data);
- if ($save) {
- return $this->success('提交成功');
- } else {
- return $this->error('提交失败');
- }
- }
- /**
- * 积分明细
- */
- public function integral()
- {
- $user = $this->geiUserInfo();
-
- $data = Db::name('user_integral_history')->where('uid',$user['id'])->select();
- return $this->success('',$data);
- }
-
- /**
- * 服务订单
- */
- public function fuwuOrder()
- {
- $user = $this->geiUserInfo();
- $data = Db::name('user_order')->where('uid',$user['id'])->select();
- return $this->success('',$data);
- }
- }
|