User.php 28 KB

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