This repository was archived by the owner on Jul 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi.txt
More file actions
875 lines (807 loc) · 14.6 KB
/
Copy pathapi.txt
File metadata and controls
875 lines (807 loc) · 14.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
baseUrl = 'http://localhost:3000'
support methods: post, all(有些考虑到参数较多,故只支持post)
response 的结构:
{
success: true/false,
code: 0/1,// 0代表成功,1代表错误,错误原因结合desc理解
desc: ''/'用户名或密码错误'/'参数错误'/,
data: {
// 数组或对象或字符串
}
}
1. 关键字搜索
url: '/search'
post: data:{keyword:'keyword'}
get: ?keyword='keyword'
{
success: true,
code: 0,
desc: '',
data: {
basic_info: {
photos: 100,
collections:20,
users: 20
},
lists: [
{
image_id: '',
image_md5: '',
owner: {
name: '',
id: '',
image_md5: ''
},
liked: 200
}
]
}
}
2. 获取最热图片列表
url: '/getList/hot'
{
success: true,
code: 0,
desc: '',
data: {
lists: [
{
image_id: '',
image_md5: '',
owner: {
name: '',
id: '',
image_md5: ''
},
liked: 200
}
]
}
}
3. 获取最新图片列表
url: '/getList/new'
{
success: true,
code: 0,
desc: '',
data: {
lists: [
{
image_id: '',
image_md5: '',
owner: {
name: '',
id: '',
image_md5: ''
},
liked: 200
}
]
}
}
4. 已登录用户,获取其所关注的作者的图片列表
url: '/getList/following'
post: data: {token: '用户的token'}
get: ?token='用户的token'
{
success: true,
code: 0,
desc: '',
data: {
lists: [
{
image_id: '',
image_md5: '',
owner: {
name: '',
id: '',
image_md5: ''
},
liked: 200
}
]
}
}
4-1. 已登陆用户,获取其所有的图片列表
url:'/getList/user'
4-2. 已登陆用户,获取其喜欢过的图片列表
url: '/getList/liked'
5. 获取所有图片集
url: '/getCollection/all'
{
success: true,
code: 0,
desc: '',
data: {
lists: [
{
image_id: '',
image_md5: '',
owner: {
name: '',
id: '',
image_md5: ''
},
created_time: '',
collection_name: '',
collection_id: '',
collection_photo_nums: 100
}
]
}
}
8. 获取用户自己的图片集
url: 'getCollection/user'
post: data: {token: '用户的token'}
get: ?token='用户的token'
{
success: true,
code: 0,
desc: '',
data: {
lists: [
{
collection_name: '',
collection_id: '',
collection_image_md5: '',
collection_photo_nums: 100
}
]
}
}
8-1. 获取每个图片集里面的图片
url: 'getCollection/one'
9. 用户上传图片
url: 'uploadUserPhoto'
post: data: {
token:localStorage.token,
image_md5:'http://my-image-carol.oss-cn-beijing.aliyuncs.com/1509425905335.jpeg',
image_tags:'pig, animals',
make: '2222',
model: '2222',
focalLength: '2222',
aperture: '2222',
iso: '2222',
shutterSpeed: '2222',
story_title: '雅阁',
story_detail: '照片拍摄于今天早上,天气有点冷',
location: '广东省深圳市龙华区',
display_location: '0',
collection_id: ''
}
response: {
success: true,
code: 0, // 0代表成功,其他数字结合desc理解
desc: '',
data: {
}
}
10. 用户修改个人资料
url: 'updateUserAccount/info'
post: data: {
token: '用户的token',
image_md5: '', //以md5的格式
email: '',
user_name: '',
personal_site: '',
wechat: '',
location: '',
bio: '',
province: '',
city: '',
town: ''
}
response: {
success: true,
code: 0, // 0代表成功,其他数字结合desc理解
desc: '',
data: {}
}
11. 用户修改密码
url: 'updateUserAccount/password'
post: data: {
token: '',
password: '' // 将加密后的密码发给我
}
response: {
success: true,
code: 0, // 0代表成功,其他数字结合desc理解
desc: '',
data: {}
}
13. 用户删除账户
url: 'updateUserAccount/delete'
post: data: {token:'token'}
get:?token=token
response: {
success: true,
code: 0, // 0代表成功,其他数字结合desc理解
desc: '',
data: {}
}
14. 获取用户连接的应用(开发者模式)
url: 'getUserApplication'
post: data: {token:'token', pageNo:1, pageSize:10}
get:?token=token&pageNo=1&pageSize=10
response: {
success: true,
code: 0, // 0代表成功,其他数字结合desc理解
desc: '获取应用列表成功'/'用户名或密码错误'/'参数错误'/,
data: {
[
{
app_id: '',
app_name: '',
created_time: '',
callback_url: '',
status: '',
hourly_rate_limit: ''
}
]
}
}
15. 用户删除图片
url: 'deleteUserPhoto'
post: data: {token:'token', image_id: '图片的id'}
get: ?token='token'&image_id='image_id'
response: {
success: true,
code: 0, // 0代表成功,其他数字结合desc理解
desc: '删除成功',
data: {}
}
16. 用户修改邮件设置
url: 'updateUserAccount/emailSettings'
post: data: {
token: 'token',
email_settings: '1,2' // 设置为true的id,之间用逗号隔开
}
response: {
success: true,
code: 0, // 0代表成功,其他数字结合desc理解
desc: '',
data: {}
}
17. 用户注册成为developer
url: 'updateUserAccount/developer'
post: data: {
token: '',
url: '',
description: ''
}
response: {
success: true,
code: 0, // 0代表成功,其他数字结合desc理解
desc: '',
data: {}
}
18. developer用户添加新的应用
url: 'addNewApp',
post: data: {
token:'token',
app_name: '',
app_desc: '',
callback_url:'',
permissions: '1,2' // id 之间用逗号隔开
}
response: {
success: true,
code: 0, // 0代表成功,其他数字结合desc理解
desc: '',
data: {}
}
19. 打标签页面的图片
url: 'getUntagedPhoto'
response: {
success: true,
code: 0, // 0代表成功,其他数字结合desc理解
desc: '',
data: {
image_id: '',
image_md5: '',
image_tags:''
}
}
20. 更新打标签页面图片的tag
url: 'updatePhotoTag',
post: data: {
image_id: '',
tag: '' // 以逗号分隔
}
response: {
success: true,
code: 0, // 0代表成功,其他数字结合desc理解
desc: '',
data: {}
}
20. 用户上传图片到阿里云服务器/上传商品图片到阿里云服务器
url: 'uploadPhotoToAliyun' / 'uploadProductImageToAliyun'
post: {
data: formdata(图片文件)
processData: false
contentType: false
}
response: {
success: true,
code: 0, // 0代表成功,其他数字结合desc理解
desc: '',
data: {
image_md5: ''
}
}
21. 获取store中的最新产品列表
url: 'getProducts/new'
response: {
success: true,
code: 0, // 0代表成功,其他数字结合desc理解
desc: '',
data: {
product_id: '',
product_md5: '',
product_name: '',
creater_name: '',
product_price: '',
profits_share: true/false
}
}
22. 获取store中的最热产品列表
url: 'getProducts/hot'
response: {
success: true,
code: 0, // 0代表成功,其他数字结合desc理解
desc: '',
data: {
product_id: '',
product_md5: '',
product_name: '',
creater_name: '',
product_price: '',
profits_share: true/false
}
}
23. 获取store中所有产品列表
url: 'getProducts/all'
response: {
success: true,
code: 0, // 0代表成功,其他数字结合desc理解
desc: '',
data: {
product_id: '',
product_md5: '',
product_name: '',
creater_name: '',
product_price: '',
profits_share: true/false
}
}
24. 获取store中自营的产品列表
url: 'getProducts/self'
response: {
success: true,
code: 0, // 0代表成功,其他数字结合desc理解
desc: '',
data: {
product_id: '',
product_md5: '',
product_name: '',
creater_name: '',
product_price: '',
profits_share: true/false
}
}
26. 用户将商品加入购物车
url: 'addToCart'
post: data: {
token: '', // 如果是非登录用户将商品放入购物车,则用localStorage在本地记住就好
product_id: '',
quantity:'' //如果是删减则传负数,比如用户删减了2件,则传-2
}
27. 用户获取购物车中的所有商品列表
url: 'getProductsInCart'
post: data: {
token: ''
}
response: {
success: true,
code: 0, // 0代表成功,其他数字结合desc理解
desc: '',
data: {
product_id: '',
product_md5: '',
product_name: '',
creater_name: '',
product_price: '',
profits_share: true/false,
product_quantity: ''
}
}
27-1. 获取单件商品的具体信息
url: 'getProductDetails'
post: data: {
product_id:''
}
get: ?product_id=''
response: {
success: true,
code: 0, // 0代表成功,其他数字结合desc理解
desc: '',
data: {
product_id: '',
product_md5: '',
product_name: '',
creater_name: '',
product_price: '',
profits_share: true/false,
product_desc: '',
product_measurement: {
XS: {
bodyLength: 27,
chest:20,
sleeve:34
},
S: {
bodyLength: 27,
chest:20,
sleeve:34
},
M: {
bodyLength: 27,
chest:20,
sleeve:34
},
L:{
bodyLength: 27,
chest:20,
sleeve:34
},
XL:{
bodyLength: 27,
chest:20,
sleeve:34
}
},
product_pics_md5: [], //5张图片的md5
product_pics_and_desc: [
{
md5: '',
desc: ''
}
] //正文中每张图片及其对应的文字
}
}
28. 新用户邮件注册
url: 'register'
post: data: {
firstName: '',
lastName: '',
userName: '',
email: '',
password: '' // 加密后传过来
}
response: {
success: true,
code: 0, // 0代表成功,其他数字结合desc理解
desc: '',
data: {
token: '',
user_id: '',
user_name: '',
user_email: '',
first_name: '',
last_name: '',
image_md5: '',
personal_site: '',
instagram: '',
twitter: '',
location: '',
bio: ''
}
}
30. 老用户登录
url:'login'
post: data: {
email: '',
password: '' //加密后传过来
}
response: {
success: true,
code: 0, // 0代表成功,其他数字结合desc理解
desc: '',
data: {
user_info: {
token: '',
user_id: '',
user_name: '',
user_email: '',
first_name: '',
last_name: '',
image_md5: '',
personal_site: '',
instagram: '',
twitter: '',
location: '',
bio: ''
}
}
}
33. 获取所有类别的图片集列表
url: 'getCategories'
response: {
success: true,
code: 0, // 0代表成功,其他数字结合desc理解
desc: '',
data: {
[
{
image_md5: '',
category_name: '',
category_id: ''
}
]
}
}
34. 更新用户选择关注的类别图片集
url: 'updateUserCategories'
post: data: {
token: '',
categories: '' //用户选择的图片集的id
}
response: {
success: true,
code: 0, // 0代表成功,其他数字结合desc理解
desc: '',
data: {
}
}
35. 获取推荐给用户的摄影师列表
url: 'getPhotographers'
response: {
success: true,
code: 0, // 0代表成功,其他数字结合desc理解
desc: '',
data: {
[
{
user_id: '',
user_name: '',
instagram: '',
image_md5: '',
followers: ''
}
]
}
}
36. 更新用户选择关注的摄像师列表
url:'updatePhotographers'
post: data: {
token:'',
followings: '' //id 之间用逗号隔开
}
response: {
success: true,
code: 0, // 0代表成功,其他数字结合desc理解
desc: '',
data: {
}
}
37. 修改用户收货地址
url: '/updateUserAccount/delivery'
post: data: {
token: '',
delivery_id:'',//不传或为空则默认为新建收货地址,有则为更改该条收货信息
delivery_address:'',
delivery_province:'',
delivery_city:'',
delivery_town:'',
consignee:'',
consignee_phone:''
}
{
success: true,
code: 0,
desc: '',
data: {
}
}
38. 修改产品库存
url: '/changeStocks'
post: data: {
token: '',
product_id:_user.product_id,
stocks:_user.stocks,
unit:_user.unit,
province:_user.province,
city:_user.city,
town:_user.town,
address:_user.address,
inventory_id:'' //有则修改,无则新增
}
{
success: true,
code: 0,
desc: '',
data: {
}
}
39. 获取单件产品的所有图片
url: '/getAllImages'
post: data: {
product_id:'',
}
{
success: true,
code: 0,
desc: '',
data: {
}
}
40. 用户添加商品(根据是否是admin判断产品是否属于自营)
url: '/uploadProducts'
post: data: {
token:'',
product_id:'', //修改商品信息时需要提供,新增商品则不需要
product_md5:'',
product_name:'',
product_unit:'',
product_price:'',
produst_desc:'',
}
{
success: true,
code: 0,
desc: '',
data: {
}
}
42. 用户给商品添加图片
url: '/addProductImages'
post: data: {
token:'',
product_id:'',
image_name:'',
image_url:'',
image_desc:''
}
{
success: true,
code: 0,
desc: '',
data: {
}
}
43.用户移除或修改购物车产品的数量
url: '/removeFromCart'
post: data: {
token:'',
product_id:'',
}
{
success: true,
code: 0,
desc: '',
data: {
}
}
44.获取用户收货地址
url: '/getDeliveryAddress'
post: data: {
token:'',
}
{
success: true,
code: 0,
desc: '',
data: {
}
}
45.用户提交订单
url:'/placeOrder'
post: data:{
token:'',
delivery_id:'',
orders: [
{
product_id:'12',
product_quantity:20
},
{
product_id:'1',
product_quantity:200
},
]
}
46.用户给图片点赞
url:'/photoLike'
post: data: {
image_id:'',
like:1/0 // 1代表喜欢该图片,0取消该喜欢
}
47.用户新建相册
url:'/newCollection'
post: data: {
token:'',
collection_name: '',
is_private: 1 // 0代表私有,1代表公开,默认为公开
}
48.用户更改相册名称或是否公开
url:'/updateCollection'
post: data: {
token:'',
collection_id: '',
collection_name:'', // 可选
is_private: 0/1 // 可选,默认是0,即不公开
}
49.用户更改照片的信息
url:'/updatePhoto'
post: data: {
token: '',
image_md5:'http://my-image-carol.oss-cn-beijing.aliyuncs.com/1509425905335.jpeg',
image_tags:'pig, animals',
make: '2222',
model: '2222',
focalLength: '2222',
aperture: '2222',
iso: '2222',
shutterSpeed: '2222',
story_title: '雅阁',
story_detail: '照片拍摄于今天早上,天气有点冷',
location: '广东省深圳市龙华区',
display_location: '0',
collection_id: ''
}
50. 将照片加入自己的相册
url:'/addToCollection'
data: post: {
token: '',
image_id: '',
collection_id: ''
}
51. 给图片添加评论
url:'/photoComment'
data: post: {
token: '',
image_id: '',
comment: ''
}
52. 获取图片的评论列表
url:'/getPhotoComments'
data: post: {
image_id:''
}
53. 点赞、评论图片,将图片加入收藏,用websocket通知图片的所有者
54. 取消关注某人
url:'/updatePhotographers/rm'
data: post: {
token: '',
following_id: ''
}
55. 用户删除图片、相册、账户时,阿里云上相关联的图片也要删除
co(function* () {
var result = yield client.delete('object-key');
console.log(result);
}).catch(function (err) {
console.log(err);
});
co(function* () {
var result = yield client.deleteMulti(['obj-1', 'obj-2', 'obj-3']);
console.log(result);
var result = yield client.deleteMulti(['obj-1', 'obj-2', 'obj-3'], {
quiet: true
});
console.log(result);
}).catch(function (err) {
console.log(err);
});
56. 删除相册
url: '/deleteCollection'
data: post: {
token: '',
collection_id:''
}
57. 用户把相册里的图片都删除后,相册是不存在的
58. 用户是否喜欢过该图片
url:'/alreadyLike'
data: {
token: '',
image_id: ''
}