Index.php 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <?php
  2. namespace app\api\controller;
  3. use app\common\model\Config;
  4. use app\common\model\Banner;
  5. use app\common\model\User;
  6. use app\common\controller\Api;
  7. use think\facade\Validate;
  8. use function Sodium\add;
  9. /**
  10. * @title 首页
  11. * @controller Index
  12. */
  13. class Index extends Api
  14. {
  15. /**
  16. * @title 首页banner
  17. * @desc 首页banner
  18. * @url /api/Index/banner_list
  19. * @method POST
  20. * @tag 基础
  21. * @header name:Authorization require:1 default: desc:验证token
  22. */
  23. public function banner_list(){
  24. $this->check_login();
  25. $result = Banner::BannerList();
  26. $this->success($result['msg'],$result['data']);
  27. }
  28. /**
  29. * @title 获取首页搜索日期列表
  30. * @desc 获取首页搜索日期列表
  31. * @url /api/Index/search_date_list
  32. * @method POST
  33. * @tag 基础
  34. * @header name:Authorization require:1 default: desc:验证token
  35. */
  36. public function search_date_list(){
  37. $this->check_login();
  38. $result = User::searchDateList();
  39. $this->success($result['msg'],$result['data']);
  40. }
  41. /**
  42. * @title 用户端设计师列表
  43. * @desc 设计师列表
  44. * @url /api/Index/designer
  45. * @method POST
  46. * @tag 基础
  47. * @header name:Authorization require:1 default: desc:验证token
  48. *
  49. * @param name:page type:int require:0 default:1 desc:
  50. * @param name:limit type:int require:0 default:10 desc:
  51. * @param name:design_classifi type:string require:0 default:10 desc:设计分类
  52. * @param name:keywords type:string require:0 default:10 desc:关键词
  53. * @param name:distance type:string require:0 default: desc:距离asc:正序,desc:倒序
  54. * @param name:price type:string require:0 default: desc:价格asc:正序,desc:倒序
  55. * @param name:price_section_start type:string require:0 default: desc:价格区间开始
  56. * @param name:price_section_end type:string require:0 default: desc:价格区间结束
  57. * @param name:evaluation type:string require:0 default: desc:评价asc:正序,desc:倒序
  58. * @param name:date type:date require:0 default: desc:日期
  59. * @param name:city type:string require:0 default: desc:城市
  60. * @param name:wd type:string require:0 default: desc:纬度
  61. * @param name:jd type:string require:0 default: desc:经度
  62. *
  63. *
  64. * @return name:phone type:string desc:手机号
  65. * @return name:name type:string desc:姓名
  66. * @return name:nickname type:string desc:昵称
  67. * @return name:headimg type:string desc:头像
  68. * @return name:price type:string desc:价格
  69. * @return name:design_classifi type:string desc:分类
  70. * @return name:skills_label type:string desc:技能标签
  71. * @return name:good_type type:string desc:擅长类型
  72. * @return name:good_style type:string desc:擅长风格
  73. * @return name:evaluation type:string desc:评价几颗星
  74. * @return name:date_list@switch type:string desc:日期开关1:开2:关
  75. * @return name:date_list@price type:string desc:价格
  76. * @return name:date_list@date type:string desc:日期
  77. *
  78. */
  79. public function designer(){
  80. $user_id = $this->check_login();
  81. $Nowpage = input('page',1);
  82. $limits = input("limit",10);
  83. $design_classifi = input("design_classifi");
  84. $keywords = input("keywords");
  85. $lat = input('wd'); //纬度
  86. $log = input('jd'); //经度
  87. $city = input('city'); //市
  88. $distance = input('distance'); //距离asc:正序,desc:倒序
  89. $price = input('price'); //价格asc:正序,desc:倒序
  90. $price_section_start = input('price_section_start'); //价格区间 开始
  91. $price_section_end = input('price_section_end'); //价格区间 结束
  92. $evaluation = input('evaluation'); //评价asc:正序,desc:倒序
  93. $date = input('date'); //日期
  94. $result = User::Designer($user_id,$Nowpage,$limits,$design_classifi,$keywords,$lat,$log,$city,$distance,$price,$evaluation,$date,$price_section_start,$price_section_end);
  95. $this->success($result['msg'],$result['data']);
  96. }
  97. /**
  98. * @title 获取可使用优惠券列表
  99. * @desc 获取可使用优惠券列表
  100. * @url /api/Index/get_coupon_list
  101. * @method POST
  102. * @tag 基础
  103. * @header name:Authorization require:1 default: desc:验证token
  104. *
  105. * @param name:money type:string require:1 default: desc:金额
  106. *
  107. * @return name:coupon_title type:string desc:优惠券标题
  108. * @return name:coupon_price type:string desc:优惠券的面值
  109. * @return name:use_min_price type:string desc:最低消费多少金额可用优惠券
  110. * @return name:add_time type:string desc:优惠券创建时间
  111. * @return name:end_time type:string desc:优惠券结束时间
  112. * @return name:status type:string desc:状态(0:未使用,1:已使用,2:已过期)
  113. */
  114. public function get_coupon_list(){
  115. $user_id = $this->check_login();
  116. $money = input('money');
  117. if (!$money || $money<0) $this->error('金额错误');
  118. $result = User::getCouponList($user_id,$money);
  119. $this->success($result['msg'],$result['data']);
  120. }
  121. /**
  122. * @title 下单
  123. * @desc 下单
  124. * @url /api/Index/order
  125. * @method POST
  126. * @tag 基础
  127. * @header name:Authorization require:1 default: desc:验证token
  128. *
  129. * @param name:address_id type:int require:1 default: desc:地址ID
  130. * @param name:yy_date type:int require:1 default: desc:预约日期
  131. * @param name:designer_id type:string require:1 default: desc:设计师ID
  132. * @param name:project_name type:string require:1 default: desc:项目名称
  133. * @param name:coupon_id type:string require:0 default: desc:优惠券ID
  134. * @param name:pay_type type:string require:0 default: desc:支付方式(weixin:微信,zfb:支付宝)
  135. * @param name:period_id type:string require:0 default: desc:时间段ID
  136. */
  137. public function order(){
  138. $user_id = $this->check_login();
  139. $address_id = input("address_id");
  140. $designer_id = input("designer_id");
  141. $yy_date = input("yy_date");
  142. $project_name = input("project_name");
  143. $coupon_id = input("coupon_id");
  144. $pay_type = input("pay_type",'weixin');
  145. $period_id = input("period_id");
  146. if (!$address_id || !$designer_id || !$yy_date || !$project_name || !$pay_type ||!$period_id) $this->error('参数错误');
  147. if (!in_array($pay_type,array('weixin','zfb'))) $this->error('支付方式错误');
  148. $result = User::PlaceOrder($user_id,$address_id,$designer_id,$yy_date,$project_name,$coupon_id,$pay_type,$period_id);
  149. if ($result['code']){
  150. $this->success($result['msg'],$result['data']);
  151. }else{
  152. $this->error($result['msg']);
  153. }
  154. }
  155. /**
  156. * @title 下单时间段列表
  157. * @desc 下单时间段列表
  158. * @url /api/Index/period_time_list
  159. * @method POST
  160. * @tag 基础
  161. * @header name:Authorization require:1 default: desc:验证token
  162. *
  163. */
  164. public function period_time_list(){
  165. $user_id = $this->check_login();
  166. $result = User::periodTimeList();
  167. $this->success($result['msg'],$result['data']);
  168. }
  169. /**
  170. * @title 设计师端首页
  171. * @desc 设计师端首页
  172. * @url /api/Index/designer_index
  173. * @method POST
  174. * @tag 基础
  175. * @header name:Authorization require:1 default: desc:验证token
  176. *
  177. */
  178. public function designer_index(){
  179. $user_id = $this->check_login();
  180. $result = User::designerIndex($user_id);
  181. $this->success($result['msg'],$result['data']);
  182. }
  183. /**
  184. * @title 公告列表
  185. * @desc 公告列表
  186. * @url /api/Index/notice
  187. * @method POST
  188. * @tag 基础
  189. * @header name:Authorization require:1 default: desc:验证token
  190. *
  191. */
  192. public function notice(){
  193. $this->check_login();
  194. $result = User::notice();
  195. $this->success($result['msg'],$result['data']);
  196. }
  197. public function test(){
  198. User::RecentlyPrice();
  199. }
  200. }