|
|
746
|
+ "origin_expired_stamps": 1529541404000,
|
|
|
747
|
+ "photo_thumbnail2_w": 1080,
|
|
|
748
|
+ "thumbup": false,
|
|
|
749
|
+ "comment_num": 0,
|
|
|
750
|
+ "photo_thumbnail_url": "http://orf3ahvt6.bkt.clouddn.com/FgajMVwPstn6iO8hQjEdt79uTsS3",
|
|
|
751
|
+ "group_from": 1,
|
|
|
752
|
+ "group_name": "solom",
|
|
|
753
|
+ "porder": {},
|
|
|
754
|
+ "latitude": 0,
|
|
|
755
|
+ "display_payment_btn": false,
|
|
|
756
|
+ "group_default_avatar": 0,
|
|
|
757
|
+ "user_id": "LzWPe7z",
|
|
|
758
|
+ "nickname": "solom",
|
|
|
759
|
+ "photo_h": 1280,
|
|
|
760
|
+ "photo_url": "http://orf3lnlmb.bkt.clouddn.com/Fufz7LyavCFHdymqZb8SnJMWKZ67",
|
|
|
761
|
+ "photo_thumbnail2_url": "http://orf3muf5n.bkt.clouddn.com/FsEV99H3ZVVPUsnYYMiqHpejfTcC",
|
|
|
762
|
+ "photo_id": "Kx4DVTpuxqynZQypFKFBhW",
|
|
|
763
|
+ "photo_share_url": "https://pai.ai/gp/Kx4DVTpuxqynZQypFKFBhW",
|
|
|
764
|
+ "created_at": "2018-06-14T08:36:44",
|
|
|
765
|
+ "photo_thumbnail_h": 360,
|
|
|
766
|
+ "session_id": "LzWPe7z6v46522px527gb9fcaqb8abiz",
|
|
|
767
|
+ "thumbup_num": 0,
|
|
|
768
|
+ "photo_thumbnail_w": 540,
|
|
|
769
|
+ "group_avatar": null,
|
|
|
770
|
+ "photo_thumbnail2_h": 720,
|
|
|
771
|
+ "nomark": 100,
|
|
|
772
|
+ "photo_from": 1,
|
|
|
773
|
+ "group_id": "WrWbvT7",
|
|
|
774
|
+ "avatar": "https://wx.qlogo.cn/mmopen/vi_32/DYAIOgq83erxcJiaabkvdFnmb7LTsjwBKlwLGIxCsxx7OwZQYGDkVexcshb0SSDQaF6pcQLqWrbPad9EFqbDM6Q/132"
|
|
|
775
|
+ },
|
|
|
776
|
+ {
|
|
|
777
|
+ "origin": 999,
|
|
|
778
|
+ "photo_w": 1920,
|
|
|
779
|
+ "longitude": 0,
|
|
|
780
|
+ "location": null,
|
|
|
781
|
+ "origin_expired_stamps": 1529541154000,
|
|
|
782
|
+ "photo_thumbnail2_w": 1080,
|
|
|
783
|
+ "thumbup": false,
|
|
|
784
|
+ "comment_num": 0,
|
|
|
785
|
+ "photo_thumbnail_url": "http://orf3ahvt6.bkt.clouddn.com/FnWJKneOOXCZ4QpTuzsL2f3aY-R5",
|
|
|
786
|
+ "group_from": 1,
|
|
|
787
|
+ "group_name": "solom",
|
|
|
788
|
+ "porder": {},
|
|
|
789
|
+ "latitude": 0,
|
|
|
790
|
+ "display_payment_btn": false,
|
|
|
791
|
+ "group_default_avatar": 0,
|
|
|
792
|
+ "user_id": "LzWPe7z",
|
|
|
793
|
+ "nickname": "solom",
|
|
|
794
|
+ "photo_h": 1280,
|
|
|
795
|
+ "photo_url": "http://orf3lnlmb.bkt.clouddn.com/FlSlMaB9WcGi_jq6qOyfokXpjdx7",
|
|
|
796
|
+ "photo_thumbnail2_url": "http://orf3muf5n.bkt.clouddn.com/FuT97fRCofT0M48mXr1OM5xV8Sag",
|
|
|
797
|
+ "photo_id": "itTfzb6hZWd8Up9xkdmCk2",
|
|
|
798
|
+ "photo_share_url": "https://pai.ai/gp/itTfzb6hZWd8Up9xkdmCk2",
|
|
|
799
|
+ "created_at": "2018-06-14T08:32:34",
|
|
|
800
|
+ "photo_thumbnail_h": 360,
|
|
|
801
|
+ "session_id": "LzWPe7z6v46522px527gb9fcaqb8abiz",
|
|
|
802
|
+ "thumbup_num": 0,
|
|
|
803
|
+ "photo_thumbnail_w": 540,
|
|
|
804
|
+ "group_avatar": null,
|
|
|
805
|
+ "photo_thumbnail2_h": 720,
|
|
|
806
|
+ "nomark": 100,
|
|
|
807
|
+ "photo_from": 1,
|
|
|
808
|
+ "group_id": "WrWbvT7",
|
|
|
809
|
+ "avatar": "https://wx.qlogo.cn/mmopen/vi_32/DYAIOgq83erxcJiaabkvdFnmb7LTsjwBKlwLGIxCsxx7OwZQYGDkVexcshb0SSDQaF6pcQLqWrbPad9EFqbDM6Q/132"
|
|
|
810
|
+ },
|
|
|
811
|
+ {
|
|
|
812
|
+ "origin": 999,
|
|
|
813
|
+ "photo_w": 1920,
|
|
|
814
|
+ "longitude": 0,
|
|
|
815
|
+ "location": null,
|
|
|
816
|
+ "origin_expired_stamps": 1529541118000,
|
|
|
817
|
+ "photo_thumbnail2_w": 1080,
|
|
|
818
|
+ "thumbup": false,
|
|
|
819
|
+ "comment_num": 0,
|
|
|
820
|
+ "photo_thumbnail_url": "http://orf3ahvt6.bkt.clouddn.com/FhfQyF1TywtriSCNxF-_dAYhPz-W",
|
|
|
821
|
+ "group_from": 1,
|
|
|
822
|
+ "group_name": "solom",
|
|
|
823
|
+ "porder": {},
|
|
|
824
|
+ "latitude": 0,
|
|
|
825
|
+ "display_payment_btn": false,
|
|
|
826
|
+ "group_default_avatar": 0,
|
|
|
827
|
+ "user_id": "LzWPe7z",
|
|
|
828
|
+ "nickname": "solom",
|
|
|
829
|
+ "photo_h": 1280,
|
|
|
830
|
+ "photo_url": "http://orf3lnlmb.bkt.clouddn.com/FrIkVp2aa8-mIxJsKmGme5iU_J1v",
|
|
|
831
|
+ "photo_thumbnail2_url": "http://orf3muf5n.bkt.clouddn.com/FpjEqxgAWtJcITMR9xPpxd0WCOpf",
|
|
|
832
|
+ "photo_id": "2qeTqWuHrNHwLUYFvx8XEX",
|
|
|
833
|
+ "photo_share_url": "https://pai.ai/gp/2qeTqWuHrNHwLUYFvx8XEX",
|
|
|
834
|
+ "created_at": "2018-06-14T08:31:58",
|
|
|
835
|
+ "photo_thumbnail_h": 360,
|
|
|
836
|
+ "session_id": "LzWPe7z6v46522px527gb9fcaqb8abiz",
|
|
|
837
|
+ "thumbup_num": 0,
|
|
|
838
|
+ "photo_thumbnail_w": 540,
|
|
|
839
|
+ "group_avatar": null,
|
|
|
840
|
+ "photo_thumbnail2_h": 720,
|
|
|
841
|
+ "nomark": 100,
|
|
|
842
|
+ "photo_from": 1,
|
|
|
843
|
+ "group_id": "WrWbvT7",
|
|
|
844
|
+ "avatar": "https://wx.qlogo.cn/mmopen/vi_32/DYAIOgq83erxcJiaabkvdFnmb7LTsjwBKlwLGIxCsxx7OwZQYGDkVexcshb0SSDQaF6pcQLqWrbPad9EFqbDM6Q/132"
|
|
|
845
|
+ },
|
|
|
846
|
+ {
|
|
|
847
|
+ "origin": 999,
|
|
|
848
|
+ "photo_w": 1920,
|
|
|
849
|
+ "longitude": 0,
|
|
|
850
|
+ "location": null,
|
|
|
851
|
+ "origin_expired_stamps": 1529541095000,
|
|
|
852
|
+ "photo_thumbnail2_w": 1080,
|
|
|
853
|
+ "thumbup": false,
|
|
|
854
|
+ "comment_num": 0,
|
|
|
855
|
+ "photo_thumbnail_url": "http://orf3ahvt6.bkt.clouddn.com/FqiGM9ZY9RR0wApMtVXqMNhpHYuW",
|
|
|
856
|
+ "group_from": 1,
|
|
|
857
|
+ "group_name": "solom",
|
|
|
858
|
+ "porder": {},
|
|
|
859
|
+ "latitude": 0,
|
|
|
860
|
+ "display_payment_btn": false,
|
|
|
861
|
+ "group_default_avatar": 0,
|
|
|
862
|
+ "user_id": "LzWPe7z",
|
|
|
863
|
+ "nickname": "solom",
|
|
|
864
|
+ "photo_h": 1280,
|
|
|
865
|
+ "photo_url": "http://orf3lnlmb.bkt.clouddn.com/FliQ3QCt_69YViub4mGCahmjDM-_",
|
|
|
866
|
+ "photo_thumbnail2_url": "http://orf3muf5n.bkt.clouddn.com/FvXB-V4UAfVqoTds827EzoNKK-yl",
|
|
|
867
|
+ "photo_id": "JtpKcN4LLE84CsVE2tFJQ2",
|
|
|
868
|
+ "photo_share_url": "https://pai.ai/gp/JtpKcN4LLE84CsVE2tFJQ2",
|
|
|
869
|
+ "created_at": "2018-06-14T08:31:35",
|
|
|
870
|
+ "photo_thumbnail_h": 360,
|
|
|
871
|
+ "session_id": "LzWPe7z6v46522px527gb9fcaqb8abiz",
|
|
|
872
|
+ "thumbup_num": 0,
|
|
|
873
|
+ "photo_thumbnail_w": 540,
|
|
|
874
|
+ "group_avatar": null,
|
|
|
875
|
+ "photo_thumbnail2_h": 720,
|
|
|
876
|
+ "nomark": 100,
|
|
|
877
|
+ "photo_from": 1,
|
|
|
878
|
+ "group_id": "WrWbvT7",
|
|
|
879
|
+ "avatar": "https://wx.qlogo.cn/mmopen/vi_32/DYAIOgq83erxcJiaabkvdFnmb7LTsjwBKlwLGIxCsxx7OwZQYGDkVexcshb0SSDQaF6pcQLqWrbPad9EFqbDM6Q/132"
|
|
|
880
|
+ },
|
|
|
881
|
+ {
|
|
|
882
|
+ "origin": 999,
|
|
|
883
|
+ "photo_w": 1920,
|
|
|
884
|
+ "longitude": 0,
|
|
|
885
|
+ "location": null,
|
|
|
886
|
+ "origin_expired_stamps": 1529541063000,
|
|
|
887
|
+ "photo_thumbnail2_w": 1080,
|
|
|
888
|
+ "thumbup": false,
|
|
|
889
|
+ "comment_num": 0,
|
|
|
890
|
+ "photo_thumbnail_url": "http://orf3ahvt6.bkt.clouddn.com/FqV3ngD73YRBna0UbNerv9Y5HLHC",
|
|
|
891
|
+ "group_from": 1,
|
|
|
892
|
+ "group_name": "solom",
|
|
|
893
|
+ "porder": {},
|
|
|
894
|
+ "latitude": 0,
|
|
|
895
|
+ "display_payment_btn": false,
|
|
|
896
|
+ "group_default_avatar": 0,
|
|
|
897
|
+ "user_id": "LzWPe7z",
|
|
|
898
|
+ "nickname": "solom",
|
|
|
899
|
+ "photo_h": 1280,
|
|
|
900
|
+ "photo_url": "http://orf3lnlmb.bkt.clouddn.com/FkOtpDM2UoqYRX-_jZRIb2IclXwk",
|
|
|
901
|
+ "photo_thumbnail2_url": "http://orf3muf5n.bkt.clouddn.com/FtWErvFBRn5ivcecXNTnT2UBtLRv",
|
|
|
902
|
+ "photo_id": "9GFXKSy3YNc2rY5ZAF8Thc",
|
|
|
903
|
+ "photo_share_url": "https://pai.ai/gp/9GFXKSy3YNc2rY5ZAF8Thc",
|
|
|
904
|
+ "created_at": "2018-06-14T08:31:03",
|
|
|
905
|
+ "photo_thumbnail_h": 360,
|
|
|
906
|
+ "session_id": "LzWPe7z6v46522px527gb9fcaqb8abiz",
|
|
|
907
|
+ "thumbup_num": 0,
|
|
|
908
|
+ "photo_thumbnail_w": 540,
|
|
|
909
|
+ "group_avatar": null,
|
|
|
910
|
+ "photo_thumbnail2_h": 720,
|
|
|
911
|
+ "nomark": 100,
|
|
|
912
|
+ "photo_from": 1,
|
|
|
913
|
+ "group_id": "WrWbvT7",
|
|
|
914
|
+ "avatar": "https://wx.qlogo.cn/mmopen/vi_32/DYAIOgq83erxcJiaabkvdFnmb7LTsjwBKlwLGIxCsxx7OwZQYGDkVexcshb0SSDQaF6pcQLqWrbPad9EFqbDM6Q/132"
|
|
|
915
|
+ },
|
|
|
916
|
+ {
|
|
|
917
|
+ "origin": 999,
|
|
|
918
|
+ "photo_w": 1920,
|
|
|
919
|
+ "longitude": 0,
|
|
|
920
|
+ "location": null,
|
|
|
921
|
+ "origin_expired_stamps": 1529540593000,
|
|
|
922
|
+ "photo_thumbnail2_w": 1080,
|
|
|
923
|
+ "thumbup": false,
|
|
|
924
|
+ "comment_num": 0,
|
|
|
925
|
+ "photo_thumbnail_url": "http://orf3ahvt6.bkt.clouddn.com/FrhawRT3wVCiKWl2OqhoUsaKeAYG",
|
|
|
926
|
+ "group_from": 1,
|
|
|
927
|
+ "group_name": "solom",
|
|
|
928
|
+ "porder": {},
|
|
|
929
|
+ "latitude": 0,
|
|
|
930
|
+ "display_payment_btn": false,
|
|
|
931
|
+ "group_default_avatar": 0,
|
|
|
932
|
+ "user_id": "LzWPe7z",
|
|
|
933
|
+ "nickname": "solom",
|
|
|
934
|
+ "photo_h": 1280,
|
|
|
935
|
+ "photo_url": "http://orf3lnlmb.bkt.clouddn.com/Fsox2chS8bu5VmoUSgb-n1Br-0no",
|
|
|
936
|
+ "photo_thumbnail2_url": "http://orf3muf5n.bkt.clouddn.com/FlxLpjSCteQVtSBuRt_406Cn_0Tz",
|
|
|
937
|
+ "photo_id": "MuZ3vUUskdnC9P454xuaGf",
|
|
|
938
|
+ "photo_share_url": "https://pai.ai/gp/MuZ3vUUskdnC9P454xuaGf",
|
|
|
939
|
+ "created_at": "2018-06-14T08:23:13",
|
|
|
940
|
+ "photo_thumbnail_h": 360,
|
|
|
941
|
+ "session_id": "LzWPe7z6v46522px527gb9fcaqb8abiz",
|
|
|
942
|
+ "thumbup_num": 0,
|
|
|
943
|
+ "photo_thumbnail_w": 540,
|
|
|
944
|
+ "group_avatar": null,
|
|
|
945
|
+ "photo_thumbnail2_h": 720,
|
|
|
946
|
+ "nomark": 100,
|
|
|
947
|
+ "photo_from": 1,
|
|
|
948
|
+ "group_id": "WrWbvT7",
|
|
|
949
|
+ "avatar": "https://wx.qlogo.cn/mmopen/vi_32/DYAIOgq83erxcJiaabkvdFnmb7LTsjwBKlwLGIxCsxx7OwZQYGDkVexcshb0SSDQaF6pcQLqWrbPad9EFqbDM6Q/132"
|
|
|
950
|
+ }
|
|
|
951
|
+ ],
|
|
|
952
|
+ "session_id": "LzWPe7z6v46522px527gb9fcaqb8abiz"
|
|
|
953
|
+ }
|
|
|
954
|
+ ]
|
|
|
955
|
+ var photoWidth = width * 49 / 100;
|
|
|
956
|
+ var photoHeight = 0;
|
|
|
957
|
+ var photoIdx = 0;
|
|
|
958
|
+ var leftHeight = 0;
|
|
|
959
|
+ var rightHeight = 0;
|
|
|
960
|
+ var leftImgs = '';
|
|
|
961
|
+ var rightImgs = '';
|
|
|
962
|
+ var swipeItems = [];
|
|
|
963
|
+
|
|
|
964
|
+ for (var i = 0; i < session_photos.length; i++) {
|
|
|
965
|
+ var photos = session_photos[i].photos;
|
|
|
966
|
+ for (var j = 0; j < photos.length; j++) {
|
|
|
967
|
+ photoHeight = photos[j].photo_thumbnail_h / photos[j].photo_thumbnail_w * photoWidth;
|
|
|
968
|
+ var header = (
|
|
|
969
|
+ '<div class="photo-top">' +
|
|
|
970
|
+ '<img class="group-avatar float-left" src="../../static/img/{0}.png" />' +
|
|
|
971
|
+ '<text class="group-name float-left">{1}</text>' +
|
|
|
972
|
+ '<text class="section-text float-right">{2}</text>' +
|
|
|
973
|
+ '</div>'
|
|
|
974
|
+ ).format(GROUP_AVATAR_LIST[photos[j].group_default_avatar], photos[j].group_name, fromNow(photos[j].created_at));
|
|
|
975
|
+ var imgctx = '<img src="{0}" data-idx="{1}" style="width:{2}px;height:{3}px">'.format(photos[j].photo_thumbnail_url, photoIdx, photoWidth, photoHeight);
|
|
|
976
|
+ var footer = (
|
|
|
977
|
+ '<div class="photo-bottom">' +
|
|
|
978
|
+ '<img class="section-icon float-left" src="../../static/img/thumbup.png" />' +
|
|
|
979
|
+ '<text class="thump-comment-num float-left">{0}</text>' +
|
|
|
980
|
+ '<img class="section-icon float-left" src="../../static/img/comment.png" />' +
|
|
|
981
|
+ '<text class="thump-comment-num float-left">{1}</text>' +
|
|
|
982
|
+ '</div>'
|
|
|
983
|
+ ).format(photos[j].thumbup_num, photos[j].comment_num);
|
|
|
984
|
+ if (leftHeight > rightHeight) {
|
|
|
985
|
+ rightHeight += photoHeight + 72;
|
|
|
986
|
+ rightImgs += '<div class="imgctx">{0}{1}{2}</div>'.format(header, imgctx, footer);
|
|
|
987
|
+ } else {
|
|
|
988
|
+ leftHeight += photoHeight + 72;
|
|
|
989
|
+ leftImgs += '<div class="imgctx">{0}{1}{2}</div>'.format(header, imgctx, footer);
|
|
|
990
|
+ }
|
|
|
991
|
+ swipeItems.push({
|
|
|
992
|
+ src: photos[j].photo_url,
|
|
|
993
|
+ w: photos[j].photo_w,
|
|
|
994
|
+ h: photos[j].photo_h,
|
|
|
995
|
+ })
|
|
|
996
|
+ photoIdx += 1;
|
|
|
997
|
+ }
|
|
|
998
|
+ }
|
|
|
999
|
+
|
|
|
1000
|
+ $('#left').append(leftImgs);
|
|
|
1001
|
+ $('#right').append(rightImgs);
|
|
|
1002
|
+
|
|
|
1003
|
+ var pswpElement = document.querySelectorAll('.pswp')[0];
|
|
|
1004
|
+ // define options (if needed)
|
|
|
1005
|
+ var options = {
|
|
|
1006
|
+ // optionName: 'option value'
|
|
|
1007
|
+ // for example:
|
|
|
1008
|
+ loop: true,
|
|
|
1009
|
+ index: 1, // start at first slide
|
|
|
1010
|
+ // Tap on sliding area should close gallery'
|
|
|
1011
|
+ tapToClose: true,
|
|
|
1012
|
+ };
|
|
|
1013
|
+ // Initializes and opens PhotoSwipe
|
|
|
1014
|
+ $('#photos img').click(function () {
|
|
|
1015
|
+ options['index'] = parseInt($(this).attr('data-idx'));
|
|
|
1016
|
+ var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, swipeItems, options);
|
|
|
1017
|
+ gallery.init();
|
|
|
1018
|
+
|
|
|
1019
|
+ $('#mask-thump').show();
|
|
|
1020
|
+
|
|
|
1021
|
+ // After slides change
|
|
|
1022
|
+ // (after content changed)
|
|
|
1023
|
+ gallery.listen('afterChange', function() {
|
|
|
1024
|
+ console.log(gallery.getCurrentIndex())
|
|
|
1025
|
+ });
|
|
|
1026
|
+
|
|
|
1027
|
+ // Gallery starts closing
|
|
|
1028
|
+ gallery.listen('close', function() {
|
|
|
1029
|
+ $('#mask-thump').hide();
|
|
|
1030
|
+ });
|
|
|
1031
|
+ })
|
|
|
1032
|
+ })
|
|
|
1033
|
+</script>
|
|
|
1034
|
+<script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
|
|
|
1035
|
+<script type="text/javascript" src="{% static 'pai2/js/jswe-0.0.4.js' %}"></script>
|
|
|
1036
|
+<script>
|
|
|
1037
|
+ V.initWxData({
|
|
|
1038
|
+ imgUrl: "http://pai.ai/static/pai2/img/paiai_96_96.png",
|
|
|
1039
|
+ link: 'http://pai.ai/w/o?r=http%3A%2F%2Fpai.ai%2Fp%2Floginqr',
|
|
|
1040
|
+ desc: "授权登录",
|
|
|
1041
|
+ title: "授权登录",
|
|
|
1042
|
+ timeLine: ""
|
|
|
1043
|
+ }, true);
|
|
|
1044
|
+ V.hideOptionMenu();
|
|
|
1045
|
+</script>
|
|
|
1046
|
+</body>
|
|
|
1047
|
+</html>
|
|
|
|
@@ -33,4 +33,5 @@ urlpatterns += [
|
|
33
|
33
|
# 小程序相关
|
|
34
|
34
|
urlpatterns += [
|
|
35
|
35
|
url(r'^mini$', mini_views.mini_preview, name='mini_preview'), #
|
|
|
36
|
+ url(r'^mini2$', mini_views.mini_preview2, name='mini_preview2'), #
|
|
36
|
37
|
]
|
|
|
|
@@ -86,7 +86,7 @@ urlpatterns += [
|
|
86
|
86
|
url(r'^uniapi/', include('django_uniapi.urls', namespace='uniapi')),
|
|
87
|
87
|
url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),
|
|
88
|
88
|
|
|
89
|
|
- url(r'^p/', include('page.urls', namespace='shortpage')),
|
|
|
89
|
+ # url(r'^p/', include('page.urls', namespace='shortpage')),
|
|
90
|
90
|
url(r'^page/', include('page.urls', namespace='page')),
|
|
91
|
91
|
|
|
92
|
92
|
url(r'^w/', include('django_we.urls', namespace='shortwechat')),
|
|
|
|
@@ -11,11 +11,12 @@ django-mobi2==1.0.2
|
|
11
|
11
|
django-models-ext==1.1.6
|
|
12
|
12
|
django-multidomain==1.1.4
|
|
13
|
13
|
django-paginator2==1.0.4
|
|
|
14
|
+django-query==1.0.3
|
|
14
|
15
|
django-redis-connector==1.0.1
|
|
15
|
16
|
django-response==1.1.1
|
|
16
|
17
|
django-rlog==1.0.7
|
|
17
|
18
|
django-shortuuidfield==0.1.3
|
|
18
|
19
|
django-six==1.0.4
|
|
19
|
|
-django-uniapi==1.0.4
|
|
|
20
|
+django-uniapi==1.0.5
|
|
20
|
21
|
django-we==1.4.2
|
|
21
|
22
|
djangorestframework==3.7.7
|
|
|
|
@@ -1,8 +1,8 @@
|
|
1
|
1
|
pywe-jssdk==1.1.0
|
|
2
|
2
|
pywe-membercard==1.0.0
|
|
3
|
|
-pywe-miniapp==1.0.2
|
|
|
3
|
+pywe-miniapp==1.1.0
|
|
4
|
4
|
pywe-oauth==1.0.6
|
|
5
|
|
-pywe-pay==1.0.11
|
|
|
5
|
+pywe-pay==1.0.12
|
|
6
|
6
|
pywe-pay-notify==1.0.4
|
|
7
|
7
|
pywe-response==1.0.1
|
|
8
|
8
|
pywe-sign==1.0.8
|
|
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+# -*- coding: utf-8 -*-
|
|
|
2
|
+
|
|
|
3
|
+from __future__ import division
|
|
|
4
|
+
|
|
|
5
|
+import itertools
|
|
|
6
|
+
|
|
|
7
|
+from django.conf import settings
|
|
|
8
|
+from django.db import connection
|
|
|
9
|
+from django_query import get_query_value
|
|
|
10
|
+from paginator import pagination
|
|
|
11
|
+
|
|
|
12
|
+from group.models import GroupPhotoInfo
|
|
|
13
|
+from utils.qiniucdn import qiniu_file_url
|
|
|
14
|
+from utils.redis.rgroup import get_group_photo_thumbup_flag
|
|
|
15
|
+from utils.redis.rorder import get_lensman_order_record
|
|
|
16
|
+from utils.sql.raw import PAI2_HOME_API, PAI2_HOME_WX_API
|
|
|
17
|
+from utils.time_utils import origin_expired_stamps
|
|
|
18
|
+from utils.url_utils import share_url
|
|
|
19
|
+
|
|
|
20
|
+
|
|
|
21
|
+def get_home_photos(request):
|
|
|
22
|
+ user_id = get_query_value(request, 'user_id')
|
|
|
23
|
+ page = get_query_value(request, 'page', default=1, val_cast_func=int)
|
|
|
24
|
+ num = get_query_value(request, 'num', default=settings.PAI2_HOME_PER_PAGE, val_cast_func=int)
|
|
|
25
|
+
|
|
|
26
|
+ # 执行原生 SQL 语句,获取首页照片列表
|
|
|
27
|
+ cursor = connection.cursor()
|
|
|
28
|
+ cursor.execute((PAI2_HOME_WX_API if request.weixin else PAI2_HOME_API).format(
|
|
|
29
|
+ user_id=user_id,
|
|
|
30
|
+ offset=0,
|
|
|
31
|
+ rows=settings.PAI2_HOME_MAX_ROWS,
|
|
|
32
|
+ ))
|
|
|
33
|
+ rows = cursor.fetchall()
|
|
|
34
|
+
|
|
|
35
|
+ # 首页照片分页
|
|
|
36
|
+ rows, left = pagination(rows, page, num)
|
|
|
37
|
+
|
|
|
38
|
+ # 首页照片信息
|
|
|
39
|
+ rows = [{
|
|
|
40
|
+ 'group_id': row[0],
|
|
|
41
|
+ 'group_name': row[1],
|
|
|
42
|
+ 'group_default_avatar': row[2],
|
|
|
43
|
+ 'group_avatar': row[3],
|
|
|
44
|
+ 'group_from': row[4],
|
|
|
45
|
+ 'photo_id': row[5],
|
|
|
46
|
+ 'photo_url': qiniu_file_url(row[6], bucket='watermark' if row[7] else 'photo'),
|
|
|
47
|
+ 'photo_w': row[8],
|
|
|
48
|
+ 'photo_h': row[9],
|
|
|
49
|
+ 'photo_thumbnail_url': qiniu_file_url(row[10], bucket='thumbnail'),
|
|
|
50
|
+ 'photo_thumbnail_w': row[11],
|
|
|
51
|
+ 'photo_thumbnail_h': row[12],
|
|
|
52
|
+ 'photo_thumbnail2_url': qiniu_file_url(row[13], bucket='thumbnail2'),
|
|
|
53
|
+ 'photo_thumbnail2_w': row[14],
|
|
|
54
|
+ 'photo_thumbnail2_h': row[15],
|
|
|
55
|
+ 'photo_share_url': share_url(row[5]), # Warning: Index of This Line is 5
|
|
|
56
|
+ 'user_id': row[16],
|
|
|
57
|
+ 'nickname': row[17],
|
|
|
58
|
+ 'avatar': row[18],
|
|
|
59
|
+ 'comment_num': row[19],
|
|
|
60
|
+ 'thumbup_num': row[20],
|
|
|
61
|
+ 'photo_from': row[21],
|
|
|
62
|
+ 'session_id': row[22],
|
|
|
63
|
+ 'nomark': row[23],
|
|
|
64
|
+ 'origin': row[24],
|
|
|
65
|
+ 'created_at': row[25],
|
|
|
66
|
+ 'origin_expired_stamps': origin_expired_stamps(row[25], row[16]),
|
|
|
67
|
+ 'thumbup': get_group_photo_thumbup_flag(row[5], user_id),
|
|
|
68
|
+ 'porder': get_lensman_order_record(row[5], user_id) if row[21] == GroupPhotoInfo.SESSION_GROUP else {},
|
|
|
69
|
+ 'display_payment_btn': row[21] == GroupPhotoInfo.SESSION_GROUP and row[27] not in [GroupPhotoInfo.OUTTAKE],
|
|
|
70
|
+ 'longitude': row[28],
|
|
|
71
|
+ 'latitude': row[29],
|
|
|
72
|
+ 'location': row[30],
|
|
|
73
|
+ } for row in rows]
|
|
|
74
|
+
|
|
|
75
|
+ session_photos = map(lambda x: {'session_id': x[0], 'photos': list(x[1])}, itertools.groupby(rows, lambda x: x.get('session_id', '')))
|
|
|
76
|
+
|
|
|
77
|
+ return rows, session_photos, left
|