User.php 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799
  1. <?php
  2. namespace app\api\controller;
  3. use app\common\library\Common;
  4. use think\Console;
  5. use think\Db;
  6. use think\Request;
  7. use app\common\model\User as Users;
  8. use think\facade\Validate;
  9. use app\common\controller\Api;
  10. /**
  11. * @title 个人中心
  12. * @controller User
  13. * @group user
  14. */
  15. class User extends Api
  16. {
  17. /**
  18. * @title 获取用户信息
  19. * @desc 获取用户信息
  20. * @url /api/User/userinfo
  21. * @method POST
  22. * @tag 基础
  23. * @header name:Authorization require:1 default: desc:验证token
  24. */
  25. public function userinfo(){
  26. $user_id = $this->check_login();
  27. $userinfo = Users::getUserInfo($user_id);
  28. $this->success('成功',$userinfo);
  29. }
  30. /**
  31. * @title 收货地址列表
  32. * @desc 我的收货地址
  33. * @url /api/User/my_address
  34. * @method POST
  35. * @tag 基础
  36. * @header name:Authorization require:1 default: desc:验证token
  37. * @param name:page type:int require:0 default:1 desc:
  38. * @param name:limit type:int require:0 default:10 desc:
  39. */
  40. public function my_address(){
  41. $user_id = $this->check_login();
  42. $Nowpage = input('page',1);
  43. $limits = input("limit",10);
  44. $result = Users::MyAddress($user_id,$Nowpage,$limits);
  45. $this->success('成功',$result['data']);
  46. }
  47. /**
  48. * @title 添加、修改收货地址
  49. * @desc 添加、修改收货地址
  50. * @url /api/User/add_edit_address
  51. * @method POST
  52. * @tag 基础
  53. * @header name:Authorization require:1 default: desc:验证token
  54. * @param name:name type:string require:1 default: desc:收货人姓名
  55. * @param name:phone type:string require:1 default: desc:手机号
  56. * @param name:province type:string require:1 default: desc:省
  57. * @param name:city type:string require:1 default: desc:市
  58. * @param name:area type:string require:1 default: desc:区
  59. * @param name:address type:string require:1 default: desc:具体地址
  60. * @param name:is_default type:int require:0 default:0 desc:默认地址1:默认0:否
  61. * @param name:jd type:string require:0 default:0 desc:经度
  62. * @param name:wd type:string require:0 default:0 desc:纬度
  63. * @param name:address_id type:int require:0 default:0 desc:收货地址ID,有则修改,无则添加
  64. */
  65. public function add_edit_address(){
  66. $user_id = $this->check_login();
  67. $data['name'] = input('name'); //收货人姓名
  68. $data['phone'] = input('phone'); //手机号
  69. $data['province'] = input('province'); //省
  70. $data['city'] = input('city'); //市
  71. $data['area'] = input('area'); //区
  72. $data['address'] = input('address'); //具体地址
  73. $data['is_default'] = input('is_default',0); //默认地址 1:默认
  74. $data['jd'] = input('jd'); //经度
  75. $data['wd'] = input('wd'); //纬度
  76. $address_id = intval(input('address_id')); //收货地址ID 有则修改,无则添加
  77. if (!$data['name'] || !$data['phone'] || !$data['province'] || !$data['city'] || !$data['area'] || !$data['address']) $this->error('参数错误');
  78. if (!Validate::regex($data['phone'], "^1\d{10}$")) $this->error('手机号格式错误');
  79. $result = Users::AddEditAddress($user_id,$data,$address_id);
  80. if ($result['code']){
  81. $this->success($result['msg']);
  82. }else{
  83. $this->error($result['msg']);
  84. }
  85. }
  86. /**
  87. * @title 设为默认地址
  88. * @desc 设为默认地址
  89. * @url /api/User/set_address_default
  90. * @method POST
  91. * @tag 基础
  92. * @header name:Authorization require:1 default: desc:验证token
  93. * @param name:address_id type:int require:1 default:1 desc:地址ID
  94. */
  95. public function set_address_default(){
  96. $user_id = $this->check_login();
  97. $address_id = intval(input('address_id')); //地址ID
  98. if (!$address_id) $this->error('地址ID为空');
  99. $result = Users::SetAddressDefault($user_id,$address_id);
  100. if ($result['code']){
  101. $this->success($result['msg']);
  102. }else{
  103. $this->error($result['msg']);
  104. }
  105. }
  106. /**
  107. * @title 删除地址
  108. * @desc 删除地址
  109. * @url /api/User/del_address
  110. * @method POST
  111. * @tag 基础
  112. * @header name:Authorization require:1 default: desc:验证token
  113. * @param name:address_id type:int require:1 default:1 desc:地址ID
  114. */
  115. public function del_address(){
  116. $user_id = $this->check_login();
  117. $address_id = intval(input('address_id')); //地址ID
  118. if (!$address_id) $this->error('地址ID为空');
  119. $result = Users::DelAddress($user_id,$address_id);
  120. if ($result['code']){
  121. $this->success($result['msg']);
  122. }else{
  123. $this->error($result['msg']);
  124. }
  125. }
  126. /**
  127. * @title 修改个人资料
  128. * @desc 修改个人资料
  129. * @url /api/User/edit_user_info
  130. * @method POST
  131. * @tag 基础
  132. * @header name:Authorization require:1 default: desc:验证token
  133. * @param name:headimg type:string require:0 default:1 desc:头像
  134. * @param name:nickname type:string require:0 default:1 desc:昵称
  135. */
  136. public function edit_user_info(){
  137. $user_id = $this->check_login();
  138. $data = input();
  139. $result = Users::EditUserInfo($user_id,$data);
  140. if ($result['code']){
  141. $this->success($result['msg']);
  142. }else{
  143. $this->error($result['msg']);
  144. }
  145. }
  146. /**
  147. * @title 修改密码
  148. * @desc 修改密码
  149. * @url /api/User/change_password
  150. * @method POST
  151. * @tag 基础
  152. * @header name:Authorization require:1 default: desc:验证token
  153. *
  154. * @param name:password type:string require:0 desc:密码
  155. * @param name:confirm_password type:string require:0 desc:确认密码
  156. * @param name:ver_code type:string require:0 desc:验证码
  157. */
  158. public function change_password(){
  159. $user_id = $this->check_login();
  160. $password = input('password'); //密码
  161. $confirm_password = input('confirm_password'); //确认密码
  162. $ver_code = input('ver_code'); //验证码
  163. if (!$password || !$ver_code || !$confirm_password){
  164. $this->error('参数错误');
  165. }
  166. if ($password!=$confirm_password){
  167. $this->error('密码与确认密码不一致');
  168. }
  169. $result = Users::changePassword($user_id,$password,$ver_code);
  170. if ($result['code']){
  171. $this->success($result['msg']);
  172. }else{
  173. $this->error($result['msg']);
  174. }
  175. }
  176. /**
  177. * @title 申请成为设计师
  178. * @desc 申请成为设计师
  179. * @url /api/User/apply_designer
  180. * @method POST
  181. * @tag 基础
  182. * @header name:Authorization require:1 default: desc:验证token
  183. *
  184. * @param name:name type:string require:1 desc:姓名
  185. * @param name:design_classifi type:string require:1 desc:设计分类
  186. * @param name:skills_label type:string require:1 desc:技能标签
  187. * @param name:good_type type:string require:1 desc:擅长类型
  188. * @param name:good_style type:string require:1 desc:擅长风格
  189. * @param name:province type:string require:1 desc:省
  190. * @param name:city type:string require:1 desc:市
  191. * @param name:area type:string require:1 desc:区
  192. * @param name:work_experience type:string require:1 desc:工作经历
  193. * @param name:work_year type:string require:1 desc:工作年限
  194. * @param name:identity_card_zheng type:string require:1 desc:身份证正面
  195. * @param name:identity_card_fan type:string require:1 desc:身份证反面
  196. * @param name:related_certificate type:string require:1 desc:相关证书,数组
  197. * @param name:works type:string require:1 desc:作品,数组
  198. * @param name:wd type:string require:1 desc:当前位置纬度
  199. * @param name:jd type:string require:1 desc:当前位置经度
  200. */
  201. public function apply_designer(){
  202. $user_id = $this->check_login();
  203. $data['name'] = input('name'); //姓名
  204. $data['design_classifi'] = input('design_classifi'); //设计分类
  205. $data['skills_label'] = input('skills_label'); //技能标签
  206. $data['good_type'] = input('good_type'); //擅长类型
  207. // $data['good_style'] = input('good_style'); //擅长风格
  208. $data['province'] = input('province'); //省
  209. $data['city'] = input('city'); //市
  210. $data['area'] = input('area'); //区
  211. // $data['work_experience'] = input('work_experience'); //工作经历
  212. $data['work_year'] = input('work_year'); //工作年限
  213. $data['identity_card_zheng'] = input('identity_card_zheng'); //身份证正面
  214. $data['identity_card_fan'] = input('identity_card_fan'); //身份证反面
  215. $data['related_certificate'] = input('related_certificate'); //相关证书
  216. $data['works'] = input('works'); //作品
  217. $data['wd'] = input('wd'); //当前位置纬度
  218. $data['jd'] = input('jd'); //当前位置经度
  219. if (!$data['name'] || !$data['design_classifi'] || !$data['design_classifi'] || !$data['skills_label'] || !$data['good_type'] || !$data['identity_card_zheng'] || !$data['identity_card_fan'] || !$data['province']
  220. || !$data['city'] || !$data['area'] || !$data['work_year'] || !$data['works']){
  221. $this->error('参数错误');
  222. }
  223. $data['related_certificate'] = implode(',',$data['related_certificate']);
  224. $data['works'] = implode(',',$data['works']);
  225. $data['skills_label'] = implode(',',$data['skills_label']);
  226. $data['good_type'] = implode(',',$data['good_type']);
  227. $result = Users::applyDesigner($user_id,$data);
  228. if ($result['code']){
  229. $this->success($result['msg']);
  230. }else{
  231. $this->error($result['msg']);
  232. }
  233. }
  234. /**
  235. * @title 投诉提交
  236. * @desc 投诉提交
  237. * @url /api/User/message
  238. * @method POST
  239. * @tag 基础
  240. * @header name:Authorization require:1 default: desc:验证token
  241. *
  242. * @param name:content type:string require:0 desc:内容
  243. */
  244. public function message(){
  245. $user_id = $this->check_login();
  246. $content = input('content'); //内容
  247. if (!$content) $this->error('参数错误');
  248. $result = Users::Message($user_id,$content);
  249. if ($result['code']){
  250. $this->success($result['msg']);
  251. }else{
  252. $this->error($result['msg']);
  253. }
  254. }
  255. /**
  256. * @title 时间管理列表
  257. * @desc 时间管理列表
  258. * @url /api/User/time_list
  259. * @method POST
  260. * @tag 基础
  261. * @header name:Authorization require:1 default: desc:验证token
  262. *
  263. *
  264. * @return name:switch type:int desc:1:开启2:关闭
  265. * @return name:date type:int desc:日期
  266. * @return name:price type:int desc:价格
  267. */
  268. public function time_list(){
  269. $user_id = $this->check_login();
  270. $result = Users::timeList($user_id);
  271. $this->success('成功',$result['data']);
  272. }
  273. /**
  274. * @title 时间设置开关
  275. * @desc 时间设置开关
  276. * @url /api/User/time_switch
  277. * @method POST
  278. * @tag 基础
  279. * @header name:Authorization require:1 default: desc:验证token
  280. *
  281. * @param name:json type:json require:1 desc:json
  282. */
  283. public function time_switch(){
  284. $user_id = $this->check_login();
  285. $json = input('json');
  286. // $date = input('date'); //日期
  287. // $switch = input('switch'); //1:开 2:关
  288. // $price = input('price'); //价格
  289. // if (!$date || !$switch || !$price || $price<=0) $this->error('参数错误');
  290. if (!$json) $this->error('参数错误');
  291. // $result = Users::timeSwitch($user_id,$date,$switch,$price);
  292. $json = json_decode($json,true);
  293. $result = Users::timeSwitch($user_id,$json);
  294. if ($result['code']){
  295. $this->success($result['msg']);
  296. }else{
  297. $this->error($result['msg']);
  298. }
  299. }
  300. /**
  301. * @title 设计师端余额提现
  302. * @desc 设计师端余额提现
  303. * @url /api/User/user_withdraw
  304. * @method POST
  305. * @tag 基础
  306. * @header name:Authorization require:1 default: desc:验证token
  307. *
  308. * @param name:money type:string require:0 desc:金额
  309. * @param name:withdraw_type type:string require:0 desc:提现方式weixin:微信zfb:支付宝
  310. */
  311. public function user_withdraw(){
  312. $user_id = $this->check_login();
  313. $money = input('money'); //提现金额
  314. $withdraw_type = input('withdraw_type'); //提现方式
  315. if (!in_array($withdraw_type,array('weixin','zfb'))) $this->error('提现方式错误');
  316. if (!$money || $money<=0) $this->error('金额错误');
  317. $result = Users::userWithdraw($user_id,$money,$withdraw_type);
  318. if ($result['code']){
  319. $this->success($result['msg']);
  320. }else{
  321. $this->error($result['msg']);
  322. }
  323. }
  324. /**
  325. * @title 设计师端消费明细
  326. * @desc 设计师端消费明细
  327. * @url /api/User/money_record
  328. * @method POST
  329. * @tag 基础
  330. * @header name:Authorization require:1 default: desc:验证token
  331. * @param name:page type:int require:0 default:1 desc:
  332. * @param name:limit type:int require:0 default:10 desc:
  333. *
  334. *
  335. *
  336. * @return name:paid type:int desc:是否完成0:审核中1:成功2:拒绝
  337. * @return name:withdraw_type type:string desc:方式(weixin:微信,zfb:支付宝,sy:订单收益)
  338. * @return name:create_at type:string desc:时间
  339. * @return name:price type:string desc:金额
  340. *
  341. */
  342. public function money_record(){
  343. $user_id = $this->check_login();
  344. $Nowpage = input('page',1);
  345. $limits = input("limit",10);
  346. $result = Users::moneyRecord($user_id,$Nowpage,$limits);
  347. $this->success($result['msg'],$result['data']);
  348. }
  349. /**
  350. * @title 用户端订单列表
  351. * @desc 用户端订单列表
  352. * @url /api/User/user_order_list
  353. * @method POST
  354. * @tag 基础
  355. * @header name:Authorization require:1 default: desc:验证token
  356. * @param name:page type:int require:0 default:1 desc:
  357. * @param name:limit type:int require:0 default:10 desc:
  358. * @param name:keywords type:int require:0 default:10 desc:关键词
  359. * @param name:status type:int require:0 default:10 desc:订单状态(-1:申请退款中-2:退款成功-3:退款失败0:待付款1:待服务;2:进行中;3:已完成,待评价;4:已评价5:取消订单all:全部订单)
  360. *
  361. *
  362. */
  363. public function user_order_list(){
  364. $user_id = $this->check_login();
  365. $Nowpage = input('page',1);
  366. $limits = input("limit",10);
  367. $status = input("status",'all');
  368. $keywords = input('keywords'); //搜索关键词
  369. $result = Users::userOrderList($user_id,$status,$keywords,$Nowpage,$limits);
  370. $this->success($result['msg'],$result['data']);
  371. }
  372. /**
  373. * @title 订单支付
  374. * @desc 订单支付
  375. * @url /api/User/pay_order
  376. * @method POST
  377. * @tag 基础
  378. * @header name:Authorization require:1 default: desc:验证token
  379. * @param name:order_no type:string require:0 default: desc:订单号
  380. *
  381. */
  382. public function pay_order(){
  383. $user_id = $this->check_login();
  384. $order_no = input('order_no'); //订单号
  385. if (!$order_no) $this->error('订单号为空');
  386. $result = Users::payOrder($user_id,$order_no);
  387. if ($result['code']){
  388. $this->success($result['msg'],$result['data']);
  389. }else{
  390. $this->error($result['msg']);
  391. }
  392. }
  393. /**
  394. * @title 订单支付加班费
  395. * @desc 订单支付加班费
  396. * @url /api/User/overtime_pay_order
  397. * @method POST
  398. * @tag 基础
  399. * @header name:Authorization require:1 default: desc:验证token
  400. * @param name:order_no type:string require:0 default: desc:订单号
  401. * @param name:pay_type type:string require:0 default: desc:支付方式(weixin:微信,zfb:支付宝)
  402. *
  403. */
  404. public function overtime_pay_order(){
  405. $user_id = $this->check_login();
  406. $order_no = input('order_no'); //订单号
  407. if (!$order_no) $this->error('订单号为空');
  408. $pay_type = input("pay_type",'weixin');
  409. if (!in_array($pay_type,array('weixin','zfb'))) $this->error('支付方式错误');
  410. $result = Users::overtimePayOrder($user_id,$order_no,$pay_type);
  411. if ($result['code']){
  412. $this->success($result['msg'],$result['data']);
  413. }else{
  414. $this->error($result['msg']);
  415. }
  416. }
  417. /**
  418. * @title 订单详情
  419. * @desc 订单详情
  420. * @url /api/User/order_detail
  421. * @method POST
  422. * @tag 基础
  423. * @header name:Authorization require:1 default: desc:验证token
  424. * @param name:order_no type:string require:0 default: desc:订单号
  425. *
  426. *
  427. */
  428. public function order_detail(){
  429. $this->check_login();
  430. $order_no= input('order_no'); //订单号
  431. $result = Users::orderDetail($order_no);
  432. if ($result['code']){
  433. $this->success($result['msg'],$result['data']);
  434. }else{
  435. $this->error($result['msg']);
  436. }
  437. }
  438. /**
  439. * @title 取消订单
  440. * @desc 取消订单
  441. * @url /api/User/cancel_order
  442. * @method POST
  443. * @tag 基础
  444. * @header name:Authorization require:1 default: desc:验证token
  445. * @param name:order_no type:string require:0 default: desc:订单号
  446. *
  447. *
  448. */
  449. public function cancel_order(){
  450. $user_id = $this->check_login();
  451. $order_no= input('order_no');
  452. $result = Users::cancelOrder($user_id,$order_no);
  453. if ($result['code']){
  454. $this->success($result['msg'],$result['data']);
  455. }else{
  456. $this->error($result['msg']);
  457. }
  458. }
  459. /**
  460. * @title 删除订单
  461. * @desc 删除订单
  462. * @url /api/User/del_order
  463. * @method POST
  464. * @tag 基础
  465. * @header name:Authorization require:1 default: desc:验证token
  466. * @param name:order_no type:string require:0 default: desc:订单号
  467. *
  468. *
  469. */
  470. public function del_order(){
  471. $user_id = $this->check_login();
  472. $order_no= input('order_no');
  473. $result = Users::delOrder($user_id,$order_no);
  474. if ($result['code']){
  475. $this->success($result['msg'],$result['data']);
  476. }else{
  477. $this->error($result['msg']);
  478. }
  479. }
  480. /**
  481. * @title 订单评价
  482. * @desc 订单评价
  483. * @url /api/User/evaluation_order
  484. * @method POST
  485. * @tag 基础
  486. * @header name:Authorization require:1 default: desc:验证token
  487. * @param name:order_no type:string require:0 default: desc:订单号
  488. * @param name:evaluation type:int require:0 default: desc:几颗星
  489. * @param name:evaluation_content type:string require:0 default: desc:评价内容
  490. *
  491. */
  492. public function evaluation_order(){
  493. $user_id = $this->check_login();
  494. $order_no= input('order_no'); //订单号
  495. $evaluation = intval(input('evaluation')); //几颗星
  496. $evaluation_content = input('evaluation_content'); //评价内容
  497. if (!$evaluation) $this->error('请评分');
  498. if ($evaluation<1 || $evaluation>5) $this->error('评分1-5');
  499. if (!$evaluation_content) $this->error('请输入评价内容');
  500. $result = Users::evaluationOrder($user_id,$order_no,$evaluation,$evaluation_content);
  501. if ($result['code']){
  502. $this->success($result['msg']);
  503. }else{
  504. $this->error($result['msg']);
  505. }
  506. }
  507. /**
  508. * @title 用户端我的评价
  509. * @desc 用户端我的评价
  510. * @url /api/User/user_evaluation_list
  511. * @method POST
  512. * @tag 基础
  513. * @header name:Authorization require:1 default: desc:验证token
  514. * @param name:page type:int require:0 default:1 desc:
  515. * @param name:limit type:int require:0 default:10 desc:
  516. *
  517. * @return name:order_no type:string desc:订单号
  518. * @return name:evaluation type:string desc:几颗星
  519. * @return name:evaluation_time type:string desc:时间
  520. * @return name:evaluation_content type:string desc:评价内容
  521. * @return name:name type:string desc:用户姓名
  522. * @return name:nickname type:string desc:用户昵称
  523. * @return name:headimg type:string desc:头像
  524. * @return name:designer_name type:string desc:设计师姓名
  525. */
  526. public function user_evaluation_list(){
  527. $user_id = $this->check_login();
  528. $Nowpage = input('page',1);
  529. $limits = input("limit",10);
  530. $result = Users::userEvaluationList($user_id,$Nowpage,$limits);
  531. $this->success($result['msg'],$result['data']);
  532. }
  533. /**
  534. * @title 设计师端我的评价
  535. * @desc 设计师端我的评价
  536. * @url /api/User/designer_evaluation_list
  537. * @method POST
  538. * @tag 基础
  539. * @header name:Authorization require:1 default: desc:验证token
  540. * @param name:page type:int require:0 default:1 desc:
  541. * @param name:limit type:int require:0 default:10 desc:
  542. *
  543. * @return name:order_no type:string desc:订单号
  544. * @return name:evaluation type:string desc:几颗星
  545. * @return name:evaluation_time type:string desc:时间
  546. * @return name:evaluation_content type:string desc:评价内容
  547. * @return name:name type:string desc:用户姓名
  548. * @return name:nickname type:string desc:用户昵称
  549. * @return name:headimg type:string desc:头像
  550. */
  551. public function designer_evaluation_list(){
  552. $user_id = $this->check_login();
  553. $Nowpage = input('page',1);
  554. $limits = input("limit",10);
  555. $result = Users::designerEvaluationList($user_id,$Nowpage,$limits);
  556. $this->success($result['msg'],$result['data']);
  557. }
  558. /**
  559. * @title 设计师端添加作品
  560. * @desc 设计师端添加作品
  561. * @url /api/User/add_works
  562. * @method POST
  563. * @tag 基础
  564. * @header name:Authorization require:1 default: desc:验证token
  565. * @param name:imgs type:array require:1 default: desc:作品图片,数组
  566. *
  567. */
  568. public function add_works(){
  569. $user_id = $this->check_login();
  570. $imgs = input('imgs'); //图片
  571. if (!$imgs) $this->error('请上传图片');
  572. $result = Users::addWorks($user_id,$imgs);
  573. if ($result['code']){
  574. $this->success($result['msg']);
  575. }else{
  576. $this->error($result['msg']);
  577. }
  578. }
  579. /**
  580. * @title 设计师端作品列表
  581. * @desc 设计师端作品列表
  582. * @url /api/User/work_list
  583. * @method POST
  584. * @tag 基础
  585. * @header name:Authorization require:1 default: desc:验证token
  586. *
  587. * @return name:date type:string desc:日期
  588. * @return name:imgs@id type:string desc:主键ID
  589. * @return name:imgs@img type:string desc:图片地址
  590. */
  591. public function work_list(){
  592. $user_id = $this->check_login();
  593. $result = Users::workList($user_id);
  594. $this->success($result['msg'],$result['data']);
  595. }
  596. /**
  597. * @title 设计师端删除作品
  598. * @desc 设计师端删除作品
  599. * @url /api/User/del_works
  600. * @method POST
  601. * @tag 基础
  602. * @header name:Authorization require:1 default: desc:验证token
  603. * @param name:ids type:string require:1 default: desc:作品id,多个以逗号隔开
  604. *
  605. */
  606. public function del_works(){
  607. $user_id = $this->check_login();
  608. $ids = input('ids'); //作品id
  609. if (!$ids) $this->error('作品id为空');
  610. $result = Users::delWorks($user_id,$ids);
  611. if ($result['code']){
  612. $this->success($result['msg']);
  613. }else{
  614. $this->error($result['msg']);
  615. }
  616. }
  617. /**
  618. * @title 设计师端订单列表
  619. * @desc 设计师端订单列表
  620. * @url /api/User/designer_order_list
  621. * @method POST
  622. * @tag 基础
  623. * @header name:Authorization require:1 default: desc:验证token
  624. *
  625. * @param name:page type:int require:0 default:1 desc:
  626. * @param name:limit type:int require:0 default:10 desc:
  627. * @param name:keywords type:int require:0 default:10 desc:关键词
  628. * @param name:status type:int require:0 default:10 desc:订单状态(1:已接单;2:待完成;3:已完成;all:全部订单)
  629. */
  630. public function designer_order_list(){
  631. $user_id = $this->check_login();
  632. $Nowpage = input('page',1);
  633. $limits = input("limit",10);
  634. $status = input("status",'all');
  635. $keywords = input('keywords'); //搜索关键词
  636. $result = Users::designerOrderList($user_id,$status,$keywords,$Nowpage,$limits);
  637. $this->success($result['msg'],$result['data']);
  638. }
  639. /**
  640. * @title 设计师开始工作打卡
  641. * @desc 设计师开始工作打卡
  642. * @url /api/User/clock_in_start
  643. * @method POST
  644. * @tag 基础
  645. * @header name:Authorization require:1 default: desc:验证token
  646. *
  647. * @param name:order_no type:string require:1 default: desc:订单号
  648. * @param name:start_address type:string require:0 default:10 desc:打卡地址
  649. */
  650. public function clock_in_start(){
  651. $user_id = $this->check_login();
  652. $order_no = input('order_no');
  653. $start_address = input('start_address');
  654. if (!$order_no || !$start_address) $this->error('参数错误');
  655. $result = Users::clockInStart($user_id,$order_no,$start_address);
  656. $this->success($result['msg'],$result['data']);
  657. }
  658. /**
  659. * @title 设计师结束工作打卡
  660. * @desc 设计师结束工作打卡
  661. * @url /api/User/clock_in_end
  662. * @method POST
  663. * @tag 基础
  664. * @header name:Authorization require:1 default: desc:验证token
  665. *
  666. * @param name:order_no type:string require:1 default: desc:订单号
  667. * @param name:end_address type:string require:0 default:10 desc:打卡地址
  668. */
  669. public function clock_in_end(){
  670. $user_id = $this->check_login();
  671. $order_no = input('order_no');
  672. $end_address = input('end_address');
  673. if (!$order_no || !$end_address) $this->error('参数错误');
  674. $result = Users::clockInEnd($user_id,$order_no,$end_address);
  675. $this->success($result['msg'],$result['data']);
  676. }
  677. /**
  678. * @title 设计师结束工作上传作品
  679. * @desc 设计师结束工作上传作品
  680. * @url /api/User/order_uploading
  681. * @method POST
  682. * @tag 基础
  683. * @header name:Authorization require:1 default: desc:验证token
  684. *
  685. * @param name:order_no type:string require:1 default: desc:订单号
  686. * @param name:works type:string require:0 default:10 desc:上传作品,数组
  687. */
  688. public function order_uploading(){
  689. $user_id = $this->check_login();
  690. $order_no = input('order_no');
  691. $works = input('works');
  692. if (!$order_no || !$works) $this->error('参数错误');
  693. $result = Users::orderUploading($user_id,$order_no,$works);
  694. $this->success($result['msg'],$result['data']);
  695. }
  696. /**
  697. * @title 用户优惠券列表
  698. * @desc 用户优惠券列表
  699. * @url /api/User/coupon_list
  700. * @method POST
  701. * @tag 基础
  702. * @header name:Authorization require:1 default: desc:验证token
  703. *
  704. * @param name:page type:int require:0 default:1 desc:
  705. * @param name:limit type:int require:0 default:10 desc:
  706. */
  707. public function coupon_list(){
  708. $user_id = $this->check_login();
  709. $Nowpage = input('page',1);
  710. $limits = input("limit",10);
  711. $result = Users::couponList($user_id,$Nowpage,$limits);
  712. $this->success($result['msg'],$result['data']);
  713. }
  714. }