123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- <?php
- namespace app\api\controller;
- use app\common\model\Config;
- use app\common\model\User;
- use app\common\controller\Api;
- use hg\apidoc\Parser;
- use PhpOffice\PhpWord\Template;
- use PhpOffice\PhpWord\TemplateProcessor;
- use setasign\Fpdi\PdfParser\PdfParser;
- use think\Db;
- use think\facade\Validate;
- use function Sodium\add;
- use Mpdf\Mpdf;
- /**
- * @title 首页
- * @controller Index
- */
- class Index extends Api
- {
- protected $arr=[
- '一年内'=>[0,13],
- '1~2年'=>[11,25],
- '2~3年'=>[23,37],
- '3年以上'=>[35,999999],
- ];
- public function lists(){
- $list=Db::table('p_car')->where('is_deleted',0)
- ->limit(getLimit())
- ->select();
- $this->success('操作成功',$list);
- }
- public function info(){
- $this->check_login();
- $id=input('id');
- if(empty($id)){
- $this->error('参数错误');
- }
- $info=Db::table('p_car')->where('id',$id)->find();
- $this->success('操作成功',$info);
- }
- public function collect(){
- $uid=$this->check_login();
- $car_id=input('car_id');
- if(empty($car_id)){
- $this->error('参数错误');
- }
- $r=Db::table('p_collect')->where('uid',$uid)->where('car_id',$car_id)->find();
- if($r){
- Db::table('p_collect')->where('uid',$uid)->where('car_id',$car_id)->delete();
- $this->success('取消收藏成功');
- }else{
- $data['car_id']=$car_id;
- $data['uid']=$uid;
- Db::table('p_collect')->insert($data);
- $this->success('收藏成功');
- }
- }
- public function order(){
- $uid=$this->check_login();
- $car_id=input('car_id');
- $username=input('username');
- $mobile=input('mobile');
- $data['car_id']=$car_id;
- $data['uid']=$uid;
- $data['username']=$username;
- $data['mobile']=$mobile;
- Db::table('p_order')->insert($data);
- $this->success('提交成功');
- }
- public function chexing(){
- $list=Db::table('p_car_chexing')->where('is_deleted',0)
- ->select();
- foreach ($list as $k=>&$v){
- $v['pinpai']=Db::table('p_car_pinpai')->where('find_in_set('.$v['id'].',chexing_id)')->select();
- }
- $this->success('操作成功',$list);
- }
- public function tm(){
- $this->success('操作成功',$this->arr);
- }
- }
|