123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227 |
- <?php
- namespace app\api\controller;
- use app\common\model\Config;
- use app\common\model\Banner;
- use app\common\model\User;
- use app\common\controller\Api;
- use think\facade\Validate;
- use function Sodium\add;
- /**
- * @title 首页
- * @controller Index
- */
- class Index extends Api
- {
- /**
- * @title 首页banner
- * @desc 首页banner
- * @url /api/Index/banner_list
- * @method POST
- * @tag 基础
- * @header name:Authorization require:1 default: desc:验证token
- */
- public function banner_list(){
- $this->check_login();
- $result = Banner::BannerList();
- $this->success($result['msg'],$result['data']);
- }
- /**
- * @title 获取首页搜索日期列表
- * @desc 获取首页搜索日期列表
- * @url /api/Index/search_date_list
- * @method POST
- * @tag 基础
- * @header name:Authorization require:1 default: desc:验证token
- */
- public function search_date_list(){
- $this->check_login();
- $result = User::searchDateList();
- $this->success($result['msg'],$result['data']);
- }
- /**
- * @title 用户端设计师列表
- * @desc 设计师列表
- * @url /api/Index/designer
- * @method POST
- * @tag 基础
- * @header name:Authorization require:1 default: desc:验证token
- *
- * @param name:page type:int require:0 default:1 desc:
- * @param name:limit type:int require:0 default:10 desc:
- * @param name:design_classifi type:string require:0 default:10 desc:设计分类
- * @param name:keywords type:string require:0 default:10 desc:关键词
- * @param name:distance type:string require:0 default: desc:距离asc:正序,desc:倒序
- * @param name:price type:string require:0 default: desc:价格asc:正序,desc:倒序
- * @param name:price_section_start type:string require:0 default: desc:价格区间开始
- * @param name:price_section_end type:string require:0 default: desc:价格区间结束
- * @param name:evaluation type:string require:0 default: desc:评价asc:正序,desc:倒序
- * @param name:date type:date require:0 default: desc:日期
- * @param name:city type:string require:0 default: desc:城市
- * @param name:wd type:string require:0 default: desc:纬度
- * @param name:jd type:string require:0 default: desc:经度
- *
- *
- * @return name:phone type:string desc:手机号
- * @return name:name type:string desc:姓名
- * @return name:nickname type:string desc:昵称
- * @return name:headimg type:string desc:头像
- * @return name:price type:string desc:价格
- * @return name:design_classifi type:string desc:分类
- * @return name:skills_label type:string desc:技能标签
- * @return name:good_type type:string desc:擅长类型
- * @return name:good_style type:string desc:擅长风格
- * @return name:evaluation type:string desc:评价几颗星
- * @return name:date_list@switch type:string desc:日期开关1:开2:关
- * @return name:date_list@price type:string desc:价格
- * @return name:date_list@date type:string desc:日期
- *
- */
- public function designer(){
- $user_id = $this->check_login();
- $Nowpage = input('page',1);
- $limits = input("limit",10);
- $design_classifi = input("design_classifi");
- $keywords = input("keywords");
- $lat = input('wd'); //纬度
- $log = input('jd'); //经度
- $city = input('city'); //市
- $distance = input('distance'); //距离asc:正序,desc:倒序
- $price = input('price'); //价格asc:正序,desc:倒序
- $price_section_start = input('price_section_start'); //价格区间 开始
- $price_section_end = input('price_section_end'); //价格区间 结束
- $evaluation = input('evaluation'); //评价asc:正序,desc:倒序
- $date = input('date'); //日期
- $result = User::Designer($user_id,$Nowpage,$limits,$design_classifi,$keywords,$lat,$log,$city,$distance,$price,$evaluation,$date,$price_section_start,$price_section_end);
- $this->success($result['msg'],$result['data']);
- }
- /**
- * @title 获取可使用优惠券列表
- * @desc 获取可使用优惠券列表
- * @url /api/Index/get_coupon_list
- * @method POST
- * @tag 基础
- * @header name:Authorization require:1 default: desc:验证token
- *
- * @param name:money type:string require:1 default: desc:金额
- *
- * @return name:coupon_title type:string desc:优惠券标题
- * @return name:coupon_price type:string desc:优惠券的面值
- * @return name:use_min_price type:string desc:最低消费多少金额可用优惠券
- * @return name:add_time type:string desc:优惠券创建时间
- * @return name:end_time type:string desc:优惠券结束时间
- * @return name:status type:string desc:状态(0:未使用,1:已使用,2:已过期)
- */
- public function get_coupon_list(){
- $user_id = $this->check_login();
- $money = input('money');
- if (!$money || $money<0) $this->error('金额错误');
- $result = User::getCouponList($user_id,$money);
- $this->success($result['msg'],$result['data']);
- }
- /**
- * @title 下单
- * @desc 下单
- * @url /api/Index/order
- * @method POST
- * @tag 基础
- * @header name:Authorization require:1 default: desc:验证token
- *
- * @param name:address_id type:int require:1 default: desc:地址ID
- * @param name:yy_date type:int require:1 default: desc:预约日期
- * @param name:designer_id type:string require:1 default: desc:设计师ID
- * @param name:project_name type:string require:1 default: desc:项目名称
- * @param name:coupon_id type:string require:0 default: desc:优惠券ID
- * @param name:pay_type type:string require:0 default: desc:支付方式(weixin:微信,zfb:支付宝)
- * @param name:period_id type:string require:0 default: desc:时间段ID
- */
- public function order(){
- $user_id = $this->check_login();
- $address_id = input("address_id");
- $designer_id = input("designer_id");
- $yy_date = input("yy_date");
- $project_name = input("project_name");
- $coupon_id = input("coupon_id");
- $pay_type = input("pay_type",'weixin');
- $period_id = input("period_id");
- if (!$address_id || !$designer_id || !$yy_date || !$project_name || !$pay_type ||!$period_id) $this->error('参数错误');
- if (!in_array($pay_type,array('weixin','zfb'))) $this->error('支付方式错误');
- $result = User::PlaceOrder($user_id,$address_id,$designer_id,$yy_date,$project_name,$coupon_id,$pay_type,$period_id);
- if ($result['code']){
- $this->success($result['msg'],$result['data']);
- }else{
- $this->error($result['msg']);
- }
- }
- /**
- * @title 下单时间段列表
- * @desc 下单时间段列表
- * @url /api/Index/period_time_list
- * @method POST
- * @tag 基础
- * @header name:Authorization require:1 default: desc:验证token
- *
- */
- public function period_time_list(){
- $user_id = $this->check_login();
- $result = User::periodTimeList();
- $this->success($result['msg'],$result['data']);
- }
- /**
- * @title 设计师端首页
- * @desc 设计师端首页
- * @url /api/Index/designer_index
- * @method POST
- * @tag 基础
- * @header name:Authorization require:1 default: desc:验证token
- *
- */
- public function designer_index(){
- $user_id = $this->check_login();
- $result = User::designerIndex($user_id);
- $this->success($result['msg'],$result['data']);
- }
- /**
- * @title 公告列表
- * @desc 公告列表
- * @url /api/Index/notice
- * @method POST
- * @tag 基础
- * @header name:Authorization require:1 default: desc:验证token
- *
- */
- public function notice(){
- $this->check_login();
- $result = User::notice();
- $this->success($result['msg'],$result['data']);
- }
- public function test(){
- User::RecentlyPrice();
- }
- }
|