Compare commits
575 Commits
merge_upst
...
malio-A
| Author | SHA1 | Date |
|---|---|---|
|
|
8633e1cd2d | 6 years ago |
|
|
ba85e469ac | 6 years ago |
|
|
5e6638547f | 6 years ago |
|
|
cfb13c8ef0 | 6 years ago |
|
|
b91b0c3e33 | 6 years ago |
|
|
78d09700ea | 6 years ago |
|
|
80cd95f334 | 6 years ago |
|
|
d14e8f8115 | 6 years ago |
|
|
025bbeb9d3 | 6 years ago |
|
|
bc49882353 | 6 years ago |
|
|
e3eab497ae | 6 years ago |
|
|
5645bb1b1a | 6 years ago |
|
|
18ecb3723f | 6 years ago |
|
|
a822b502b2 | 6 years ago |
|
|
af02fc0efb | 6 years ago |
|
|
fdf582dcdf | 6 years ago |
|
|
882aa266cb | 6 years ago |
|
|
d19cd32055 | 6 years ago |
|
|
62d8f8ead8 | 6 years ago |
|
|
1f87696d86 | 6 years ago |
|
|
e6a23af95f | 6 years ago |
|
|
04d20e52f6 | 6 years ago |
|
|
53e817431c | 6 years ago |
|
|
28213af6ba | 7 years ago |
|
|
d7d536c79d | 7 years ago |
|
|
8043684bf6 | 7 years ago |
|
|
deeb5ecdac | 7 years ago |
|
|
4bb967085a | 7 years ago |
|
|
f9fb905aa8 | 7 years ago |
|
|
8701e6ed2b | 7 years ago |
|
|
2c05cd08e3 | 7 years ago |
|
|
a05176d2b6 | 7 years ago |
|
|
b4c7d13296 | 7 years ago |
|
|
23014aad36 | 7 years ago |
|
|
ed481f683d | 7 years ago |
|
|
b1aa5090f6 | 7 years ago |
|
|
171c39bb87 | 7 years ago |
|
|
af2a7d2a41 | 7 years ago |
|
|
493d0232aa | 7 years ago |
|
|
0ec4414b33 | 7 years ago |
|
|
df8a2b2190 | 7 years ago |
|
|
196a8bc151 | 7 years ago |
|
|
8a56a0ba90 | 7 years ago |
|
|
69fedbcbf3 | 7 years ago |
|
|
a3f0c7ece6 | 7 years ago |
|
|
ed9c1eb7bb | 7 years ago |
|
|
1ba142cd90 | 7 years ago |
|
|
a902d4e60d | 7 years ago |
|
|
69e4d22e4a | 7 years ago |
|
|
e350d32b1a | 7 years ago |
|
|
f57ffdfb0a | 7 years ago |
|
|
c38ab82d42 | 7 years ago |
|
|
76517c9172 | 7 years ago |
|
|
8924e5fd82 | 7 years ago |
|
|
facc66d78a | 7 years ago |
|
|
787e8f16be | 7 years ago |
|
|
0185572e5c | 7 years ago |
|
|
1c455e0b3c | 7 years ago |
|
|
b547121472 | 7 years ago |
|
|
4b75975399 | 7 years ago |
|
|
b516a11f87 | 7 years ago |
|
|
d971fa429e | 7 years ago |
|
|
aa0e40e893 | 7 years ago |
|
|
79e8b40dfd | 7 years ago |
|
|
516344fa7b | 7 years ago |
|
|
7da5fae5eb | 7 years ago |
|
|
73cdeb69a9 | 7 years ago |
|
|
7e0f4fc5ce | 7 years ago |
|
|
c49fe18b2f | 7 years ago |
|
|
3de1210f39 | 7 years ago |
|
|
784c82a50d | 7 years ago |
|
|
360d09d94b | 7 years ago |
|
|
68e1a92672 | 7 years ago |
|
|
edbebf43fd | 7 years ago |
|
|
90a746a633 | 7 years ago |
|
|
0cb6c62614 | 7 years ago |
|
|
4dc562a41d | 7 years ago |
|
|
0c042b3aee | 7 years ago |
|
|
735cbc129b | 7 years ago |
|
|
5c1112b3a6 | 7 years ago |
|
|
2717862e29 | 7 years ago |
|
|
fe546e5024 | 7 years ago |
|
|
47f3813ec2 | 7 years ago |
|
|
7abed27b75 | 7 years ago |
|
|
27542ca725 | 7 years ago |
|
|
13abb867dd | 7 years ago |
|
|
9ff825c294 | 7 years ago |
|
|
bd4fc024b2 | 7 years ago |
|
|
533d1423ff | 7 years ago |
|
|
d47bd98773 | 7 years ago |
|
|
7c817b6174 | 7 years ago |
|
|
733a11048d | 7 years ago |
|
|
c010a67300 | 7 years ago |
|
|
f6a94fbdf3 | 7 years ago |
|
|
c259030c9a | 7 years ago |
|
|
7814d7ec83 | 7 years ago |
|
|
2244627804 | 7 years ago |
|
|
ac5c582b76 | 7 years ago |
|
|
5838189366 | 7 years ago |
|
|
c3daab80cb | 7 years ago |
|
|
5a8b03a106 | 7 years ago |
|
|
b3dac73008 | 7 years ago |
|
|
dd41e26a0d | 7 years ago |
|
|
01e10aeaf0 | 7 years ago |
|
|
04e4ec061b | 7 years ago |
|
|
6415da3819 | 7 years ago |
|
|
3f39e56b52 | 7 years ago |
|
|
e28ede416b | 7 years ago |
|
|
81fc72a9b5 | 7 years ago |
|
|
b2d1f1d6fe | 7 years ago |
|
|
1a99f59c6f | 7 years ago |
|
|
aacef2eaec | 7 years ago |
|
|
e12fa43ef4 | 7 years ago |
|
|
441a081724 | 7 years ago |
|
|
781c41f2ae | 7 years ago |
|
|
38ccb7960e | 7 years ago |
|
|
4326f52b8e | 7 years ago |
|
|
ef84384ecc | 7 years ago |
|
|
41dab53a8c | 7 years ago |
|
|
251f4095d1 | 7 years ago |
|
|
6d8559c78b | 7 years ago |
|
|
f59c424407 | 7 years ago |
|
|
3661829e80 | 7 years ago |
|
|
b2df72ef79 | 7 years ago |
|
|
6c863f745b | 7 years ago |
|
|
eaea2b336e | 7 years ago |
|
|
96f7a23400 | 7 years ago |
|
|
ae330b454c | 7 years ago |
|
|
ee4060f8ab | 7 years ago |
|
|
56cfbfe67d | 7 years ago |
|
|
9465a24947 | 7 years ago |
|
|
48100a0f98 | 7 years ago |
|
|
2b97a04e8f | 7 years ago |
|
|
40848af02f | 7 years ago |
|
|
d56edcf7e2 | 7 years ago |
|
|
4313d1e428 | 7 years ago |
|
|
ae6eca628b | 7 years ago |
|
|
795bfe8af5 | 7 years ago |
|
|
66274de89c | 7 years ago |
|
|
4e6db25d6a | 7 years ago |
|
|
228158c84d | 7 years ago |
|
|
134fe6cb29 | 7 years ago |
|
|
7204c32e9e | 7 years ago |
|
|
8e61ac1175 | 7 years ago |
|
|
2a6b4ba9d6 | 7 years ago |
|
|
07a6120651 | 7 years ago |
|
|
9cbf3d88db | 7 years ago |
|
|
56099ff991 | 7 years ago |
|
|
fe2fb3ae29 | 7 years ago |
|
|
05054f2910 | 7 years ago |
|
|
043ff80923 | 7 years ago |
|
|
1514e36e44 | 7 years ago |
|
|
d1c0bf6d5d | 7 years ago |
|
|
2ee42af5f5 | 7 years ago |
|
|
239e2fc6d2 | 7 years ago |
|
|
157805d495 | 7 years ago |
|
|
08eefe35e6 | 7 years ago |
|
|
b4f7bf6e55 | 7 years ago |
|
|
8fed9d184c | 7 years ago |
|
|
1723af4419 | 7 years ago |
|
|
7eaaf1addf | 7 years ago |
|
|
133918163b | 7 years ago |
|
|
3edc891722 | 7 years ago |
|
|
02fdf1e90d | 7 years ago |
|
|
049f71d913 | 7 years ago |
|
|
478339ff4f | 7 years ago |
|
|
e95205d203 | 7 years ago |
|
|
0d2b25b4e2 | 7 years ago |
|
|
4009d7d883 | 7 years ago |
|
|
12ecd51269 | 7 years ago |
|
|
758b4272ff | 7 years ago |
|
|
f20a405c0c | 7 years ago |
|
|
730a6e432a | 7 years ago |
|
|
15d9462d3e | 7 years ago |
|
|
41a44f3c12 | 7 years ago |
|
|
d7d83c2b0d | 7 years ago |
|
|
6b9d5800d3 | 7 years ago |
|
|
6d6a01b3e9 | 7 years ago |
|
|
f8b08a0bb6 | 7 years ago |
|
|
fa7933966f | 7 years ago |
|
|
06483130dd | 7 years ago |
|
|
efa11e17e3 | 7 years ago |
|
|
9079c21340 | 7 years ago |
|
|
691aef4578 | 7 years ago |
|
|
f6f1267e28 | 7 years ago |
|
|
f922d60e9d | 7 years ago |
|
|
5c5de895e8 | 7 years ago |
|
|
5873a37fed | 7 years ago |
|
|
34569c5dc2 | 7 years ago |
|
|
df9f9009a5 | 7 years ago |
|
|
a04c1755d2 | 7 years ago |
|
|
e8be1d0a39 | 7 years ago |
|
|
a709cfae54 | 7 years ago |
|
|
30b8239dd6 | 7 years ago |
|
|
cd20d8c37a | 7 years ago |
|
|
cc96e2e3b5 | 7 years ago |
|
|
73afc143cd | 7 years ago |
|
|
bc7e18e211 | 7 years ago |
|
|
b57e618ee3 | 7 years ago |
|
|
c37c12d8a4 | 7 years ago |
|
|
78b378b978 | 7 years ago |
|
|
5dff6c4ce1 | 7 years ago |
|
|
4ac06220b9 | 7 years ago |
|
|
3cd4017f37 | 7 years ago |
|
|
6bdc510cf2 | 7 years ago |
|
|
096228c6c7 | 7 years ago |
|
|
4fc6ae0db4 | 7 years ago |
|
|
438b4fe3a4 | 7 years ago |
|
|
c0fb19dbf4 | 7 years ago |
|
|
b6fc28819e | 7 years ago |
|
|
5eff0b6a01 | 7 years ago |
|
|
d1c3e9cf9c | 7 years ago |
|
|
7669cf7768 | 7 years ago |
|
|
cd529f5657 | 7 years ago |
|
|
95a437f04b | 7 years ago |
|
|
e76026a5d8 | 7 years ago |
|
|
339dfaac21 | 7 years ago |
|
|
006250ff76 | 7 years ago |
|
|
487cefb418 | 7 years ago |
|
|
dbb3bd7751 | 7 years ago |
|
|
33aeabf077 | 7 years ago |
|
|
fa6026c4c9 | 7 years ago |
|
|
952825b7d4 | 7 years ago |
|
|
e554b29711 | 7 years ago |
|
|
5061561e71 | 7 years ago |
|
|
6ab5fcd17e | 7 years ago |
|
|
086f4c5b58 | 7 years ago |
|
|
7b78b7800c | 7 years ago |
|
|
1ad8d806ac | 7 years ago |
|
|
5afc5e0ac9 | 7 years ago |
|
|
609bc6ed1c | 7 years ago |
|
|
0dabf932f9 | 7 years ago |
|
|
653e82f1c4 | 7 years ago |
|
|
ca36add3f9 | 7 years ago |
|
|
b889f2b366 | 7 years ago |
|
|
36f167c0dd | 7 years ago |
|
|
a797a8d2b3 | 7 years ago |
|
|
94d822a708 | 7 years ago |
|
|
1ca33982b2 | 7 years ago |
|
|
b2d78c0d63 | 7 years ago |
|
|
3dc8e6001a | 7 years ago |
|
|
e775d9a329 | 7 years ago |
|
|
5eee24df84 | 7 years ago |
|
|
5e7b07d256 | 7 years ago |
|
|
dd532ab945 | 7 years ago |
|
|
4c19b026a9 | 7 years ago |
|
|
9c994800cc | 7 years ago |
|
|
e704107a5d | 7 years ago |
|
|
d645c8659e | 7 years ago |
|
|
98d9f04c68 | 7 years ago |
|
|
1dc1d9e555 | 7 years ago |
|
|
545c021013 | 7 years ago |
|
|
64589d8e03 | 7 years ago |
|
|
0567e05d80 | 7 years ago |
|
|
e2773f5a2d | 7 years ago |
|
|
ff4177668b | 7 years ago |
|
|
a984e01afb | 7 years ago |
|
|
f6f88fc19a | 7 years ago |
|
|
1fd4b4a8e3 | 7 years ago |
|
|
90958f2aa1 | 7 years ago |
|
|
78a7c0ff14 | 7 years ago |
|
|
3b85685260 | 7 years ago |
|
|
e89a266572 | 7 years ago |
|
|
f02d933b8f | 7 years ago |
|
|
3150594b86 | 7 years ago |
|
|
6997a7fb0c | 7 years ago |
|
|
a116d92e00 | 7 years ago |
|
|
513697ea18 | 7 years ago |
|
|
d4ce819dc5 | 7 years ago |
|
|
14c4db9be5 | 7 years ago |
|
|
edaad4aec6 | 7 years ago |
|
|
a8f2224484 | 7 years ago |
|
|
9c6a7a6bb2 | 7 years ago |
|
|
e9df462cf6 | 7 years ago |
|
|
8f7c22a991 | 7 years ago |
|
|
083826931a | 7 years ago |
|
|
23390cd207 | 7 years ago |
|
|
6973056f12 | 7 years ago |
|
|
2911b9e7a7 | 7 years ago |
|
|
8b004688c9 | 7 years ago |
|
|
457e4277ca | 7 years ago |
|
|
96db900a6b | 7 years ago |
|
|
b57f817475 | 7 years ago |
|
|
659bc38af8 | 7 years ago |
|
|
57de09ea4a | 7 years ago |
|
|
ab60f5c7c8 | 7 years ago |
|
|
d68337872e | 7 years ago |
|
|
b6135efc88 | 7 years ago |
|
|
e7ac0b9562 | 7 years ago |
|
|
d809788106 | 7 years ago |
|
|
c2bf1dc952 | 7 years ago |
|
|
be32a13c9b | 7 years ago |
|
|
777c409031 | 7 years ago |
|
|
e7700ee755 | 7 years ago |
|
|
c7d2b5f614 | 7 years ago |
|
|
30654b7cd2 | 7 years ago |
|
|
a647590326 | 7 years ago |
|
|
931eb9d1d2 | 7 years ago |
|
|
7c60d3fe41 | 7 years ago |
|
|
04c0e4d7a4 | 7 years ago |
|
|
e1127e863a | 7 years ago |
|
|
9b0cd43a2e | 7 years ago |
|
|
e9e59e4dcb | 7 years ago |
|
|
6996425e9b | 7 years ago |
|
|
67af63b052 | 7 years ago |
|
|
0449eed1fe | 7 years ago |
|
|
b8d383f8f3 | 7 years ago |
|
|
f0cb4b710a | 7 years ago |
|
|
4f312527ae | 7 years ago |
|
|
d69fb6b1b8 | 7 years ago |
|
|
000abaa4d7 | 7 years ago |
|
|
9dfd9e992a | 7 years ago |
|
|
90f11f9e50 | 7 years ago |
|
|
8bfa574c7f | 7 years ago |
|
|
ad160e46f7 | 7 years ago |
|
|
38283cf96d | 7 years ago |
|
|
67334f8abf | 7 years ago |
|
|
56ebebf928 | 7 years ago |
|
|
8546a43f9e | 7 years ago |
|
|
895410e80f | 7 years ago |
|
|
3c063f5b4b | 7 years ago |
|
|
ccac5960ff | 7 years ago |
|
|
9c905ff215 | 7 years ago |
|
|
051ffc57f9 | 7 years ago |
|
|
74e5f87b84 | 7 years ago |
|
|
d01adce482 | 7 years ago |
|
|
8d7e1f9293 | 7 years ago |
|
|
0fecd8600b | 7 years ago |
|
|
082f7c5a00 | 7 years ago |
|
|
e40e820135 | 7 years ago |
|
|
d06ebb83c4 | 7 years ago |
|
|
2dbdf2a25c | 7 years ago |
|
|
a98ff85079 | 7 years ago |
|
|
6be1abfaf1 | 7 years ago |
|
|
83db32626f | 7 years ago |
|
|
b56272fe07 | 7 years ago |
|
|
588696234e | 7 years ago |
|
|
be379f66a9 | 7 years ago |
|
|
accd82e754 | 7 years ago |
|
|
0a4f629226 | 7 years ago |
|
|
eed442a52b | 7 years ago |
|
|
3aabb5c58a | 7 years ago |
|
|
245f584a9e | 7 years ago |
|
|
da7ca38780 | 7 years ago |
|
|
30e24b24c3 | 7 years ago |
|
|
c0eee00f74 | 7 years ago |
|
|
6d918b8c11 | 7 years ago |
|
|
1c6b49555d | 7 years ago |
|
|
04899474d3 | 7 years ago |
|
|
c358c7ae45 | 7 years ago |
|
|
fd4aa61bb9 | 7 years ago |
|
|
1279aea9cf | 7 years ago |
|
|
110229fe5a | 7 years ago |
|
|
6c2830c0db | 7 years ago |
|
|
30e7577b86 | 7 years ago |
|
|
b45874673e | 7 years ago |
|
|
279826e328 | 7 years ago |
|
|
a8e24fce50 | 7 years ago |
|
|
d0b6f0e677 | 7 years ago |
|
|
26e9dcf7d0 | 7 years ago |
|
|
6891c895f4 | 7 years ago |
|
|
9c5f3b0303 | 7 years ago |
|
|
ea69862bdb | 7 years ago |
|
|
87a191a961 | 7 years ago |
|
|
9b0005b013 | 7 years ago |
|
|
e4329a7661 | 7 years ago |
|
|
5576d97e2a | 7 years ago |
|
|
9f24cffb73 | 7 years ago |
|
|
2db61fb807 | 7 years ago |
|
|
cf4b62966c | 7 years ago |
|
|
e34671d4fd | 7 years ago |
|
|
e26a94a2b3 | 7 years ago |
|
|
51d784d52a | 7 years ago |
|
|
1a8dd4d873 | 7 years ago |
|
|
d217000ca2 | 7 years ago |
|
|
a2e471d9f9 | 7 years ago |
|
|
2782c532cc | 7 years ago |
|
|
532f2f457f | 7 years ago |
|
|
9601dd3aa6 | 7 years ago |
|
|
c7140d35ad | 7 years ago |
|
|
0e3e64b952 | 7 years ago |
|
|
2806ea97fa | 7 years ago |
|
|
972bd1ede8 | 7 years ago |
|
|
8082ea7bb2 | 7 years ago |
|
|
093dbc3d48 | 7 years ago |
|
|
340ac718f6 | 7 years ago |
|
|
5c7baf7068 | 7 years ago |
|
|
c4e38e84d3 | 7 years ago |
|
|
b058977406 | 7 years ago |
|
|
9cc5619fbd | 7 years ago |
|
|
46ab110c8b | 7 years ago |
|
|
c888980129 | 7 years ago |
|
|
198a29c568 | 7 years ago |
|
|
82e77f9054 | 7 years ago |
|
|
48e06a78e4 | 7 years ago |
|
|
4d586be4a1 | 7 years ago |
|
|
0890287f1f | 7 years ago |
|
|
13277cae81 | 7 years ago |
|
|
ad88680eff | 7 years ago |
|
|
30933e9051 | 7 years ago |
|
|
9986c06833 | 7 years ago |
|
|
5d1dc6b8fc | 7 years ago |
|
|
bc9a9ca0b8 | 7 years ago |
|
|
dd0c0b471e | 7 years ago |
|
|
c85ad3a6a2 | 7 years ago |
|
|
1b43d82320 | 7 years ago |
|
|
003817fc9f | 7 years ago |
|
|
e6a6bcf333 | 7 years ago |
|
|
5a3016d4b8 | 7 years ago |
|
|
6e9f086a87 | 7 years ago |
|
|
93daffbaae | 7 years ago |
|
|
146de086b4 | 7 years ago |
|
|
aeaebe7b45 | 7 years ago |
|
|
d3fc79a23e | 7 years ago |
|
|
2e03e2fcba | 7 years ago |
|
|
0af4ca452a | 7 years ago |
|
|
c07d971eae | 7 years ago |
|
|
93a20db84f | 7 years ago |
|
|
bb805d65a4 | 7 years ago |
|
|
f88e4ec68c | 7 years ago |
|
|
f148bc9d90 | 7 years ago |
|
|
d5957b86c8 | 7 years ago |
|
|
ac4cba7694 | 7 years ago |
|
|
ae61a876f1 | 7 years ago |
|
|
4a6b2de019 | 7 years ago |
|
|
eca2fe37d5 | 7 years ago |
|
|
f8bcda612d | 7 years ago |
|
|
f26de621ed | 7 years ago |
|
|
adf612b328 | 7 years ago |
|
|
0ac57122d0 | 7 years ago |
|
|
b4ca288073 | 7 years ago |
|
|
aa064e2b7c | 7 years ago |
|
|
2b1741e001 | 7 years ago |
|
|
46a184b289 | 7 years ago |
|
|
05218cf148 | 7 years ago |
|
|
84cf80dd79 | 7 years ago |
|
|
030c2986b5 | 7 years ago |
|
|
3e30834536 | 7 years ago |
|
|
1777938cd9 | 7 years ago |
|
|
fe48719b55 | 7 years ago |
|
|
6220110fae | 7 years ago |
|
|
e67bc77e83 | 7 years ago |
|
|
bc8e20ac00 | 7 years ago |
|
|
9f15cdf088 | 7 years ago |
|
|
c764dd81cd | 7 years ago |
|
|
9fcb1efe8d | 7 years ago |
|
|
d8f829daf1 | 7 years ago |
|
|
0e6320c352 | 7 years ago |
|
|
993be4b442 | 7 years ago |
|
|
ab53bafdee | 7 years ago |
|
|
a1181edd3d | 7 years ago |
|
|
8ff3ad2f0c | 7 years ago |
|
|
0128ee95d1 | 7 years ago |
|
|
6f06034dd4 | 7 years ago |
|
|
95142cdfdf | 7 years ago |
|
|
281c79ccd7 | 7 years ago |
|
|
a1eb884661 | 7 years ago |
|
|
992acb62de | 7 years ago |
|
|
f18ad3820f | 7 years ago |
|
|
e7ac894ef5 | 7 years ago |
|
|
270fbd0f82 | 7 years ago |
|
|
225cb47cfb | 7 years ago |
|
|
f8bee8dba0 | 7 years ago |
|
|
24c8b7d49e | 7 years ago |
|
|
56ac260b33 | 7 years ago |
|
|
7dde4ee3f4 | 7 years ago |
|
|
af21872576 | 7 years ago |
|
|
6ab71df638 | 7 years ago |
|
|
2f3ad9bd77 | 7 years ago |
|
|
fe8a812a44 | 7 years ago |
|
|
8fc614700b | 7 years ago |
|
|
3ba85bff3c | 7 years ago |
|
|
d1909d1f77 | 7 years ago |
|
|
5216e0ad7b | 7 years ago |
|
|
4bbdd5a001 | 7 years ago |
|
|
bef9829e21 | 7 years ago |
|
|
c46c504881 | 7 years ago |
|
|
b3059febfe | 7 years ago |
|
|
5f8cdaccd6 | 7 years ago |
|
|
ab1e3c25ea | 7 years ago |
|
|
de3aff84f4 | 7 years ago |
|
|
69857e4995 | 7 years ago |
|
|
b30c38d61d | 7 years ago |
|
|
aece4427f7 | 7 years ago |
|
|
352e78c09d | 7 years ago |
|
|
6158bb240a | 7 years ago |
|
|
a9ea4330ce | 7 years ago |
|
|
12ad7255b2 | 7 years ago |
|
|
42fcce8f8b | 7 years ago |
|
|
c0c5a8a1ae | 7 years ago |
|
|
45baaa4a21 | 7 years ago |
|
|
b7a1424eb8 | 7 years ago |
|
|
73c29bc682 | 7 years ago |
|
|
8bac50f8d2 | 7 years ago |
|
|
abcff60744 | 7 years ago |
|
|
e9db469f3f | 7 years ago |
|
|
c60ed58350 | 7 years ago |
|
|
9adda201f2 | 7 years ago |
|
|
d1eb011b87 | 7 years ago |
|
|
8d556c8c0b | 7 years ago |
|
|
e95932a590 | 7 years ago |
|
|
304a2ddf91 | 7 years ago |
|
|
b6153578ca | 7 years ago |
|
|
0c635bd0ff | 7 years ago |
|
|
435d5e7f3d | 7 years ago |
|
|
b9c15a9bd8 | 7 years ago |
|
|
2557020f02 | 7 years ago |
|
|
59401305f9 | 7 years ago |
|
|
146c3b67d3 | 7 years ago |
|
|
83425b7793 | 7 years ago |
|
|
d5af7bd77c | 7 years ago |
|
|
d68c31f668 | 7 years ago |
|
|
9e10b4f63a | 7 years ago |
|
|
18eb83dca8 | 7 years ago |
|
|
c70fa2da0f | 7 years ago |
|
|
dc9ce5934a | 7 years ago |
|
|
e828e87a1a | 7 years ago |
|
|
0cb00205d6 | 7 years ago |
|
|
2eef980fe5 | 7 years ago |
|
|
247897eb5a | 7 years ago |
|
|
21a0be745d | 7 years ago |
|
|
61791e58b6 | 7 years ago |
|
|
71564e4171 | 7 years ago |
|
|
4d76a7af0c | 7 years ago |
|
|
3dd1136d71 | 7 years ago |
|
|
988583b9a3 | 7 years ago |
|
|
48fc064d46 | 7 years ago |
|
|
eabe7dbfa8 | 7 years ago |
|
|
cb244fb171 | 7 years ago |
|
|
d45e7eb915 | 7 years ago |
|
|
2058c1f099 | 7 years ago |
|
|
7428b2320d | 7 years ago |
|
|
9b4ec018a5 | 7 years ago |
|
|
2dde4b75a5 | 7 years ago |
|
|
668acbb59a | 7 years ago |
|
|
d8dfb8bfce | 7 years ago |
|
|
270836e631 | 7 years ago |
|
|
2cb97a0829 | 7 years ago |
|
|
3b0766832f | 7 years ago |
|
|
60b036fc29 | 7 years ago |
|
|
02c09d1b9a | 7 years ago |
|
|
b1c2ee643d | 7 years ago |
|
|
989c06fb0c | 7 years ago |
|
|
53fd369ec9 | 7 years ago |
|
|
d37e860d45 | 7 years ago |
|
|
810e328691 | 7 years ago |
|
|
b02d8ac294 | 7 years ago |
|
|
1283d01d45 | 7 years ago |
|
|
b1361722bd | 7 years ago |
|
|
122eb42ac4 | 7 years ago |
|
|
5217aa2031 | 7 years ago |
|
|
b48391982c | 7 years ago |
|
|
fcd1e83a32 | 7 years ago |
|
|
6ceb83d7b8 | 7 years ago |
|
|
a561a10c95 | 7 years ago |
|
|
075ddc9464 | 7 years ago |
|
|
b683962395 | 7 years ago |
|
|
8b306c2943 | 7 years ago |
|
|
30e4a77638 | 7 years ago |
|
|
d5e0bb0ac3 | 7 years ago |
|
|
345275681c | 7 years ago |
|
|
7a7b1e04a7 | 7 years ago |
|
|
d369d4b130 | 7 years ago |
|
|
4459d7748a | 7 years ago |
|
|
6ba1ed871a | 7 years ago |
|
|
670a94b6db | 7 years ago |
|
|
cd3be13aca | 7 years ago |
|
|
2538228244 | 7 years ago |
|
|
b9fc433d63 | 7 years ago |
|
|
66d33f50d8 | 7 years ago |
|
|
65c3d46942 | 7 years ago |
|
|
1318ccd530 | 7 years ago |
|
|
ccc0ed1d46 | 7 years ago |
|
|
0a94ae0778 | 8 years ago |
|
|
c9b0573f43 | 8 years ago |
@ -1,22 +0,0 @@
|
||||
# https://editorconfig.org/
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
tab_width = 4
|
||||
|
||||
[*.php]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.md]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_style = space
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
max_line_length = 80
|
||||
@ -1,2 +0,0 @@
|
||||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
||||
@ -0,0 +1,19 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an new idea for this project
|
||||
title: "[Feature Request]"
|
||||
labels: enhancement
|
||||
|
||||
---
|
||||
|
||||
- [ ] I acknowledge if I don't follow the format below or I don't check these box, my issue could be closed without any notice.
|
||||
- [ ] I certify that I have read project Wiki and other issue may related to this one.
|
||||
|
||||
**Feature**
|
||||
The feature you want.
|
||||
|
||||
**Solution**
|
||||
If you have some solution about this issue, type it here.
|
||||
|
||||
**Addition**
|
||||
Additional context here.
|
||||
@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>ss-panel-v3-mod_UIChanges</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>com.aptana.ide.core.unifiedBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>com.aptana.projects.webnature</nature>
|
||||
</natures>
|
||||
<filteredResources>
|
||||
<filter>
|
||||
<id>1522297588605</id>
|
||||
<name></name>
|
||||
<type>26</type>
|
||||
<matcher>
|
||||
<id>org.eclipse.ui.ide.multiFilter</id>
|
||||
<arguments>1.0-name-matches-false-false-node_modules</arguments>
|
||||
</matcher>
|
||||
</filter>
|
||||
</filteredResources>
|
||||
</projectDescription>
|
||||
@ -1,19 +0,0 @@
|
||||
根据时间从 2018 年 12 月始...
|
||||
|
||||
- 支持 Quantumult 格式的 V2Ray 订阅以及策略组配置导出
|
||||
- 支持 Surge 2 & 3 的托管配置以及 policy group
|
||||
- 支持 SurfBoard 的托管配置
|
||||
- 支持 Shadowrocket 支持的 Shadowsocks(R) & VMess 合并订阅
|
||||
- 提供用户使用文档
|
||||
- 完全合并普通端口和单端口的订阅及托管
|
||||
- ShadowsocksR 订阅中的账户及流量信息改为可选
|
||||
- ~~一键切换 SS/SSR 加密、协议、混淆~~ (已废弃)
|
||||
- 订阅链接兼容 Anankke
|
||||
- ~~支持 ss-v2ray-plugin 类型节点~~ (已合并到 Anankke)
|
||||
- V2Ray 订阅可选支持显示账户及流量信息
|
||||
- 可选使用预定义的加密、协议、混淆配置方案
|
||||
- 支持用户自定义 Surge 托管配置
|
||||
- 支持用户自定义 Clash 托管配置
|
||||
|
||||
……
|
||||
|
||||
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Command;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Services\Config;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
|
||||
class Malio
|
||||
{
|
||||
public static function GenerateUUIDforAllUsers()
|
||||
{
|
||||
$users = User::all();
|
||||
foreach ($users as $user) {
|
||||
if ($user->uuid == null) {
|
||||
$user->uuid = Uuid::uuid3(Uuid::NAMESPACE_DNS, ($user->passwd) . Config::get('key') . $user->id)->toString();
|
||||
if ($user->save()) {
|
||||
echo ($user->id . " 生成UUID成功 " . $user->uuid . PHP_EOL);
|
||||
} else {
|
||||
echo ($user->id . " 失败 " . $user->uuid . PHP_EOL);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin;
|
||||
|
||||
use App\Controllers\AdminController;
|
||||
use App\Services\Auth;
|
||||
use App\Models\GConfig;
|
||||
|
||||
class GConfigController extends AdminController
|
||||
{
|
||||
public function update($request, $response, $args)
|
||||
{
|
||||
$key = trim($args['key']);
|
||||
$user = Auth::getUser();
|
||||
|
||||
$config = GConfig::find($key);
|
||||
$config->oldvalue = $config->value;
|
||||
$config->value = $request->getParam('value');
|
||||
$config->operator_id = $user->id;
|
||||
$config->operator_name = $user->user_name;
|
||||
$config->operator_email = $user->email;
|
||||
$config->last_update = time();
|
||||
if (!$config->save()) {
|
||||
$rs['ret'] = 0;
|
||||
$rs['msg'] = '修改失败';
|
||||
return $response->write(json_encode($rs));
|
||||
}
|
||||
$rs['ret'] = 1;
|
||||
$rs['msg'] = '修改成功';
|
||||
return $response->write(json_encode($rs));
|
||||
}
|
||||
|
||||
public function telegram($request, $response, $args)
|
||||
{
|
||||
$table_config['total_column'] = array(
|
||||
'op' => '操作',
|
||||
'name' => '配置名称',
|
||||
'key' => '配置名',
|
||||
'value' => '配置值',
|
||||
'operator_id' => '操作员 ID',
|
||||
'operator_name' => '操作员名称',
|
||||
'operator_email' => '操作员邮箱',
|
||||
'last_update' => '修改时间'
|
||||
);
|
||||
$table_config['default_show_column'] = array();
|
||||
foreach ($table_config['total_column'] as $column => $value) {
|
||||
$table_config['default_show_column'][] = $column;
|
||||
}
|
||||
$table_config['ajax_url'] = 'telegram/ajax';
|
||||
return $this->view()->assign('table_config', $table_config)->fetch('admin/config/telegram/index.tpl');
|
||||
}
|
||||
|
||||
public function telegram_edit($request, $response, $args)
|
||||
{
|
||||
$key = trim($args['key']);
|
||||
$config = GConfig::find($key);
|
||||
return $this->view()->assign('edit_config', $config)->fetch('admin/config/telegram/edit.tpl');
|
||||
}
|
||||
|
||||
public function telegram_update($request, $response, $args)
|
||||
{
|
||||
return self::update($request, $response, $args);
|
||||
}
|
||||
|
||||
public function telegram_ajax($request, $response, $args)
|
||||
{
|
||||
$start = $request->getParam("start");
|
||||
$limit_length = $request->getParam('length');
|
||||
$configs = GConfig::skip($start)->where('key', 'LIKE', "%Telegram%")->limit($limit_length)->get();
|
||||
$total_conut = GConfig::where('key', 'LIKE', "%Telegram%")->count();
|
||||
$data = [];
|
||||
foreach ($configs as $config) {
|
||||
$tempdata = [];
|
||||
$tempdata['op'] = '<a class="btn btn-brand" href="/admin/config/telegram/' . $config->key . '/edit">编辑</a>';
|
||||
$tempdata['name'] = $config->name;
|
||||
$tempdata['key'] = $config->key;
|
||||
$tempdata['value'] = $config->value;
|
||||
$tempdata['operator_id'] = $config->operator_id;
|
||||
$tempdata['operator_name'] = $config->operator_name;
|
||||
$tempdata['operator_email'] = $config->operator_email;
|
||||
$tempdata['last_update'] = date('Y-m-d H:i:s', $config->last_update);
|
||||
if (strpos($config->key, '.enable.')) {
|
||||
switch ((int) $config->value) {
|
||||
case 0:
|
||||
$tempdata['value'] = '关闭';
|
||||
break;
|
||||
case 1:
|
||||
$tempdata['value'] = '开启';
|
||||
break;
|
||||
default:
|
||||
$tempdata['value'] = '未知';
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
$tempdata['value'] = '(请在编辑页面查看)';
|
||||
}
|
||||
$data[] = $tempdata;
|
||||
}
|
||||
$info = [
|
||||
'draw' => $request->getParam('draw'),
|
||||
'recordsTotal' => $total_conut,
|
||||
'recordsFiltered' => $total_conut,
|
||||
'data' => $data
|
||||
];
|
||||
|
||||
return json_encode($info, true);
|
||||
}
|
||||
}
|
||||
@ -1,162 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Models\Node;
|
||||
use App\Models\User;
|
||||
use App\Services\Factory;
|
||||
use App\Services\Config;
|
||||
use App\Utils\Tools;
|
||||
use App\Utils\Hash;
|
||||
use App\Utils\Helper;
|
||||
|
||||
/**
|
||||
* ApiController
|
||||
*/
|
||||
class ApiController extends BaseController
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
}
|
||||
|
||||
public function token($request, $response, $args)
|
||||
{
|
||||
$accessToken = $id = $args['token'];
|
||||
$storage = Factory::createTokenStorage();
|
||||
$token = $storage->get($accessToken);
|
||||
if ($token == null) {
|
||||
$res['ret'] = 0;
|
||||
$res['msg'] = 'token is null';
|
||||
return $this->echoJson($response, $res);
|
||||
}
|
||||
$res['ret'] = 1;
|
||||
$res['msg'] = 'ok';
|
||||
$res['data'] = $token;
|
||||
return $this->echoJson($response, $res);
|
||||
}
|
||||
|
||||
public function newToken($request, $response, $args)
|
||||
{
|
||||
// $data = $request->post('sdf');
|
||||
$email = $request->getParam('email');
|
||||
|
||||
$email = strtolower($email);
|
||||
$passwd = $request->getParam('passwd');
|
||||
|
||||
// Handle Login
|
||||
$user = User::where('email', '=', $email)->first();
|
||||
|
||||
if ($user == null) {
|
||||
$res['ret'] = 0;
|
||||
$res['msg'] = '401 邮箱或者密码错误';
|
||||
return $this->echoJson($response, $res);
|
||||
}
|
||||
|
||||
if (!Hash::checkPassword($user->pass, $passwd)) {
|
||||
$res['ret'] = 0;
|
||||
$res['msg'] = '402 邮箱或者密码错误';
|
||||
return $this->echoJson($response, $res);
|
||||
}
|
||||
$tokenStr = Tools::genToken();
|
||||
$storage = Factory::createTokenStorage();
|
||||
$expireTime = time() + 3600 * 24 * 7;
|
||||
if ($storage->store($tokenStr, $user, $expireTime)) {
|
||||
$res['ret'] = 1;
|
||||
$res['msg'] = 'ok';
|
||||
$res['data']['token'] = $tokenStr;
|
||||
$res['data']['user_id'] = $user->id;
|
||||
return $this->echoJson($response, $res);
|
||||
}
|
||||
$res['ret'] = 0;
|
||||
$res['msg'] = 'system error';
|
||||
return $this->echoJson($response, $res);
|
||||
}
|
||||
|
||||
public function node($request, $response, $args)
|
||||
{
|
||||
$accessToken = Helper::getParam($request, 'access_token');
|
||||
$storage = Factory::createTokenStorage();
|
||||
$token = $storage->get($accessToken);
|
||||
$user = User::find($token->userId);
|
||||
$nodes = Node::where('sort', 0)->where('type', '1')->where(
|
||||
static function ($query) use ($user) {
|
||||
$query->where('node_group', '=', $user->node_group)
|
||||
->orWhere('node_group', '=', 0);
|
||||
}
|
||||
)->orderBy('name')->get();
|
||||
|
||||
$mu_nodes = Node::where('sort', 9)->where('node_class', '<=', $user->class)->where('type', '1')->where(
|
||||
static function ($query) use ($user) {
|
||||
$query->where('node_group', '=', $user->node_group)
|
||||
->orWhere('node_group', '=', 0);
|
||||
}
|
||||
)->orderBy('name')->get();
|
||||
|
||||
$temparray = array();
|
||||
foreach ($nodes as $node) {
|
||||
if ($node->mu_only == 0) {
|
||||
$temparray[] = array('remarks' => $node->name,
|
||||
'server' => $node->server,
|
||||
'server_port' => $user->port,
|
||||
'method' => $node->custom_method == 1 ? $user->method : $node->method,
|
||||
'obfs' => str_replace('_compatible', '', (($node->custom_rss == 1 && !($user->obfs == 'plain' && $user->protocol == 'origin')) ? $user->obfs : 'plain')),
|
||||
'obfsparam' => ($node->custom_rss == 1 && !($user->obfs == 'plain' && $user->protocol == 'origin')) ? $user->obfs_param : '',
|
||||
'remarks_base64' => base64_encode($node->name),
|
||||
'password' => $user->passwd,
|
||||
'tcp_over_udp' => false,
|
||||
'udp_over_tcp' => false,
|
||||
'group' => Config::get('appName'),
|
||||
'protocol' => str_replace('_compatible', '', (($node->custom_rss == 1 && !($user->obfs == 'plain' && $user->protocol == 'origin')) ? $user->protocol : 'origin')),
|
||||
'obfs_udp' => false,
|
||||
'enable' => true);
|
||||
}
|
||||
|
||||
if ($node->custom_rss == 1) {
|
||||
foreach ($mu_nodes as $mu_node) {
|
||||
$mu_user = User::where('port', '=', $mu_node->server)->first();
|
||||
$mu_user->obfs_param = $user->getMuMd5();
|
||||
|
||||
$temparray[] = array('remarks' => $node->name . '- ' . $mu_node->server . ' 单端口',
|
||||
'server' => $node->server,
|
||||
'server_port' => $mu_user->port,
|
||||
'method' => $mu_user->method,
|
||||
'group' => Config::get('appName'),
|
||||
'obfs' => str_replace('_compatible', '', (($node->custom_rss == 1 && !($mu_user->obfs == 'plain' && $mu_user->protocol == 'origin')) ? $mu_user->obfs : 'plain')),
|
||||
'obfsparam' => ($node->custom_rss == 1 && !($mu_user->obfs == 'plain' && $mu_user->protocol == 'origin')) ? $mu_user->obfs_param : '',
|
||||
'remarks_base64' => base64_encode($node->name . '- ' . $mu_node->server . ' 单端口'),
|
||||
'password' => $mu_user->passwd,
|
||||
'tcp_over_udp' => false,
|
||||
'udp_over_tcp' => false,
|
||||
'protocol' => str_replace('_compatible', '', (($node->custom_rss == 1 && !($mu_user->obfs == 'plain' && $mu_user->protocol == 'origin')) ? $mu_user->protocol : 'origin')),
|
||||
'obfs_udp' => false,
|
||||
'enable' => true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$res['ret'] = 1;
|
||||
$res['msg'] = 'ok';
|
||||
$res['data'] = $temparray;
|
||||
return $this->echoJson($response, $res);
|
||||
}
|
||||
|
||||
public function userInfo($request, $response, $args)
|
||||
{
|
||||
$id = $args['id'];
|
||||
$accessToken = Helper::getParam($request, 'access_token');
|
||||
$storage = Factory::createTokenStorage();
|
||||
$token = $storage->get($accessToken);
|
||||
if ($id != $token->userId) {
|
||||
$res['ret'] = 0;
|
||||
$res['msg'] = 'access denied';
|
||||
return $this->echoJson($response, $res);
|
||||
}
|
||||
$user = User::find($token->userId);
|
||||
$user->pass = null;
|
||||
$data = $user;
|
||||
$res['ret'] = 1;
|
||||
$res['msg'] = 'ok';
|
||||
$res['data'] = $data;
|
||||
return $this->echoJson($response, $res);
|
||||
}
|
||||
}
|
||||
@ -1,71 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: kaguya
|
||||
* Date: 2018/06/30
|
||||
* Time: 21:40
|
||||
*/
|
||||
|
||||
namespace App\Controllers\Client;
|
||||
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
use App\Controllers\LinkController;
|
||||
use App\Models\Ann;
|
||||
use App\Models\User;
|
||||
use App\Services\Auth;
|
||||
use App\Services\Config;
|
||||
use App\Services\Factory;
|
||||
use App\Utils\Helper;
|
||||
|
||||
class ClientApiController extends BaseController
|
||||
{
|
||||
public function GetAnnouncement($request, $response, $args)
|
||||
{
|
||||
$accessToken = Helper::getParam($request, 'access_token');
|
||||
$storage = Factory::createTokenStorage();
|
||||
$token = $storage->get($accessToken);
|
||||
$user = User::find($token->userId);
|
||||
$Anns = Ann::orderBy('date', 'desc')->first();
|
||||
$res['ret'] = 1;
|
||||
$res['msg'] = 'ok';
|
||||
$res['data'] = $Anns;
|
||||
return $this->echoJson($response, $res);
|
||||
}
|
||||
|
||||
public function Redirect($request, $response, $args)
|
||||
{
|
||||
$user = Auth::getUser();
|
||||
$url = $request->getQueryParams()['target'];
|
||||
if (!$user->isLogin) {
|
||||
$accessToken = Helper::getParam($request, 'access_token');
|
||||
$storage = Factory::createTokenStorage();
|
||||
$token = $storage->get($accessToken);
|
||||
if ($token == null) {
|
||||
$res['ret'] = 0;
|
||||
$res['msg'] = 'token is null';
|
||||
return $this->echoJson($response, $res);
|
||||
}
|
||||
$user = User::find($token->userId);
|
||||
$time = 3600 * 24;
|
||||
Auth::login($user->id, $time);
|
||||
}
|
||||
return $response->withRedirect($url);
|
||||
}
|
||||
|
||||
public function GetSubLink($request, $response, $args)
|
||||
{
|
||||
$accessToken = Helper::getParam($request, 'access_token');
|
||||
$sub = (Helper::getParam($request, 'sub') != ''
|
||||
? Helper::getParam($request, 'sub')
|
||||
: 1);
|
||||
$storage = Factory::createTokenStorage();
|
||||
$token = $storage->get($accessToken);
|
||||
$user = User::find($token->userId);
|
||||
$ssr_sub_token = LinkController::GenerateSSRSubCode($user->id, 0);
|
||||
$res['ret'] = 1;
|
||||
$res['msg'] = 'ok';
|
||||
$res['data'] = Config::get('subUrl') . $ssr_sub_token . '?sub=' . $sub;
|
||||
return $this->echoJson($response, $res);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,57 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Controllers\Mu;
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
use App\Models\NodeOnlineLog;
|
||||
use App\Models\NodeInfoLog;
|
||||
|
||||
class NodeController extends BaseController
|
||||
{
|
||||
public function onlineUserLog($request, $response, $args)
|
||||
{
|
||||
$node_id = $args['id'];
|
||||
$count = $request->getParam('count');
|
||||
$log = new NodeOnlineLog();
|
||||
$log->node_id = $node_id;
|
||||
$log->online_user = $count;
|
||||
$log->log_time = time();
|
||||
if (!$log->save()) {
|
||||
$res = [
|
||||
'ret' => 0,
|
||||
'msg' => 'update failed',
|
||||
];
|
||||
return $this->echoJson($response, $res);
|
||||
}
|
||||
$res = [
|
||||
'ret' => 1,
|
||||
'msg' => 'ok',
|
||||
];
|
||||
return $this->echoJson($response, $res);
|
||||
}
|
||||
|
||||
public function info($request, $response, $args)
|
||||
{
|
||||
$node_id = $args['id'];
|
||||
$load = $request->getParam('load');
|
||||
$uptime = $request->getParam('uptime');
|
||||
$log = new NodeInfoLog();
|
||||
$log->node_id = $node_id;
|
||||
$log->load = $load;
|
||||
$log->uptime = $uptime;
|
||||
$log->log_time = time();
|
||||
if (!$log->save()) {
|
||||
$res = [
|
||||
'ret' => 0,
|
||||
'msg' => 'update failed',
|
||||
];
|
||||
return $this->echoJson($response, $res);
|
||||
}
|
||||
$res = [
|
||||
'ret' => 1,
|
||||
'msg' => 'ok',
|
||||
];
|
||||
return $this->echoJson($response, $res);
|
||||
}
|
||||
}
|
||||
@ -1,122 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Mu;
|
||||
|
||||
use App\Models\Node;
|
||||
use App\Models\TrafficLog;
|
||||
use App\Models\User;
|
||||
use App\Controllers\BaseController;
|
||||
use App\Utils\Tools;
|
||||
|
||||
class UserController extends BaseController
|
||||
{
|
||||
// User List
|
||||
public function index($request, $response, $args)
|
||||
{
|
||||
$node = Node::where('node_ip', '=', $_SERVER['REMOTE_ADDR'])->where(
|
||||
static function ($query) {
|
||||
$query->where('sort', '=', 0)
|
||||
->orWhere('sort', '=', 10)->orWhere('sort', '=', 12);
|
||||
}
|
||||
)->first();
|
||||
$node->node_heartbeat = time();
|
||||
$node->save();
|
||||
|
||||
if ($node->node_group != 0) {
|
||||
$users_raw = User::where(
|
||||
static function ($query) use ($node) {
|
||||
$query->where(
|
||||
static function ($query1) use ($node) {
|
||||
$query1->where('class', '>=', $node->node_class)
|
||||
->where('node_group', '=', $node->node_group);
|
||||
}
|
||||
)->orwhere('is_admin', 1);
|
||||
}
|
||||
)
|
||||
->where('enable', 1)->where('expire_in', '>', date('Y-m-d H:i:s'))->get();
|
||||
} else {
|
||||
$users_raw = User::where(
|
||||
static function ($query) use ($node) {
|
||||
$query->where(
|
||||
static function ($query1) use ($node) {
|
||||
$query1->where('class', '>=', $node->node_class);
|
||||
}
|
||||
)->orwhere('is_admin', 1);
|
||||
}
|
||||
)->where('enable', 1)->where('expire_in', '>', date('Y-m-d H:i:s'))->get();
|
||||
}
|
||||
if (($node->node_bandwidth_limit != 0) && $node->node_bandwidth_limit < $node->node_bandwidth) {
|
||||
$users = null;
|
||||
|
||||
$res = [
|
||||
'ret' => 1,
|
||||
'data' => $users
|
||||
];
|
||||
return $this->echoJson($response, $res);
|
||||
}
|
||||
|
||||
$key_list = array('method', 'id', 'port', 'passwd', 'u', 'd', 'enable',
|
||||
't', 'transfer_enable', 'switch', 'email');
|
||||
|
||||
$users_output = array();
|
||||
|
||||
foreach ($users_raw as $user_raw) {
|
||||
if ($user_raw->transfer_enable > $user_raw->u + $user_raw->d) {
|
||||
$user_raw = Tools::keyFilter($user_raw, $key_list);
|
||||
$users_output[] = $user_raw;
|
||||
}
|
||||
}
|
||||
|
||||
$res = [
|
||||
'ret' => 1,
|
||||
'msg' => 'ok',
|
||||
'data' => $users_output
|
||||
];
|
||||
return $this->echoJson($response, $res);
|
||||
}
|
||||
|
||||
// Update Traffic
|
||||
public function addTraffic($request, $response, $args)
|
||||
{
|
||||
$id = $args['id'];
|
||||
$u = $request->getParam('u');
|
||||
$d = $request->getParam('d');
|
||||
$nodeId = $request->getParam('node_id');
|
||||
$node = Node::find($nodeId);
|
||||
|
||||
$node->node_bandwidth = $node->node_bandwidth + $d + $u;
|
||||
|
||||
$node->save();
|
||||
|
||||
|
||||
$rate = $node->traffic_rate;
|
||||
$user = User::find($id);
|
||||
|
||||
$user->t = time();
|
||||
$user->u += ($u * $rate);
|
||||
$user->d += ($d * $rate);
|
||||
if (!$user->save()) {
|
||||
$res = [
|
||||
'ret' => 0,
|
||||
'msg' => 'update failed',
|
||||
];
|
||||
//return $this->echoJson($response, $res);
|
||||
}
|
||||
// log
|
||||
$traffic = new TrafficLog();
|
||||
$traffic->user_id = $id;
|
||||
$traffic->u = $u;
|
||||
$traffic->d = $d;
|
||||
$traffic->node_id = $nodeId;
|
||||
$traffic->rate = $rate;
|
||||
$traffic->traffic = Tools::flowAutoShow(($u + $d) * $rate);
|
||||
$traffic->log_time = time();
|
||||
$traffic->save();
|
||||
|
||||
$res = [
|
||||
'ret' => 1,
|
||||
'msg' => 'ok',
|
||||
];
|
||||
return $this->echoJson($response, $res);
|
||||
}
|
||||
}
|
||||
@ -1,38 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Middleware;
|
||||
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use App\Services\Factory;
|
||||
use App\Utils\Helper;
|
||||
|
||||
class Api
|
||||
{
|
||||
public function __invoke(ServerRequestInterface $request, ResponseInterface $response, $next)
|
||||
{
|
||||
$accessToken = Helper::getParam($request, 'access_token');
|
||||
if ($accessToken == null) {
|
||||
$res['ret'] = 0;
|
||||
$res['msg'] = 'token is null';
|
||||
$response->getBody()->write(json_encode($res));
|
||||
return $response;
|
||||
}
|
||||
$storage = Factory::createTokenStorage();
|
||||
$token = $storage->get($accessToken);
|
||||
if ($token == null) {
|
||||
$res['ret'] = 0;
|
||||
$res['msg'] = 'token is null';
|
||||
$response->getBody()->write(json_encode($res));
|
||||
return $response;
|
||||
}
|
||||
if ($token->expireTime < time()) {
|
||||
$res['ret'] = 0;
|
||||
$res['msg'] = 'token is expire';
|
||||
$response->getBody()->write(json_encode($res));
|
||||
return $response;
|
||||
}
|
||||
$response = $next($request, $response);
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
@ -1,51 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Middleware;
|
||||
|
||||
use App\Services\Config;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use App\Utils\Helper;
|
||||
use App\Models\Node;
|
||||
|
||||
class Mu
|
||||
{
|
||||
public function __invoke(ServerRequestInterface $request, ResponseInterface $response, $next)
|
||||
{
|
||||
$key = Helper::getParam($request, 'key');
|
||||
if ($key === null) {
|
||||
$res['ret'] = 0;
|
||||
$res['msg'] = 'key is null';
|
||||
$response->getBody()->write(json_encode($res));
|
||||
return $response;
|
||||
}
|
||||
|
||||
$auth = false;
|
||||
$keyset = explode(',', Config::get('muKey'));
|
||||
foreach ($keyset as $sinkey) {
|
||||
if ($key == $sinkey) {
|
||||
$auth = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($auth == false) {
|
||||
$res['ret'] = 0;
|
||||
$res['msg'] = 'token or source is invalid';
|
||||
$response->getBody()->write(json_encode($res));
|
||||
return $response;
|
||||
}
|
||||
|
||||
$node = Node::where('node_ip', 'LIKE', $_SERVER['REMOTE_ADDR'] . '%')->first();
|
||||
if ($node == null && $_SERVER['REMOTE_ADDR'] != '127.0.0.1') {
|
||||
$res['ret'] = 0;
|
||||
$res['msg'] = 'token or source is invalid';
|
||||
$response->getBody()->write(json_encode($res));
|
||||
return $response;
|
||||
}
|
||||
|
||||
$response = $next($request, $response);
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Services\DefaultConfig;
|
||||
|
||||
class GConfig extends Model
|
||||
{
|
||||
|
||||
/**
|
||||
* The connection name for the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $connection = 'default';
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'gconfig';
|
||||
|
||||
/**
|
||||
* The primary key associated with the table.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $primaryKey = 'key';
|
||||
|
||||
/**
|
||||
* Indicates if the IDs are auto-incrementing.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $incrementing = false;
|
||||
|
||||
/**
|
||||
* The "type" of the auto-incrementing ID.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $keyType = 'string';
|
||||
|
||||
public static function recover($user)
|
||||
{
|
||||
$this->oldvalue = $this->value;
|
||||
$this->value = DefaultConfig::default_value($this->key)['value'];
|
||||
$this->operator_id = $user->id;
|
||||
$this->operator_name = ('[恢复默认] - ' . $user->user_name);
|
||||
$this->operator_email = $user->email;
|
||||
$this->last_update = time();
|
||||
$this->save();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
/**
|
||||
* SmsVerify Model
|
||||
*/
|
||||
class SmsVerify extends Model
|
||||
{
|
||||
protected $connection = 'default';
|
||||
protected $table = 'sms_verify';
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Auth;
|
||||
|
||||
class File
|
||||
{
|
||||
}
|
||||
@ -1,31 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Services\Auth;
|
||||
|
||||
use App\Services\Factory;
|
||||
|
||||
class Token extends Base
|
||||
{
|
||||
protected $storage;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->storage = Factory::createTokenStorage();
|
||||
}
|
||||
|
||||
public function login($uid, $time)
|
||||
{
|
||||
// TODO: Implement getUser() method.
|
||||
}
|
||||
|
||||
public function logout()
|
||||
{
|
||||
// TODO: Implement logout() method.
|
||||
}
|
||||
|
||||
public function getUser()
|
||||
{
|
||||
$token = Cookie::get('token');
|
||||
}
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
class Cache
|
||||
{
|
||||
}
|
||||
@ -1,161 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: tonyzou
|
||||
* Author:
|
||||
* Date: 2018/9/24
|
||||
* Time: 下午4:01
|
||||
*/
|
||||
|
||||
/**
|
||||
* Made By Leo
|
||||
* 黛米付接口
|
||||
* 2.1.4版本
|
||||
* 适用于 V1 API 黛米付面板V1
|
||||
* copyright all rights reserved
|
||||
*/
|
||||
|
||||
namespace App\Services\Gateway;
|
||||
|
||||
use App\Services\View;
|
||||
use App\Services\Auth;
|
||||
use App\Services\Config;
|
||||
|
||||
use App\Models\Paylist;
|
||||
|
||||
|
||||
class DoiAMPay extends AbstractPayment
|
||||
{
|
||||
public function getPurchaseHTML()
|
||||
{
|
||||
return View::getSmarty()->assign('enabled', Config::get('doiampay')['enabled'])->fetch('user/doiam.tpl');
|
||||
}
|
||||
|
||||
public function notify($request, $response, $args)
|
||||
{
|
||||
$order_data = $_POST;
|
||||
$status = $order_data['status']; //获取传递过来的交易状态
|
||||
$invoiceid = $order_data['out_trade_no']; //订单号
|
||||
$transid = $order_data['trade_no']; //转账交易号
|
||||
$amount = $order_data['money']; //获取递过来的总价格
|
||||
if (!DoiAM::checksign($_POST, Config::get('doiampay')['mchdata'][$args['type']]['token'])) {
|
||||
return json_encode(array('errcode' => 2333));
|
||||
}
|
||||
if ($status == 'success') {
|
||||
$this->postPayment($invoiceid, '黛米付' . ['wepay' => '(微信)', 'qqpay' => '(QQ支付)', 'alipay' => '(支付宝)'][$args['type']]);
|
||||
return json_encode(['errcode' => 0]);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
public function purchase($request, $response, $args)
|
||||
{
|
||||
$type = $request->getParam('type');
|
||||
$price = $request->getParam('price');
|
||||
if (Config::get('doiampay')['enabled'][$type] == 0) {
|
||||
return json_encode(['errcode' => -1, 'errmsg' => '非法的支付方式.']);
|
||||
}
|
||||
if ($price <= 0) {
|
||||
return json_encode(['errcode' => -1, 'errmsg' => '非法的金额.']);
|
||||
}
|
||||
$user = Auth::getUser();
|
||||
$settings = Config::get('doiampay')['mchdata'][$type];
|
||||
$pl = new Paylist();
|
||||
$pl->userid = $user->id;
|
||||
$pl->total = $price;
|
||||
$pl->tradeno = self::generateGuid();
|
||||
$pl->save();
|
||||
$data = [
|
||||
'trade' => $pl->tradeno,
|
||||
'price' => $price,
|
||||
'phone' => $settings['phone'],
|
||||
'mchid' => $settings['mchid'],
|
||||
'subject' => Config::get('appName') . '充值' . $price . '元',
|
||||
'body' => Config::get('appName') . '充值' . $price . '元',
|
||||
'type' => 'Mod',
|
||||
];
|
||||
$data = DoiAM::sign($data, $settings['token']);
|
||||
$ret = DoiAM::post('https://api.daimiyun.cn/v2/' . $type . '/create', $data);
|
||||
$result = json_decode($ret, true);
|
||||
if ($result && $result['errcode'] == 0) {
|
||||
$result['pid'] = $pl->tradeno;
|
||||
return json_encode($result);
|
||||
}
|
||||
|
||||
return json_encode([
|
||||
'errcode' => -1,
|
||||
'errmsg' => '接口调用失败!' . $ret,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
public function getReturnHTML($request, $response, $args)
|
||||
{
|
||||
$money = $_GET['money'];
|
||||
echo "您已经成功支付 $money 元,正在跳转..";
|
||||
echo <<<HTML
|
||||
<script>
|
||||
location.href="/user/code";
|
||||
</script>
|
||||
HTML;
|
||||
}
|
||||
|
||||
public function getStatus($request, $response, $args)
|
||||
{
|
||||
$p = Paylist::where('tradeno', $_POST['pid'])->first();
|
||||
$return['ret'] = 1;
|
||||
$return['result'] = $p->status;
|
||||
return json_encode($return);
|
||||
}
|
||||
}
|
||||
|
||||
class DoiAM
|
||||
{
|
||||
public static function sort(&$array)
|
||||
{
|
||||
ksort($array);
|
||||
}
|
||||
|
||||
public static function getsign($array, $key)
|
||||
{
|
||||
unset($array['sign']);
|
||||
self::sort($array);
|
||||
$sss = http_build_query($array);
|
||||
$sign = hash('sha256', $sss . $key);
|
||||
$sign = sha1($sign . hash('sha256', $key));
|
||||
return $sign;
|
||||
}
|
||||
|
||||
public static function sign($array, $key)
|
||||
{
|
||||
$array['sign'] = self::getSign($array, $key);
|
||||
return $array;
|
||||
}
|
||||
|
||||
public static function checksign($array, $key)
|
||||
{
|
||||
$new = $array;
|
||||
$new = self::sign($new, $key);
|
||||
if (!isset($array['sign'])) {
|
||||
return false;
|
||||
}
|
||||
return $array['sign'] == $new['sign'];
|
||||
}
|
||||
|
||||
public static function post($url, $data = null)
|
||||
{
|
||||
$curl = curl_init();
|
||||
curl_setopt($curl, CURLOPT_URL, $url);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
|
||||
if (!empty($data)) {
|
||||
curl_setopt($curl, CURLOPT_POST, 1);
|
||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
|
||||
}
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
||||
$output = curl_exec($curl);
|
||||
curl_close($curl);
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,236 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: tonyzou
|
||||
* Date: 2018/9/24
|
||||
* Time: 下午9:24
|
||||
*/
|
||||
|
||||
namespace App\Services\Gateway;
|
||||
|
||||
use App\Services\Auth;
|
||||
use App\Services\Config;
|
||||
use App\Models\Paylist;
|
||||
use App\Services\View;
|
||||
use Exception;
|
||||
use Omnipay\Omnipay;
|
||||
|
||||
class F2Fpay_PAYJS extends AbstractPayment
|
||||
{
|
||||
// f2fpay
|
||||
private function createGateway()
|
||||
{
|
||||
$gateway = Omnipay::create('Alipay_AopF2F');
|
||||
$gateway->setSignType('RSA2'); //RSA/RSA2
|
||||
$gateway->setAppId(Config::get('f2fpay_app_id'));
|
||||
$gateway->setPrivateKey(Config::get('merchant_private_key')); // 可以是路径,也可以是密钥内容
|
||||
$gateway->setAlipayPublicKey(Config::get('alipay_public_key')); // 可以是路径,也可以是密钥内容
|
||||
$notifyUrl = Config::get('f2fNotifyUrl') ?? (Config::get('baseUrl') . '/payment/notify');
|
||||
$gateway->setNotifyUrl($notifyUrl);
|
||||
return $gateway;
|
||||
}
|
||||
// f2fpay end
|
||||
|
||||
// payjs
|
||||
public function __construct()
|
||||
{
|
||||
$this->appSecret = Config::get('payjs_key');
|
||||
$this->gatewayUri = 'https://payjs.cn/api/';
|
||||
}
|
||||
public function prepareSign($data)
|
||||
{
|
||||
$data['mchid'] = Config::get('payjs_mchid');
|
||||
$data = array_filter($data);
|
||||
ksort($data);
|
||||
return http_build_query($data);
|
||||
}
|
||||
|
||||
public function sign($data)
|
||||
{
|
||||
return strtoupper(md5(urldecode($data) . '&key=' . $this->appSecret));
|
||||
}
|
||||
|
||||
public function verify($data, $signature)
|
||||
{
|
||||
$mySign = $this->sign($data);
|
||||
return $mySign === $signature;
|
||||
}
|
||||
|
||||
public function post($data, $type = 'pay')
|
||||
{
|
||||
if ($type == 'pay') {
|
||||
$this->gatewayUri .= 'cashier';
|
||||
} elseif ($type == 'refund') {
|
||||
$this->gatewayUri .= 'refund';
|
||||
} else {
|
||||
$this->gatewayUri .= 'check';
|
||||
}
|
||||
$curl = curl_init();
|
||||
curl_setopt($curl, CURLOPT_URL, $this->gatewayUri);
|
||||
curl_setopt($curl, CURLOPT_HEADER, 0);
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
|
||||
curl_setopt($curl, CURLOPT_POST, 1);
|
||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
|
||||
$data = curl_exec($curl);
|
||||
curl_close($curl);
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function query($tradeNo)
|
||||
{
|
||||
$data['payjs_order_id'] = $tradeNo;
|
||||
$params = $this->prepareSign($data);
|
||||
$data['sign'] = $this->sign($params);
|
||||
return json_decode($this->post($data, $type = 'query'), true);
|
||||
}
|
||||
|
||||
public function refund($merchantTradeNo)
|
||||
{
|
||||
$data['payjs_order_id'] = $merchantTradeNo;
|
||||
$params = $this->prepareSign($data);
|
||||
$data['sign'] = $this->sign($params);
|
||||
return $this->post($data, 'refund');
|
||||
}
|
||||
// payjs end
|
||||
|
||||
|
||||
public function purchase($request, $response, $args)
|
||||
{
|
||||
$payment = $request->getParam('payment');
|
||||
if ($payment == 'alipay') {
|
||||
$amount = $request->getParam('amount');
|
||||
$user = Auth::getUser();
|
||||
if ($amount == '') {
|
||||
$res['ret'] = 0;
|
||||
$res['msg'] = '订单金额错误:' . $amount;
|
||||
return $response->getBody()->write(json_encode($res));
|
||||
}
|
||||
|
||||
$pl = new Paylist();
|
||||
$pl->userid = $user->id;
|
||||
$pl->tradeno = self::generateGuid();
|
||||
$pl->total = $amount;
|
||||
$pl->save();
|
||||
|
||||
$gateway = $this->createGateway();
|
||||
|
||||
$request = $gateway->purchase();
|
||||
$request->setBizContent([
|
||||
'subject' => $pl->tradeno,
|
||||
'out_trade_no' => $pl->tradeno,
|
||||
'total_amount' => $pl->total
|
||||
]);
|
||||
|
||||
/** @var \Omnipay\Alipay\Responses\AopTradePreCreateResponse $response */
|
||||
$aliResponse = $request->send();
|
||||
|
||||
// 获取收款二维码内容
|
||||
$qrCodeContent = $aliResponse->getQrCode();
|
||||
|
||||
$return['ret'] = 1;
|
||||
$return['qrcode'] = $qrCodeContent;
|
||||
$return['amount'] = $pl->total;
|
||||
$return['pid'] = $pl->tradeno;
|
||||
|
||||
return json_encode($return);
|
||||
|
||||
} else if ($payment == 'wechat') {
|
||||
$price = $request->getParam('amount');
|
||||
if ($price <= 0) {
|
||||
return json_encode(['ret' => -1, 'errmsg' => '非法的金额.']);
|
||||
}
|
||||
$user = Auth::getUser();
|
||||
$pl = new Paylist();
|
||||
$pl->userid = $user->id;
|
||||
$pl->total = $price;
|
||||
$pl->tradeno = self::generateGuid();
|
||||
$pl->save();
|
||||
$data['mchid'] = Config::get('payjs_mchid');
|
||||
$data['out_trade_no'] = $pl->tradeno;
|
||||
$data['total_fee'] = (float) $price * 100;
|
||||
$data['notify_url'] = Config::get('baseUrl') . '/payment/notify?way=payjs';
|
||||
$params = $this->prepareSign($data);
|
||||
$data['sign'] = $this->sign($params);
|
||||
$url = 'https://payjs.cn/api/cashier?' . http_build_query($data);
|
||||
return json_encode(['ret' => 1, 'qrcode' => $url, 'pid' => $data['out_trade_no']]);
|
||||
} else {
|
||||
$res['ret'] = 0;
|
||||
$res['msg'] = 'payment参数缺失';
|
||||
return $response->getBody()->write(json_encode($res));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function notify($request, $response, $args)
|
||||
{
|
||||
$way = $_GET['way'];
|
||||
if ($way == 'payjs') {
|
||||
$data = $_POST;
|
||||
|
||||
if($data['return_code'] == 1){
|
||||
// 验证签名
|
||||
$in_sign = $data['sign'];
|
||||
unset($data['sign']);
|
||||
$data = array_filter($data);
|
||||
ksort($data);
|
||||
$sign = strtoupper(md5(urldecode(http_build_query($data) . '&key=' . $this->appSecret)));
|
||||
$resultVerify = $sign ? true : false;
|
||||
|
||||
//$str_to_sign = $this->prepareSign($data);
|
||||
//$resultVerify = $this->verify($str_to_sign, $request->getParam('sign'));
|
||||
|
||||
if ($resultVerify) {
|
||||
// 验重
|
||||
$p = Paylist::where('tradeno', '=', $data['out_trade_no'])->first();
|
||||
$money = $p->total;
|
||||
if ($p->status != 1) {
|
||||
$this->postPayment($data['out_trade_no'], '微信支付');
|
||||
echo 'SUCCESS';
|
||||
} else {
|
||||
echo 'ERROR';
|
||||
}
|
||||
} else {
|
||||
echo 'FAIL2';
|
||||
}
|
||||
} else {
|
||||
echo 'FAIL1';
|
||||
}
|
||||
} else {
|
||||
$gateway = $this->createGateway();
|
||||
$aliRequest = $gateway->completePurchase();
|
||||
$aliRequest->setParams($_POST);
|
||||
|
||||
try {
|
||||
/** @var \Omnipay\Alipay\Responses\AopCompletePurchaseResponse $response */
|
||||
$aliResponse = $aliRequest->send();
|
||||
$pid = $aliResponse->data('out_trade_no');
|
||||
if ($aliResponse->isPaid()) {
|
||||
$this->postPayment($pid, '支付宝当面付 ' . $pid);
|
||||
die('success'); //The response should be 'success' only
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
die('fail');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getPurchaseHTML()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public function getStatus($request, $response, $args)
|
||||
{
|
||||
$p = Paylist::where('tradeno', $_POST['pid'])->first();
|
||||
$return['ret'] = 1;
|
||||
$return['result'] = $p->status;
|
||||
return json_encode($return);
|
||||
}
|
||||
|
||||
public function getReturnHTML($request, $response, $args)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,458 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Gateway;
|
||||
|
||||
use App\Services\View;
|
||||
use App\Services\Auth;
|
||||
use App\Services\Config;
|
||||
use App\Models\Paylist;
|
||||
use App\Services\MalioConfig;
|
||||
use Omnipay\Omnipay;
|
||||
use Stripe\Stripe;
|
||||
use Stripe\Charge;
|
||||
|
||||
class MalioPay extends AbstractPayment
|
||||
{
|
||||
public function purchase($request, $response, $args)
|
||||
{
|
||||
$price = $request->getParam('price');
|
||||
$type = $request->getParam('type');
|
||||
$user = Auth::getUser();
|
||||
if ($type != 'alipay' and $type != 'wechat') {
|
||||
return json_encode(['ret' => 0, 'msg' => 'wrong type']);
|
||||
}
|
||||
|
||||
if ($price < MalioConfig::get('mups_minimum_amount')) {
|
||||
return json_encode(['ret' => 0, 'errmsg' => '充值最低金额为' . MalioConfig::get('mups_minimum_amount') . '元']);
|
||||
}
|
||||
|
||||
if ($price <= 0) {
|
||||
return json_encode(['ret' => 0, 'msg' => "金额必须大于0元"]);
|
||||
}
|
||||
|
||||
if ($type == 'alipay') {
|
||||
$payment_system = MalioConfig::get('mups_alipay');
|
||||
switch ($payment_system) {
|
||||
case ('bitpayx'):
|
||||
$bitpayx = new BitPayX(Config::get('bitpay_secret'));
|
||||
$result = $bitpayx->purchase_maliopay($type, $price);
|
||||
if ($result['errcode'] == 0) {
|
||||
$return = array(
|
||||
'ret' => 1,
|
||||
'type' => 'url',
|
||||
'tradeno' => $result['tradeno'],
|
||||
'url' => $result['url']
|
||||
);
|
||||
} else {
|
||||
$return = array(
|
||||
'ret' => 0,
|
||||
'msg' => $result['errmsg']
|
||||
);
|
||||
}
|
||||
return json_encode($return);
|
||||
case ('tomatopay'):
|
||||
$tomatopay = new TomatoPay();
|
||||
$result = $tomatopay->purchase_maliopay($type, $price);
|
||||
if ($result['errcode'] == 0) {
|
||||
$return = array(
|
||||
'ret' => 1,
|
||||
'type' => 'url',
|
||||
'tradeno' => $result['tradeno'],
|
||||
'url' => $result['code']
|
||||
);
|
||||
} else {
|
||||
$return = array(
|
||||
'ret' => 0,
|
||||
'msg' => $result['errmsg']
|
||||
);
|
||||
}
|
||||
return json_encode($return);
|
||||
case ('f2fpay'):
|
||||
$f2fpay = new AopF2F();
|
||||
$result = $f2fpay->purchase_maliopay($type, $price);
|
||||
if ($result['errcode'] == 0) {
|
||||
$return = array(
|
||||
'ret' => 1,
|
||||
'type' => 'qrcode',
|
||||
'tradeno' => $result['tradeno'],
|
||||
'url' => $result['url']
|
||||
);
|
||||
} else {
|
||||
$return = array(
|
||||
'ret' => 0,
|
||||
'msg' => $result['errmsg']
|
||||
);
|
||||
}
|
||||
return json_encode($return);
|
||||
case ('stripe'):
|
||||
$stripe = new StripePay();
|
||||
$result = $stripe->purchase_maliopay($type, $price);
|
||||
if ($result['errcode'] == 0) {
|
||||
$return = array(
|
||||
'ret' => 1,
|
||||
'type' => 'url',
|
||||
'tradeno' => $result['tradeno'],
|
||||
'url' => $result['url']
|
||||
);
|
||||
} else {
|
||||
$return = array(
|
||||
'ret' => 0,
|
||||
'msg' => $result['errmsg']
|
||||
);
|
||||
}
|
||||
return json_encode($return);
|
||||
case ('wolfpay'):
|
||||
$wolfpay = new Wolfpay();
|
||||
$result = $wolfpay->purchase_maliopay($type, $price);
|
||||
if ($result['errcode'] == 0) {
|
||||
$return = array(
|
||||
'ret' => 1,
|
||||
'type' => 'url',
|
||||
'tradeno' => $result['tradeno'],
|
||||
'url' => $result['url']
|
||||
);
|
||||
} else {
|
||||
$return = array(
|
||||
'ret' => 0,
|
||||
'msg' => $result['errmsg']
|
||||
);
|
||||
}
|
||||
return json_encode($return);
|
||||
case ('materialpay'):
|
||||
$materialpay = new MaterialPay(Config::get('materialpay_secret'));
|
||||
$result = $materialpay->purchase_maliopay($type, $price);
|
||||
if ($result['errcode'] == 0) {
|
||||
$return = array(
|
||||
'ret' => 1,
|
||||
'type' => 'url',
|
||||
'tradeno' => $result['tradeno'],
|
||||
'url' => $result['url']
|
||||
);
|
||||
} else {
|
||||
$return = array(
|
||||
'ret' => 0,
|
||||
'msg' => $result['errmsg']
|
||||
);
|
||||
}
|
||||
return json_encode($return);
|
||||
}
|
||||
} else if ($type == 'wechat') {
|
||||
$payment_system = MalioConfig::get('mups_wechat');
|
||||
switch ($payment_system) {
|
||||
case ('bitpayx'):
|
||||
$bitpayx = new BitPayX(Config::get('bitpay_secret'));
|
||||
$result = $bitpayx->purchase_maliopay($type, $price);
|
||||
if ($result['errcode'] == 0) {
|
||||
$return = array(
|
||||
'ret' => 1,
|
||||
'type' => 'qrcode',
|
||||
'tradeno' => $result['tradeno'],
|
||||
'url' => $result['qrcode_url']
|
||||
);
|
||||
} else {
|
||||
$return = array(
|
||||
'ret' => 0,
|
||||
'msg' => $result['errmsg']
|
||||
);
|
||||
}
|
||||
return json_encode($return);
|
||||
case ('tomatopay'):
|
||||
$tomatopay = new TomatoPay();
|
||||
$result = $tomatopay->purchase_maliopay($type, $price);
|
||||
if ($result['errcode'] == 0) {
|
||||
$return = array(
|
||||
'ret' => 1,
|
||||
'type' => 'url',
|
||||
'tradeno' => $result['tradeno'],
|
||||
'url' => $result['code']
|
||||
);
|
||||
} else {
|
||||
$return = array(
|
||||
'ret' => 0,
|
||||
'msg' => $result['errmsg']
|
||||
);
|
||||
}
|
||||
return json_encode($return);
|
||||
case ('stripe'):
|
||||
$stripe = new StripePay();
|
||||
$result = $stripe->purchase_maliopay($type, $price);
|
||||
if ($result['errcode'] == 0) {
|
||||
$return = array(
|
||||
'ret' => 1,
|
||||
'type' => 'qrcode',
|
||||
'tradeno' => $result['tradeno'],
|
||||
'url' => $result['url']
|
||||
);
|
||||
} else {
|
||||
$return = array(
|
||||
'ret' => 0,
|
||||
'msg' => $result['errmsg']
|
||||
);
|
||||
}
|
||||
return json_encode($return);
|
||||
case ('materialpay'):
|
||||
$materialpay = new MaterialPay(Config::get('materialpay_secret'));
|
||||
$result = $materialpay->purchase_maliopay($type, $price);
|
||||
if ($result['errcode'] == 0) {
|
||||
$return = array(
|
||||
'ret' => 1,
|
||||
'type' => 'qrcode',
|
||||
'tradeno' => $result['tradeno'],
|
||||
'url' => $result['url']
|
||||
);
|
||||
} else {
|
||||
$return = array(
|
||||
'ret' => 0,
|
||||
'msg' => $result['errmsg']
|
||||
);
|
||||
}
|
||||
return json_encode($return);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function notify($request, $response, $args)
|
||||
{
|
||||
$path = $request->getUri()->getPath();
|
||||
$path_exploded = explode('/', $path);
|
||||
$payment_system = $path_exploded[3];
|
||||
|
||||
switch ($payment_system) {
|
||||
case ('bitpayx'):
|
||||
$bitpayx = new BitPayX(Config::get('bitpay_secret'));
|
||||
if (!Config::get('bitpay_secret') || Config::get('bitpay_secret') === '') {
|
||||
$return = [];
|
||||
$return['status'] = 400;
|
||||
echo json_encode($return);
|
||||
return $return;
|
||||
}
|
||||
$inputString = file_get_contents('php://input', 'r');
|
||||
$inputStripped = str_replace(array("\r", "\n", "\t", "\v"), '', $inputString);
|
||||
$inputJSON = json_decode($inputStripped, true); //convert JSON into array
|
||||
$data = array();
|
||||
if ($inputJSON !== null) {
|
||||
$data['status'] = $inputJSON['status'];
|
||||
$data['order_id'] = $inputJSON['order_id'];
|
||||
$data['merchant_order_id'] = $inputJSON['merchant_order_id'];
|
||||
$data['price_amount'] = $inputJSON['price_amount'];
|
||||
$data['price_currency'] = $inputJSON['price_currency'];
|
||||
$data['created_at_t'] = $inputJSON['created_at_t'];
|
||||
}
|
||||
$str_to_sign = $bitpayx->prepareSignId($inputJSON['merchant_order_id']);
|
||||
$resultVerify = $bitpayx->verify($str_to_sign, $inputJSON['token']);
|
||||
$isPaid = $data !== null && $data['status'] !== null && $data['status'] === 'PAID';
|
||||
if ($resultVerify && $isPaid) {
|
||||
$bitpayx->postPaymentMaliopay($data['merchant_order_id'], '在线支付 ' . $data['merchant_order_id']);
|
||||
// echo 'SUCCESS';
|
||||
$return = [];
|
||||
$return['status'] = 200;
|
||||
echo json_encode($return);
|
||||
} else {
|
||||
// echo 'FAIL';
|
||||
$return = [];
|
||||
$return['status'] = 400;
|
||||
echo json_encode($return);
|
||||
}
|
||||
return $return;
|
||||
case ('tomatopay'):
|
||||
$type = 'alipay';
|
||||
$settings = Config::get("tomatopay")[$type];
|
||||
$order_data = $_REQUEST;
|
||||
$transid = $order_data['trade_no']; //转账交易号
|
||||
$invoiceid = $order_data['out_trade_no']; //订单号
|
||||
$amount = $order_data['total_fee']; //获取递过来的总价格
|
||||
$status = $order_data['trade_status']; //获取传递过来的交易状态
|
||||
$signs = $order_data['sign'];
|
||||
|
||||
if ($request->isGet()) {
|
||||
header("Location: /user/payment/return?tradeno=".$order_data['out_trade_no']);
|
||||
return 0;
|
||||
}
|
||||
|
||||
$security = array();
|
||||
$security['out_trade_no'] = $invoiceid;
|
||||
$security['total_fee'] = $amount;
|
||||
$security['trade_no'] = $transid;
|
||||
$security['trade_status'] = $status;
|
||||
foreach ($security as $k => $v) {
|
||||
$o .= "$k=" . urlencode($v) . "&";
|
||||
}
|
||||
$sign = md5(substr($o, 0, -1) . $settings['token']);
|
||||
|
||||
|
||||
if ($sign == $signs) {
|
||||
//验重
|
||||
$p = Paylist::where('tradeno', '=', $order_data['out_trade_no'])->first();
|
||||
$money = $p->total;
|
||||
if ($p->status != 1) {
|
||||
$this->postPaymentMaliopay($order_data['out_trade_no'], "在线支付");
|
||||
echo 'SUCCESS';
|
||||
} else {
|
||||
echo 'ERROR';
|
||||
}
|
||||
echo 'success';
|
||||
} else {
|
||||
echo '验证失败';
|
||||
}
|
||||
|
||||
return 'tomatopay';
|
||||
case ('f2fpay'):
|
||||
$f2fpay = new AopF2F();
|
||||
|
||||
$gateway = Omnipay::create('Alipay_AopF2F');
|
||||
$gateway->setSignType('RSA2'); //RSA/RSA2
|
||||
$gateway->setAppId(Config::get('f2fpay_app_id'));
|
||||
$gateway->setPrivateKey(Config::get('merchant_private_key')); // 可以是路径,也可以是密钥内容
|
||||
$gateway->setAlipayPublicKey(Config::get('alipay_public_key')); // 可以是路径,也可以是密钥内容
|
||||
|
||||
$aliRequest = $gateway->completePurchase();
|
||||
$aliRequest->setParams($_POST);
|
||||
|
||||
$aliResponse = $aliRequest->send();
|
||||
$pid = $aliResponse->data('out_trade_no');
|
||||
if ($aliResponse->isPaid()) {
|
||||
$this->postPaymentMaliopay($pid, '支付宝');
|
||||
die('success'); //The response should be 'success' only
|
||||
}
|
||||
return 'f2fpay';
|
||||
case ('stripe'):
|
||||
Stripe::setApiKey(Config::get('stripe_key'));
|
||||
$endpoint_secret = Config::get('stripe_webhook_endpoint_secret');
|
||||
$payload = @file_get_contents('php://input');
|
||||
$sig_header = $_SERVER['HTTP_STRIPE_SIGNATURE'];
|
||||
$event = null;
|
||||
|
||||
try {
|
||||
$event = \Stripe\Webhook::constructEvent(
|
||||
$payload,
|
||||
$sig_header,
|
||||
$endpoint_secret
|
||||
);
|
||||
} catch (\UnexpectedValueException $e) {
|
||||
http_response_code(400);
|
||||
exit();
|
||||
} catch (\Stripe\Error\SignatureVerification $e) {
|
||||
http_response_code(400);
|
||||
exit();
|
||||
}
|
||||
|
||||
switch ($event->type) {
|
||||
case 'source.chargeable':
|
||||
$source = $event->data->object;
|
||||
$charge = Charge::create([
|
||||
'amount' => $source['amount'],
|
||||
'currency' => $source['currency'],
|
||||
'source' => $source['id'],
|
||||
]);
|
||||
if ($charge['status'] == 'succeeded') {
|
||||
$type = null;
|
||||
if ($source['type'] == 'alipay') {
|
||||
$type = '支付宝支付';
|
||||
} else if ($source['type'] == 'wechat') {
|
||||
$type = '微信支付';
|
||||
}
|
||||
$order = Paylist::where('tradeno', '=', $source['id'])->first();
|
||||
if ($order->status != 1) {
|
||||
$this->postPaymentMaliopay($source['id'], 'Stripe '.$type);
|
||||
echo 'SUCCESS';
|
||||
} else {
|
||||
echo 'ERROR';
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
http_response_code(400);
|
||||
exit();
|
||||
}
|
||||
|
||||
http_response_code(200);
|
||||
case ('wolfpay'):
|
||||
$type = $args['method'];
|
||||
$settings = Config::get("wolfpay") ['config'];
|
||||
$security['orderid'] = $_REQUEST['out_trade_no'];
|
||||
if ($security['orderid'] == '' OR $security['orderid'] == null) {
|
||||
header("Location: /user/code");
|
||||
} else {
|
||||
//实例化支付类
|
||||
//$pay = new Pays($settings['hid'], $settings['key']);
|
||||
$wolfpay = new Wolfpay();
|
||||
//接收异步通知数据
|
||||
$data = $_GET;
|
||||
//商户订单号
|
||||
$out_trade_no = $data['out_trade_no'];
|
||||
//验证签名
|
||||
if ($wolfpay->verify($data)) {
|
||||
//验证支付状态
|
||||
if ($data['trade_status'] == 'TRADE_SUCCESS') {
|
||||
$wolfpay->postPaymentMaliopay($data['out_trade_no'], "在线支付");
|
||||
echo "success";
|
||||
header("Location: /user/code");
|
||||
}
|
||||
} else {
|
||||
echo '錯誤';
|
||||
}
|
||||
}
|
||||
case ('materialpay'):
|
||||
$data = array();
|
||||
$data['tradeStatus'] = $request->getParam('tradeStatus');
|
||||
$data['payAmount'] = number_format($request->getParam('payAmount'),2);
|
||||
$data['tradeNo'] = $request->getParam('tradeNo');
|
||||
$data['payType'] = $request->getParam('payType');
|
||||
$data['outTradeNo'] = $request->getParam('outTradeNo');
|
||||
|
||||
$pl = Paylist::where('tradeno',$data['outTradeNo'])->first();
|
||||
if ($pl->status == 1) {
|
||||
echo 'success';
|
||||
return;
|
||||
}
|
||||
|
||||
$materialpay = new MaterialPay(Config::get('materialpay_secret'));
|
||||
// 准备待签名数据
|
||||
$str_to_sign = $materialpay->prepareSign($data);
|
||||
// 验证签名
|
||||
$resultVerify = $materialpay->verify($str_to_sign, $request->getParam('sign'));
|
||||
if ($resultVerify) {
|
||||
$materialpay->postPaymentMaliopay($data['outTradeNo'], 'MaterialPay - ' . $data['outTradeNo']);
|
||||
echo 'success';
|
||||
return;
|
||||
} else {
|
||||
echo 'fail';
|
||||
return;
|
||||
}
|
||||
default:
|
||||
return 'failed';
|
||||
}
|
||||
}
|
||||
|
||||
public function getPurchaseHTML()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public function getReturnHTML($request, $response, $args)
|
||||
{
|
||||
$tradeno = $_GET['tradeno'];
|
||||
if ($tradeno == '' || $tradeno == null) {
|
||||
$tradeno = $_GET['source'];
|
||||
}
|
||||
if ($tradeno == '' || $tradeno == null) {
|
||||
$tradeno = $_GET['out_trade_no'];
|
||||
}
|
||||
$p = Paylist::where('tradeno', '=', $tradeno)->first();
|
||||
$money = $p->total;
|
||||
if ($p->status === 1) {
|
||||
$success = 1;
|
||||
} else {
|
||||
$success = 0;
|
||||
}
|
||||
return View::getSmarty()->assign('money', $money)->assign('success', $success)->fetch('user/pay_success.tpl');
|
||||
}
|
||||
|
||||
public function getStatus($request, $response, $args)
|
||||
{
|
||||
$p = Paylist::where('tradeno', $_POST['tradeno'])->first();
|
||||
$return['ret'] = 1;
|
||||
$return['result'] = $p->status;
|
||||
return json_encode($return);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,174 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Gateway;
|
||||
|
||||
use App\Services\Auth;
|
||||
use App\Services\Config;
|
||||
use App\Models\Paylist;
|
||||
use App\Services\View;
|
||||
use App\Services\MalioConfig;
|
||||
use Exception;
|
||||
use App\Services\Gateway\PayssionClient;
|
||||
|
||||
class Payssion extends AbstractPayment
|
||||
{
|
||||
public function purchase($request, $response, $args)
|
||||
{
|
||||
$price = $request->getParam('price');
|
||||
$type = $request->getParam('type');
|
||||
$user = Auth::getUser();
|
||||
if ($type != 'alipay' and $type != 'unionpay') {
|
||||
return json_encode(['errcode' => -1, 'errmsg' => 'wrong payment.']);
|
||||
}
|
||||
|
||||
if ($type == 'alipay') {
|
||||
$type = 'alipay_cn';
|
||||
} else if ($type == 'unionpay') {
|
||||
$type = 'unionpay_cn';
|
||||
}
|
||||
|
||||
$pl = new Paylist();
|
||||
$pl->userid = $user->id;
|
||||
$pl->total = $price;
|
||||
$pl->tradeno = self::generateGuid();
|
||||
$pl->save();
|
||||
|
||||
$payssion = new PayssionClient(Config::get('payssion_api_key'), Config::get('payssion_secret_key'));
|
||||
|
||||
|
||||
$payssion_response = null;
|
||||
try {
|
||||
//$type = 'dotpay_pl'; // for test
|
||||
$payssion_response = $payssion->create(array(
|
||||
'amount' => $price,
|
||||
'currency' => 'CNY',
|
||||
'pm_id' => $type,
|
||||
'description' => 'Shadowsocks Product',
|
||||
'order_id' => $pl->tradeno,
|
||||
'return_url' => Config::get('baseUrl').'/user/payment/return' //optional, the return url after payments (for both of paid and non-paid)
|
||||
));
|
||||
} catch (\Exception $e) {
|
||||
$res['ret'] = 0;
|
||||
$res['msg'] = "创建订单失败。".$e->getMessage();
|
||||
return $response->getBody()->write(json_encode($res));
|
||||
}
|
||||
if ($payssion->isSuccess()) {
|
||||
$todo = $payssion_response['todo'];
|
||||
if ($todo) {
|
||||
$todo_list = explode('|', $todo);
|
||||
if (in_array("redirect", $todo_list)) {
|
||||
$res['ret'] = 1;
|
||||
$res['url'] = $payssion_response['redirect_url'];
|
||||
$res['pid'] = $pl->id;
|
||||
return $response->getBody()->write(json_encode($res));
|
||||
}
|
||||
} else {
|
||||
//just in case, should not be here
|
||||
}
|
||||
} else {
|
||||
return json_encode($payssion_response);
|
||||
}
|
||||
|
||||
$res['ret'] = 0;
|
||||
$res['msg'] = "购买失败";
|
||||
return $response->getBody()->write(json_encode($res));
|
||||
}
|
||||
|
||||
public function notify($request, $response, $args)
|
||||
{
|
||||
$api_key=Config::get('payssion_api_key');
|
||||
$pm_id=$request->getParam('pm_id');
|
||||
$amount=$request->getParam('amount');
|
||||
$currency=$request->getParam('currency');
|
||||
$order_id=$request->getParam('order_id');
|
||||
$secret_key=Config::get('payssion_secret_key');
|
||||
$state=$request->getParam('state');
|
||||
$msg = implode('|', array($api_key, $pm_id, $amount, $currency,$order_id,$state, $secret_key));
|
||||
if($request->getParam('notify_sig')!= md5($msg)){
|
||||
return;
|
||||
}
|
||||
$state_code=3;
|
||||
switch ($state) {
|
||||
case 'error':
|
||||
$state_code=2;
|
||||
break;
|
||||
case 'pending':
|
||||
$state_code=3;
|
||||
break;
|
||||
case 'completed':
|
||||
$state_code=4;
|
||||
break;
|
||||
case 'paid_partial':
|
||||
$state_code=5;
|
||||
break;
|
||||
case 'failed':
|
||||
$state_code=6;
|
||||
break;
|
||||
case 'cancelled':
|
||||
$state_code=7;
|
||||
break;
|
||||
case 'expired':
|
||||
$state_code=8;
|
||||
break;
|
||||
case 'refunded':
|
||||
$state_code=9;
|
||||
break;
|
||||
case 'refund_pending':
|
||||
$state_code=10;
|
||||
break;
|
||||
case 'refund_failed':
|
||||
$state_code=11;
|
||||
break;
|
||||
case 'refund_cancelled':
|
||||
$state_code=12;
|
||||
break;
|
||||
case 'chargeback':
|
||||
$state_code=13;
|
||||
break;
|
||||
default:
|
||||
$state_code=14;
|
||||
break;
|
||||
}
|
||||
|
||||
if ($state_code != 4) {
|
||||
return;
|
||||
}
|
||||
|
||||
$type = null;
|
||||
if ($pm_id == 'alipay_cn') {
|
||||
$type = '支付宝支付';
|
||||
} else if ($pm_id == 'unionpay_cn') {
|
||||
$type = '银联支付';
|
||||
}
|
||||
$order = Paylist::where('tradeno', '=', $order_id)->first();
|
||||
if ($order->status != 1) {
|
||||
$this->postPayment($order_id, 'Payssion '.$type);
|
||||
echo 'SUCCESS';
|
||||
} else {
|
||||
echo 'ERROR';
|
||||
}
|
||||
}
|
||||
|
||||
public function getPurchaseHTML()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public function getReturnHTML($request, $response, $args)
|
||||
{
|
||||
$pid = $_GET['order_id'];
|
||||
$p = Paylist::where('tradeno', '=', $pid)->first();
|
||||
$money = $p->total;
|
||||
if ($p->status === 1) {
|
||||
$success = 1;
|
||||
} else {
|
||||
$success = 0;
|
||||
}
|
||||
return View::getSmarty()->assign('money', $money)->assign('success', $success)->fetch('user/pay_success.tpl');
|
||||
}
|
||||
|
||||
public function getStatus($request, $response, $args)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,313 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Gateway;
|
||||
/**
|
||||
* Client library for Payssion API.
|
||||
*/
|
||||
class PayssionClient
|
||||
{
|
||||
/**
|
||||
* @const string
|
||||
*/
|
||||
const VERSION = '1.3.0.160612';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $api_url;
|
||||
protected $api_key = ''; //your api key
|
||||
protected $secret_key = ''; //your secret key
|
||||
|
||||
protected static $sig_keys = array(
|
||||
'create' => array(
|
||||
'api_key', 'pm_id', 'amount', 'currency', 'order_id', 'secret_key'
|
||||
),
|
||||
'details' => array(
|
||||
'api_key', 'transaction_id', 'order_id', 'secret_key'
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $http_errors = array
|
||||
(
|
||||
400 => '400 Bad Request',
|
||||
401 => '401 Unauthorized',
|
||||
500 => '500 Internal Server Error',
|
||||
501 => '501 Not Implemented',
|
||||
502 => '502 Bad Gateway',
|
||||
503 => '503 Service Unavailable',
|
||||
504 => '504 Gateway Timeout',
|
||||
);
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $is_success = false;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $allowed_request_methods = array(
|
||||
'get',
|
||||
'put',
|
||||
'post',
|
||||
'delete',
|
||||
);
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
*/
|
||||
protected $ssl_verify = true;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $api_key Payssion App api_key
|
||||
* @param string $secret_key Payssion App secret_key
|
||||
* @param bool $is_livemode false if you use sandbox api_key and true for live mode
|
||||
*/
|
||||
public function __construct($api_key, $secret_key, $is_livemode = true)
|
||||
{
|
||||
$this->api_key = $api_key;
|
||||
$this->secret_key = $secret_key;
|
||||
|
||||
$validate_params = array
|
||||
(
|
||||
false === extension_loaded('curl') => 'The curl extension must be loaded for using this class!',
|
||||
false === extension_loaded('json') => 'The json extension must be loaded for using this class!',
|
||||
empty($this->api_key) => 'api_key is not set!',
|
||||
empty($this->secret_key) => 'secret_key is not set!',
|
||||
);
|
||||
$this->checkForErrors($validate_params);
|
||||
|
||||
$this->setLiveMode($is_livemode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set LiveMode
|
||||
*
|
||||
* @param bool $is_livemode
|
||||
*/
|
||||
public function setLiveMode($is_livemode)
|
||||
{
|
||||
if ($is_livemode) {
|
||||
$this->api_url = 'https://www.payssion.com/api/v1/payment/';
|
||||
} else {
|
||||
$this->api_url = 'http://sandbox.payssion.com/api/v1/payment/';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Api URL
|
||||
*
|
||||
* @param string $url Api URL
|
||||
*/
|
||||
public function setUrl($url)
|
||||
{
|
||||
$this->api_url = $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets SSL verify
|
||||
*
|
||||
* @param bool $ssl_verify SSL verify
|
||||
*/
|
||||
public function setSSLverify($ssl_verify)
|
||||
{
|
||||
$this->ssl_verify = $ssl_verify;
|
||||
}
|
||||
|
||||
/**
|
||||
* Request state getter
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isSuccess()
|
||||
{
|
||||
return $this->is_success;
|
||||
}
|
||||
|
||||
/**
|
||||
* create payment order
|
||||
*
|
||||
* @param $params create Params
|
||||
* @return array
|
||||
*/
|
||||
public function create(array $params)
|
||||
{
|
||||
return $this->call(
|
||||
'create',
|
||||
'post',
|
||||
$params
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* get payment details
|
||||
*
|
||||
* @param $params query Params
|
||||
* @return array
|
||||
*/
|
||||
public function getDetails(array $params)
|
||||
{
|
||||
return $this->call(
|
||||
'details',
|
||||
'post',
|
||||
$params
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method responsible for preparing, setting state and returning answer from rest server
|
||||
*
|
||||
* @param string $method
|
||||
* @param string $request
|
||||
* @param array $params
|
||||
* @return array
|
||||
*/
|
||||
protected function call($method, $request, $params)
|
||||
{
|
||||
$this->is_success = false;
|
||||
|
||||
$validate_params = array
|
||||
(
|
||||
false === is_string($method) => 'Method name must be string',
|
||||
false === $this->checkRequestMethod($request) => 'Not allowed request method type',
|
||||
true === empty($params) => 'params is null',
|
||||
);
|
||||
|
||||
$this->checkForErrors($validate_params);
|
||||
|
||||
$params['api_key'] = $this->api_key;
|
||||
$params['api_sig'] = $this->getSig($params, self::$sig_keys[$method]);
|
||||
|
||||
$response = $this->pushData($method, $request, $params);
|
||||
|
||||
$response = json_decode($response, true);
|
||||
|
||||
if (isset($response['result_code']) && 200 == $response['result_code'])
|
||||
{
|
||||
$this->is_success = true;
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
/**
|
||||
* Checking error mechanism
|
||||
*
|
||||
* @param array $validateArray
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function getSig(array &$params, array $sig_keys)
|
||||
{
|
||||
$msg_array = array();
|
||||
foreach ($sig_keys as $key) {
|
||||
$msg_array[$key] = isset($params[$key]) ? $params[$key] : '';
|
||||
}
|
||||
$msg_array['secret_key'] = $this->secret_key;
|
||||
|
||||
$msg = implode('|', $msg_array);
|
||||
$sig = md5($msg);
|
||||
return $sig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checking error mechanism
|
||||
*
|
||||
* @param array $validateArray
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function checkForErrors(&$validate_params)
|
||||
{
|
||||
foreach ($validate_params as $key => $error)
|
||||
{
|
||||
if ($key)
|
||||
{
|
||||
throw new Exception($error, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if method is allowed
|
||||
*
|
||||
* @param string $method_type
|
||||
* @return bool
|
||||
*/
|
||||
protected function checkRequestMethod($method_type)
|
||||
{
|
||||
$request_method = strtolower($method_type);
|
||||
|
||||
if(in_array($request_method, $this->allowed_request_methods))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method responsible for pushing data to server
|
||||
*
|
||||
* @param string $method
|
||||
* @param string $method_type
|
||||
* @param array|string $vars
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function pushData($method, $method_type, $vars)
|
||||
{
|
||||
$ch = curl_init();
|
||||
|
||||
curl_setopt($ch, CURLOPT_URL, $this->api_url. $method);
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
|
||||
if (is_array($vars)) $vars = http_build_query($vars, '', '&');
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $vars);
|
||||
|
||||
curl_setopt($ch, CURLOPT_HEADER, false);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $this->getHeaders());
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $this->ssl_verify);
|
||||
|
||||
$response = curl_exec($ch);
|
||||
|
||||
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
|
||||
if (isset($this->http_errors[$code]))
|
||||
{
|
||||
throw new Exception('Response Http Error - ' . $this->http_errors[$code], $code);
|
||||
}
|
||||
|
||||
$code = curl_errno($ch);
|
||||
if (0 < $code)
|
||||
{
|
||||
throw new Exception('Unable to connect to ' . $this->api_url . ' Error: ' . "$code :". curl_error($ch), $code);
|
||||
}
|
||||
|
||||
curl_close($ch);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
protected function &getHeaders() {
|
||||
$langVersion = phpversion();
|
||||
$uname = php_uname();
|
||||
$ua = array(
|
||||
'version' => self::VERSION,
|
||||
'lang' => 'php',
|
||||
'lang_version' => $langVersion,
|
||||
'publisher' => 'payssion',
|
||||
'uname' => $uname,
|
||||
);
|
||||
$headers = array(
|
||||
'X-Payssion-Client-User-Agent: ' . json_encode($ua),
|
||||
"User-Agent: Payssion/php/$langVersion/" . self::VERSION,
|
||||
'Content-Type: application/x-www-form-urlencoded',
|
||||
);
|
||||
|
||||
return $headers;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,196 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Gateway;
|
||||
|
||||
use App\Services\Auth;
|
||||
use App\Services\Config;
|
||||
use App\Models\Paylist;
|
||||
use App\Services\View;
|
||||
use App\Services\MalioConfig;
|
||||
use Exception;
|
||||
use Stripe\Stripe;
|
||||
use Stripe\Charge;
|
||||
use Stripe\Source;
|
||||
|
||||
class StripePay extends AbstractPayment
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
Stripe::setApiKey(Config::get('stripe_key'));
|
||||
}
|
||||
|
||||
public function purchase($request, $response, $args)
|
||||
{
|
||||
$price = $request->getParam('price');
|
||||
$type = $request->getParam('type');
|
||||
$user = Auth::getUser();
|
||||
if ($type != 'alipay' and $type != 'wechat') {
|
||||
return json_encode(['errcode' => -1, 'errmsg' => 'wrong payment.']);
|
||||
}
|
||||
$stripe_minimum_amount = MalioConfig::get('stripe_minimum_amount');
|
||||
if ($price < $stripe_minimum_amount) {
|
||||
return json_encode(['errcode' => -1, 'errmsg' => '充值最低金额为'.$stripe_minimum_amount.'元']);
|
||||
}
|
||||
|
||||
$ch = curl_init();
|
||||
$url = 'https://api.exchangeratesapi.io/latest?symbols=CNY&base='.strtoupper(MalioConfig::get('stripe_currency'));
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 0);
|
||||
$currency = json_decode(curl_exec($ch));
|
||||
curl_close($ch);
|
||||
|
||||
$price_exchanged = ((double)$price) / ($currency->rates->CNY);
|
||||
|
||||
$source = Source::create([
|
||||
'amount' => floor($price_exchanged * 100),
|
||||
'currency' => MalioConfig::get('stripe_currency'),
|
||||
'type' => $type,
|
||||
'redirect' => [
|
||||
'return_url' => Config::get('baseUrl') . '/user/payment/return',
|
||||
],
|
||||
]);
|
||||
|
||||
$pl = new Paylist();
|
||||
$pl->userid = $user->id;
|
||||
$pl->total = $price;
|
||||
$pl->tradeno = $source['id'];
|
||||
$pl->save();
|
||||
|
||||
if ($type == 'alipay') {
|
||||
return json_encode(array('url' => $source['redirect']['url'], 'errcode' => 0, 'pid' => $pl->id));
|
||||
} else {
|
||||
return json_encode(array('url' => $source['wechat']['qr_code_url'], 'errcode' => 0, 'pid' => $pl->id));
|
||||
}
|
||||
}
|
||||
|
||||
public function purchase_maliopay($type, $price)
|
||||
{
|
||||
$user = Auth::getUser();
|
||||
if ($type != 'alipay' and $type != 'wechat') {
|
||||
return json_encode(['errcode' => -1, 'errmsg' => 'wrong payment.']);
|
||||
}
|
||||
$stripe_minimum_amount = MalioConfig::get('stripe_minimum_amount');
|
||||
if ($price < $stripe_minimum_amount) {
|
||||
return json_encode(['errcode' => -1, 'errmsg' => '充值最低金额为'.$stripe_minimum_amount.'元']);
|
||||
}
|
||||
|
||||
$ch = curl_init();
|
||||
$url = 'https://api.exchangeratesapi.io/latest?symbols=CNY&base='.strtoupper(MalioConfig::get('stripe_currency'));
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 0);
|
||||
$currency = json_decode(curl_exec($ch));
|
||||
curl_close($ch);
|
||||
|
||||
$price_exchanged = ((double)$price) / ($currency->rates->CNY);
|
||||
|
||||
$source = Source::create([
|
||||
'amount' => floor($price_exchanged * 100),
|
||||
'currency' => MalioConfig::get('stripe_currency'),
|
||||
'type' => $type,
|
||||
'redirect' => [
|
||||
'return_url' => Config::get('baseUrl') . '/user/payment/return',
|
||||
],
|
||||
]);
|
||||
|
||||
$pl = new Paylist();
|
||||
$pl->userid = $user->id;
|
||||
$pl->total = $price;
|
||||
$pl->tradeno = $source['id'];
|
||||
$pl->save();
|
||||
|
||||
if ($type == 'alipay') {
|
||||
return array(
|
||||
'url' => $source['redirect']['url'],
|
||||
'errcode' => 0,
|
||||
'tradeno' => $pl->tradeno
|
||||
);
|
||||
} else {
|
||||
return array(
|
||||
'url' => $source['wechat']['qr_code_url'],
|
||||
'errcode' => 0,
|
||||
'tradeno' => $pl->tradeno
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public function notify($request, $response, $args)
|
||||
{
|
||||
$endpoint_secret = Config::get('stripe_webhook_endpoint_secret');
|
||||
$payload = @file_get_contents('php://input');
|
||||
$sig_header = $_SERVER['HTTP_STRIPE_SIGNATURE'];
|
||||
$event = null;
|
||||
|
||||
try {
|
||||
$event = \Stripe\Webhook::constructEvent(
|
||||
$payload,
|
||||
$sig_header,
|
||||
$endpoint_secret
|
||||
);
|
||||
} catch (\UnexpectedValueException $e) {
|
||||
http_response_code(400);
|
||||
exit();
|
||||
} catch (\Stripe\Error\SignatureVerification $e) {
|
||||
http_response_code(400);
|
||||
exit();
|
||||
}
|
||||
|
||||
switch ($event->type) {
|
||||
case 'source.chargeable':
|
||||
$source = $event->data->object;
|
||||
$charge = Charge::create([
|
||||
'amount' => $source['amount'],
|
||||
'currency' => $source['currency'],
|
||||
'source' => $source['id'],
|
||||
]);
|
||||
if ($charge['status'] == 'succeeded') {
|
||||
$type = null;
|
||||
if ($source['type'] == 'alipay') {
|
||||
$type = '支付宝支付';
|
||||
} else if ($source['type'] == 'wechat') {
|
||||
$type = '微信支付';
|
||||
}
|
||||
$order = Paylist::where('tradeno', '=', $source['id'])->first();
|
||||
if ($order->status != 1) {
|
||||
$this->postPayment($source['id'], 'Stripe '.$type);
|
||||
echo 'SUCCESS';
|
||||
} else {
|
||||
echo 'ERROR';
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
http_response_code(400);
|
||||
exit();
|
||||
}
|
||||
|
||||
http_response_code(200);
|
||||
}
|
||||
|
||||
public function getPurchaseHTML()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public function getReturnHTML($request, $response, $args)
|
||||
{
|
||||
$pid = $_GET['source'];
|
||||
$p = Paylist::where('tradeno', '=', $pid)->first();
|
||||
$money = $p->total;
|
||||
if ($p->status === 1) {
|
||||
$success = 1;
|
||||
} else {
|
||||
$success = 0;
|
||||
}
|
||||
return View::getSmarty()->assign('money', $money)->assign('success', $success)->fetch('user/pay_success.tpl');
|
||||
}
|
||||
|
||||
public function getStatus($request, $response, $args)
|
||||
{
|
||||
$p = Paylist::where('id', $_POST['pid'])->first();
|
||||
$return['ret'] = 1;
|
||||
$return['result'] = $p->status;
|
||||
return json_encode($return);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,202 @@
|
||||
<?php
|
||||
namespace App\Services\Gateway;
|
||||
use App\Services\View;
|
||||
use App\Services\Auth;
|
||||
use App\Services\Config;
|
||||
use App\Models\Paylist;
|
||||
class TomatoPay extends AbstractPayment
|
||||
{
|
||||
|
||||
public function purchase($request, $response, $args)
|
||||
{
|
||||
$type = $request->getParam('type');
|
||||
$price = $request->getParam('price');
|
||||
if($price <= 0){
|
||||
return json_encode(['errcode'=>-1,'errmsg'=>"非法的金额."]);
|
||||
}
|
||||
$user = Auth::getUser();
|
||||
$settings = Config::get("tomatopay")[$type];
|
||||
$pl = new Paylist();
|
||||
$pl->userid = $user->id;
|
||||
$pl->total = $price;
|
||||
$pl->tradeno = self::generateGuid();
|
||||
$pl->save();
|
||||
|
||||
$fqaccount=$settings['account'];
|
||||
$fqkey=$settings['token'];
|
||||
$fqmchid = $settings['mchid'];
|
||||
$fqtype = 1;
|
||||
$fqtrade = $pl->tradeno;
|
||||
$fqcny = $price;
|
||||
$data = [
|
||||
'account' => $settings['account'],
|
||||
'mchid' => $settings['mchid'],
|
||||
'type' => 1,
|
||||
'trade' => $pl->tradeno,
|
||||
'cny' => $price,
|
||||
];
|
||||
$signs = md5("mchid=".$fqmchid."&account=".$fqaccount."&cny=".$fqcny."&type=1&trade=".$fqtrade.$fqkey);
|
||||
$url="https://b.fanqieui.com/gateways/".$type.".php?account=".$fqaccount."&mchid=".$fqmchid."&type=".$fqtype."&trade=".$fqtrade."&cny=".$fqcny."&signs=".$signs;
|
||||
$result = "<script language='javascript' type='text/javascript'>window.location.href='".$url."';</script>";
|
||||
$result = json_encode(array('code'=>$url,'errcode'=>0,'pid' =>$pl->id));
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function purchase_maliopay($type, $price)
|
||||
{
|
||||
if($price <= 0){
|
||||
return json_encode(['errcode'=>-1,'errmsg'=>"非法的金额."]);
|
||||
}
|
||||
$user = Auth::getUser();
|
||||
$settings = Config::get("tomatopay")[$type];
|
||||
$pl = new Paylist();
|
||||
$pl->userid = $user->id;
|
||||
$pl->total = $price;
|
||||
$pl->tradeno = self::generateGuid();
|
||||
$pl->save();
|
||||
|
||||
$fqaccount=$settings['account'];
|
||||
$fqkey=$settings['token'];
|
||||
$fqmchid = $settings['mchid'];
|
||||
$fqtype = 1;
|
||||
$fqtrade = $pl->tradeno;
|
||||
$fqcny = $price;
|
||||
$data = [
|
||||
'account' => $settings['account'],
|
||||
'mchid' => $settings['mchid'],
|
||||
'type' => 1,
|
||||
'trade' => $pl->tradeno,
|
||||
'cny' => $price,
|
||||
];
|
||||
$signs = md5("mchid=".$fqmchid."&account=".$fqaccount."&cny=".$fqcny."&type=1&trade=".$fqtrade.$fqkey);
|
||||
$url="https://b.fanqieui.com/gateways/".$type.".php?account=".$fqaccount."&mchid=".$fqmchid."&type=".$fqtype."&trade=".$fqtrade."&cny=".$fqcny."&signs=".$signs;
|
||||
$result = array('code'=>$url,'errcode'=>0,'tradeno' => $pl->tradeno );
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function notify($request, $response, $args)
|
||||
{
|
||||
$type = $args['type'];
|
||||
$settings = Config::get("tomatopay")[$type];
|
||||
$order_data = $_REQUEST;
|
||||
$transid = $order_data['trade_no']; //转账交易号
|
||||
$invoiceid = $order_data['out_trade_no']; //订单号
|
||||
$amount = $order_data['total_fee']; //获取递过来的总价格
|
||||
$status = $order_data['trade_status']; //获取传递过来的交易状态
|
||||
$signs = $order_data['sign'];
|
||||
|
||||
$security = array();
|
||||
$security['out_trade_no'] = $invoiceid;
|
||||
$security['total_fee'] = $amount;
|
||||
$security['trade_no'] = $transid;
|
||||
$security['trade_status'] = $status;
|
||||
foreach ($security as $k=>$v)
|
||||
{
|
||||
$o.= "$k=".urlencode($v)."&";
|
||||
}
|
||||
$sign = md5(substr($o,0,-1).$settings['token']);
|
||||
|
||||
|
||||
if ($sign == $signs) {
|
||||
//验重
|
||||
$p = Paylist::where('tradeno', '=', $order_data['out_trade_no'])->first();
|
||||
$money = $p->total;
|
||||
if ($p->status != 1) {
|
||||
$this->postPayment($order_data['out_trade_no'], "在线支付");
|
||||
echo 'SUCCESS';
|
||||
} else {
|
||||
echo 'ERROR';
|
||||
}
|
||||
echo 'success';
|
||||
if($ispost==0) header("Location: /user/code");
|
||||
|
||||
|
||||
}else{
|
||||
echo '验证失败';
|
||||
}
|
||||
}
|
||||
public function getPurchaseHTML()
|
||||
{
|
||||
return '
|
||||
<div class="card-inner">
|
||||
<p class="card-heading">充值</p>
|
||||
<h5>支付方式:</h5>
|
||||
<nav class="tab-nav margin-top-no">
|
||||
<ul class="nav nav-list">
|
||||
|
||||
<li>
|
||||
<a class="waves-attach waves-effect type active" data-toggle="tab" data-pay="wxpay">微信支付</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<a class="waves-attach waves-effect type" data-toggle="tab" data-pay="alipay">支付宝</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
<div class="tab-nav-indicator"></div>
|
||||
</nav>
|
||||
<div class="form-group form-group-label">
|
||||
<label class="floating-label" for="amount">金额</label>
|
||||
<input class="form-control" id="amount" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-action">
|
||||
<div class="card-action-btn pull-left">
|
||||
<button class="btn btn-flat waves-attach" id="code-update" ><span class="icon">check</span> 充值</NOtton>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var type = "wxpay";
|
||||
var type = "alipay";
|
||||
var pid = 0;
|
||||
$(".type").click(function(){
|
||||
type = $(this).data("pay");
|
||||
});
|
||||
$("#code-update").click(function(){
|
||||
var price = parseFloat($("#amount").val());
|
||||
console.log("将要使用"+type+"方法充值"+price+"元")
|
||||
if(isNaN(price)){
|
||||
$("#result").modal();
|
||||
$("#msg").html("非法的金额!");
|
||||
}
|
||||
$.ajax({
|
||||
\'url\':"/user/payment/purchase",
|
||||
\'data\':{
|
||||
\'price\':price,
|
||||
\'type\':type,
|
||||
},
|
||||
\'dataType\':\'json\',
|
||||
\'type\':"POST",
|
||||
success:function(data){
|
||||
console.log(data);
|
||||
if(data.errcode==-1){
|
||||
$("#result").modal();
|
||||
$("#msg").html(data.errmsg);
|
||||
}
|
||||
if(data.errcode==0){
|
||||
pid = data.pid;
|
||||
if(type=="wxpay"){
|
||||
$("#result").modal();
|
||||
$("#msg").html("正在跳转到微信..."+data.code);
|
||||
}else if(type=="alipay"){
|
||||
$("#result").modal();
|
||||
$("#msg").html("正在跳转到支付宝..."+data.code);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
';
|
||||
}
|
||||
public function getReturnHTML($request, $response, $args)
|
||||
{
|
||||
|
||||
}
|
||||
public function getStatus($request, $response, $args)
|
||||
{
|
||||
// TODO: Implement getStatus() method.
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,131 @@
|
||||
<?php
|
||||
namespace App\Services\Gateway;
|
||||
use App\Services\View;
|
||||
use App\Services\Auth;
|
||||
use App\Services\Config;
|
||||
use App\Models\Paylist;
|
||||
|
||||
class Wolfpay extends AbstractPayment {
|
||||
private $pid;
|
||||
private $key;
|
||||
private $url;
|
||||
public function __construct() {
|
||||
$config = Config::get("wolfpay") ['config'];
|
||||
$this->pid = $config['hid'];
|
||||
$this->key = $config['key'];
|
||||
$this->url = $config['url'];
|
||||
}
|
||||
|
||||
public function purchase($request, $response, $args) {
|
||||
return '';
|
||||
}
|
||||
|
||||
public function purchase_maliopay($type, $price) {
|
||||
$user = Auth::getUser();
|
||||
$settings = Config::get("wolfpay")['config'];
|
||||
$pl = new Paylist();
|
||||
$pl->userid = $user->id;
|
||||
$pl->total = $price;
|
||||
$pl->tradeno = self::generateGuid();
|
||||
$pl->save();
|
||||
|
||||
//支付方式
|
||||
$type = 'all'; //$type;
|
||||
//订单号
|
||||
$out_trade_no = $pl->tradeno;
|
||||
//异步通知地址
|
||||
$notify_url = 'https://' . $_SERVER['HTTP_HOST'] . '/payment/notify/wolfpay/' . $type;
|
||||
//回调通知地址
|
||||
$return_url = 'https://' . $_SERVER['HTTP_HOST'] . '/user/payment/return';
|
||||
//商品名称
|
||||
$name = 'SS商品-' . $_SERVER['HTTP_HOST'];
|
||||
//支付金额(保留小数点后两位)
|
||||
$money = round($price, 2);
|
||||
//站点名称
|
||||
$sitename = $_SERVER['HTTP_HOST'];
|
||||
//发起支付
|
||||
$url = $this->submit($type, $out_trade_no, $notify_url, $return_url, $name, $money, $sitename);
|
||||
|
||||
return array(
|
||||
'url' => $url,
|
||||
'errcode' => 0,
|
||||
'tradeno' => $pl->tradeno
|
||||
);
|
||||
}
|
||||
|
||||
public function notify($request, $response, $args) {
|
||||
return '';
|
||||
}
|
||||
public function getPurchaseHTML() {
|
||||
return '';
|
||||
}
|
||||
public function getReturnHTML($request, $response, $args) {
|
||||
}
|
||||
public function getStatus($request, $response, $args) {
|
||||
// TODO: Implement getStatus() method.
|
||||
|
||||
}
|
||||
|
||||
public function verify($data) {
|
||||
if (!isset($data['sign']) || !$data['sign']) {
|
||||
return false;
|
||||
}
|
||||
$sign = $data['sign'];
|
||||
unset($data['sign']);
|
||||
unset($data['sign_type']);
|
||||
$sign2 = $this->getSign($data, $this->key);
|
||||
if ($sign != $sign2) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function submit($type, $out_trade_no, $notify_url, $return_url, $name, $money, $sitename) {
|
||||
$data = ['pid' => $this->pid, 'type' => $type, 'out_trade_no' => $out_trade_no, 'notify_url' => $notify_url, 'return_url' => $return_url, 'name' => $name, 'money' => $money, 'sitename' => $sitename];
|
||||
$string = http_build_query($data);
|
||||
$keys = $this->ensy($string, $this->pid);
|
||||
$keyss = $this->base64url_encode($this->pid . '-' . $keys);
|
||||
$sign = substr($this->ensy($keyss, $this->key) , 0, 15);
|
||||
return 'https://' . $this->url . '/submit?skey=' . $keyss . '&sign=' . $sign . '&sign_type=MD5';
|
||||
}
|
||||
|
||||
private function getSign($data) {
|
||||
$data = array_filter($data);
|
||||
ksort($data);
|
||||
$str1 = '';
|
||||
foreach ($data as $k => $v) {
|
||||
$str1.= '&' . $k . "=" . $v;
|
||||
}
|
||||
$str = $str1 . $this->key;
|
||||
$str = trim($str, '&');
|
||||
$sign = md5($str);
|
||||
return $sign;
|
||||
}
|
||||
|
||||
public function ensy($data, $key) {
|
||||
$key = md5($key);
|
||||
$len = strlen($data);
|
||||
$code = '';
|
||||
for ($i = 0; $i < ceil($len / 32); $i++) {
|
||||
for ($j = 0; $j < 32; $j++) {
|
||||
$p = $i * 32 + $j;
|
||||
if ($p < $len) {
|
||||
$code.= $data{$p} ^ $key{$j};
|
||||
}
|
||||
}
|
||||
}
|
||||
$code = str_replace(array(
|
||||
'+',
|
||||
'/',
|
||||
'='
|
||||
) , array(
|
||||
'_',
|
||||
'$',
|
||||
''
|
||||
) , base64_encode($code));
|
||||
return $code;
|
||||
}
|
||||
public function base64url_encode($data) {
|
||||
return rtrim(strtr(base64_encode($data) , '+/', '-_') , '=');
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Administrator
|
||||
* Date: 2019/10/10
|
||||
* Time: 17:05
|
||||
*/
|
||||
|
||||
namespace App\Services\Gateway;
|
||||
class YftPayConfig{
|
||||
public $pay_config;
|
||||
public function init()
|
||||
{
|
||||
$this->pay_config = [
|
||||
"return_url" => "/user/code",
|
||||
"type" => "aliPay"
|
||||
];
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,239 @@
|
||||
<?php
|
||||
namespace App\Services\Gateway;
|
||||
use App\Services\View;
|
||||
use App\Services\Auth;
|
||||
use App\Services\Config;
|
||||
use App\Models\Paylist;
|
||||
|
||||
class Pays
|
||||
{
|
||||
private $pid;
|
||||
private $key;
|
||||
|
||||
public function __construct($pid, $key)
|
||||
{
|
||||
$this->pid = $pid;
|
||||
$this->key = $key;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Note 支付发起
|
||||
* @param $type 支付方式
|
||||
* @param $out_trade_no 订单号
|
||||
* @param $notify_url 异步通知地址
|
||||
* @param $return_url 回调通知地址
|
||||
* @param $name 商品名称
|
||||
* @param $money 金额
|
||||
* @param $sitename 站点名称
|
||||
* @return string
|
||||
*/
|
||||
public function submit($type, $out_trade_no, $notify_url, $return_url, $name, $money, $sitename)
|
||||
{
|
||||
$data = [
|
||||
'pid' => $this->pid,
|
||||
'type' => $type,
|
||||
'out_trade_no' => $out_trade_no,
|
||||
'notify_url' => $notify_url,
|
||||
'return_url' => $return_url,
|
||||
'name' => $name,
|
||||
'money' => $money,
|
||||
'sitename' => $sitename
|
||||
];
|
||||
$string = http_build_query($data);
|
||||
$sign = $this->getsign($data);
|
||||
return 'https://api.jxspay.cn/submit/?' . $string . '&sign=' . $sign . '&sign_type=MD5';
|
||||
}
|
||||
|
||||
/**
|
||||
* @Note 验证签名
|
||||
* @param $data 待验证参数
|
||||
* @return bool
|
||||
*/
|
||||
public function verify($data)
|
||||
{
|
||||
if (!isset($data['sign']) || !$data['sign']) {
|
||||
return false;
|
||||
}
|
||||
$sign = $data['sign'];
|
||||
unset($data['sign']);
|
||||
unset($data['sign_type']);
|
||||
$sign2 = $this->getSign($data, $this->key);
|
||||
if ($sign != $sign2) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Note 生成签名
|
||||
* @param $data 参与签名的参数
|
||||
* @return string
|
||||
*/
|
||||
private function getSign($data)
|
||||
{
|
||||
$data = array_filter($data);
|
||||
ksort($data);
|
||||
$str1 = '';
|
||||
foreach ($data as $k => $v) {
|
||||
$str1 .= '&' . $k . "=" . $v;
|
||||
}
|
||||
$str = $str1 . $this->key;
|
||||
$str = trim($str, '&');
|
||||
$sign = md5($str);
|
||||
return $sign;
|
||||
}
|
||||
}
|
||||
class flyfoxpay extends AbstractPayment
|
||||
{
|
||||
|
||||
public function purchase($request, $response, $args)
|
||||
{
|
||||
$type = $request->getParam('type');
|
||||
$price = $request->getParam('price');
|
||||
if($price <= 0){
|
||||
return json_encode(['errcode'=>-1,'errmsg'=>"非法的金额."]);
|
||||
}
|
||||
$user = Auth::getUser();
|
||||
$settings = Config::get("flyfoxpay")['config'];
|
||||
$pl = new Paylist();
|
||||
$pl->userid = $user->id;
|
||||
$pl->total = $price;
|
||||
$pl->tradeno = self::generateGuid();
|
||||
$pl->save();
|
||||
$return='https://'.$_SERVER['HTTP_HOST'].'/flyfoxpay_back/'.$type;
|
||||
$pay = new Pays($settings['hid'], $settings['key']);
|
||||
|
||||
//支付方式
|
||||
$type = 'all';
|
||||
|
||||
//订单号
|
||||
$out_trade_no = $pl->tradeno;
|
||||
|
||||
//异步通知地址
|
||||
$notify_url = $return;
|
||||
|
||||
//回调通知地址
|
||||
$return_url = $return;
|
||||
|
||||
//商品名称
|
||||
$name = 'SS商品-'.$_SERVER['HTTP_HOST'];
|
||||
|
||||
//支付金额(保留小数点后两位)
|
||||
$money = $price;
|
||||
|
||||
//站点名称
|
||||
$sitename = $_SERVER['HTTP_HOST'];
|
||||
|
||||
//发起支付
|
||||
$url = $pay->submit($type, $out_trade_no, $notify_url, $return_url, $name, $money, $sitename);
|
||||
|
||||
$result = "<script language='javascript' type='text/javascript'>window.location.href='".$url."';</script>";
|
||||
$result = json_encode(array('code'=>$url,'errcode'=>0,'pid' =>$pl->id));
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function notify($request, $response, $args)
|
||||
{
|
||||
$type = $args['type'];
|
||||
$settings = Config::get("flyfoxpay")['config'];
|
||||
$security['orderid'] = $_REQUEST['out_trade_no'];
|
||||
if($security['orderid']=='' OR $security['orderid']==null){header("Location: /user/code");}else{
|
||||
//实例化支付类
|
||||
$pay = new Pays($settings['hid'], $settings['key']);
|
||||
|
||||
//接收异步通知数据
|
||||
$data = $_GET;
|
||||
|
||||
//商户订单号
|
||||
$out_trade_no = $data['out_trade_no'];
|
||||
|
||||
//验证签名
|
||||
if ($pay->verify($data)) {
|
||||
//验证支付状态
|
||||
if ($data['trade_status'] == 'TRADE_SUCCESS') {
|
||||
$this->postPayment($data['out_trade_no'], "在线支付");
|
||||
header("Location: /user/code");
|
||||
//这里就可以放心的处理您的业务流程了
|
||||
//您可以通过上面的商户订单号进行业务流程处理
|
||||
}
|
||||
} else {
|
||||
echo '錯誤';
|
||||
}
|
||||
}}
|
||||
public function getPurchaseHTML()
|
||||
{
|
||||
return '
|
||||
<div class="card-inner">
|
||||
<p class="card-heading">充值</p>
|
||||
<h5>支付方式:</h5>
|
||||
<nav class="tab-nav margin-top-no">
|
||||
<ul class="nav nav-list">
|
||||
|
||||
<li>
|
||||
<a class="waves-attach waves-effect type active" data-toggle="tab" data-pay="wxpay">聚合支付</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
<div class="tab-nav-indicator"></div>
|
||||
</nav>
|
||||
<div class="form-group form-group-label">
|
||||
<label class="floating-label" for="amount">金额</label>
|
||||
<input class="form-control" id="amount" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-action">
|
||||
<div class="card-action-btn pull-left">
|
||||
<button class="btn btn-flat waves-attach" id="code-updates" ><span class="icon">check</span> 充值</button>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var type = "wxpay";
|
||||
var pid = 0;
|
||||
$(".type").click(function(){
|
||||
type = $(this).data("pay");
|
||||
});
|
||||
$("#code-updates").click(function(){
|
||||
var price = parseFloat($("#amount").val());
|
||||
console.log("将要使用"+type+"方法充值"+price+"元")
|
||||
if(isNaN(price)){
|
||||
$("#result").modal();
|
||||
$("#msg").html("非法的金额!");
|
||||
}
|
||||
$.ajax({
|
||||
\'url\':"/user/payment/purchase",
|
||||
\'data\':{
|
||||
\'price\':price,
|
||||
\'type\':type,
|
||||
},
|
||||
\'dataType\':\'json\',
|
||||
\'type\':"POST",
|
||||
success:function(data){
|
||||
console.log(data);
|
||||
if(data.errcode==-1){
|
||||
$("#result").modal();
|
||||
$("#msg").html(data.errmsg);
|
||||
}
|
||||
if(data.errcode==0){
|
||||
pid = data.pid;
|
||||
if(type=="wxpay"){
|
||||
$("#result").modal();
|
||||
$("#msg").html("正在跳转到支付系統..."+data.code);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
';
|
||||
}
|
||||
public function getReturnHTML($request, $response, $args)
|
||||
{
|
||||
|
||||
}
|
||||
public function getStatus($request, $response, $args)
|
||||
{
|
||||
// TODO: Implement getStatus() method.
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Utils\Cookie;
|
||||
|
||||
class Internationalization
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->lang = MalioConfig::get('default_lang');
|
||||
}
|
||||
|
||||
public function detectLang($request, $response, $args)
|
||||
{
|
||||
$user = Auth::getUser();
|
||||
if ($user->isLogin == true && $user->lang != null) {
|
||||
$lang = $user->lang;
|
||||
} else {
|
||||
$cookie = Cookie::get('lang');
|
||||
if ($cookie != null || $cookie != '') {
|
||||
$lang = $cookie;
|
||||
} else {
|
||||
$accept_language = $request->getHeader('Accept-Language');
|
||||
$accept_language = strtolower($accept_language[0]);
|
||||
$accept_language = explode(";",$accept_language)[0];
|
||||
$accept_language = explode(",",$accept_language)[0];
|
||||
if (strpos($accept_language, 'zh') !== false) {
|
||||
if (strpos($accept_language, 'cn') !== false || strpos($accept_language, 'sg') !== false) {
|
||||
$lang = 'zh-cn';
|
||||
} elseif (strpos($accept_language, 'tw') !== false || strpos($accept_language, 'hk') !== false) {
|
||||
$lang = 'zh-cn';
|
||||
} else {
|
||||
$lang = 'zh-cn';
|
||||
}
|
||||
} else if (strpos($accept_language, 'en') !== false) {
|
||||
$lang = 'en';
|
||||
}
|
||||
|
||||
if ($lang == null) {
|
||||
$lang = MalioConfig::get('default_lang');
|
||||
}
|
||||
|
||||
Cookie::set([
|
||||
'lang' => $lang
|
||||
],'1775445251');
|
||||
}
|
||||
}
|
||||
|
||||
$this->lang = $lang;
|
||||
return $lang;
|
||||
}
|
||||
|
||||
public function get($name, $args=null) {
|
||||
global $I18N;
|
||||
if ($args == null){
|
||||
return $I18N[$name][$this->lang];
|
||||
} else {
|
||||
$counter = 1;
|
||||
$text = $I18N[$name][$this->lang];
|
||||
foreach ($args as $arg) {
|
||||
$text = str_replace("$".$counter, $arg, $text);
|
||||
$counter += 1;
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
}
|
||||
|
||||
public static function getPublicConfig()
|
||||
{
|
||||
global $I18N;
|
||||
return $I18N;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
class MalioConfig
|
||||
{
|
||||
public static function get($key)
|
||||
{
|
||||
global $Malio_Config;
|
||||
return $Malio_Config[$key];
|
||||
}
|
||||
|
||||
public static function getPublicConfig()
|
||||
{
|
||||
global $Malio_Config;
|
||||
return $Malio_Config;
|
||||
}
|
||||
}
|
||||
@ -1,39 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use Slim\App;
|
||||
use Zeuxisoo\Whoops\Provider\Slim\WhoopsMiddleware;
|
||||
|
||||
/***
|
||||
* The slim documents: http://www.slimframework.com/docs/objects/router.html
|
||||
*/
|
||||
class Slim
|
||||
{
|
||||
public $app;
|
||||
|
||||
public function newApp()
|
||||
{
|
||||
// config
|
||||
$debug = false;
|
||||
if (defined('DEBUG')) {
|
||||
$debug = true;
|
||||
}
|
||||
|
||||
// Make a Slim App
|
||||
$app = new App([
|
||||
'settings' => [
|
||||
'debug' => $debug,
|
||||
'whoops.editor' => 'sublime',
|
||||
'displayErrorDetails' => $debug
|
||||
]
|
||||
]);
|
||||
$app->add(new WhoopsMiddleware());
|
||||
$this->app = $app;
|
||||
}
|
||||
|
||||
public function run()
|
||||
{
|
||||
$this->app->run();
|
||||
}
|
||||
}
|
||||
@ -1,14 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Token;
|
||||
|
||||
use App\Models\User;
|
||||
|
||||
abstract class Base
|
||||
{
|
||||
abstract public function store($token, User $user, $expireTime);
|
||||
|
||||
abstract public function delete($token);
|
||||
|
||||
abstract public function get($token);
|
||||
}
|
||||
@ -1,49 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Services\Token;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Models\Token as TokenModel;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
|
||||
class DB extends Base
|
||||
{
|
||||
public function store($tokenStr, User $user, $expireTime)
|
||||
{
|
||||
$token = new TokenModel();
|
||||
$token->token = $tokenStr;
|
||||
$token->user_id = $user->id;
|
||||
$token->create_time = time();
|
||||
$token->expire_time = $expireTime;
|
||||
if ($token->save()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function delete($token)
|
||||
{
|
||||
$token = TokenModel::where('token', $token)->first();
|
||||
if ($token == null) {
|
||||
return false;
|
||||
}
|
||||
$token->delete();
|
||||
return true;
|
||||
}
|
||||
|
||||
public function get($token)
|
||||
{
|
||||
try {
|
||||
$tokenModel = TokenModel::where('token', $token)->firstOrFail();
|
||||
} catch (ModelNotFoundException $e) {
|
||||
return null;
|
||||
}
|
||||
$token = new Token();
|
||||
$token->token = $tokenModel->token;
|
||||
$token->userId = $tokenModel->user_id;
|
||||
$token->createTime = $tokenModel->create_time;
|
||||
$token->expireTime = $tokenModel->expire_time;
|
||||
return $token;
|
||||
}
|
||||
}
|
||||
@ -1,60 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Token;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Services\Aws\Factory;
|
||||
|
||||
class Dynamodb extends Base
|
||||
{
|
||||
protected $client;
|
||||
|
||||
protected $tableName = 'token';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->client = Factory::createDynamodb();
|
||||
$this->tableName = 'token';
|
||||
}
|
||||
|
||||
public function store($token, User $user, $expireTime)
|
||||
{
|
||||
$result = $this->client->putItem(array(
|
||||
'TableName' => $this->tableName,
|
||||
'Item' => array(
|
||||
'token' => array('S' => $token),
|
||||
'user_id' => array('N' => (string)$user->id),
|
||||
'create_time' => array('N' => (string)time()),
|
||||
'expire_time' => array('N' => (string)$expireTime)
|
||||
)
|
||||
));
|
||||
return true;
|
||||
}
|
||||
|
||||
public function delete($token)
|
||||
{
|
||||
$this->client->deleteItem(array(
|
||||
'TableName' => $this->tableName,
|
||||
'Key' => array(
|
||||
'token' => array('S' => $token),
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
public function get($token)
|
||||
{
|
||||
$result = $this->client->getItem(array(
|
||||
'ConsistentRead' => true,
|
||||
'TableName' => $this->tableName,
|
||||
'Key' => array(
|
||||
'token' => array('S' => $token),
|
||||
)
|
||||
));
|
||||
$token = new Token();
|
||||
$token->token = $result['Item']['token']['S'];
|
||||
$token->userId = $result['Item']['user_id']['N'];
|
||||
$token->createTime = $result['Item']['create_time']['N'];
|
||||
$token->expireTime = $result['Item']['expire_time']['N'];
|
||||
return $token;
|
||||
}
|
||||
}
|
||||
@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Services\Token;
|
||||
|
||||
class Token
|
||||
{
|
||||
public $token;
|
||||
public $userId;
|
||||
public $createTime;
|
||||
public $expireTime;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue