610 Commits

Author SHA1 Message Date
as2252258 895988cf27 update composer.json.
Signed-off-by: 向林 <as2252258@163.com>
2025-12-23 02:29:27 +00:00
as2252258 87c597c3fe update composer.json.
xxx

Signed-off-by: 向林 <as2252258@163.com>
2025-12-23 02:24:07 +00:00
as2252258 f536b12f00 eee 2025-07-14 18:34:14 +08:00
as2252258 d3b0f436fa eee 2025-07-14 15:35:56 +08:00
as2252258 f5b6bd54f4 eee 2025-07-08 11:43:14 +08:00
as2252258 59a3b45c77 eee 2025-02-24 17:10:45 +08:00
as2252258 dd96d653d1 eee 2025-02-24 17:08:40 +08:00
as2252258 97d1c32310 eee 2025-02-24 16:30:57 +08:00
as2252258 d7733525bc eee 2025-02-24 16:29:54 +08:00
as2252258 62e57b99a0 eee 2025-02-18 11:53:54 +08:00
as2252258 24655a4644 eee 2025-02-18 09:09:32 +08:00
as2252258 4ca64c8205 eee 2025-02-17 16:26:32 +08:00
as2252258 d9dbfb3ca6 eee 2024-06-03 11:58:53 +08:00
as2252258 1ff0203511 eee 2024-06-03 11:41:26 +08:00
as2252258 561b105d31 eee 2024-06-03 11:11:48 +08:00
as2252258 3d423acec2 eee 2024-06-03 11:07:46 +08:00
as2252258 d76680a7a2 eee 2024-06-03 10:53:51 +08:00
as2252258 aeb4f3d7fb eee 2024-05-07 14:42:30 +08:00
as2252258 a3aa8e8ac3 eee 2024-05-07 14:41:14 +08:00
as2252258 de4f58d3e3 eee 2024-05-07 14:38:47 +08:00
as2252258 76bf8cc2fc eee 2024-02-09 17:01:54 +08:00
as2252258 d9713d00e7 eee 2024-02-09 17:00:41 +08:00
as2252258 0c89617b00 eee 2023-12-18 21:56:04 +08:00
as2252258 d16adba08e eee 2023-12-12 15:35:37 +08:00
as2252258 6438d8affb eee 2023-12-06 17:29:16 +08:00
as2252258 857237c2bc eee 2023-12-06 17:21:31 +08:00
as2252258 faccc08c86 eee 2023-12-06 17:19:29 +08:00
as2252258 b1cf009069 eee 2023-12-06 17:03:51 +08:00
as2252258 4ea7c71bbb eee 2023-12-06 17:03:01 +08:00
as2252258 5516f78983 eee 2023-12-06 17:01:57 +08:00
as2252258 03e8d0e181 eee 2023-12-06 16:56:55 +08:00
as2252258 7550d6dcfc eee 2023-12-06 16:56:09 +08:00
as2252258 8af14d1b3b eee 2023-12-06 16:54:38 +08:00
as2252258 3e7de322df eee 2023-12-06 16:54:15 +08:00
as2252258 9b13746b02 eee 2023-12-06 16:53:39 +08:00
as2252258 d8214fe810 eee 2023-12-06 16:50:53 +08:00
as2252258 e76f4a7b95 eee 2023-12-06 16:44:46 +08:00
as2252258 441f3fed31 eee 2023-12-06 16:43:46 +08:00
as2252258 246ca43a83 eee 2023-12-06 16:42:49 +08:00
as2252258 4303983818 eee 2023-12-06 16:39:11 +08:00
as2252258 4f3eed59a0 eee 2023-12-06 16:37:52 +08:00
as2252258 daa4034e39 eee 2023-12-01 17:14:48 +08:00
as2252258 6c1e4dbbae eee 2023-11-23 13:54:13 +08:00
as2252258 581da74115 eee 2023-11-23 09:15:19 +08:00
as2252258 e7220b6aba eee 2023-11-14 14:14:42 +08:00
as2252258 70222819b9 eee 2023-11-14 14:10:36 +08:00
as2252258 f263014948 eee 2023-11-14 12:41:17 +08:00
as2252258 f92fdab692 eee 2023-11-14 12:39:28 +08:00
as2252258 c3326a9b5a eee 2023-11-14 10:45:52 +08:00
as2252258 a962c00223 eee 2023-11-14 10:45:18 +08:00
as2252258 09cb764dad eee 2023-11-14 10:24:18 +08:00
as2252258 2f67a0145e eee 2023-11-14 10:10:11 +08:00
as2252258 64749d2365 eee 2023-11-14 09:48:20 +08:00
as2252258 2114f08eda eee 2023-11-14 09:37:58 +08:00
as2252258 21303e5363 eee 2023-11-14 09:31:14 +08:00
as2252258 a0fc4d5a30 eee 2023-11-14 09:29:44 +08:00
as2252258 dfc59ab88d eee 2023-11-14 09:28:25 +08:00
as2252258 4f2b9367ae eee 2023-11-14 09:20:29 +08:00
as2252258 93dc51b02c eee 2023-11-14 01:39:18 +08:00
as2252258 77aa01185b eee 2023-11-14 01:12:03 +08:00
as2252258 a6a2a0f472 eee 2023-11-14 01:08:06 +08:00
as2252258 0d8ddfef54 eee 2023-11-14 00:45:54 +08:00
as2252258 e721fe4f36 eee 2023-11-14 00:15:27 +08:00
as2252258 fbdbcbccd9 eee 2023-11-14 00:07:18 +08:00
as2252258 c97302ae76 eee 2023-11-14 00:06:57 +08:00
as2252258 d64ffe4b07 eee 2023-11-13 23:52:41 +08:00
as2252258 494a7e48c0 eee 2023-11-13 23:36:03 +08:00
as2252258 0eb8aab1d2 eee 2023-11-13 22:59:34 +08:00
as2252258 ac4c6c1e27 eee 2023-11-13 22:57:36 +08:00
as2252258 e010910a25 eee 2023-11-13 22:42:26 +08:00
as2252258 f35f3e69a6 eee 2023-11-13 22:37:49 +08:00
as2252258 e8bd6f3ae0 eee 2023-11-13 22:14:14 +08:00
as2252258 59456a4759 eee 2023-11-13 22:13:44 +08:00
as2252258 0d1cb506aa eee 2023-11-13 21:20:10 +08:00
as2252258 90c65a8c5f Default Changelist 2023-11-07 17:26:26 +08:00
as2252258 693ec4fa65 Default Changelist 2023-11-07 16:48:59 +08:00
as2252258 389f5261c7 Default Changelist 2023-11-07 16:33:09 +08:00
as2252258 cf03ebd6dc Default Changelist 2023-11-07 16:31:30 +08:00
as2252258 e0d1811a00 Default Changelist 2023-11-07 16:29:44 +08:00
as2252258 1a78bdb173 Default Changelist 2023-11-07 16:26:06 +08:00
as2252258 c5f8b19a83 Default Changelist 2023-11-07 16:14:59 +08:00
as2252258 227ff1c166 Default Changelist 2023-11-07 16:14:09 +08:00
as2252258 b8960deda5 Default Changelist 2023-11-07 16:09:40 +08:00
as2252258 ac70bd3df5 Default Changelist 2023-11-07 16:07:57 +08:00
as2252258 9264f05a49 Default Changelist 2023-11-07 16:01:11 +08:00
as2252258 a2dc66ec84 Default Changelist 2023-11-07 15:59:17 +08:00
as2252258 d0a6787b85 Default Changelist 2023-11-07 15:56:53 +08:00
as2252258 7f2bdbdb4f Default Changelist 2023-11-07 15:55:50 +08:00
as2252258 459d298983 Default Changelist 2023-11-07 15:39:46 +08:00
as2252258 a876b780f5 Default Changelist 2023-11-07 15:17:59 +08:00
as2252258 885c902be8 Default Changelist 2023-11-07 15:14:25 +08:00
as2252258 43f504b2ad Default Changelist 2023-11-07 15:13:11 +08:00
as2252258 dbdae7c6c5 Default Changelist 2023-11-07 14:02:43 +08:00
as2252258 b87232bbc0 Default Changelist 2023-11-07 13:48:18 +08:00
as2252258 d9528679ff Default Changelist 2023-11-07 13:48:04 +08:00
as2252258 09544ee4a2 Default Changelist 2023-08-18 20:24:15 +08:00
as2252258 a7c6939a9f Default Changelist 2023-08-18 19:59:46 +08:00
as2252258 0578ba384b Default Changelist 2023-08-18 19:58:45 +08:00
as2252258 7abbaaca46 Default Changelist 2023-08-18 19:50:25 +08:00
as2252258 d574ce2c42 Default Changelist 2023-08-18 19:47:48 +08:00
as2252258 2275ed92d1 Default Changelist 2023-08-18 17:47:42 +08:00
as2252258 48467b88ce Default Changelist 2023-08-18 17:40:46 +08:00
as2252258 e87728266b Default Changelist 2023-08-18 16:59:47 +08:00
as2252258 ae67dce77b Default Changelist 2023-08-18 16:58:36 +08:00
as2252258 2ff7ceb66b Default Changelist 2023-08-18 16:57:32 +08:00
as2252258 c74c3b004b Default Changelist 2023-08-18 15:34:49 +08:00
as2252258 b92ea7df9f Default Changelist 2023-08-18 15:31:47 +08:00
as2252258 72a7c58bc4 Default Changelist 2023-07-20 17:42:42 +08:00
as2252258 e1959752e1 Default Changelist 2023-07-18 00:24:58 +08:00
as2252258 361ad4538f Default Changelist 2023-07-18 00:19:13 +08:00
as2252258 90e05b1892 Default Changelist 2023-07-13 08:59:23 +08:00
as2252258 b66d1de244 Default Changelist 2023-07-11 21:04:33 +08:00
as2252258 191624b7e6 Default Changelist 2023-07-11 16:16:41 +08:00
as2252258 88917d55c3 Default Changelist 2023-05-29 14:38:00 +08:00
as2252258 7273fe1ce5 add clear 2022-09-09 16:42:55 +08:00
as2252258 ad76b45b45 add clear 2021-04-06 16:56:01 +08:00
as2252258 66db166fc6 add clear 2021-04-06 16:43:50 +08:00
as2252258 5d227c619c add clear 2021-04-06 16:41:19 +08:00
as2252258 4efbdf8631 add clear 2021-04-06 16:41:02 +08:00
as2252258 6ccc1a8c1f add clear 2021-04-06 16:39:14 +08:00
as2252258 c412df7252 add clear 2021-04-06 16:35:08 +08:00
as2252258 0569d1d752 add clear 2021-04-06 16:34:39 +08:00
as2252258 f5b14a4565 add clear 2021-04-06 16:33:49 +08:00
as2252258 10f3d5b99f add clear 2021-04-06 16:17:31 +08:00
as2252258 18d898a438 add clear 2021-04-06 16:01:32 +08:00
as2252258 61a226bc0f add clear 2021-04-06 16:00:27 +08:00
as2252258 820132e5bc add clear 2021-04-06 15:51:33 +08:00
as2252258 b06f893e57 add clear 2021-04-06 15:51:11 +08:00
as2252258 457d0ebd4e add clear 2021-04-06 15:50:37 +08:00
as2252258 50773cefad add clear 2021-04-06 15:49:46 +08:00
as2252258 74960d1df1 add clear 2021-04-06 15:43:10 +08:00
as2252258 e8ff51e8be add clear 2021-04-06 15:40:44 +08:00
as2252258 cf19d0ea15 add clear 2021-04-06 15:38:39 +08:00
as2252258 58c276eef9 add clear 2021-04-06 15:32:06 +08:00
as2252258 649817e9ef add clear 2021-04-06 15:31:18 +08:00
as2252258 fedc0bde24 add clear 2021-04-06 15:30:11 +08:00
as2252258 523ee91797 add clear 2021-04-06 15:28:44 +08:00
as2252258 589b92c152 add clear 2021-04-06 15:28:16 +08:00
as2252258 74847b2a2d add clear 2021-04-06 15:27:10 +08:00
as2252258 bdafc011a6 add clear 2021-04-06 15:20:39 +08:00
as2252258 80abb3a20a add clear 2021-04-06 15:15:37 +08:00
as2252258 092e355850 add clear 2021-03-17 16:52:36 +08:00
as2252258 80833aacb8 add clear 2021-02-05 12:50:20 +08:00
as2252258 075dcd3700 add clear 2021-02-05 12:49:09 +08:00
as2252258 6d141c60cf add clear 2021-02-05 12:41:44 +08:00
as2252258 512e62a442 add clear 2021-01-30 19:00:01 +08:00
as2252258 ed87844b7d add clear 2021-01-30 18:59:21 +08:00
as2252258 781d754d59 add clear 2021-01-30 18:57:39 +08:00
as2252258 16c728e697 add clear 2021-01-30 18:41:30 +08:00
as2252258 eec78ff4a8 add clear 2021-01-30 18:41:12 +08:00
as2252258 9f0d07b224 add clear 2021-01-30 18:39:06 +08:00
as2252258 6d4d6cdfb4 add clear 2021-01-30 18:12:16 +08:00
as2252258 18536c575f add clear 2021-01-30 18:05:48 +08:00
as2252258 49b671afa4 add clear 2021-01-30 17:39:30 +08:00
as2252258 b6f7c0b840 add clear 2021-01-30 17:33:53 +08:00
as2252258 59ac8f97bb add clear 2021-01-30 17:32:42 +08:00
as2252258 ee82e3b592 add clear 2021-01-30 17:29:35 +08:00
as2252258 ae3c9ea077 add clear 2021-01-30 17:28:59 +08:00
as2252258 4b088296b3 add clear 2021-01-30 17:20:31 +08:00
as2252258 80ead6d2bb add clear 2020-12-02 18:55:12 +08:00
as2252258 b6668b815d add clear 2020-12-02 18:52:30 +08:00
as2252258 f9a37089f7 add clear 2020-12-02 18:51:52 +08:00
as2252258 3ca162fa85 add clear 2020-12-02 18:50:42 +08:00
as2252258 ce0255b2c5 add clear 2020-12-02 18:50:30 +08:00
as2252258 aec9c53e5a add clear 2020-12-02 18:49:18 +08:00
as2252258 2898481696 add clear 2020-12-02 18:47:49 +08:00
as2252258 8d9c41b9e2 add clear 2020-11-25 18:32:11 +08:00
as2252258 6fd5e530fb add clear 2020-11-25 18:25:22 +08:00
as2252258 41393ef343 add clear 2020-11-25 17:29:46 +08:00
as2252258 1e507f0e6c add clear 2020-11-25 17:27:14 +08:00
as2252258 062f712862 add clear 2020-11-25 17:26:59 +08:00
as2252258 07803dd31a add clear 2020-11-25 16:55:23 +08:00
as2252258 8e1d54413a add clear 2020-11-25 16:47:43 +08:00
as2252258 b92fdeee39 add clear 2020-11-25 16:45:27 +08:00
as2252258 f174d9450e add clear 2020-11-25 16:26:42 +08:00
as2252258 f6b89da482 add clear 2020-11-25 11:05:58 +08:00
as2252258 87dd5dee46 add clear 2020-11-25 11:04:48 +08:00
as2252258 2c808dd27c add clear 2020-11-25 11:00:46 +08:00
as2252258 3f26f94ff4 add clear 2020-11-18 11:23:23 +08:00
as2252258 f6b28c0084 add clear 2020-11-18 11:19:05 +08:00
as2252258 4e2d39293e add clear 2020-11-16 16:27:13 +08:00
as2252258 da349413c2 add clear 2020-11-16 16:26:06 +08:00
as2252258 943a233724 add clear 2020-11-16 16:25:03 +08:00
as2252258 02cfc264f2 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	wchat/common/HttpClient.php
2020-11-16 16:24:42 +08:00
as2252258 f7d401b852 add clear 2020-11-16 16:24:10 +08:00
as2252258 837fc72a10 3 2020-11-14 03:14:44 +08:00
as2252258 016885ba16 3 2020-11-14 03:11:17 +08:00
as2252258 411bd5f017 3 2020-11-14 03:08:43 +08:00
as2252258 63d0639b85 3 2020-11-14 03:07:25 +08:00
as2252258 6e488f87b1 3 2020-11-14 03:06:42 +08:00
as2252258 8f8161a780 3 2020-11-14 03:05:25 +08:00
as2252258 13a56f3555 3 2020-11-14 03:04:25 +08:00
as2252258 8319fac4b7 3 2020-11-14 03:03:41 +08:00
as2252258 b556ebffa2 3 2020-11-14 02:36:05 +08:00
as2252258 7e3a959096 3 2020-11-14 02:33:13 +08:00
as2252258 650b4d9f19 3 2020-11-14 02:30:35 +08:00
as2252258 59e72de410 3 2020-11-14 02:28:41 +08:00
as2252258 6377d7e1ee 3 2020-11-14 02:19:24 +08:00
as2252258 e9d9b305eb 3 2020-11-14 02:18:27 +08:00
as2252258 02997c3476 3 2020-11-14 02:17:15 +08:00
as2252258 17da6239f3 3 2020-11-14 02:15:02 +08:00
as2252258 30b5ea5d3d add clear 2020-11-13 17:38:31 +08:00
as2252258 0c04c6fc05 add clear 2020-11-13 17:34:52 +08:00
as2252258 48da0a22bf add clear 2020-11-13 16:14:23 +08:00
as2252258 7def314478 add clear 2020-11-13 16:11:24 +08:00
as2252258 98723bcd4f add clear 2020-11-13 16:07:21 +08:00
as2252258 32faedd793 add clear 2020-11-13 16:06:38 +08:00
as2252258 774b16e372 add clear 2020-11-13 16:04:27 +08:00
as2252258 dc887b81e3 add clear 2020-11-13 15:59:45 +08:00
as2252258 c37a3995e9 add clear 2020-11-13 15:54:35 +08:00
as2252258 e3956048b2 add clear 2020-11-13 15:52:48 +08:00
as2252258 2ca01ea46f add clear 2020-11-13 15:47:45 +08:00
as2252258 b7e92ba514 add clear 2020-09-24 15:24:34 +08:00
as2252258 409eae7dc4 add clear 2020-09-24 11:53:16 +08:00
as2252258 c5468c95fc add clear 2020-09-24 11:47:35 +08:00
as2252258 b5a8102b72 add clear 2020-09-24 11:43:22 +08:00
as2252258 465e48ffe4 add clear 2020-09-24 11:42:16 +08:00
as2252258 03df0bfa4e add clear 2020-09-24 11:41:23 +08:00
as2252258 4d24fd7dde add clear 2020-09-24 11:40:48 +08:00
as2252258 401ef6aa18 add clear 2020-09-24 11:40:20 +08:00
as2252258 178a558b6d add clear 2020-09-24 11:39:26 +08:00
as2252258 95849babc7 add clear 2020-09-24 11:38:53 +08:00
as2252258 2f2950e944 add clear 2020-09-24 11:37:28 +08:00
as2252258 2b9bced512 add clear 2020-09-24 11:36:29 +08:00
as2252258 421c6ecf31 add clear 2020-09-24 11:33:28 +08:00
as2252258 c0ab8adfcb add clear 2020-09-10 17:25:46 +08:00
as2252258 0d202fce14 add clear 2020-09-10 17:08:50 +08:00
as2252258 bf18dd5951 add clear 2020-09-03 16:12:50 +08:00
as2252258 2d322ab0e9 add clear 2020-08-24 12:04:01 +08:00
as2252258 6c94ecc353 add clear 2020-08-24 11:59:31 +08:00
as2252258 bba7544942 add clear 2020-08-24 11:52:36 +08:00
as2252258 562f06cc49 add clear 2020-08-24 11:50:17 +08:00
as2252258 f8724a8c36 add clear 2020-08-24 11:49:25 +08:00
as2252258 f1c06d30e1 add clear 2020-08-24 11:48:11 +08:00
as2252258 5a27218ea7 add clear 2020-08-24 11:42:22 +08:00
as2252258 93579952b9 add clear 2020-08-24 11:42:09 +08:00
as2252258 b378d20826 add clear 2020-08-24 11:41:08 +08:00
as2252258 14bea139e9 add clear 2020-08-24 11:37:59 +08:00
as2252258 a8840aaae8 add clear 2020-08-24 11:34:18 +08:00
as2252258 65422f37fb add clear 2020-08-24 11:30:39 +08:00
as2252258 eaaec85239 add clear 2020-08-24 11:27:59 +08:00
as2252258 83742695c1 add clear 2020-08-24 11:23:30 +08:00
as2252258 efdae639b3 add clear 2020-08-24 11:13:49 +08:00
as2252258 d980695e0e add clear 2020-08-24 11:09:53 +08:00
as2252258 aae5f9cea3 add clear 2020-08-13 10:56:00 +08:00
as2252258 acd2583a20 add clear 2020-08-12 17:29:51 +08:00
as2252258 109db2e3c4 add clear 2020-08-12 17:22:19 +08:00
as2252258 7dbb749cce add clear 2020-08-12 17:16:42 +08:00
as2252258 b8f240d910 add clear 2020-08-12 17:16:09 +08:00
as2252258 aeb7a8c4b5 add clear 2020-08-10 11:19:52 +08:00
as2252258 e8c1f12fc8 add clear 2020-08-10 11:17:42 +08:00
as2252258 28a2b0b4f8 add clear 2020-07-30 17:17:46 +08:00
as2252258 7a8c869f6a add clear 2020-07-30 17:11:07 +08:00
as2252258 2e83dbc44f add clear 2020-07-30 17:09:48 +08:00
as2252258 7e58adf4ff add clear 2020-07-30 17:08:36 +08:00
as2252258 df40f74560 add clear 2020-07-30 16:58:05 +08:00
as2252258 7329a24577 add clear 2020-07-30 16:54:44 +08:00
as2252258 557c92a343 add clear 2020-07-30 16:49:30 +08:00
as2252258 2969eac00e add clear 2020-07-30 16:46:45 +08:00
as2252258 f218e12de3 add clear 2020-07-30 16:44:45 +08:00
as2252258 b6544dbb8e add clear 2020-07-30 16:43:54 +08:00
as2252258 6539c988e8 add clear 2020-05-27 16:30:12 +08:00
as2252258 74d55943cf add clear 2020-05-27 16:19:59 +08:00
as2252258 954cf6999c add clear 2020-05-27 16:19:04 +08:00
as2252258 1b9b6c4af6 add clear 2020-05-27 16:17:21 +08:00
as2252258 6f2852ecbf add clear 2020-05-27 16:15:06 +08:00
as2252258 e586437334 add clear 2020-05-27 16:00:09 +08:00
as2252258 ba578732b9 add clear 2020-05-27 15:58:49 +08:00
as2252258 4cd04c4f42 add clear 2020-05-27 15:54:22 +08:00
as2252258 455e0f9bcb add clear 2020-05-27 15:52:29 +08:00
as2252258 44627516e8 add clear 2020-05-27 15:51:10 +08:00
as2252258 b896ca4143 add clear 2020-05-27 15:49:19 +08:00
as2252258 1ab20dbae4 add clear 2020-05-27 15:41:51 +08:00
as2252258 01f8429110 add clear 2020-05-22 15:27:32 +08:00
as2252258 35696bb8fc add clear 2020-05-22 15:25:50 +08:00
as2252258 6c1c1a379b add clear 2020-05-22 15:21:47 +08:00
as2252258 9c415292a4 add clear 2020-05-22 15:17:24 +08:00
as2252258 0a3c8ad5c3 add clear 2020-05-22 15:16:32 +08:00
as2252258 4127dc283a add clear 2020-05-22 15:15:08 +08:00
as2252258 caf2960d4a add clear 2020-05-22 14:53:59 +08:00
as2252258 ebede84969 add clear 2020-05-21 18:18:36 +08:00
as2252258 bed2fe1093 add clear 2020-05-21 18:17:51 +08:00
as2252258 1e9555a3d6 add clear 2020-05-21 18:16:48 +08:00
as2252258 5475e2ba14 add clear 2020-05-21 17:14:04 +08:00
as2252258 3c5f02d52a add clear 2020-05-21 17:07:42 +08:00
as2252258 8152b1b85e add clear 2020-05-21 17:06:55 +08:00
as2252258 8952e72708 add clear 2020-05-21 17:05:29 +08:00
as2252258 296086a7ae add clear 2020-05-21 17:03:32 +08:00
as2252258 83a86a2a57 add clear 2020-05-21 16:42:42 +08:00
as2252258 403373db84 add clear 2020-05-21 16:15:15 +08:00
as2252258 758917bd0b add clear 2020-05-21 16:13:39 +08:00
as2252258 e3831ad4d8 add clear 2020-05-21 16:12:20 +08:00
as2252258 cf4c0259f7 add clear 2020-05-21 15:43:42 +08:00
as2252258 7b7020d66f add clear 2020-05-21 15:42:58 +08:00
as2252258 7e29cbb5ef add clear 2020-05-21 15:42:34 +08:00
as2252258 3cda6f409e add clear 2020-05-21 15:41:37 +08:00
as2252258 d4a4154643 add clear 2020-05-21 15:40:28 +08:00
as2252258 f626a73a37 add clear 2020-05-21 15:39:21 +08:00
as2252258 b8e4a80c3a add clear 2020-05-08 19:03:11 +08:00
as2252258 07df6767b4 add clear 2020-04-30 22:25:50 +08:00
as2252258 44146ad916 add clear 2020-04-30 22:09:08 +08:00
as2252258 7bda1dbcce add clear 2020-04-30 18:17:29 +08:00
as2252258 a7d2121bf0 add clear 2020-04-30 18:13:57 +08:00
as2252258 28918928c6 add clear 2020-04-30 18:12:52 +08:00
as2252258 69c27d8f2a add clear 2020-04-30 18:11:59 +08:00
as2252258 5b46609863 add clear 2020-04-30 18:10:26 +08:00
as2252258 15ad099c45 add clear 2020-04-30 18:08:43 +08:00
as2252258 6a61697c0d add clear 2020-04-13 20:34:02 +08:00
as2252258 ba4ae203b4 add clear 2020-04-13 20:33:31 +08:00
as2252258 1050b7f6bb add clear 2020-04-06 02:09:25 +08:00
as2252258 a4bab25b3b add clear 2020-04-06 02:07:44 +08:00
as2252258 d983f7785b add clear 2020-04-06 02:07:14 +08:00
as2252258 fa4aea6b2c add clear 2020-04-06 02:06:34 +08:00
as2252258 3f98508539 add clear 2020-04-06 02:05:22 +08:00
as2252258 e3d53af185 add clear 2020-04-05 23:41:18 +08:00
as2252258 5a42d843b9 add clear 2020-04-05 23:39:51 +08:00
as2252258 ac4db69cb3 add clear 2020-04-05 23:36:48 +08:00
as2252258 980edd9d8a add clear 2020-04-03 18:45:13 +08:00
as2252258 7ed51596da add clear 2020-04-03 18:41:06 +08:00
as2252258 06c93400b4 add clear 2020-04-03 18:39:35 +08:00
as2252258 10a29dafee add clear 2020-04-03 18:38:31 +08:00
as2252258 1d81d3e7f7 add clear 2020-04-03 18:35:22 +08:00
as2252258 4a1b152daa add clear 2020-04-03 18:34:52 +08:00
as2252258 4bbdf5622b add clear 2020-04-03 18:34:01 +08:00
as2252258 dbb41245ee add clear 2020-04-03 18:33:06 +08:00
as2252258 b2e46c64c6 add clear 2020-04-03 18:32:24 +08:00
as2252258 a67ecd7493 add clear 2020-04-03 18:31:29 +08:00
as2252258 f8103f93b9 add clear 2020-04-03 18:27:06 +08:00
as2252258 db6d6a0611 add clear 2020-04-03 17:54:13 +08:00
as2252258 2d08ed945a add clear 2020-04-03 17:53:17 +08:00
as2252258 04a86e3e17 add clear 2020-04-03 17:50:45 +08:00
as2252258 9d82b5399c add clear 2020-04-03 17:49:15 +08:00
as2252258 67acf5e750 add clear 2020-04-03 17:48:45 +08:00
as2252258 1f492a1521 add clear 2020-04-03 17:48:06 +08:00
as2252258 78348ae2f7 add clear 2020-04-03 17:47:22 +08:00
as2252258 5ee4e994c7 add clear 2020-04-03 17:46:43 +08:00
as2252258 a4f51ef586 add clear 2020-04-03 17:45:36 +08:00
as2252258 608a3b8639 add clear 2020-04-03 17:45:00 +08:00
as2252258 cb25fce004 add clear 2020-04-03 17:43:45 +08:00
as2252258 07a00bd4b0 add clear 2020-04-03 17:42:47 +08:00
as2252258 7bdbf14baf add clear 2020-04-03 17:41:14 +08:00
as2252258 cda357bc68 add clear 2020-04-03 17:40:47 +08:00
as2252258 dd32f8003a add clear 2020-04-03 17:39:54 +08:00
as2252258 b27f50d1e2 add clear 2020-04-03 17:39:12 +08:00
as2252258 e9b465fd20 add clear 2020-04-03 17:38:44 +08:00
as2252258 d8cae08cb0 add clear 2020-04-03 17:37:19 +08:00
as2252258 2d37e4e6d7 add clear 2020-04-03 17:35:56 +08:00
as2252258 92453ca02c add clear 2020-04-03 17:34:37 +08:00
as2252258 2a1bf128b1 add clear 2020-04-03 17:34:10 +08:00
as2252258 a826961afa add clear 2020-04-03 17:33:13 +08:00
as2252258 73c340844b add clear 2020-04-03 17:31:34 +08:00
as2252258 dc6eb2bae2 add clear 2020-04-03 17:30:48 +08:00
as2252258 94b8a217d5 add clear 2020-04-03 17:30:22 +08:00
as2252258 df41369095 add clear 2020-04-03 17:29:43 +08:00
as2252258 c7484da782 add clear 2020-04-03 17:28:55 +08:00
as2252258 6fc876f59d add clear 2020-04-03 17:27:30 +08:00
as2252258 339532536f add clear 2020-04-03 17:22:44 +08:00
as2252258 08878a7090 add clear 2020-04-03 17:18:21 +08:00
as2252258 2c2fe5d5a1 add clear 2020-04-03 17:12:03 +08:00
as2252258 92d7ba8ff5 add clear 2020-04-01 13:10:15 +08:00
as2252258 fa1c7b8363 add clear 2020-04-01 13:09:16 +08:00
as2252258 b460fd2518 add clear 2020-04-01 13:08:12 +08:00
as2252258 f022210d81 add clear 2020-04-01 13:00:22 +08:00
as2252258 9dd8ea2d0b add clear 2020-04-01 11:53:15 +08:00
as2252258 7eeaef4c3b add clear 2020-03-31 16:15:01 +08:00
as2252258 796ed52624 add clear 2020-03-31 16:14:43 +08:00
as2252258 7ee32b10b6 add clear 2020-03-31 16:10:49 +08:00
as2252258 cdc74e59a9 add clear 2020-03-31 15:20:31 +08:00
as2252258 424634ee2b add clear 2020-03-31 15:14:35 +08:00
as2252258 7f04bc8af7 add clear 2020-03-31 15:13:16 +08:00
as2252258 30bb2cf1c5 add clear 2020-03-31 15:08:37 +08:00
as2252258 b4a6ed706f add clear 2020-03-31 15:07:30 +08:00
as2252258 156ef4db41 add clear 2020-03-31 15:06:46 +08:00
as2252258 e9c21d404a add clear 2020-03-31 15:06:15 +08:00
as2252258 5d510cadb6 add clear 2020-03-31 15:00:38 +08:00
as2252258 2ea3bd28c8 add clear 2020-03-31 14:59:18 +08:00
as2252258@163.com 809246f50e add clear 2020-03-17 13:01:47 +08:00
as2252258@163.com a7bce22f0c add clear 2020-03-17 13:01:26 +08:00
as2252258@163.com f7128047f4 add clear 2020-03-16 19:40:10 +08:00
as2252258@163.com 9d5b7b5101 add clear 2020-03-16 19:38:48 +08:00
as2252258@163.com aa8b93799b add clear 2020-03-16 19:37:00 +08:00
as2252258@163.com f6daf53a58 add clear 2020-03-16 19:36:14 +08:00
as2252258@163.com f08bf962b1 add clear 2020-03-16 19:33:28 +08:00
as2252258@163.com 29758ebf52 add clear 2020-03-16 19:29:59 +08:00
as2252258@163.com cdf806a390 add clear 2020-03-16 19:29:02 +08:00
as2252258@163.com def9dbb297 add clear 2020-03-16 19:28:29 +08:00
as2252258@163.com 350016e83a add clear 2020-03-16 19:27:32 +08:00
as2252258@163.com 4b87f485b6 add clear 2020-03-16 19:26:57 +08:00
as2252258@163.com ba796bc373 add clear 2020-03-16 19:26:26 +08:00
as2252258@163.com d32b6e85ec add clear 2020-03-16 19:25:29 +08:00
as2252258@163.com 937a5ae22c add clear 2020-03-16 19:24:07 +08:00
as2252258@163.com e3a1b3e777 add clear 2020-03-16 19:20:15 +08:00
as2252258@163.com 331dcaa325 add clear 2020-03-16 19:16:32 +08:00
as2252258@163.com e572352208 add clear 2020-03-16 18:55:29 +08:00
as2252258@163.com d7189c3db8 add clear 2020-03-16 18:55:02 +08:00
as2252258@163.com 760ccec8a0 add clear 2020-03-16 18:52:25 +08:00
as2252258@163.com 50d2cbcd24 add clear 2020-03-16 18:49:18 +08:00
as2252258@163.com 5a4968d3b1 add clear 2020-03-16 17:26:38 +08:00
as2252258@163.com 74df55e7aa add clear 2020-03-11 16:48:22 +08:00
as2252258@163.com 73e08b1c0d add clear 2020-03-11 16:43:57 +08:00
as2252258@163.com 572e1b592a add clear 2020-03-11 16:41:18 +08:00
as2252258@163.com e0feb1c891 add clear 2020-03-11 16:41:08 +08:00
as2252258@163.com 5087d6d306 add clear 2020-03-11 16:38:14 +08:00
as2252258@163.com a88b42a26d add clear 2020-03-10 16:17:57 +08:00
as2252258@163.com 535d3b3e82 add clear 2020-03-10 16:09:59 +08:00
as2252258@163.com ea822241a1 add clear 2020-03-10 16:05:13 +08:00
as2252258@163.com c8ead691e6 add clear 2020-03-09 16:20:25 +08:00
as2252258@163.com ac3d99b4d9 add clear 2020-03-09 16:19:23 +08:00
as2252258@163.com 3f2a69a05b add clear 2020-03-09 16:05:48 +08:00
as2252258@163.com ef89db4c65 add clear 2020-03-09 16:01:10 +08:00
as2252258@163.com 347a67ffc5 add clear 2020-03-09 15:59:49 +08:00
as2252258@163.com 5217b1e535 add clear 2020-03-09 15:59:16 +08:00
as2252258@163.com 4718d4d4a2 add clear 2020-03-09 15:58:25 +08:00
as2252258@163.com 1d3abdf9f0 add clear 2020-03-09 15:58:01 +08:00
as2252258@163.com 12d55949c7 add clear 2020-03-09 15:57:32 +08:00
as2252258@163.com ea2f69e224 add clear 2020-03-09 15:55:34 +08:00
as2252258@163.com 294303298e add clear 2020-03-09 15:54:24 +08:00
as2252258@163.com 03b08f79fe add clear 2020-03-09 15:52:20 +08:00
as2252258@163.com 81e9fe4b54 add clear 2020-03-09 15:51:03 +08:00
as2252258@163.com 0f954c111f add clear 2020-03-05 13:16:04 +08:00
as2252258@163.com 291e882069 add clear 2020-03-05 12:41:49 +08:00
as2252258@163.com 0a16cc14e4 add clear 2020-03-05 12:36:55 +08:00
as2252258@163.com 56cc706c67 add clear 2020-01-13 17:32:04 +08:00
as2252258@163.com c645d63f97 add clear 2020-01-13 16:51:04 +08:00
as2252258@163.com 53030480ea add clear 2020-01-13 16:50:13 +08:00
as2252258@163.com 6e270b760c add clear 2020-01-13 16:48:29 +08:00
as2252258@163.com 6318a796eb add clear 2020-01-10 20:00:19 +08:00
as2252258@163.com 93b178e855 add clear 2020-01-10 19:58:39 +08:00
as2252258@163.com fe99e03799 add clear 2020-01-10 19:57:20 +08:00
as2252258@163.com 82d7e48604 add clear 2020-01-10 19:56:19 +08:00
as2252258@163.com e8175a650a add clear 2020-01-10 19:55:30 +08:00
as2252258@163.com 79d9295f6b add clear 2020-01-10 19:55:03 +08:00
as2252258@163.com b290c3dc77 add clear 2020-01-10 19:54:03 +08:00
as2252258@163.com dfec642731 add clear 2020-01-10 19:52:54 +08:00
as2252258@163.com eaca17753a add clear 2020-01-10 19:52:11 +08:00
as2252258@163.com cf9a45b410 add clear 2020-01-10 19:47:52 +08:00
as2252258@163.com 85069f1f70 add clear 2020-01-10 19:45:01 +08:00
as2252258@163.com f746766fc6 add clear 2020-01-10 19:43:53 +08:00
as2252258@163.com cdd881d694 add clear 2020-01-10 19:41:58 +08:00
as2252258@163.com 7c9981c63d add clear 2020-01-10 19:38:20 +08:00
as2252258@163.com adb2c7d3e1 add clear 2020-01-10 19:37:23 +08:00
as2252258@163.com ea1f27bd21 add clear 2020-01-10 19:34:09 +08:00
as2252258@163.com d17392ffb8 add clear 2020-01-09 19:13:47 +08:00
as2252258@163.com 2682cdacf8 add clear 2020-01-09 19:13:31 +08:00
as2252258@163.com 889d8a438c add clear 2020-01-09 19:12:45 +08:00
as2252258@163.com ace3d67552 add clear 2020-01-09 19:12:00 +08:00
as2252258@163.com deb06e20a6 add clear 2020-01-09 19:10:44 +08:00
as2252258@163.com 9780ee345b add clear 2020-01-09 19:09:41 +08:00
as2252258@163.com 744f464db4 add clear 2020-01-09 19:05:39 +08:00
as2252258@163.com baf07b7ab2 add clear 2020-01-09 18:57:08 +08:00
as2252258@163.com ab2e7e3900 add clear 2020-01-09 18:55:30 +08:00
as2252258@163.com 583630d0ca add clear 2020-01-07 14:46:50 +08:00
as2252258@163.com ea6c53796a add clear 2020-01-07 14:29:21 +08:00
as2252258@163.com 8a3f8ac479 add clear 2020-01-07 14:18:26 +08:00
as2252258@163.com 67d27159f3 add clear 2020-01-07 14:16:15 +08:00
as2252258@163.com c34c78320b add clear 2020-01-07 14:15:35 +08:00
as2252258@163.com fbe3aa4ff7 add clear 2020-01-07 14:15:01 +08:00
as2252258@163.com e07f50ac98 add clear 2020-01-07 14:12:56 +08:00
as2252258@163.com 049462cfb4 add clear 2020-01-07 14:11:34 +08:00
as2252258@163.com d4826968eb add clear 2020-01-07 14:10:53 +08:00
as2252258@163.com 7885d0f572 add clear 2020-01-07 14:10:16 +08:00
as2252258@163.com 114d783c63 add clear 2020-01-07 14:09:25 +08:00
as2252258@163.com 4c08a2dcce add clear 2020-01-07 14:08:42 +08:00
as2252258@163.com 0f3f86dfa2 add clear 2020-01-07 14:07:18 +08:00
as2252258@163.com 28557514b0 add clear 2020-01-07 14:06:35 +08:00
as2252258@163.com ccb6ed6c08 add clear 2020-01-07 14:05:44 +08:00
as2252258@163.com 22196b5c62 add clear 2020-01-07 14:03:05 +08:00
as2252258@163.com 0b10b3568a add clear 2020-01-07 13:00:29 +08:00
as2252258@163.com 4be259587c add clear 2020-01-07 12:59:38 +08:00
as2252258@163.com 2a2b163188 add clear 2020-01-07 12:57:24 +08:00
as2252258@163.com 0eb014d511 add clear 2020-01-07 12:55:55 +08:00
as2252258@163.com 48adcda749 add clear 2020-01-07 12:54:27 +08:00
as2252258@163.com d586e2aee2 add clear 2020-01-07 12:35:04 +08:00
as2252258@163.com 40ac73f40f add clear 2020-01-07 12:22:17 +08:00
as2252258@163.com fec5a10e32 add clear 2020-01-07 12:21:01 +08:00
as2252258@163.com ee3f729fc4 add clear 2020-01-07 12:19:27 +08:00
as2252258@163.com 4764db18c5 add clear 2020-01-07 12:18:24 +08:00
as2252258@163.com 2753f555b3 add clear 2020-01-07 12:13:58 +08:00
as2252258@163.com 155b1374b5 add clear 2020-01-07 12:11:00 +08:00
as2252258@163.com 07b7886bd7 add clear 2020-01-07 12:05:27 +08:00
as2252258@163.com 8d4f278c6c add clear 2020-01-07 12:03:31 +08:00
as2252258@163.com 7b13db2330 add clear 2020-01-07 12:02:55 +08:00
as2252258@163.com e13a898a54 add clear 2020-01-07 11:57:56 +08:00
as2252258@163.com 40f73f7df8 add clear 2020-01-07 11:44:45 +08:00
as2252258@163.com 8a40496206 add clear 2020-01-03 18:48:20 +08:00
as2252258@163.com 3bca09cfe2 add clear 2020-01-03 18:44:15 +08:00
as2252258@163.com 4cbb26c8aa add clear 2020-01-03 18:43:40 +08:00
as2252258@163.com 048b864f9e add clear 2020-01-03 18:43:10 +08:00
as2252258@163.com c8130cb02c add clear 2020-01-03 18:42:18 +08:00
as2252258@163.com 93be947fc8 add clear 2020-01-03 18:38:53 +08:00
as2252258@163.com 85728ef47a add clear 2020-01-03 18:37:29 +08:00
as2252258@163.com 6c74fd5fae add clear 2020-01-03 18:34:23 +08:00
as2252258@163.com 483b1f6da2 add clear 2020-01-03 18:32:41 +08:00
as2252258@163.com 564cd968e5 add clear 2020-01-03 15:38:45 +08:00
as2252258@163.com df89d8e544 add clear 2020-01-03 15:36:53 +08:00
as2252258@163.com 91878579b6 add clear 2020-01-03 15:36:18 +08:00
as2252258@163.com 18d58c7182 add clear 2020-01-03 15:35:28 +08:00
as2252258@163.com 540b15ceba add clear 2020-01-03 15:34:51 +08:00
as2252258@163.com ff93c07540 add clear 2020-01-03 15:33:23 +08:00
as2252258@163.com 213451e345 add clear 2020-01-03 15:32:26 +08:00
as2252258@163.com 2ab9714f96 add clear 2020-01-03 15:15:00 +08:00
as2252258@163.com 0417e76c26 add clear 2020-01-03 15:14:06 +08:00
as2252258@163.com 9c7a23d802 add clear 2020-01-03 15:12:57 +08:00
as2252258@163.com e435a3888b add clear 2020-01-03 15:12:06 +08:00
as2252258@163.com f7863891c2 add clear 2020-01-03 15:09:19 +08:00
as2252258@163.com 42365a696d add clear 2020-01-03 15:06:47 +08:00
as2252258@163.com f35f42944f add clear 2020-01-03 15:06:08 +08:00
as2252258@163.com f0a0cd586a add clear 2020-01-03 14:50:07 +08:00
as2252258@163.com 2cc181bf7b add clear 2020-01-03 11:56:06 +08:00
as2252258@163.com d89a05bc07 add clear 2020-01-03 11:55:14 +08:00
as2252258@163.com f52d8ff4a8 add clear 2020-01-03 11:48:51 +08:00
as2252258@163.com 089f52c585 add clear 2020-01-03 11:47:29 +08:00
as2252258@163.com c9d7f52845 add clear 2020-01-03 11:46:51 +08:00
as2252258@163.com 5ef309de4e add clear 2020-01-03 11:45:48 +08:00
as2252258@163.com 36875f19e0 add clear 2020-01-03 11:45:29 +08:00
as2252258@163.com f01c5e35d8 add clear 2020-01-03 11:44:31 +08:00
as2252258@163.com da21f45554 add clear 2020-01-03 11:43:20 +08:00
as2252258@163.com 2ca6eb7b41 add clear 2020-01-03 11:41:02 +08:00
as2252258@163.com 0220bb69b0 add clear 2020-01-03 11:39:57 +08:00
as2252258@163.com 44dd66dc6b add clear 2020-01-03 11:38:53 +08:00
as2252258@163.com 72055c6591 add clear 2020-01-03 11:37:36 +08:00
as2252258@163.com 145e680740 add clear 2020-01-03 11:36:39 +08:00
as2252258@163.com 9934adad01 add clear 2020-01-03 11:27:57 +08:00
as2252258@163.com f7fe347ec3 add clear 2020-01-02 14:26:39 +08:00
as2252258@163.com 70d0de22ef add clear 2020-01-02 11:48:20 +08:00
as2252258@163.com 77a925ccc7 add clear 2020-01-02 11:45:56 +08:00
as2252258@163.com 224bd81184 add clear 2019-12-25 16:32:54 +08:00
as2252258@163.com 9f87d4f8f9 add clear 2019-12-19 15:57:51 +08:00
as2252258@163.com 5fcbf18271 add clear 2019-12-19 15:00:25 +08:00
as2252258@163.com 3d16592366 add clear 2019-12-19 12:17:56 +08:00
as2252258@163.com b140617f23 add clear 2019-12-19 10:56:14 +08:00
as2252258@163.com f453f98b38 add clear 2019-12-19 10:55:15 +08:00
as2252258@163.com 6156ef2cb4 add clear 2019-12-19 10:53:19 +08:00
as2252258@163.com dea36a9be5 add clear 2019-12-19 10:51:57 +08:00
as2252258@163.com 2745650d39 add clear 2019-12-19 10:51:30 +08:00
as2252258@163.com 96bc5a4d8b add clear 2019-12-19 10:51:00 +08:00
as2252258@163.com 77417cdf5a add clear 2019-12-19 10:47:06 +08:00
as2252258@163.com 824969968c add clear 2019-12-19 10:45:21 +08:00
as2252258@163.com 11745b8b66 add clear 2019-12-19 10:43:56 +08:00
as2252258@163.com 7db7ad1ea0 add clear 2019-12-19 10:43:18 +08:00
as2252258@163.com 976b936396 add clear 2019-12-19 10:42:20 +08:00
as2252258@163.com 7c849555f4 add clear 2019-12-19 10:41:42 +08:00
as2252258@163.com b6690c18d5 add clear 2019-12-19 10:39:04 +08:00
as2252258@163.com 3284a0922e add clear 2019-12-19 10:38:04 +08:00
as2252258@163.com 97df0910ec add clear 2019-12-19 10:36:56 +08:00
as2252258@163.com daba7fe499 add clear 2019-12-18 20:08:51 +08:00
as2252258@163.com 6148a56126 add clear 2019-12-18 20:02:47 +08:00
as2252258@163.com f68080387a add clear 2019-12-18 19:58:00 +08:00
as2252258@163.com 496d2a95aa add clear 2019-12-12 14:08:05 +08:00
as2252258@163.com 6ae53dc7d4 add clear 2019-12-12 12:25:05 +08:00
as2252258@163.com 775cdeab7c add clear 2019-12-12 12:17:44 +08:00
as2252258@163.com 6df3d38880 add clear 2019-12-12 12:05:22 +08:00
as2252258@163.com 6677193b35 add clear 2019-12-12 12:04:25 +08:00
as2252258@163.com 4ed83cb6d8 add clear 2019-12-02 17:53:08 +08:00
as2252258@163.com f7893e08ae add clear 2019-12-02 17:07:04 +08:00
as2252258@163.com fa8008d6d8 add clear 2019-11-11 18:29:09 +08:00
as2252258@163.com 7f138ef255 add clear 2019-11-11 18:14:47 +08:00
as2252258@163.com 62a2326e23 add clear 2019-11-04 14:46:37 +08:00
as2252258@163.com 8eb5922d10 add clear 2019-11-04 14:39:59 +08:00
as2252258@163.com dbfbbf75b0 add clear 2019-11-04 14:18:33 +08:00
as2252258@163.com ddaf80a14d add clear 2019-10-29 10:20:12 +08:00
as2252258@163.com af316b799b add clear 2019-10-25 15:29:10 +08:00
as2252258@163.com 4784354c22 add clear 2019-10-25 15:20:52 +08:00
as2252258@163.com 4a3a3a5091 add clear 2019-10-25 15:20:09 +08:00
as2252258@163.com 7011a4569d add clear 2019-10-22 14:02:44 +08:00
as2252258@163.com 27d8b60845 add clear 2019-10-22 13:57:09 +08:00
as2252258@163.com b2bf378b7f add clear 2019-10-18 10:40:38 +08:00
as2252258@163.com b2d477f0cf add clear 2019-09-29 17:10:14 +08:00
as2252258@163.com f2dc33fca4 add clear 2019-09-19 19:04:43 +08:00
as2252258@163.com d605600657 add clear 2019-09-19 18:58:46 +08:00
as2252258@163.com 6ff5ecc853 add clear 2019-09-19 18:34:06 +08:00
as2252258@163.com 09776fc906 add clear 2019-09-04 14:08:01 +08:00
as2252258@163.com c9d0f86620 add clear 2019-09-04 14:06:50 +08:00
as2252258@163.com 33de57b515 add clear 2019-08-29 18:25:42 +08:00
as2252258@163.com 678543151f add clear 2019-08-29 18:13:55 +08:00
as2252258@163.com e0925d86c5 add clear 2019-08-29 18:07:11 +08:00
as2252258@163.com 658b951fe9 add clear 2019-08-29 18:06:19 +08:00
as2252258@163.com 7aa22e2e62 add clear 2019-08-29 18:05:46 +08:00
as2252258@163.com 31d75529bc add clear 2019-08-29 18:00:53 +08:00
as2252258@163.com f13a0e80ff add clear 2019-08-29 17:59:29 +08:00
as2252258@163.com df23a0ecf4 add clear 2019-08-29 17:57:02 +08:00
as2252258@163.com ea3790579c add clear 2019-08-29 17:54:51 +08:00
as2252258@163.com aa513a397f add clear 2019-08-29 17:52:02 +08:00
as2252258@163.com 447390a87b add clear 2019-08-29 17:44:51 +08:00
as2252258@163.com b1524a7eaf add clear 2019-08-29 17:40:42 +08:00
as2252258@163.com a4071f1ad8 add clear 2019-08-29 16:14:46 +08:00
as2252258@163.com a376fe8f4f add clear 2019-08-29 15:53:21 +08:00
as2252258@163.com aaae917b72 add clear 2019-08-29 14:48:09 +08:00
as2252258@163.com d7953bc801 add clear 2019-08-29 11:32:58 +08:00
as2252258@163.com 26e691fec8 add clear 2019-08-21 13:37:26 +08:00
as2252258@163.com 00f046fba1 add clear 2019-08-21 13:34:03 +08:00
as2252258@163.com ad78b85ea0 add clear 2019-08-21 13:27:12 +08:00
as2252258@163.com a4e504e5e3 add clear 2019-08-21 13:23:11 +08:00
as2252258@163.com 706088998b add clear 2019-08-21 13:22:22 +08:00
as2252258@163.com cf52645c42 add clear 2019-08-21 13:20:56 +08:00
as2252258@163.com 8e27dc41e5 add clear 2019-08-21 12:13:02 +08:00
as2252258@163.com 5202270073 add clear 2019-08-21 12:11:36 +08:00
as2252258@163.com 93e763c880 add clear 2019-08-21 11:55:42 +08:00
as2252258@163.com 6136633a83 add clear 2019-08-21 11:54:20 +08:00
as2252258@163.com fa67c60088 add clear 2019-08-19 16:17:45 +08:00
as2252258@163.com fecac0e850 add clear 2019-08-19 16:14:36 +08:00
as2252258@163.com 1b89cd61ae add clear 2019-08-19 16:13:24 +08:00
as2252258@163.com a1c85376e1 add clear 2019-08-19 16:07:44 +08:00
as2252258@163.com c323b97112 add clear 2019-08-19 15:51:29 +08:00
as2252258@163.com 663bf23ebd add clear 2019-07-19 19:11:12 +08:00
as2252258@163.com d769ba0aaa add clear 2019-07-19 18:09:58 +08:00
as2252258@163.com e44b1c0989 add clear 2019-07-19 18:09:42 +08:00
as2252258@163.com b24d18dc55 add clear 2019-07-19 17:53:54 +08:00
as2252258@163.com cc87f8b440 Merge remote-tracking branch 'origin/master' 2019-07-19 17:50:59 +08:00
as2252258@163.com 4de90eff88 add clear 2019-07-19 17:50:49 +08:00
59 changed files with 5167 additions and 1983 deletions
+1
View File
@@ -1,3 +1,4 @@
/.idea/php.xml
vendor/
composer.lock
.idea/*
+22
View File
@@ -0,0 +1,22 @@
<?php
namespace PHPSTORM_META {
// Reflect
use Kiri\Di\Container;
use Kiri\Di\ContainerInterface;
use wchat\wx\QqFactory;
use wchat\wx\WxFactory;
override(ContainerInterface::get(0), map('@'));
override(Container::get(0), map('@'));
override(WxFactory::get(0), map('@'));
override(QqFactory::get(0), map('@'));
override(Container::make(0), map('@'));
override(Container::create(0), map('@'));
// override(\Hyperf\Utils\Context::get(0), map('@'));
// override(\make(0), map('@'));
override(\di(0), map('@'));
override(\duplicate(0), map('@'));
}
+1 -1
View File
@@ -7,7 +7,7 @@
```php
$config = new \wchat\Config();
$config = new \common\Config();
$config->setAppid('');
$config->setAppsecret('');
$config->setMchId('');
+197
View File
@@ -0,0 +1,197 @@
<?php
namespace wchat\base;
use Kiri\Client;
use wchat\common\Multiprogramming;
use wchat\common\Result;
/**
* Class Subject
* @package wchat\base
*/
abstract class Subject extends Multiprogramming
{
private array $keywords = [];
private string $templateId = '';
private string $openId = '';
private string $page = 'pages/index/index';
private string $emphasis_keyword = '';
private string $oac_appid = '';
private string $use_robot = '';
/**
* @param array $keywords
*/
public function setKeywords(array $keywords): void
{
$this->keywords = $keywords;
}
/**
* @param $templateId
*/
public function setTemplateId($templateId): void
{
$this->templateId = $templateId;
}
/**
* @param $openId
*/
public function setOpenId($openId): void
{
$this->openId = $openId;
}
/**
* @param $page
*/
public function setPage($page): void
{
$this->page = $page;
}
/**
* @param $emphasis_keyword
*/
public function setEmphasisKeyword($emphasis_keyword): void
{
$this->emphasis_keyword = $emphasis_keyword;
}
/**
* @param $index
* @param $context
* @param string $color
*/
public function replaceKeyword($index, $context, string $color = ''): void
{
if (empty($color)) {
$color = '#000';
}
$this->keywords['keyword' . $index] = [
'value' => $context,
'color' => $color
];
}
/**
* @param $color
* @param $context
*/
public function addKeyword($context, $color = null): void
{
if (empty($color)) {
$color = '#000';
}
$this->keywords['keyword' . (count($this->keywords) + 1)] = [
'value' => $context,
'color' => $color
];
}
abstract public function getUrl();
abstract public function getHost();
/**
* @return string
*/
public function getOacAppid(): string
{
return $this->oac_appid;
}
/**
* @param string $oac_appid
*/
public function setOacAppid(string $oac_appid): void
{
$this->oac_appid = $oac_appid;
}
/**
* @return string
*/
public function getUseRobot(): string
{
return $this->use_robot;
}
/**
* @param string $use_robot
*/
public function setUseRobot(string $use_robot): void
{
$this->use_robot = $use_robot;
}
/**
* @return Result
* @throws
*/
public function sendTemplate(): Result
{
$access_token = $this->payConfig->getAccessToken();
if (empty($access_token)) {
throw new \Exception('request access_token con\'t null.');
}
$params = [
"touser" => $this->openId,
"template_id" => $this->templateId,
"page" => $this->page,
"data" => $this->keywords,
];
if (!empty($this->emphasis_keyword)) {
$params['emphasis_keyword'] = $this->emphasis_keyword;
}
if (!empty($this->oac_appid)) {
$params['oac_appid'] = $this->oac_appid;
}
if (!empty($this->use_robot)) {
$params['use_robot'] = $this->use_robot;
}
$this->reset();
$client = new Client($this->getHost(), 443, true);
$client->withHeader(['Content-Type' => 'application/json; charset=utf-8']);
$proxyHost = $this->payConfig->getProxyHost();
$proxyPort = $this->payConfig->getProxyPort();
if (!empty($proxyHost) && $proxyPort > 0) {
$client->withProxyHost($proxyHost)->withProxyPort($proxyPort);
}
$client->post($this->getUrl() . '?access_token=' . $access_token, $params);
$client->close();
if (!in_array($client->getStatusCode(), [101, 200, 201])) {
return new Result(code: 505, message: $client->getBody());
}
$body = json_decode($client->getBody(), true);
if (isset($body['errcode']) && $body['errcode'] != 0) {
return new Result(code: $body['errcode'], message: $body['errmsg']);
} else {
return new Result(code: 0, data: $body);
}
}
/**
* @return void
*/
public function reset(): void
{
$this->openId = '';
$this->keywords = [];
$this->templateId = '';
$this->page = '';
}
}
+168
View File
@@ -0,0 +1,168 @@
<?php
namespace wchat\base;
use Kiri\Client;
use wchat\common\Multiprogramming;
use wchat\common\Result;
/**
* Class Template
*/
abstract class Template extends Multiprogramming
{
private array $keywords = [];
private string $templateId = '';
private string $formId = '';
private string $openId = '';
private string $page = 'pages/index/index';
private string $emphasis_keyword = '';
/**
* @param array $keywords
*/
public function setKeywords(array $keywords): void
{
$this->keywords = $keywords;
}
/**
* @param $templateId
*/
public function setTemplateId($templateId): void
{
$this->templateId = $templateId;
}
/**
* @param $formId
*/
public function setFormId($formId): void
{
$this->formId = $formId;
}
/**
* @param $openId
*/
public function setOpenId($openId): void
{
$this->openId = $openId;
}
/**
* @param $page
*/
public function setPage($page): void
{
$this->page = $page;
}
/**
* @param $emphasis_keyword
*/
public function setEmphasisKeyword($emphasis_keyword): void
{
$this->emphasis_keyword = $emphasis_keyword;
}
/**
* @param $index
* @param $context
* @param string $color
*/
public function replaceKeyword($index, $context, string $color = ''): void
{
if (empty($color)) {
$color = '#000';
}
$this->keywords['keyword' . $index] = [
'value' => $context,
'color' => $color
];
}
/**
* @param $color
* @param $context
*/
public function addKeyword($context, $color = null): void
{
if (empty($color)) {
$color = '#000';
}
$this->keywords['keyword' . (count($this->keywords) + 1)] = [
'value' => $context,
'color' => $color
];
}
abstract public function getUrl();
abstract public function getHost();
/**
* @return Result
* @throws
*
* 奴隶交易通知
*/
public function sendTemplate(): Result
{
$access_token = $this->payConfig->getAccessToken();
if (empty($access_token)) {
throw new \Exception('request access_token con\'t null.');
}
$params = [
"touser" => $this->openId,
"template_id" => $this->templateId,
"page" => $this->page,
"form_id" => $this->formId,
"data" => $this->keywords,
];
if (!empty($this->emphasis_keyword)) {
$params['emphasis_keyword'] = $this->emphasis_keyword;
}
$this->reset();
$client = new Client($this->getHost(), 443, true);
$client->withHeader(['Content-Type' => 'application/json; charset=utf-8']);
$proxyHost = $this->payConfig->getProxyHost();
$proxyPort = $this->payConfig->getProxyPort();
if (!empty($proxyHost) && $proxyPort > 0) {
$client->withProxyHost($proxyHost)->withProxyPort($proxyPort);
}
$client->post($this->getUrl() . '?access_token=' . $access_token, $params);
$client->close();
if (!in_array($client->getStatusCode(), [101, 200, 201])) {
return new Result(code: 505, message: $client->getBody());
}
$body = json_decode($client->getBody(), true);
if (isset($body['errcode']) && $body['errcode'] != 0) {
return new Result(code: $body['errcode'], message: $body['errmsg']);
}
return new Result(code: 0, data: $body);
}
/**
* @return void
*/
private function reset(): void
{
$this->openId = '';
$this->keywords = [];
$this->formId = '';
$this->templateId = '';
$this->page = '';
}
}
+260
View File
@@ -0,0 +1,260 @@
<?php
namespace wchat\common;
use JetBrains\PhpStorm\ArrayShape;
use wchat\common\libs\Aliyun;
use wchat\common\libs\Qq;
use wchat\common\libs\Wx;
class AppConfig
{
const int TYPE_WCHAT_PROJECT = 0;
const int TYPE_ALI_GAME_OR_APPLET = 3;
const int TYPE_QQ_GAME_OR_APPLET = 1;
const int TYPE_APP_PROJECT = 2;
/**
* @var string
*/
public string $appId = '';
/**
* @var string
*/
private string $host = '';
/**
* @var string
*/
public string $appSecret = '';
/**
* @var PayConfig
*/
public PayConfig $pay;
private string $proxyHost = '';
private int $proxyPort = 0;
private string $notifyUrl = '';
private string $body = '';
private string $currency = 'CNY';
private string $remoteIp = '';
private string $accessToken = '';
private string $tradeType = 'JSAPI';
private string $signType = 'MD5';
/**
* @var int
*/
public int $type;
/**
* @var array|string[]
*/
#[ArrayShape(['token' => 'string', 'secret' => 'string', 'unionId' => 'string'])]
public array $notice = ['token' => '', 'secret' => '', 'unionId' => ''];
public function __construct()
{
$this->pay = new PayConfig();
$this->pay->wx = new Wx();
$this->pay->qq = new Qq();
$this->pay->ali = new Aliyun();
}
/**
* @param object $app
* @return static
*/
public static function instance(object $app): static
{
$model = new static();
$model->appId = $app->appId;
$model->appSecret = $app->appSecret;
$model->type = $app->type;
PayConfig::parse($app->pay, $model->pay);
return $model;
}
/**
* @return bool
*/
public function typeIsApp(): bool
{
return $this->type === self::TYPE_APP_PROJECT;
}
/**
* @return string
*/
public function getProxyHost(): string
{
return $this->proxyHost;
}
/**
* @param string $proxyHost
*/
public function setProxyHost(string $proxyHost): void
{
$this->proxyHost = $proxyHost;
}
/**
* @return int
*/
public function getProxyPort(): int
{
return $this->proxyPort;
}
/**
* @param int $proxyPort
*/
public function setProxyPort(int $proxyPort): void
{
$this->proxyPort = $proxyPort;
}
/**
* @return string
*/
public function getNotifyUrl(): string
{
return $this->notifyUrl;
}
/**
* @param string $notifyUrl
*/
public function setNotifyUrl(string $notifyUrl): void
{
$this->notifyUrl = $notifyUrl;
}
/**
* @return string
*/
public function getBody(): string
{
return $this->body;
}
/**
* @param string $body
*/
public function setBody(string $body): void
{
$this->body = $body;
}
/**
* @return string
*/
public function getCurrency(): string
{
return $this->currency;
}
/**
* @param string $currency
*/
public function setCurrency(string $currency): void
{
$this->currency = $currency;
}
/**
* @return string
*/
public function getRemoteIp(): string
{
return $this->remoteIp;
}
/**
* @param string $remoteIp
*/
public function setRemoteIp(string $remoteIp): void
{
$this->remoteIp = $remoteIp;
}
/**
* @return string
*/
public function getAccessToken(): string
{
return $this->accessToken;
}
/**
* @param string $accessToken
*/
public function setAccessToken(string $accessToken): void
{
$this->accessToken = $accessToken;
}
/**
* @return string
*/
public function getTradeType(): string
{
return $this->tradeType;
}
/**
* @param string $tradeType
*/
public function setTradeType(string $tradeType): void
{
$this->tradeType = $tradeType;
}
/**
* @return string
*/
public function getSignType(): string
{
return $this->signType;
}
/**
* @param string $signType
*/
public function setSignType(string $signType): void
{
$this->signType = $signType;
}
/**
* @return string
*/
public function getHost(): string
{
return $this->host;
}
/**
* @param string $host
*/
public function setHost(string $host): void
{
$this->host = $host;
}
}
+117
View File
@@ -0,0 +1,117 @@
<?php
namespace wchat\common;
class Decode
{
private string $sessionKey;
private string $iv;
private string $encryptedData;
private string $appId;
private int $OK = 0;
private int $IllegalAesKey = -41001;
private int $IllegalIv = -41002;
private int $IllegalBuffer = -41003;
private int $DecodeBase64Error = -41004;
/**
* @return string
*/
public function getSessionKey(): string
{
return $this->sessionKey;
}
/**
* @param string $sessionKey
*/
public function setSessionKey(string $sessionKey): void
{
$this->sessionKey = $sessionKey;
}
/**
* @return string
*/
public function getIv(): string
{
return $this->iv;
}
/**
* @param string $iv
*/
public function setIv(string $iv): void
{
$this->iv = $iv;
}
/**
* @return string
*/
public function getEncryptedData(): string
{
return $this->encryptedData;
}
/**
* @param string $encryptedData
*/
public function setEncryptedData(string $encryptedData): void
{
$this->encryptedData = $encryptedData;
}
/**
* @return string
*/
public function getAppId(): string
{
return $this->appId;
}
/**
* @param string $appId
*/
public function setAppId(string $appId): void
{
$this->appId = $appId;
}
/**
* @param $asArray
* @return array|mixed
* @throws \Exception
*/
public function decode($asArray): object|array
{
if (strlen($this->sessionKey) != 24) {
throw new \Exception('encodingAesKey 非法', $this->IllegalAesKey);
}
$aesKey = base64_decode($this->sessionKey);
if (strlen($this->iv) != 24) {
throw new \Exception('base64解密失败', $this->IllegalIv);
}
$aesIV = base64_decode($this->iv);
$aesCipher = base64_decode($this->encryptedData);
$result = openssl_decrypt($aesCipher, "AES-128-CBC", $aesKey, OPENSSL_RAW_DATA, $aesIV);
if ($result === false) {
throw new \Exception('aes 解密失败', $this->IllegalBuffer);
}
$dataObj = json_decode($result);
if ($dataObj->watermark->appid != $this->appId) {
throw new \Exception('aes 解密失败', $this->IllegalBuffer);
}
return $asArray ? get_object_vars($dataObj) : $dataObj;
}
}
+161
View File
@@ -0,0 +1,161 @@
<?php
namespace wchat\common;
class Help extends Multiprogramming
{
/**
* @param array $data
* @return string
*/
public static function toXml(array $data): string
{
$xml = "<xml>";
foreach ($data as $key => $val) {
if (is_array($val)) {
$xml .= "<" . $key . ">" . static::xmlChild($val) . "</" . $key . ">";
continue;
}
if (is_numeric($val)) {
$xml .= "<" . $key . ">" . $val . "</" . $key . ">";
} else {
$xml .= "<" . $key . "><![CDATA[" . $val . "]]></" . $key . ">";
}
}
$xml .= "</xml>";
return $xml;
}
/**
* @param array $array
* @return string
*/
private static function xmlChild(array $array): string
{
$string = '';
foreach ($array as $key => $value) {
if (is_array($value)) {
$string .= static::xmlChild($value);
continue;
}
if (is_numeric($value)) {
$string .= "<" . $key . ">" . $value . "</" . $key . ">";
} else {
$string .= "<" . $key . "><![CDATA[" . $value . "]]></" . $key . ">";
}
}
return $string;
}
/**
* @param $xml
* @return array|null
*/
public static function toArray($xml): ?array
{
if (is_array($xml)) return $xml;
if (str_starts_with('<', $xml) && str_ends_with('>', $xml)) {
return self::xmlToArray($xml);
} else {
return self::jsonToArray($xml);
}
}
/**
* @param string $xml
* @return array|null
*/
public static function jsonToArray(string $xml): ?array
{
return json_decode($xml, true);
}
/**
* @param string $xml
* @return array|null
*/
public static function xmlToArray(string $xml): ?array
{
if (($data = @simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA)) !== false) {
return json_decode(json_encode($data), TRUE);
}
return null;
}
/**
* @param mixed $json
* @return string
*/
public static function toJson(mixed $json): string
{
if (is_object($json)) {
$json = get_object_vars($json);
}
if (is_array($json)) {
return json_encode($json, JSON_UNESCAPED_UNICODE);
}
$matchQuote = '/(<\?xml.*?\?>)?<([a-zA-Z_]+)>(<([a-zA-Z_]+)><!.*?><\/\4>)+<\/\2>/';
if (preg_match($matchQuote, $json)) {
$json = self::xmlToArray($json);
} else {
$json = json_decode($json, true);
}
if (!is_array($json)) {
$json = [];
}
return json_encode($json, JSON_UNESCAPED_UNICODE);
}
/**
* @param int $length
* @return string
*
* 随机字符串
*/
public static function random(int $length = 20): string
{
$res = [];
$str = 'abcdefghijklmnopqrstuvwxyz';
$str .= strtoupper($str) . '1234567890';
for ($i = 0; $i < $length; $i++) {
$rand = substr($str, rand(0, strlen($str) - 2), 1);
if (empty($rand)) {
$rand = substr($str, strlen($str) - 3, 1);
}
$res[] = $rand;
}
return implode($res);
}
/**
* @param array $array
* @param $key
* @param $type
* @return string
*/
public static function sign(array $array, $key, $type): string
{
ksort($array);
$buff = "";
foreach ($array as $k => $v) {
if ($k != "sign" && $v != "" && !is_array($v)) {
$buff .= $k . "=" . $v . "&";
}
}
$string = trim($buff, "&") . '&key=' . $key;
if (strtoupper($type) == 'MD5') {
return strtoupper(md5($string));
} else {
return hash_hmac('sha256', $string, $key);
}
}
}
+161
View File
@@ -0,0 +1,161 @@
<?php
/**
* Created by PhpStorm.
* User: whwyy
* Date: 2018/3/26 0026
* Time: 10:23
*/
namespace wchat\common;
use Kiri\Client;
abstract class Multiprogramming implements Progaram
{
protected static ?Multiprogramming $instance = null;
protected int $errorCode = 0;
protected string $errorMsg = '';
/**
* @var AppConfig
*/
protected AppConfig $payConfig;
/**
* @param $message
* @param int $code
* @return Result
*/
protected function sendError($message, int $code = 500): Result
{
return new Result(code: $code, message: $message);
}
/**
* @param $code
*/
public function setErrorCode($code): void
{
$this->errorCode = $code;
}
/**
* @param $message
*/
public function setErrorMessage($message): void
{
$this->errorMsg = $message;
}
/**
* @return int
*/
public function getErrorCode(): int
{
return $this->errorCode;
}
/**
* @return string
*/
public function getErrorMessage(): string
{
return $this->errorMsg;
}
/**
* @return AppConfig
*/
public function getPayConfig(): AppConfig
{
return $this->payConfig;
}
/**
* @param AppConfig $payConfig
*/
public function setPayConfig(AppConfig $payConfig): void
{
$this->payConfig = $payConfig;
}
/**
* @param string $host
* @param string $requestUrl
* @param mixed $body
* @param string $contentType
* @return Result
*/
protected function post(string $host, string $requestUrl, mixed $body, string $contentType = 'application/application'): Result
{
return $this->request($host, 'post', $requestUrl, $body, $contentType);
}
/**
* @param string $host
* @param string $requestUrl
* @param mixed $body
* @param string $contentType
* @return Result
*/
protected function get(string $host, string $requestUrl, mixed $body, string $contentType = 'application/application'): Result
{
return $this->request($host, 'get', $requestUrl, $body, $contentType);
}
/**
* @param string $host
* @param string $requestUrl
* @param mixed $body
* @return Result
*/
protected function upload(string $host, string $requestUrl, mixed $body): Result
{
return $this->request($host, 'upload', $requestUrl, $body);
}
/**
* @param string $host
* @param string $method
* @param string $requestUrl
* @param $body
* @param string $contentType
* @return Result
*/
private function request(string $host, string $method, string $requestUrl, $body, string $contentType = 'application/application'): Result
{
$client = new Client($host, 80, true);
$proxyHost = $this->payConfig->getProxyHost();
$proxyPort = $this->payConfig->getProxyPort();
if (!empty($proxyHost) && $proxyPort > 0) {
$client->withProxyHost($proxyHost)->withProxyPort($proxyPort);
}
if ($method == 'post') {
$client->withHeader(['Content-Type' => $contentType]);
$client->post($requestUrl, $body);
} else if ($method == 'upload') {
$client->upload($requestUrl, $body);
} else {
$client->withHeader(['Content-Type' => $contentType]);
$client->get($requestUrl, $body);
}
$client->close();
if (!in_array($client->getStatusCode(), [101, 200, 201])) {
return new Result(code: 505, message: $client->getBody());
}
$body = json_decode($client->getBody(), true);
if (is_null($body) || (isset($body['errcode']) && $body['errcode'] != 0)) {
return new Result(code: $body['errcode'], message: $body['errmsg']);
} else {
return new Result(code: 0, data: $body);
}
}
}
+54
View File
@@ -0,0 +1,54 @@
<?php
namespace wchat\common;
use wchat\common\libs\Aliyun;
use wchat\common\libs\Qq;
use wchat\common\libs\Wx;
class PayConfig
{
/**
* @var Qq
*/
public Qq $qq;
/**
* @var Wx
*/
public Wx $wx;
/**
* @var Aliyun
*/
public Aliyun $ali;
/**
* @param string|array $pay
* @param PayConfig|null $model
* @return static
*/
public static function parse(string|array $pay, ?PayConfig $model = null): static
{
if (is_string($pay)) {
$pay = json_decode($pay, true);
}
if ($model === null) {
$model = new static();
$model->ali = \Kiri::configure(new Aliyun(), $pay['ali']);
$model->qq = \Kiri::configure(new Qq(), $pay['qq']);
$model->wx = \Kiri::configure(new Wx(), $pay['wx']);
} else {
$model->ali = \Kiri::configure($model->ali, $pay['ali']);
$model->qq = \Kiri::configure($model->qq, $pay['qq']);
$model->wx = \Kiri::configure($model->wx, $pay['wx']);
}
return $model;
}
}
+10
View File
@@ -0,0 +1,10 @@
<?php
namespace wchat\common;
interface Progaram
{
}
+181
View File
@@ -0,0 +1,181 @@
<?php
namespace wchat\common;
use Exception;
use JetBrains\PhpStorm\ArrayShape;
use Kiri\Client;
/**
* Class Result
*
* @package app\components
*
* @property $code
* @property $message
* @property $count
* @property $data
*/
class Result
{
private ?int $startTime;
private ?int $requestTime;
private ?int $runTime;
/**
* @param int $code
* @param string $message
* @param int $count
* @param mixed $data
* @param array $header
*/
public function __construct(public int $code, public string $message = '', public int $count = 0, public mixed $data = [], public array $header = [],)
{
}
/**
* @param string $data
* @return static
*/
public static function wxInit(string $data): static
{
$json = json_decode($data, true);
if (isset($json['errcode']) && $json['errcode'] != 0) {
return new Result(code: $json['errcode'], message: $json['errmsg']);
} else {
return new Result(code: 0, data: $json);
}
}
/**
* @param Client $client
* @return static
*/
public static function init(Client $client): static
{
if (!in_array($client->getStatusCode(), [101, 200, 201])) {
return new Result(code: 505, message: $client->getBody());
}
$body = json_decode($client->getBody(), true);
if (isset($body['errcode']) && $body['errcode'] != 0) {
return new Result(code: $body['errcode'], message: $body['errmsg']);
} else {
return new Result(code: 0, data: $body);
}
}
/**
* @param $name
* @return mixed
*/
public function __get($name)
{
return $this->$name;
}
/**
* @param $name
* @param $value
* @return $this
*/
public function __set($name, $value)
{
$this->$name = $value;
return $this;
}
/**
* @return array
*/
#[ArrayShape(['startTime' => "int|null", 'requestTime' => "int|null", 'runTime' => "int|null"])]
public function getTime(): array
{
return [
'startTime' => $this->startTime,
'requestTime' => $this->requestTime,
'runTime' => $this->runTime,
];
}
/**
* @param $key
* @param $data
* @return $this
* @throws
*/
public function setAttr($key, $data): static
{
if (!property_exists($this, $key)) {
throw new Exception('未查找到相应对象属性');
}
$this->$key = $data;
return $this;
}
/**
* @return bool
*/
public function isResultsOK(): bool
{
if (!is_numeric($this->code)) {
return false;
}
return $this->code == 0;
}
/**
* @param string $name
* @return mixed
*/
public function getData(string $name = ''): mixed
{
if (!$this->isResultsOK()) {
return $this->data;
}
if (!is_array($this->data)) {
return $this->data;
}
if ($name != '') {
return $this->data[$name] ?? null;
} else {
return $this->data;
}
}
/**
* @param $key
* @param $data
* @return $this
*/
public function append($key, $data): static
{
if (!is_array($this->data)) {
$this->data = ['origin' => $this->data];
}
$this->data[$key] = $data;
return $this;
}
/**
* @return string
*/
public function getMessage(): string
{
return $this->message;
}
/**
* @return int
*/
public function getCode(): int
{
return $this->code;
}
}
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace wchat\common\libs;
class Aliyun
{
// APPID
public string $appId;
// APP公钥
public string $appKey;
// APP私钥
public string $appSecret;
// APP公钥证书
public string $appPubSecret;
// 阿里云公钥证书
public string $aliPubSecret;
// 阿里云根证书
public string $aliRootSecret;
// 是否开启证书模式
public int $openFileState;
}
+50
View File
@@ -0,0 +1,50 @@
<?php
namespace wchat\common\libs;
class Qq
{
/**
* @var string
*/
public string $appId;
/**
* @var string
*/
public string $mchCa;
/**
* @var string
*/
public string $mchId;
/**
* @var string
*/
public string $mchKey;
/**
* @var string
*/
public string $mchCert;
/**
* @var string
*/
public string $appSecret;
/**
* @var string
*/
public string $mchSecret;
}
+56
View File
@@ -0,0 +1,56 @@
<?php
namespace wchat\common\libs;
class Wx
{
/**
* @var string
*/
public string $appId;
/**
* @var string
*/
public string $mchId;
/**
* @var string
*/
public string $schema = 'WECHATPAY2-SHA256-RSA2048';
/**
* @var string
*/
public string $mchKey;
/**
* @var string
*/
public string $secret;
/**
* @var string
*/
public string $mchCert;
/**
* @var string
*/
public string $appSecret;
/**
* @var string
*/
public string $SerialNumber;
}
+28 -23
View File
@@ -1,25 +1,30 @@
{
"name": "wchat/wchat",
"description": "一个参数效验扩展",
"keywords": [
"validate"
],
"license": "MIT",
"authors": [
{
"name": "xianglin",
"email": "xianglin@163.com"
}
],
"autoload": {
"psr-4": {
"wchat\\": "wx"
}
},
"require": {
"php": ">= 7.0"
},
"require-dev": {
"swoole/ide-helper": "@dev"
}
"name": "game-worker/kiri-wchat",
"description": "一个参数效验扩展",
"keywords": [
"validate"
],
"license": "MIT",
"authors": [
{
"name": "xianglin",
"email": "xianglin@163.com"
}
],
"autoload": {
"psr-4": {
"wchat\\": "./"
},
"files": [
]
},
"require": {
"php": ">= 8.4",
"game-worker/kiri-client": "^v2.5",
"psr/container": "*",
"ext-openssl": "*"
},
"require-dev": {
"swoole/ide-helper": "@dev"
}
}
+47
View File
@@ -0,0 +1,47 @@
<?php
/**
* Created by PhpStorm.
* User: whwyy
* Date: 2018/4/19 0019
* Time: 16:12
*/
namespace wchat\qq;
use wchat\common\Result;
class Account extends SmallProgram
{
/**
* @param string $code
* @return Result
*/
public function login(string $code): Result
{
$param['appid'] = $this->payConfig->appId;
$param['secret'] = $this->payConfig->appSecret;
$param['js_code'] = $code;
$param['grant_type'] = 'authorization_code';
return $this->get('api.q.qq.com', '/sns/jscode2session', $param);
}
/**
* @param string $code
* @return Result
*/
public function appLogin(string $code): Result
{
$param['appid'] = $this->payConfig->appId;
$param['secret'] = $this->payConfig->appSecret;
$param['js_code'] = $code;
$param['grant_type'] = 'authorization_code';
$this->host = 'graph.qq.com';
return $this->get('api.q.qq.com', '/user/get_user_info', $param);
}
}
+94
View File
@@ -0,0 +1,94 @@
<?php
namespace wchat\qq;
use Exception;
use wchat\common\Help;
/**
* Class Notify
* @package wchat\qq
*/
class Notify extends SmallProgram
{
public mixed $appid = null;
public mixed $mch_id = null;
public mixed $nonce_str = null;
public mixed $sign = null;
public mixed $device_info = null;
public mixed $trade_type = null;
public mixed $trade_state = null;
public mixed $bank_type = null;
public mixed $fee_type = null;
public mixed $total_fee = null;
public mixed $cash_fee = null;
public mixed $coupon_fee = null;
public mixed $transaction_id = null;
public mixed $out_trade_no = null;
public mixed $attach = null;
public mixed $time_end = null;
public mixed $openid = null;
/**
* @return bool
* 判断是否完成支付
*/
public function isSuccess(): bool
{
return $this->trade_state === 'SUCCESS';
}
/**
* @param array $params
* @return $this
* @throws
*/
public function setPayNotifyData(array $params): static
{
if (!$this->validation($params)) {
throw new Exception('签名错误!');
}
foreach ($params as $key => $val) {
$this->$key = $val;
}
return $this;
}
public function __set(string $name, $value): void
{
if (property_exists($this, $name)) {
$this->{$name} = $value;
}
}
/**
* @param array $params
* @return bool
*/
public function validation(array $params): bool
{
$sign = $params['sign'];
unset($params['sign']);
$signType = $this->payConfig->getSignType();
$privateKey = $this->payConfig->pay->qq->mchSecret;
$nowSign = Help::sign($params, $privateKey, $signType);
if ($sign === $nowSign) {
return true;
}
return false;
}
/**
* @return null
*/
public function getAppid(): mixed
{
return $this->appid;
}
}
+27
View File
@@ -0,0 +1,27 @@
<?php
namespace wchat\wx;
use Kiri\Di\Container;
use wchat\common\AppConfig;
class QqFactory
{
/**
* @param $class
* @param AppConfig $config
* @return mixed
* @throws
*/
public static function get($class, AppConfig $config): mixed
{
$container = Container::instance();
$object = $container->get($class);
$object->setPayConfig($config);
return $object;
}
}
+94
View File
@@ -0,0 +1,94 @@
<?php
/**
* Created by PhpStorm.
* User: whwyy
* Date: 2018/3/26 0026
* Time: 10:22
*/
namespace wchat\qq;
use wchat\common\Result;
use wchat\common\Help;
class Recharge extends SmallProgram
{
private float $money = 0;
private string $orderNo;
private array $data = [];
private string $spill_create_ip = '';
private string $uniformer = '/cgi-bin/pay/qpay_unified_order.cgi';
protected string $host = 'qpay.qq.com';
/**
* @param string $value
*/
public function setSpillCreateIp(string $value): void
{
$this->spill_create_ip = $value;
}
/**
* @param int $money
* @param string $orderNo
* @param string $openId
* @return Result
* @throws
*/
public function recharge(int $money, string $orderNo, string $openId = ''): Result
{
if ($money < 0) {
return new Result(code: 500, message: '充值金额不能小于0.');
}
$this->money = $money;
$this->orderNo = $orderNo;
$this->data['openid'] = $openId;
return $this->post('api.q.qq.com', $this->uniformer, $this->builder(), 'application/xml');
}
/**
* @param string $prepay_id
* @return string
*/
public function reception(string $prepay_id): string
{
return Help::sign([
'signType' => $this->payConfig->getSignType(),
'package' => 'prepay_id=' . $prepay_id,
'nonceStr' => Help::random(32),
'timestamp' => time()
], $this->payConfig->pay->qq->mchSecret, $this->payConfig->getSignType());
}
/**
* @return string
*/
protected function builder(): string
{
$data = [
'appid' => $this->payConfig->appId,
'mch_id' => $this->payConfig->pay->qq->mchId,
'nonce_str' => Help::random(32),
'body' => $this->payConfig->getBody(),
'out_trade_no' => $this->orderNo,
'total_fee' => $this->money,
'spbill_create_ip' => $this->spill_create_ip,
'notify_url' => $this->payConfig->getNotifyUrl(),
'trade_type' => $this->payConfig->getTradeType(),
];
$this->data = array_merge($data, $this->data);
$key = $this->payConfig->pay->qq->mchSecret;
$sign_type = $this->payConfig->getSignType();
$this->data['sign_type'] = $this->payConfig->getSignType();
$this->data['sign'] = Help::sign($this->data, $key, $sign_type);
return Help::toXml($this->data);
}
}
+361
View File
@@ -0,0 +1,361 @@
<?php
namespace wchat\qq;
use Kiri\Client;
use wchat\common\Help;
use wchat\common\Result;
class Redhat extends SmallProgram
{
private string $charset = 'UTF8';
private string $sign = '';
private string $mch_billno = '';
private string $mch_name = '';
private string $re_openid = '';
private string $total_amount = '';
private string $total_num = '';
private string $wishing = '';
private string $act_name = '';
private string $icon_id = '';
private string $banner_id = '';
private string $not_send_msg = '';
private string $min_value = '';
private string $max_value = '';
private string $sendUrl = '/cgi-bin/hongbao/qpay_hb_mch_send.cgi';
private string $searchUrl = '/cgi-bin/mch_query/qpay_hb_mch_list_query.cgi';
/**
* @return string
*/
public function getCharset(): string
{
return $this->charset;
}
/**
* @param string $charset
*/
public function setCharset(string $charset): void
{
$this->charset = $charset;
}
/**
* @return string
*/
public function getSign(): string
{
return $this->sign;
}
/**
* @param string $sign
*/
public function setSign(string $sign): void
{
$this->sign = $sign;
}
/**
* @return string
*/
public function getMchBillno(): string
{
return $this->mch_billno;
}
/**
* @param string $mch_billno
*/
public function setMchBillno(string $mch_billno): void
{
$this->mch_billno = $mch_billno;
}
/**
* @return string
*/
public function getMchName(): string
{
return $this->mch_name;
}
/**
* @param string $mch_name
*/
public function setMchName(string $mch_name): void
{
$this->mch_name = $mch_name;
}
/**
* @return string
*/
public function getReOpenid(): string
{
return $this->re_openid;
}
/**
* @param string $re_openid
*/
public function setReOpenid(string $re_openid): void
{
$this->re_openid = $re_openid;
}
/**
* @return string
*/
public function getTotalAmount(): string
{
return $this->total_amount;
}
/**
* @param string $total_amount
*/
public function setTotalAmount(string $total_amount): void
{
$this->total_amount = $total_amount;
}
/**
* @return string
*/
public function getTotalNum(): string
{
return $this->total_num;
}
/**
* @param string $total_num
*/
public function setTotalNum(string $total_num): void
{
$this->total_num = $total_num;
}
/**
* @return string
*/
public function getWishing(): string
{
return $this->wishing;
}
/**
* @param string $wishing
*/
public function setWishing(string $wishing): void
{
$this->wishing = $wishing;
}
/**
* @return string
*/
public function getActName(): string
{
return $this->act_name;
}
/**
* @param string $act_name
*/
public function setActName(string $act_name): void
{
$this->act_name = $act_name;
}
/**
* @return string
*/
public function getIconId(): string
{
return $this->icon_id;
}
/**
* @param string $icon_id
*/
public function setIconId(string $icon_id): void
{
$this->icon_id = $icon_id;
}
/**
* @return string
*/
public function getBannerId(): string
{
return $this->banner_id;
}
/**
* @param string $banner_id
*/
public function setBannerId(string $banner_id): void
{
$this->banner_id = $banner_id;
}
/**
* @return string
*/
public function getNotSendMsg(): string
{
return $this->not_send_msg;
}
/**
* @param string $not_send_msg
*/
public function setNotSendMsg(string $not_send_msg): void
{
$this->not_send_msg = $not_send_msg;
}
/**
* @return string
*/
public function getMinValue(): string
{
return $this->min_value;
}
/**
* @param string $min_value
*/
public function setMinValue(string $min_value): void
{
$this->min_value = $min_value;
}
/**
* @return string
*/
public function getMaxValue(): string
{
return $this->max_value;
}
/**
* @param string $max_value
*/
public function setMaxValue(string $max_value): void
{
$this->max_value = $max_value;
}
/**
* @return mixed
* 构建请求参数
*/
public function generate(): array
{
$requestParam = [];
$requestParam['charset'] = $this->getCharset();
$requestParam['nonce_str'] = Help::random(30);
$requestParam['mch_billno'] = $this->getMchBillno();
$requestParam['mch_id'] = $this->payConfig->pay->qq->mchId;
$requestParam['mch_name'] = $this->getMchName();
$requestParam['qqappid'] = $this->payConfig->appId;
$requestParam['re_openid'] = $this->getReOpenid();
$requestParam['total_amount'] = $this->getTotalAmount() * 100;
$requestParam['min_value'] = $this->getMinValue() * 100;
$requestParam['max_value'] = $this->getMaxValue() * 100;
$requestParam['total_num'] = $this->getTotalNum();
$requestParam['wishing'] = $this->getWishing();
$requestParam['act_name'] = $this->getActName();
$requestParam['icon_id'] = $this->getIconId();
$requestParam['notify_url'] = $this->payConfig->getNotifyUrl();
$requestParam['sign'] = $this->builderSign($requestParam);
return $requestParam;
}
/**
* @param array $requestParam
* @return string
*/
private function builderSign(array $requestParam): string
{
return Help::sign($requestParam, $this->payConfig->pay->qq->mchSecret, $this->payConfig->getSignType());
}
/**
* @return Result
*/
public function redEnvelopes(): Result
{
$client = new Client('api.qpay.qq.com', 443, true);
$client->withHeader(['Content-Type' => 'application/x-www-form-urlencoded']);
$client->withSslKeyFile($this->payConfig->pay->qq->mchKey);
$client->withSslCertFile($this->payConfig->pay->qq->mchCert);
$client->withCa($this->payConfig->pay->qq->mchCa);
$proxyHost = $this->payConfig->getProxyHost();
$proxyPort = $this->payConfig->getProxyPort();
if (!empty($proxyHost) && $proxyPort > 0) {
$client->withProxyHost($proxyHost)->withProxyPort($proxyPort);
}
$client->post($this->sendUrl, http_build_query($this->generate()));
$client->close();
if (!in_array($client->getStatusCode(), [101, 200, 201])) {
return new Result(code: 505, message: $client->getBody());
}
$json = json_decode($client->getBody(), true);
if (isset($json['return_code']) && $json['return_code'] != 'SUCCESS') {
return new Result(code: 500, message: $json['return_msg'] ?? $json['retmsg']);
}
if ($json['retcode'] != 0) {
return new Result(code: $json['retcode'], message: $json['retmsg']);
} else {
return new Result(code: 0, data: $json);
}
}
/**
* @param string $listid
* @param string|null $orderNo
* @return Result
*/
public function searchByOrderNo(string $listid, ?string $orderNo = null): Result
{
$requestParam['nonce_str'] = Help::random(31);
$requestParam['mch_id'] = $this->payConfig->pay->qq->mchId;
$requestParam['listid'] = $listid;
if (!empty($orderNo)) {
$requestParam['mch_billno'] = $orderNo;
}
$requestParam['sign'] = $this->builderSign($requestParam);
$client = new Client('qpay.qq.com', 443, true);
$proxyHost = $this->payConfig->getProxyHost();
$proxyPort = $this->payConfig->getProxyPort();
if (!empty($proxyHost) && $proxyPort > 0) {
$client->withProxyHost($proxyHost)->withProxyPort($proxyPort);
}
$client->withHeader(['Content-Type' => 'application/json']);
$client->post($this->searchUrl, $requestParam);
$client->close();
if (!in_array($client->getStatusCode(), [101, 200, 201])) {
return new Result(code: 505, message: $client->getBody());
}
$json = json_decode($client->getBody(), true);
if (isset($json['result']) && $json['result'] != 'SUCCESS') {
return new Result(code: 500, message: $response['res_info'] ?? '订单查询失败!');
} else {
return new Result(code: 0, data: $json);
}
}
}
+55
View File
@@ -0,0 +1,55 @@
<?php
namespace wchat\qq;
use wchat\common\Result;
/**
* Class SecCheck
* @package qq
*/
class SecCheck extends SmallProgram
{
private string $_url = '/api/json/security/ImgSecCheck?access_token=';
private string $_msgUrl = '/api/json/security/MsgSecCheck?access_token=';
/**
* @param string $path
* @return Result
*/
public function image(string $path = ''): Result
{
if (!file_exists($path)) {
return $this->sendError('文件不存在', 404);
}
$real_path = new \CURLFile($path);
$data = [
'appid' => $this->payConfig->appId,
'media' => $real_path,
'form-data[filename]' => $path,
'form-data[content-type]' => $real_path->getMimeType()
];
return $this->upload('api.q.qq.com', $this->_url, $data);
}
/**
* @param string $content
* @return Result
*/
public function text(string $content): Result
{
if (empty($content)) {
return $this->sendError('文件不存在', 404);
}
$url = '/' . ltrim($this->_msgUrl, '/') . $this->payConfig->getAccessToken();
return $this->post('api.q.qq.com', $url, ['appid' => $this->payConfig->appId, 'content' => $content]);
}
}
+42
View File
@@ -0,0 +1,42 @@
<?php
namespace wchat\qq;
use Kiri\Client;
use wchat\common\Multiprogramming;
class SmallProgram extends Multiprogramming
{
/**
* @var string
*/
protected string $host = 'api.q.qq.com';
/**
* @param string $url
* @param mixed $data
* @return Client
*/
protected function createClient(string $url, mixed $data): Client
{
$client = new Client('api.qpay.qq.com', 443, true);
$client->withHeader(['Content-Type' => 'application/json']);
$client->withSslCertFile($this->payConfig->pay->qq->mchCert);
$client->withSslKeyFile($this->payConfig->pay->qq->mchKey);
$client->withCa($this->payConfig->pay->qq->mchCa);
$proxyHost = $this->payConfig->getProxyHost();
$proxyPort = $this->payConfig->getProxyPort();
if (!empty($proxyHost) && $proxyPort > 0) {
$client->withProxyHost($proxyHost)->withProxyPort($proxyPort);
}
$client->post($url, $data);
$client->close();
return $client;
}
}
+32
View File
@@ -0,0 +1,32 @@
<?php
namespace wchat\qq;
/**
* Class Subject
* @package wchat\qq
*/
class Subject extends \wchat\base\Subject
{
/**
* @return string
*/
public function getUrl(): string
{
return '/api/json/subscribe/SendSubscriptionMessage';
}
/**
* @return string
*/
public function getHost(): string
{
return 'api.q.qq.com';
}
}
+25
View File
@@ -0,0 +1,25 @@
<?php
namespace wchat\qq;
use wchat\common\Result;
class Token extends SmallProgram
{
/**
* @return Result
*/
public function token(): Result
{
$query = [
'grant_type' => 'client_credential',
'appid' => $this->payConfig->appId,
'secret' => $this->payConfig->appSecret
];
return $this->get('api.q.qq.com', '/api/getToken', $query);
}
}
+165
View File
@@ -0,0 +1,165 @@
<?php
namespace wchat\qq\pay;
use Exception;
use wchat\common\Help;
use wchat\common\Result;
use wchat\qq\SmallProgram;
/**
* Class Cash_Bonus
* @package wchat\qq
*/
class Cash_Bonus extends SmallProgram
{
public string $_cash = '/cgi-bin/hongbao/qpay_hb_mch_send.cgi';
private array $_errors = [
'66228701' => '红包个数超出限制',
'66228705' => '总金额超出限制',
'66228706' => '总金额不足以按最小金额领取每个红包',
'66228707' => '商户签名校验失败',
'66228708' => '重入??',
'66228709' => 'openid转换uin失败',
'66228711' => '商户订单中的商户号有误',
'66228712' => '商户订单中的日期超过范围',
'66228713' => '余额不足',
'66228715' => '用户未关注公众号,发送AIO消息失败',
'66229716' => '用户禁用公众号,发AIO消息失败'
];
private array $_requestParams = [];
/**
* @param string $value
*/
public function setMchName(string $value): void
{
$this->_requestParams['mch_name'] = $value;
}
/**
* @param string $value
*/
public function setActName(string $value): void
{
$this->_requestParams['act_name'] = $value;
}
/**
* @param string $value
*/
public function setWishing(string $value): void
{
$this->_requestParams['wishing'] = $value;
}
/**
* @param int $value
*/
public function setIconId(int $value): void
{
$this->_requestParams['icon_id'] = $value;
}
/**
* @param int $value
*/
public function setBannerId(int $value): void
{
$this->_requestParams['banner_id'] = $value;
}
/**
* @param string $mch_billno
* @param string $openId
* @param float $price
* @return mixed
*/
public function mch_send(string $mch_billno, string $openId, float $price): Result
{
$client = $this->createClient($this->_cash, $this->orderConfig($mch_billno, $openId, $price));
if (!in_array($client->getStatusCode(), [101, 200, 201])) {
return new Result(code: 505, message: $client->getBody());
}
$json = json_decode($client->getBody(), true);
if (isset($json['return_code']) && $json['return_code'] != 'SUCCESS') {
return new Result(code: 500, message: $json['return_msg'] ?? $json['retmsg']);
} else if ($json['retcode'] != 0) {
if (empty($json['retmsg']) && isset($this->_errors[$json['retcode']])) {
$json['retmsg'] = $this->_errors[$json['retcode']];
}
return new Result(code: $json['retcode'], message: $json['retmsg']);
} else {
return new Result(code: 0, data: $json);
}
}
/**
* @param string $mch_billno
* @param string $openId
* @param float $price
* @return array
*/
private function orderConfig(string $mch_billno, string $openId, float $price): array
{
$requestParam['charset'] = 1;
$requestParam['nonce_str'] = Help::random(32);
$requestParam['mch_billno'] = $mch_billno;
$requestParam['mch_id'] = $this->payConfig->pay->qq->mchId;
$requestParam['qqappid'] = $this->payConfig->appId;
$requestParam['re_openid'] = $openId;
$requestParam['total_amount'] = $price * 100;
$requestParam['min_value'] = $price * 100;
$requestParam['max_value'] = $price * 100;
$requestParam['total_num'] = 1;
$requestParam['notify_url'] = $this->payConfig->getNotifyUrl();
if (!empty($this->_requestParams)) {
$requestParam = array_merge($requestParam, $this->_requestParams);
}
$requestParam['sign'] = Help::sign($requestParam, $this->payConfig->pay->qq->mchSecret, 'MD5');
return $requestParam;
}
/**
* @return string
* @throws Exception
*/
public function mchOrderNo(): string
{
return implode([
$this->payConfig->pay->qq->mchId,
date('Ymd'),
random_int(11, 99),
date('His'),
random_int(11, 99)
]);
}
/**
* @param array $requestParams
* @return bool
*/
public function validator(array $requestParams): bool
{
$notifySign = $requestParams['sign'];
unset($requestParams['sign']);
$sign = Help::sign($requestParams, $this->payConfig->pay->qq->mchSecret, 'MD5');
if ($sign !== $notifySign) {
return false;
}
return true;
}
}
+146
View File
@@ -0,0 +1,146 @@
<?php
namespace wchat\qq\pay;
use Exception;
use wchat\common\Help;
use wchat\common\Result;
use wchat\qq\SmallProgram;
/**
* Class Enterprise_payment
* @package wchat\qq\pay
*/
class Enterprise_payment extends SmallProgram
{
public string $_cash = '/cgi-bin/epay/qpay_epay_b2c.cgi';
private array $_errors = [
'SYSTEMERROR' => '系统错误',
'PARAM_ERROR' => '请求参数未按指引进行填写',
'SIGNERROR' => '参数签名结果不正确',
'OP_USER_PASSWD_ERROR' => '操作员密码校验失败',
'OP_USER_AUTH_ERROR' => '操作员权限错误',
'TRANSFER_FEE_LIMIT_ERROR' => '转账限额错误',
'TRANSFER_FAIL' => '收款用户的账户不支持收款,收款失败',
'NOTENOUGH' => '商户营销账户的余额不足',
'ORDERNOTEXIST' => '转账订单不存在',
'APPID_OR_OPENID_ERR' => 'appid 或 openid 非法',
'TOTAL_FEE_OUT_OF_LIMIT' => '单笔限额检查失败',
'SPID_NOT_ALLOW' => '当前商户不支持企业付款',
'REALNAME_CHECK_ERROR' => '实名检查失败',
'RE_USER_NAME_CHECK_ERROR' => '用户真实姓名校验失败',
'INVALID_CERTIFICATE' => '证书非法',
];
private array $_requestParams = [];
/**
* @param string $value
*/
public function setOpUserId(string $value): void
{
$this->_requestParams['op_user_id'] = $value;
}
/**
* @param string $value
*/
public function setOpUserPassword(string $value): void
{
$this->_requestParams['op_user_passwd'] = $value;
}
/**
* @param string $value
*/
public function setSpbillCreateIp(string $value): void
{
$this->_requestParams['spbill_create_ip'] = $value;
}
/**
* @param string $mch_billno
* @param string $openId
* @param float $price
* @return Result
*/
public function mch_send(string $mch_billno, string $openId, float $price): Result
{
$client = $this->createClient($this->_cash, $this->orderConfig($mch_billno, $openId, $price));
if (!in_array($client->getStatusCode(), [101, 200, 201])) {
return new Result(code: 505, message: $client->getBody());
}
$json = json_decode($client->getBody(), true);
if (isset($json['return_code']) && $json['return_code'] != 'SUCCESS') {
return new Result(code: 500, data: $json['return_msg'] ?? $json['retmsg']);
} else if ($json['result_code'] != 'SUCCESS') {
return new Result(code: 500, data: $this->_errors[$json['err_code']] ?? $json['err_code_desc']);
} else {
return new Result(code: 0, data: $json);
}
}
/**
* @param string $mch_billno
* @param string $openId
* @param float $price
* @return array
*/
private function orderConfig(string $mch_billno, string $openId, float $price): array
{
$requestParam['input_charset'] = 'UTF-8';
$requestParam['nonce_str'] = Help::random(32);
$requestParam['out_trade_no'] = $mch_billno;
$requestParam['mch_id'] = $this->payConfig->pay->qq->mchId;
$requestParam['appid'] = $this->payConfig->pay->qq->mchSecret;
$requestParam['openid'] = $openId;
$requestParam['fee_type'] = 'CNY';
$requestParam['total_fee'] = $price * 100;
$requestParam['memo'] = $this->payConfig->getBody();
$requestParam['notify_url'] = $this->payConfig->getNotifyUrl();
$requestParam['spbill_create_ip'] = $this->payConfig->getNotifyUrl();
if (!empty($this->_requestParams) && is_array($this->_requestParams)) {
$requestParam = array_merge($requestParam, $this->_requestParams);
}
$requestParam['sign'] = Help::sign($requestParam, $this->payConfig->pay->qq->mchSecret, 'MD5');
return $requestParam;
}
/**
* @return string
* @throws Exception
*/
public function mchOrderNo(): string
{
return implode([
$this->payConfig->pay->qq->mchId,
date('Ymd'),
random_int(11, 99),
date('His'),
random_int(11, 99)
]);
}
/**
* @param array $requestParams
* @return bool
*/
public function validator(array $requestParams): bool
{
$notifySign = $requestParams['sign'];
unset($requestParams['sign']);
$sign = Help::sign($requestParams, $this->payConfig->pay->qq->mchSecret, 'MD5');
if ($sign !== $notifySign) {
return false;
}
return true;
}
}
+102
View File
@@ -0,0 +1,102 @@
<?php
namespace wchat\qq\result;
/**
* Class RedHatResult
* @package qq\result
*/
class RedHatResult
{
public mixed $result;
public mixed $res_info;
public mixed $listid;
public mixed $state;
public mixed $total_num;
public mixed $recv_num;
public mixed $total_amount;
public mixed $recv_amount;
public mixed $recv_details;
public mixed $uin;
const int RED_HAT_STATUS_PAID = 1;
const int RED_HAT_STATUS_SNATCHED = 2;
const int RED_HAT_STATUS_EXPIRED = 3;
const int RED_HAT_STATUS_REFUNDED = 4;
/**
* RedHatResult constructor.
* @param array $array
*/
public function __construct(array $array)
{
$this->init($array);
}
/**
* @param array $array
* @return void
*/
private function init(array $array): void
{
foreach ($array as $key => $value) {
if (!property_exists($this, $key)) {
continue;
}
$this->{$key} = $value;
}
}
/**
* @param string $field
* @return mixed
*/
public function get(string $field): mixed
{
return $this->$field;
}
/**
* @return bool
* 是否已完成支付
*/
public function isPaid(): bool
{
return $this->state == self::RED_HAT_STATUS_PAID;
}
/**
* @return bool
* 是否已抢完
*/
public function isSnatched(): bool
{
return $this->state == self::RED_HAT_STATUS_SNATCHED;
}
/**
* @return bool
*/
public function isExpired(): bool
{
return $this->state == self::RED_HAT_STATUS_EXPIRED;
}
/**
* @return bool
*/
public function isRefunded(): bool
{
return $this->state == self::RED_HAT_STATUS_REFUNDED;
}
}
+26 -28
View File
@@ -5,39 +5,37 @@
* Date: 2018/7/19 0019
* Time: 18:38
*/
//include_once __DIR__ . '/wchat/common/Progaram.php';
//include_once __DIR__ . '/wchat/common/Miniprogarampage.php';
//include_once __DIR__ . '/wchat/common/Help.php';
//include_once __DIR__ . '/wchat/common/Config.php';
//include_once __DIR__ . '/wchat/common/Result.php';
//include_once __DIR__ . '/wchat/common/HttpClient.php';
//include_once __DIR__ . '/wchat/qq/SmallProgram.php';
//include_once __DIR__ . '/wchat/base/Template.php';
//include_once __DIR__ . '/wchat/qq/Template.php';
$config = new \wchat\Config();
$config->setAppid('');
$config->setAppsecret('');
$config->setMchId('');
$config->setKey('');
$config->setRemoteAddr('');
$config->setDeviceInfo('');
$config->setAccessToken('');
require_once __DIR__ . '/vendor/autoload.php';
use wchat\common\HttpClient;
$instance = \wchat\Wx::getMiniProGaRamPage();
$instance->setConfig($config);
\Swoole\Coroutine::create(function () {
$data = '{"id":"681133","username":"","nickname":"???? 闫 ????","openId":"ovnGZ5cj4GtvTeaRZqxYtTwp4lCc","gzhOpenId":"null","phone":"","email":"","password":"","server":0,"xcx_server":0,"unionID":"","avatar":"https:\/\/wx.qlogo.cn\/mmopen\/vi_32\/mGkblm7Ffz4o0prJKnqysoicFWYmwk2YzDqGecsAA10a1QSsRDEH70IserwXKBVMSjBHCaq7Z8YIeccXEHJt9lw\/132","sex":2,"city":"Shijiazhuang","province":"Hebei","country":"China","createTime":1530404031,"modifyTime":1530404048,"lastSeetime":0,"status":1,"groupId":0}';
$recharge = $instance->getRecharge();
$recharge->cashWithdrawal(1, 'xxx', 'ooo');
$recharge->recharge(1, '', '');
var_dump(PHP_LIBDIR, PHP_CONFIG_FILE_SCAN_DIR);
$account = $instance->getAccount();
$account->setSavePath('');
$account->login('');
$account->createwxaqrcode('pages/index/index',200);
$account->getwxacode('pages/index/index',150,true);
$account->getwxacodeunlimit('pages/index/index',150,true);
$config = new \wchat\common\Config();
$config->setAppid('1110444685');
$config->setAppsecret('XTK81p7WS0PqWjiF');
$config->setUsrSwoole(true);
$config->setAccessToken('g3JqSiACJQuYuE7Hz683mz5oAi8aYuUktCc2C3a92IeB0_Kx9E92tJTtRQVUBAbucCSt');
/** @var \wchat\qq\SecCheck $model */
$model = \wchat\qq\SecCheck::getInstance($config);
var_dump($model->text('德生科技还是看得见粉红色的空间'));
$message = $instance->getMessage();
$message->setOpenid('');
$message->sendCardNews('');
// $json = json_decode($data, true);
//
// var_dump($json);
$template = $instance->getTemplate();
$template->setOpenId('');
$template->setFormId('');
$template->setTemplateId('');
$template->setPage('');
$template->sendTemplate();
});
+110 -165
View File
@@ -6,181 +6,126 @@
* Time: 16:12
*/
namespace wchat;
class Account extends Miniprogarampage
namespace wchat\wx;
use wchat\common\Result;
class Account extends SmallProgram
{
private $wxaqr = 'https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token=';
private $getwxacode = 'https://api.weixin.qq.com/wxa/getwxacode?access_token=';
private $getwxacodeunlimit = 'https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=';
/**
* @param string $code
* @return Result
*/
public function login(string $code): Result
{
$param['appid'] = $this->payConfig->appId;
$param['secret'] = $this->payConfig->appSecret;
$param['js_code'] = $code;
$param['grant_type'] = 'authorization_code';
private $savePath = __DIR__ . '/../../../';
return $this->get('api.weixin.qq.com', '/sns/jscode2session', $param);
}
/**
* @param string $code
* @return Result
*/
public function AppLogin(string $code): Result
{
$param['appid'] = $this->payConfig->pay->wx->appId;
$param['secret'] = $this->payConfig->pay->wx->appSecret;
$param['js_code'] = $code;
$param['grant_type'] = 'authorization_code';
return $this->get('api.weixin.qq.com', '/sns/oauth2/access_token', $param);
}
/**
* @param string $openid
* @return Result
*/
public function getPublicUserInfo(string $openid): Result
{
$query = [
'access_token' => $this->payConfig->getAccessToken(),
'openid' => $openid,
'lang' => 'zh_CN'
];
return $this->get('api.weixin.qq.com', '/cgi-bin/user/info', $query);
}
/**
* @param string $openid
* @return Result
*/
public function getAppUserInfo(string $openid): Result
{
$query = [
'access_token' => $this->payConfig->getAccessToken(),
'openid' => $openid,
];
return $this->get('api.weixin.qq.com', '/sns/userinfo', $query);
}
private $OK = 0;
private $IllegalAesKey = -41001;
private $IllegalIv = -41002;
private $IllegalBuffer = -41003;
private $DecodeBase64Error = -41004;
/**
* @param string $path
* @param int $width
* @return array|mixed|Result
*/
public function createwxaqrcode(string $path, int $width): mixed
{
$url = 'cgi-bin/wxaapp/createwxaqrcode?access_token=';
$sendBody['path'] = $path;
$sendBody['width'] = $width;
/**
* @param $path
*/
public function setSavePath($path)
{
$this->savePath = $path;
}
/**
* @param $code
* @return Result
*/
public function login($code)
{
$param['appid'] = $this->config->getAppid();
$param['secret'] = $this->config->getAppsecret();
$param['js_code'] = $code;
$param['grant_type'] = 'authorization_code';
$this->request->setMethod(WxClient::GET);
$this->request->addHeader('Content-Type', 'text/xml');
return $this->request->get('/sns/jscode2session', $param);
}
return $this->get('api.weixin.qq.com', $url . $this->payConfig->getAccessToken(), $sendBody);
}
/**
* @param $encryptedData
* @param $iv
* @param $sessionKey
* @param $asArray
* @return object|array
* @throws
*
* * <li>-41001: encodingAesKey 非法</li>
* <li>-41003: aes 解密失败</li>
* <li>-41004: 解密后得到的buffer非法</li>
* <li>-41005: base64加密失败</li>
* <li>-41016: base64解密失败</li>
*/
public function decode($encryptedData, $iv, $sessionKey, $asArray = false)
{
$config = Wx::getMiniProGaRamPage()->getConfig();
if (strlen($sessionKey) != 24) {
throw new \Exception('encodingAesKey 非法', $this->IllegalAesKey);
}
/**
* @param string $path
* @param int $width
* @param bool $is_hyaline
* @param bool $auto_color
* @param string $line_color
* @return Result
*/
public function getwxacode(string $path, int $width, bool $is_hyaline = false, bool $auto_color = false, string $line_color = ''): Result
{
$sendBody['path'] = $path;
$sendBody['width'] = $width;
$sendBody['auto_color'] = $auto_color;
$sendBody['is_hyaline'] = $is_hyaline;
$url = 'wxa/getwxacode?access_token=' . $this->payConfig->getAccessToken();
if ($auto_color) {
$sendBody['line_color'] = $line_color;
}
return $this->get('api.weixin.qq.com', $url . $this->payConfig->getAccessToken(), $sendBody);
$aesKey = base64_decode($sessionKey);
if (strlen($iv) != 24) {
throw new \Exception('base64解密失败', $this->IllegalIv);
}
$aesIV = base64_decode($iv);
$aesCipher = base64_decode($encryptedData);
$result = openssl_decrypt($aesCipher, "AES-128-CBC", $aesKey, OPENSSL_RAW_DATA, $aesIV);
if ($result === false) {
throw new \Exception('aes 解密失败', $this->IllegalBuffer);
}
$dataObj = json_decode($result);
if ($dataObj->watermark->appid != $config->getAppid()) {
throw new \Exception('aes 解密失败', $this->IllegalBuffer);
}
if ($asArray) {
return get_object_vars($dataObj);
}
return $dataObj;
}
}
/**
* @param $path
* @param $width
* @return array|mixed|Result
* @throws \Exception
*/
public function createwxaqrcode($path, $width)
{
$url = $this->wxaqr . $this->getAccessToken();
/**
* @param string $path
* @param int $width
* @param bool $is_hyaline
* @param bool $auto_color
* @param string $line_color
* @return Result
*/
public function getwxacodeunlimit(string $path, int $width, bool $is_hyaline = false, bool $auto_color = false, string $line_color = ''): Result
{
$sendBody['path'] = $path;
$sendBody['width'] = $width;
$sendBody['auto_color'] = $auto_color;
$sendBody['is_hyaline'] = $is_hyaline;
$url = 'wxa/getwxacodeunlimit?access_token=' . $this->payConfig->getAccessToken();
if ($auto_color) {
$sendBody['line_color'] = $line_color;
}
return $this->get('api.weixin.qq.com', $url . $this->payConfig->getAccessToken(), $sendBody);
}
$sendBody['path'] = $path;
$sendBody['width'] = $width;
$this->request->setMethod(WxClient::POST);
$this->request->setCallback([$this, 'saveByPath']);
return $this->request->post($url, $sendBody);
}
/**
* @param $path
* @param $width
* @param bool $is_hyaline
* @param bool $auto_color
* @param string $line_color
* @return array|mixed|Result
* @throws \Exception
*/
public function getwxacode($path, $width, $is_hyaline = false, $auto_color = false, $line_color = '')
{
$sendBody['path'] = $path;
$sendBody['width'] = $width;
$sendBody['auto_color'] = $auto_color;
$sendBody['is_hyaline'] = $is_hyaline;
if ($auto_color) {
$sendBody['line_color'] = $line_color;
}
$url = $this->getwxacode . $this->getAccessToken();
$this->request->setMethod(WxClient::POST);
$this->request->setCallback([$this, 'saveByPath']);
return $this->request->post($url, $sendBody);
}
/**
* @param $path
* @param $width
* @param bool $is_hyaline
* @param bool $auto_color
* @param string $line_color
* @return array|mixed|Result
* @throws \Exception
*/
public function getwxacodeunlimit($path, $width, $is_hyaline = false, $auto_color = false, $line_color = '')
{
$sendBody['path'] = $path;
$sendBody['width'] = $width;
$sendBody['auto_color'] = $auto_color;
$sendBody['is_hyaline'] = $is_hyaline;
if ($auto_color) {
$sendBody['line_color'] = $line_color;
}
$url = $this->getwxacodeunlimit . $this->getAccessToken();
$this->request->setMethod(WxClient::POST);
$this->request->setCallback([$this, 'saveByPath']);
return $this->request->post($url, $sendBody);
}
/**
* @param mixed $body
* @return string
* @throws \Exception
*/
public function saveByPath($body)
{
if (!is_null($json = json_decode($body))) {
throw new \Exception($json['errmsg'], $json['errcode']);
}
$push = md5_file($body) . '.png';
file_put_contents($this->savePath . $push, $this->savePath);
return $this->savePath . $push;
}
}
-399
View File
@@ -1,399 +0,0 @@
<?php
namespace wchat;
class Config
{
/**
* @var string
*
* 小程序ID
*/
private $appid = '';
/**
* @var string
*
* 商户号ID
*/
private $mch_id = '';
/**
* @var string
*
* 设备号
*/
private $device_info = 'WEB';
/**
* @var string
*
* 随机字符串
*/
private $nonce_str = '';
/**
* @var string
*
* 商品简单描述
*/
private $body = '好友默契Pk充值!';
/**
* @var string
*
* 商户订单号
*/
private $out_trade_no = "";
/**
* @var int
*
* 金额
*/
private $total_fee = 0;
/**
* @var string
*
* 终端IP
*/
private $spbill_create_ip = "";
/**
* @var string
*
* 异步回调地址
*/
private $notify_url = "";
/**
* @var string
*
* 交易类型
*/
private $trade_type = 'JSAPI';
/**
* @var string
*
* 签名方式
*/
private $sign_type = 'MD5';
/**
* @var string
*
* 商户接口地址
*/
private $mch_host = 'https://api.mch.weixin.qq.com';
/**
* @var string
*/
private $appsecret = '';
private $remote_addr = '127.0.0.1';
private $ssl_cert = '';
private $ssl_key = '';
/**
* @var string
*/
private $key = '';
private $access_token = '';
/**
* @return string
*/
public function getAccessToken(): string
{
return $this->access_token;
}
/**
* @param string $access_token
*/
public function setAccessToken(string $access_token)
{
$this->access_token = $access_token;
}
/**
* @param string $remote_addr
*/
public function setRemoteAddr(string $remote_addr)
{
$this->remote_addr = $remote_addr;
}
/**
* @param string $appid
*/
public function setAppid(string $appid)
{
$this->appid = $appid;
}
/**
* @param string $mch_id
*/
public function setMchId(string $mch_id)
{
$this->mch_id = $mch_id;
}
/**
* @param string $device_info
*/
public function setDeviceInfo(string $device_info)
{
$this->device_info = $device_info;
}
/**
* @param string $nonce_str
*/
public function setNonceStr(string $nonce_str)
{
$this->nonce_str = $nonce_str;
}
/**
* @param string $body
*/
public function setBody(string $body)
{
$this->body = $body;
}
/**
* @param string $out_trade_no
*/
public function setOutTradeNo(string $out_trade_no)
{
$this->out_trade_no = $out_trade_no;
}
/**
* @param int $total_fee
*/
public function setTotalFee(int $total_fee)
{
$this->total_fee = $total_fee;
}
/**
* @param string $spbill_create_ip
*/
public function setSpbillCreateIp(string $spbill_create_ip)
{
$this->spbill_create_ip = $spbill_create_ip;
}
/**
* @param string $notify_url
*/
public function setNotifyUrl(string $notify_url)
{
$this->notify_url = $notify_url;
}
/**
* @param string $trade_type
*/
public function setTradeType(string $trade_type)
{
$this->trade_type = $trade_type;
}
/**
* @param string $sign_type
*/
public function setSignType(string $sign_type)
{
$this->sign_type = $sign_type;
}
/**
* @param string $mch_host
*/
public function setMchHost(string $mch_host)
{
$this->mch_host = $mch_host;
}
/**
* @param string $appsecret
*/
public function setAppsecret(string $appsecret)
{
$this->appsecret = $appsecret;
}
/**
* @param string $ssl_cert
*/
public function setSslCert(string $ssl_cert)
{
$this->ssl_cert = $ssl_cert;
}
/**
* @param string $ssl_key
*/
public function setSslKey(string $ssl_key)
{
$this->ssl_key = $ssl_key;
}
/**
* @param string $key
*/
public function setKey(string $key)
{
$this->key = $key;
}
/**
* @return string
*/
public function getAppid(): string
{
return $this->appid;
}
/**
* @return string
*/
public function getMchId(): string
{
return $this->mch_id;
}
/**
* @return string
*/
public function getDeviceInfo(): string
{
return $this->device_info;
}
/**
* @return string
*/
public function getNonceStr(): string
{
return $this->nonce_str;
}
/**
* @return string
*/
public function getBody(): string
{
return $this->body;
}
/**
* @return string
*/
public function getOutTradeNo(): string
{
return $this->out_trade_no;
}
/**
* @return int
*/
public function getTotalFee(): int
{
return $this->total_fee;
}
/**
* @return string
*/
public function getSpbillCreateIp(): string
{
return $this->spbill_create_ip;
}
/**
* @return string
*/
public function getNotifyUrl(): string
{
return $this->notify_url;
}
/**
* @return string
*/
public function getTradeType(): string
{
return $this->trade_type;
}
/**
* @return string
*/
public function getSignType(): string
{
return $this->sign_type;
}
/**
* @return string
*/
public function getMchHost(): string
{
return $this->mch_host;
}
/**
* @return string
*/
public function getAppsecret(): string
{
return $this->appsecret;
}
/**
* @return string
*/
public function getRemoteAddr(): string
{
return $this->remote_addr;
}
/**
* @return string
*/
public function getSslCert(): string
{
return $this->ssl_cert;
}
/**
* @return string
*/
public function getSslKey(): string
{
return $this->ssl_key;
}
/**
* @return string
*/
public function getKey(): string
{
return $this->key;
}
}
+145
View File
@@ -0,0 +1,145 @@
<?php
namespace wchat\wx;
/**
* Class ContentAsyncCheck
* @package wchat
*/
class ContentAsyncCheck
{
private mixed $_ToUserName = '';
private mixed $_FromUserName = '';
private mixed $_CreateTime = '';
private mixed $_MsgType = '';
private mixed $_Event = '';
private mixed $_isrisky = '';
private mixed $_extra_info_json = '';
private mixed $_appid = '';
private mixed $_trace_id = '';
private mixed $_status_code = '';
/**
* @return string
*/
public function getToUserName(): mixed
{
return $this->_ToUserName;
}
/**
* @return string
*/
public function getFromUserName(): mixed
{
return $this->_FromUserName;
}
/**
* @return string
*/
public function getCreateTime(): mixed
{
return $this->_CreateTime;
}
/**
* @return string
*/
public function getMsgType(): mixed
{
return $this->_MsgType;
}
/**
* @return string
*/
public function getEvent(): mixed
{
return $this->_Event;
}
/**
* @return string
*/
public function getIsrisky(): mixed
{
return $this->_isrisky;
}
/**
* @return string
*/
public function getExtraInfoJson(): mixed
{
return $this->_extra_info_json;
}
/**
* @return string
*/
public function getAppid(): mixed
{
return $this->_appid;
}
/**
* @return string
*/
public function getTraceId(): mixed
{
return $this->_trace_id;
}
/**
* @return string
*/
public function getStatusCode(): mixed
{
return $this->_status_code;
}
/**
* @param array $params
* @return ContentAsyncCheck
*/
public static function instance(array $params): static
{
static $class = null;
if ($class === null) {
$class = new ContentAsyncCheck();
}
return $class->init($params);
}
/**
* @param array $params
* @return $this
*/
private function init(array $params): static
{
foreach ($params as $item => $param) {
$this->{'_' . $item} = $param;
}
return $this;
}
/**
* @return bool
*/
public function isRisky(): bool
{
return intval($this->_isrisky) === 0;
}
/**
* @return bool
*/
public function isSuccess(): bool
{
return $this->_status_code === 0;
}
}
-94
View File
@@ -1,94 +0,0 @@
<?php
namespace wchat;
class Help extends Miniprogarampage
{
/**
* @param array $data
* @return string
*/
public static function toXml(array $data)
{
$xml = "<xml>";
foreach ($data as $key => $val) {
if (is_numeric($val)) {
$xml .= "<" . $key . ">" . $val . "</" . $key . ">";
} else {
$xml .= "<" . $key . "><![CDATA[" . $val . "]]></" . $key . ">";
}
}
$xml .= "</xml>";
return $xml;
}
/**
* @param $xml
* @return mixed
*/
public static function toArray($xml)
{
if (!is_null($json = json_decode($xml, TRUE))) {
return $json;
}
if (is_array($json)) {
return $json;
}
$data = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA);
return json_decode(json_encode($data), TRUE);
}
/**
* @param int $length
* @return string
*
* 随机字符串
*/
public static function random($length = 20)
{
$res = [];
$str = 'abcdefghijklmnopqrstuvwxyz';
$str .= strtoupper($str) . '1234567890';
for ($i = 0; $i < $length; $i++) {
$rand = substr($str, rand(0, strlen($str) - 2), 1);
if (empty($rand)) {
$rand = substr($str, strlen($str) - 3, 1);
}
array_push($res, $rand);
}
return implode($res);
}
/**
* @param array $array
* @param $key
* @param $type
* @return string
*/
public static function sign(array $array, $key, $type)
{
ksort($array, SORT_STRING);
$string = '';
foreach ($array as $key => $val) {
if (empty($string)) {
$string = $key . '=' . $val;
} else {
$string .= '&' . $key . '=' . $val;
}
}
$string .= '&key=' . $key;
if ($type == 'MD5') {
return strtoupper(md5($string));
} else {
return hash('sha256', $string);
}
}
}
+239 -231
View File
@@ -1,269 +1,277 @@
<?php
namespace wchat;
namespace wchat\wx;
use Exception;
use wchat\common\Result;
class Message extends Miniprogarampage
/**
* Class Message
* @package wchat\wx
*/
class Message extends SmallProgram
{
const TEXT = 0;
const IMAGE = 1;
const VOICE = 2;
const NEWS = 3;
const VIDEO = 4;
const MUSIC = 5;
const MINIPROGRAMPAGE = 6;
const WXCARD = 7;
private $openid = '';
private $msgData = [];
private array $msgData = [];
/**
* @param string $openid
*/
public function setOpenid(string $openid)
{
$this->openid = $openid;
$this->msgData['touser'] = $openid;
}
/**
* @param string $openid
*/
public function setOpenid(string $openid): void
{
$this->msgData['touser'] = $openid;
}
/**
* @param string $content
* @return Result
* @throws \Exception
*/
public function sendTextNews(string $content)
{
$this->msgData['msgtype'] = 'text';
$this->msgData['text[content]'] = $content;
/**
* @param string $content
* @return Result
* @throws
*/
public function sendTextNews(string $content): Result
{
$this->msgData['msgtype'] = 'text';
$this->msgData['text'] = ['content' => $content];
return $this->sendKefuMsg();
}
return $this->sendKefuMsg();
}
/**
* @param $media_id
* @return Result
* @throws \Exception
*/
public function sendImageNews(string $media_id)
{
$this->msgData['msgtype'] = 'image';
$this->msgData['image[media_id]'] = $media_id;
/**
* @param string $media_id
* @return Result
* @throws
*/
public function sendImageNews(string $media_id): Result
{
$this->msgData['msgtype'] = 'image';
$this->msgData['image'] = ['media_id' => $media_id];
return $this->sendKefuMsg();
}
return $this->sendKefuMsg();
}
/**
* @param $media_id
* @return Result
* @throws \Exception
*/
public function sendVoiceNews(string $media_id)
{
$this->msgData['msgtype'] = 'voice';
$this->msgData['voice[media_id]'] = $media_id;
/**
* @param string $media_id
* @return Result
* @throws
*/
public function sendVoiceNews(string $media_id): Result
{
$this->msgData['msgtype'] = 'voice';
$this->msgData['voice'] = ['media_id' => $media_id];
return $this->sendKefuMsg();
}
return $this->sendKefuMsg();
}
/**
* @param $media_id
* @return Result
* @throws \Exception
*/
public function sendMpNewsNews(string $media_id)
{
$this->msgData['msgtype'] = 'mpnews';
$this->msgData['mpnews[media_id]'] = $media_id;
/**
* @param string $media_id
* @return Result
* @throws
*/
public function sendMpNewsNews(string $media_id): Result
{
$this->msgData['msgtype'] = 'mpnews';
$this->msgData['mpnews'] = ['media_id' => $media_id];
return $this->sendKefuMsg();
}
return $this->sendKefuMsg();
}
/**
* @param string $title
* @param string $description
* @param string $url
* @param string $picurl
* @return Result
* @throws \Exception
*/
public function sendNewsNews(string $title, string $description, string $url, string $picurl)
{
$this->msgData['msgtype'] = 'news';
$this->msgData['news[articles][0][title]'] = $title;
$this->msgData['news[articles][0][description]'] = $description;
$this->msgData['news[articles][0][url]'] = $url;
$this->msgData['news[articles][0][picurl]'] = $picurl;
return $this->sendKefuMsg();
}
/**
* @param string $title
* @param string $description
* @param string $url
* @param string $picurl
* @return Result
* @throws
*/
public function sendNewsNews(string $title, string $description, string $url, string $picurl): Result
{
$this->msgData['msgtype'] = 'news';
$this->msgData['news'] = [
'articles' => [
[
'title' => $title,
'description' => $description,
'url' => $url,
'picurl' => $picurl
]
]
];
return $this->sendKefuMsg();
}
/**
* @param string $title
* @return Result
* @throws \Exception
*/
public function sendCardNews(string $title)
{
$this->msgData['msgtype'] = 'wxcard';
$this->msgData['wxcard[card_id]'] = $title;
/**
* @param string $title
* @return Result
* @throws
*/
public function sendCardNews(string $title): Result
{
$this->msgData['msgtype'] = 'wxcard';
$this->msgData['wxcard'] = ['card_id' => $title];
return $this->sendKefuMsg();
}
return $this->sendKefuMsg();
}
/**
* @param string $head_content
* @param string $tail_content
* @param array $menus
* @return Result
* @throws \Exception
*/
public function sendMenuNews(string $head_content, string $tail_content, array $menus = [])
{
$this->msgData['msgtype'] = 'msgmenu';
$this->msgData['msgmenu[head_content]'] = $head_content;
$this->msgData['msgmenu[tail_content]'] = $tail_content;
/**
* @param string $media_id
* @param string $thumb_media_id
* @param string $title
* @param string $description
* @return Result
* @throws
*/
public function sendVideoNews(string $media_id, string $thumb_media_id, string $title, string $description): Result
{
$this->msgData['msgtype'] = 'video';
$this->msgData['video'] = [
'media_id' => [
'media_id' => $media_id,
'thumb_media_id' => $thumb_media_id,
'title' => $title,
'description' => $description
]
];
return $this->sendKefuMsg();
}
if (empty($menus) || !is_array($menus) || count($menus) < 2) {
throw new \Exception('菜单选项必须有2个');
}
foreach ($menus as $key => $val) {
$this->addNewsMenu($val['id'], $val['name']);
}
/**
* @param string $musicurl
* @param string $hqmusicurl
* @param string $thumb_media_id
* @param string $title
* @param string $description
* @return Result
* @throws
*/
public function sendMusicNews(string $musicurl, string $hqmusicurl, string $thumb_media_id, string $title, string $description): Result
{
$this->msgData['msgtype'] = 'music';
$this->msgData['music'] = [
'title' => $title,
'description' => $description,
'musicurl' => $musicurl,
'hqmusicurl' => $hqmusicurl,
'thumb_media_id' => $thumb_media_id
];
return $this->sendKefuMsg();
}
return $this->sendKefuMsg();
}
private $index = 0;
/**
* @param string $head_content
* @param string $tail_content
* @param array $menus
* @return Result
* @throws
*/
public function sendMenuNews(string $head_content, string $tail_content, array $menus = []): Result
{
$this->msgData['msgtype'] = 'msgmenu';
$this->msgData['msgmenu'] = [
'head_content' => $head_content,
'tail_content' => $tail_content,
];
if (empty($menus) || !is_array($menus) || count($menus) < 2) {
throw new Exception('菜单选项必须有2个');
}
foreach ($menus as $val) {
$this->addNewsMenu($val['id'], $val['name']);
}
return $this->sendKefuMsg();
}
/**
* @param $id
* @param $menuName
* @return $this
*/
public function addNewsMenu($id, $menuName)
{
$this->msgData['msgmenu[list][' . $this->index . '][id]'] = $id;
$this->msgData['msgmenu[list][' . $this->index . '][content]'] = $menuName;
private int $index = 0;
++$this->index;
/**
* @param string $id
* @param string $menuName
* @return $this
*/
public function addNewsMenu(string $id, string $menuName): static
{
$lists['id'] = $id;
$lists['content'] = $menuName;
$this->msgData['msgmenu']['list'][$this->index] = $lists;
++$this->index;
return $this;
}
return $this;
}
/**
* @param string $title
* @param string $appid
* @param string $pagepath
* @param string $thumb_media_id
* @return Result
* @throws
*/
public function sendMiniprogrampageNews(string $title, string $appid, string $pagepath, string $thumb_media_id): Result
{
$this->msgData['msgtype'] = 'msgmenu';
$this->msgData['miniprogrampage'] = [
'title' => $title,
'appid' => $appid,
'pagepath' => $pagepath,
'thumb_media_id' => $thumb_media_id,
];
return $this->sendKefuMsg();
}
/**
* @param $title
* @param $appid
* @param $pagepath
* @param $thumb_media_id
* @return Result
* @throws \Exception
*/
public function sendMiniprogrampageNews(string $title, string $appid, string $pagepath, string $thumb_media_id)
{
$this->msgData['msgtype'] = 'msgmenu';
$this->msgData['miniprogrampage[title]'] = $title;
$this->msgData['miniprogrampage[appid]'] = $appid;
$this->msgData['miniprogrampage[pagepath]'] = $pagepath;
$this->msgData['miniprogrampage[thumb_media_id]'] = $thumb_media_id;
/**
* @param string $filePath
* @param string $type
* @param bool $isPermanent
* @param string $title
* @param string $introduction
* @return mixed
* @throws
*/
public function uploadFile(string $filePath, string $type, bool $isPermanent = false, string $title = '', string $introduction = ''): Result
{
if (!file_exists($filePath)) {
throw new Exception('文件不存在');
}
if (!in_array($type, ['image', 'voice', 'video', 'thumb'])) {
throw new Exception('暂不支持的文件类型');
}
$token = $this->payConfig->getAccessToken();
if ($isPermanent) {
$url = "/cgi-bin/material/add_material?access_token={$token}&type={$type}";
} else {
$url = "/cgi-bin/media/upload?access_token={$token}&type={$type}";
}
$mime = mime_content_type($filePath);
$real_path = new \CURLFile(realpath($filePath));
$data = ["media" => $real_path, 'form-data[filename]' => $filePath, 'form-data[Content-Type]' => $mime];
if ($isPermanent && $mime == 'video/mp3') {
$data = ['media' => $real_path, 'description[title]' => $title, 'description[introduction]' => $introduction];
}
return $this->post('api.weixin.qq.com', $url, $data);
}
return $this->sendKefuMsg();
}
/**
* @param string $filePath
* @param string $type
* @param bool $isPermanent
* @param string $title
* @param string $introduction
* @return mixed
* @throws \Exception
*/
public function upload(string $filePath, string $type, $isPermanent = false, string $title = '', string $introduction = '')
{
if (!file_exists($filePath)) {
throw new \Exception('文件不存在');
}
/**
* @return array
*/
public function getContents(): array
{
return $this->msgData;
}
if (!in_array($type, ['image', 'voice', 'video', 'thumb'])) {
throw new \Exception('暂不支持的文件类型');
}
$token = $this->getAccessToken();
if ($isPermanent) {
$url = "https://api.weixin.qq.com/cgi-bin/material/add_material?access_token={$token}&type={$type}";
} else {
$url = "https://api.weixin.qq.com/cgi-bin/media/upload?access_token={$token}&type={$type}";
}
$mime = mime_content_type($filePath);
$real_path = new \CURLFile(realpath($filePath));
$data = array("media" => $real_path, 'form-data[filename]' => $filePath, 'form-data[content-type]' => $mime);
if ($isPermanent && $mime == 'video/mp3') {
$data = ['media' => $real_path, 'description[title]' => $title, 'description[introduction]' => $introduction];
}
$this->request->setMethod(WxClient::POST);
/** @var Result $body */
$data = $this->request->post($url, $data);
if (!$data->isResultsOK()) {
throw new \Exception($data->getMessage());
}
return $data->getData();
}
/**
* @param $mime
* @throws \Exception
*/
private function checkExtinfo($mime)
{
switch (strtolower($mime)) {
case 'image/bmp':
case 'image/png':
case 'image/jpeg':
case 'image/jpg':
case 'image/gif':
break;
case 'mp3/wma/wav/amr':
break;
case 'mp4';
break;
case 'jpg';
break;
default:
throw new \Exception('不支持的文件格式');
}
}
/**
* @param $data
* @return Result
* @throws \Exception
*/
private function sendKefuMsg()
{
$data = json_encode($this->msgData, JSON_UNESCAPED_UNICODE);
$url = '/cgi-bin/message/custom/send?access_token=' . $this->getAccessToken();
$this->request->setMethod(WxClient::POST);
/** @var Result $body */
$body = $this->request->post($url, $data);
if (!$body->isResultsOK()) {
throw new \Exception($body->getMessage());
}
return $body;
}
/**
* @return Result
* @throws
*/
private function sendKefuMsg(): Result
{
$url = '/cgi-bin/message/custom/send?access_token=' . $this->payConfig->getAccessToken();
return $this->post('api.weixin.qq.com', $url, $this->msgData);
}
}
-135
View File
@@ -1,135 +0,0 @@
<?php
/**
* Created by PhpStorm.
* User: whwyy
* Date: 2018/3/26 0026
* Time: 10:23
*/
namespace wchat;
abstract class Miniprogarampage
{
/** @var Config */
protected $config;
/** @var mixed $instance */
private static $instance = null;
/** @var WxClient */
protected $request = null;
/**
* Miniprogarampage constructor.
*/
private function __construct()
{
if (!($this->request instanceof WxClient)) {
$this->request = new WxClient();
}
$this->request->setIsSSL(true);
}
/**
* @param Config $config
* @return mixed
*/
public static function getInstance(Config $config)
{
if (static::$instance === null) {
static::$instance = new static();
}
static::$instance->config = $config;
return static::$instance;
}
/**
* @return bool|mixed|string
* @throws \Exception
*/
protected function getAccessToken()
{
$access = $this->config->getAccessToken();
if (!empty($access)) {
return $access;
}
$this->request->setMethod(WxClient::GET);
$data = $this->request->get('/cgi-bin/token', [
'grant_type' => 'client_credential',
'appid' => $this->config->getAppid(),
'secret' => $this->config->getAppsecret(),
]);
if (!$data->isResultsOK()) {
throw new \Exception($data->getMessage());
}
$access = $data->getData('access_token');
$this->config->setAccessToken($access);
return $access;
}
/**
* @param $data
* @param $body
* @return mixed
* @throws \Exception
*/
protected function buildResult($data, $body = NULL)
{
$data = $this->checkSign($data);
if (!$data) {
$return['code'] = -1;
$return['message'] = '签名错误.';
} else {
if (isset($data['return_code'])) {
if ($data['return_code'] == 'FAIL') {
$return['code'] = -1;
$return['message'] = $data['return_msg'];
} else {
$return['code'] = 0;
$return['data'] = $data;
$return['data']['postBody'] = $body;
}
} else {
if ($data['errcode'] == 'FAIL') {
$return['code'] = -1;
$return['message'] = $data['errmsg'];
} else {
$return['code'] = 0;
$return['data'] = $data;
$return['data']['postBody'] = $body;
}
}
}
return $return;
}
/**
* @param $result
* @return mixed
* @throws \Exception
*/
protected function checkSign($result)
{
$data = Help::toArray($result);
if (!isset($data['sign'])) {
return $data;
}
$sign = $data['sign'];
unset($data['sign']);
$key = $this->config->getKey();
$sign_type = $this->config->getSignType();
$_sign = Help::sign($data, $key, $sign_type);
if ($sign != $_sign) {
return FALSE;
}
return $data;
}
}
+553
View File
@@ -0,0 +1,553 @@
<?php
namespace wchat\wx;
use wchat\common\Help;
class Notify extends SmallProgram
{
public mixed $appid = '';
public mixed $mch_id = '';
public mixed $device_info = '';
public mixed $nonce_str = '';
public mixed $sign = '';
public mixed $sign_type = '';
public mixed $result_code = '';
public mixed $err_code = '';
public mixed $err_code_des = '';
public mixed $openid = '';
public mixed $is_subscribe = '';
public mixed $trade_type = '';
public mixed $bank_type = '';
public mixed $total_fee = '';
public mixed $settlement_total_fee = '';
public mixed $fee_type = '';
public mixed $cash_fee = '';
public mixed $cash_fee_type = '';
public mixed $coupon_fee = '';
public mixed $coupon_count = '';
public mixed $coupon_type_n = '';
public mixed $coupon_id_n = '';
public mixed $coupon_fee_n = '';
public mixed $transaction_id = '';
public mixed $out_trade_no = '';
public mixed $attach = '';
public mixed $time_end = '';
public mixed $return_code = '';
/**
* @return bool
* 判断是否完成支付
*/
public function isSuccess(): bool
{
if ($this->getReturnCode() != "SUCCESS") {
return false;
}
if ($this->getResultCode() != 'SUCCESS') {
return false;
}
return true;
}
/**
* @param array $params
* @return $this
*/
public function setPayNotifyData(array $params): static
{
if (!$this->validation($params)) {
$this->setResultCode('FAIL');
$this->setErrCodeDes('签名错误');
unset($params['result_code'], $params['err_code_des']);
}
foreach ($params as $key => $val) {
$this->__set($key, $val);
}
return $this;
}
/**
* @param string $name
* @param mixed $value
* @return void
*/
public function __set(string $name, mixed $value): void
{
if (property_exists($this, $name)) {
$this->$name = $value;
}
}
/**
* @param array $params
* @return bool
*/
public function validation(array $params): bool
{
$sign = $params['sign'];
unset($params['sign']);
$signType = $this->payConfig->getSignType();
$privateKey = $this->payConfig->pay->wx->secret;
$nowSign = Help::sign($params, $privateKey, $signType);
if ($sign === $nowSign) {
return true;
}
return false;
}
/**
* @return mixed|string
*/
public function getAppid(): mixed
{
return $this->appid;
}
/**
* @param mixed|string $appid
*/
public function setAppid(mixed $appid): void
{
$this->appid = $appid;
}
/**
* @return mixed|string
*/
public function getMchId(): mixed
{
return $this->mch_id;
}
/**
* @param mixed|string $mch_id
*/
public function setMchId(mixed $mch_id): void
{
$this->mch_id = $mch_id;
}
/**
* @return mixed|string
*/
public function getDeviceInfo(): mixed
{
return $this->device_info;
}
/**
* @param mixed|string $device_info
*/
public function setDeviceInfo(mixed $device_info): void
{
$this->device_info = $device_info;
}
/**
* @return mixed|string
*/
public function getNonceStr(): mixed
{
return $this->nonce_str;
}
/**
* @param mixed|string $nonce_str
*/
public function setNonceStr(mixed $nonce_str): void
{
$this->nonce_str = $nonce_str;
}
/**
* @return mixed|string
*/
public function getSign(): mixed
{
return $this->sign;
}
/**
* @param mixed|string $sign
*/
public function setSign(mixed $sign): void
{
$this->sign = $sign;
}
/**
* @return mixed|string
*/
public function getSignType(): mixed
{
return $this->sign_type;
}
/**
* @param mixed|string $sign_type
*/
public function setSignType(mixed $sign_type): void
{
$this->sign_type = $sign_type;
}
/**
* @return mixed|string
*/
public function getResultCode(): mixed
{
return $this->result_code;
}
/**
* @param mixed|string $result_code
*/
public function setResultCode(mixed $result_code): void
{
$this->result_code = $result_code;
}
/**
* @return mixed|string
*/
public function getErrCode(): mixed
{
return $this->err_code;
}
/**
* @param mixed|string $err_code
*/
public function setErrCode(mixed $err_code): void
{
$this->err_code = $err_code;
}
/**
* @return mixed|string
*/
public function getErrCodeDes(): mixed
{
return $this->err_code_des;
}
/**
* @param mixed|string $err_code_des
*/
public function setErrCodeDes(mixed $err_code_des): void
{
$this->err_code_des = $err_code_des;
}
/**
* @return mixed|string
*/
public function getOpenid(): mixed
{
return $this->openid;
}
/**
* @param mixed|string $openid
*/
public function setOpenid(mixed $openid): void
{
$this->openid = $openid;
}
/**
* @return mixed|string
*/
public function getIsSubscribe(): mixed
{
return $this->is_subscribe;
}
/**
* @param mixed|string $is_subscribe
*/
public function setIsSubscribe(mixed $is_subscribe): void
{
$this->is_subscribe = $is_subscribe;
}
/**
* @return mixed|string
*/
public function getTradeType(): mixed
{
return $this->trade_type;
}
/**
* @param mixed|string $trade_type
*/
public function setTradeType(mixed $trade_type): void
{
$this->trade_type = $trade_type;
}
/**
* @return mixed|string
*/
public function getBankType(): mixed
{
return $this->bank_type;
}
/**
* @param mixed|string $bank_type
*/
public function setBankType(mixed $bank_type): void
{
$this->bank_type = $bank_type;
}
/**
* @return mixed|string
*/
public function getTotalFee(): mixed
{
return $this->total_fee;
}
/**
* @param mixed|string $total_fee
*/
public function setTotalFee(mixed $total_fee): void
{
$this->total_fee = $total_fee;
}
/**
* @return mixed|string
*/
public function getSettlementTotalFee(): mixed
{
return $this->settlement_total_fee;
}
/**
* @param mixed|string $settlement_total_fee
*/
public function setSettlementTotalFee(mixed $settlement_total_fee): void
{
$this->settlement_total_fee = $settlement_total_fee;
}
/**
* @return mixed|string
*/
public function getFeeType(): mixed
{
return $this->fee_type;
}
/**
* @param mixed|string $fee_type
*/
public function setFeeType(mixed $fee_type): void
{
$this->fee_type = $fee_type;
}
/**
* @return mixed|string
*/
public function getCashFee(): mixed
{
return $this->cash_fee;
}
/**
* @param mixed|string $cash_fee
*/
public function setCashFee(mixed $cash_fee): void
{
$this->cash_fee = $cash_fee;
}
/**
* @return mixed|string
*/
public function getCashFeeType(): mixed
{
return $this->cash_fee_type;
}
/**
* @param mixed|string $cash_fee_type
*/
public function setCashFeeType(mixed $cash_fee_type): void
{
$this->cash_fee_type = $cash_fee_type;
}
/**
* @return mixed|string
*/
public function getCouponFee(): mixed
{
return $this->coupon_fee;
}
/**
* @param mixed|string $coupon_fee
*/
public function setCouponFee(mixed $coupon_fee): void
{
$this->coupon_fee = $coupon_fee;
}
/**
* @return mixed|string
*/
public function getCouponCount(): mixed
{
return $this->coupon_count;
}
/**
* @param mixed|string $coupon_count
*/
public function setCouponCount(mixed $coupon_count): void
{
$this->coupon_count = $coupon_count;
}
/**
* @return mixed|string
*/
public function getCouponTypeN(): mixed
{
return $this->coupon_type_n;
}
/**
* @param mixed|string $coupon_type_n
*/
public function setCouponTypeN(mixed $coupon_type_n): void
{
$this->coupon_type_n = $coupon_type_n;
}
/**
* @return mixed|string
*/
public function getCouponIdN(): mixed
{
return $this->coupon_id_n;
}
/**
* @param mixed|string $coupon_id_n
*/
public function setCouponIdN(mixed $coupon_id_n): void
{
$this->coupon_id_n = $coupon_id_n;
}
/**
* @return mixed|string
*/
public function getCouponFeeN(): mixed
{
return $this->coupon_fee_n;
}
/**
* @param mixed|string $coupon_fee_n
*/
public function setCouponFeeN(mixed $coupon_fee_n): void
{
$this->coupon_fee_n = $coupon_fee_n;
}
/**
* @return mixed|string
*/
public function getTransactionId(): mixed
{
return $this->transaction_id;
}
/**
* @param mixed|string $transaction_id
*/
public function setTransactionId(mixed $transaction_id): void
{
$this->transaction_id = $transaction_id;
}
/**
* @return mixed|string
*/
public function getOutTradeNo(): mixed
{
return $this->out_trade_no;
}
/**
* @param mixed|string $out_trade_no
*/
public function setOutTradeNo(mixed $out_trade_no): void
{
$this->out_trade_no = $out_trade_no;
}
/**
* @return mixed|string
*/
public function getAttach(): mixed
{
return $this->attach;
}
/**
* @param mixed|string $attach
*/
public function setAttach(mixed $attach): void
{
$this->attach = $attach;
}
/**
* @return mixed|string
*/
public function getTimeEnd(): mixed
{
return $this->time_end;
}
/**
* @param mixed|string $time_end
*/
public function setTimeEnd(mixed $time_end): void
{
$this->time_end = $time_end;
}
/**
* @return mixed|string
*/
public function getReturnCode(): mixed
{
return $this->return_code;
}
/**
* @param mixed|string $return_code
*/
public function setReturnCode(mixed $return_code): void
{
$this->return_code = $return_code;
}
}
+147
View File
@@ -0,0 +1,147 @@
<?php
/**
* Created by PhpStorm.
* User: whwyy
* Date: 2018/4/8 0008
* Time: 9:49
*/
namespace wchat\wx;
use wchat\common\Result;
class PublicTemplate extends SmallProgram
{
private array $keywords = [];
private string $templateId = '';
private array $first = [];
private array $remark = [];
private string $openId = '';
private string $defaultUrl = 'http://weixin.qq.com/download';
private string $sendUrl = '/cgi-bin/message/template/send';
private array $miniprogram = [];
/**
* @param array $keywords
*/
public function setKeywords(array $keywords): void
{
$this->keywords = $keywords;
}
/**
* @param string $templateId
*/
public function setTemplateId(string $templateId): void
{
$this->templateId = $templateId;
}
/**
* @param string $openId
*/
public function setOpenId(string $openId): void
{
$this->openId = $openId;
}
/**
* @param string $defaultUrl
*/
public function setDefaultUrl(string $defaultUrl): void
{
$this->defaultUrl = $defaultUrl;
}
/**
* @param string $name
* @param string $context
* @param string $color
*/
public function replaceKeyword(string $name, string $context, string $color = ''): void
{
$this->keywords[$name] = ['value' => $context, 'color' => $color];
}
/**
* @param string $name
* @param string $context
* @param null $color
*/
public function addKeyword(string $name, string $context, $color = null): void
{
if (empty($color)) {
$color = '#000';
}
$this->keywords[$name] = [
'value' => $context,
'color' => $color
];
}
/**
* @param string $context
* @param string $color
* @return void
*/
public function setFirst(string $context, string $color = '#f00'): void
{
$this->first = [
'value' => $context,
'color' => $color
];
}
/**
* @param string $context
* @param string $color
* @return void
*/
public function setRemark(string $context, string $color = '#000'): void
{
$this->remark = [
'value' => $context,
'color' => $color
];
}
/**
* @param string $appid
* @param string $pagepath
* @return void
*/
public function setMiniprogram(string $appid, string $pagepath): void
{
$this->miniprogram = [
'appid' => $appid,
'pagepath' => $pagepath
];
}
/**
* @return Result
* @throws
*
* 奴隶交易通知
*/
public function sendTemplate(): Result
{
$url = $this->sendUrl . '?access_token=' . $this->payConfig->getAccessToken();
$keywords = $this->keywords;
$keywords['first'] = $this->first;
$keywords['remark'] = $this->remark;
$default = [
"touser" => $this->openId,
"template_id" => $this->templateId,
"url" => $this->defaultUrl,
"data" => $keywords,
];
if (!empty($this->miniprogram)) {
$default['miniprogram'] = $this->miniprogram;
}
return $this->post('api.weixin.qq.com', $url, $default);
}
}
-162
View File
@@ -1,162 +0,0 @@
<?php
/**
* Created by PhpStorm.
* User: whwyy
* Date: 2018/3/26 0026
* Time: 10:22
*/
namespace wchat;
class Recharge extends Miniprogarampage
{
private $money = 0;
private $orderNo;
private $data = [];
private $transfers = 'https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfers';
private $unifiedorder = 'https://api.mch.weixin.qq.com/pay/unifiedorder';
/**
* @param int $money
* @param string $orderNo
* @param string $openId
* @return array|mixed|Result
* @throws
*/
public function recharge(int $money, string $orderNo, $openId = '')
{
if ($money < 0) {
return new Result(['code' => 500, 'message' => '充值金额不能小于0.']);
}
$this->money = $money;
$this->orderNo = $orderNo;
$this->data['openid'] = $openId;
$this->request->setCallback([$this, 'payCallback']);
return $this->send($this->unifiedorder, $this->builder());
}
/**
* @param $result
* @param $body
* @return array
*/
public function payCallback($result, $body)
{
$data = Help::toArray($result);
if (isset($data['sign'])) {
$sign = $data['sign'];
unset($data['sign']);
}
$return = [];
$_sign = Help::sign($data, $this->config->getKey(), $this->config->getSignType());
if (!isset($sign) || $sign != $_sign) {
$return['code'] = -1;
$return['message'] = $data['return_msg'] ?? '返回数据签名验证失败';
} else {
$return['code'] = 0;
$return['data'] = $data;
$return['data']['postBody'] = $body;
if ($data['return_code'] == 'FAIL') {
$return['code'] = -1;
$return['message'] = $data['return_msg'];
}
}
return $return;
}
/**
* @return string
*/
protected function builder()
{
$data = [
'appid' => $this->config->getAppid(),
'mch_id' => $this->config->getMchId(),
'nonce_str' => Help::random(32),
'body' => $this->config->getBody(),
'out_trade_no' => $this->orderNo,
'total_fee' => $this->money,
'sign_type' => $this->config->getSignType(),
'spbill_create_ip' => $_SERVER['REMOTE_ADDR'],
'notify_url' => $this->config->getNotifyUrl(),
'trade_type' => $this->config->getTradeType(),
];
$data = array_merge($data, $this->data);
$key = $this->config->getKey();
$sign_type = $this->config->getSignType();
$data['sign'] = Help::sign($data, $key, $sign_type);
return Help::toXml($data);
}
/**
* @param $money
* @param $openid
* @param $order
* @param $desc
* @return Result
* @throws
*
* 提现
*/
public function cashWithdrawal($money, $openid, $order, $desc = '零钱提现')
{
$array = [
'nonce_str' => Help::random(32),
'partner_trade_no' => $order,
'mchid' => $this->config->getMchId(),
'mch_appid' => $this->config->getAppid(),
'openid' => $openid,
'check_name' => 'NO_CHECK',
'amount' => $money * 100,
'spbill_create_ip' => $this->config->getRemoteAddr(),
'desc' => $desc,
];
$key = $this->config->getKey();
$sign_type = $this->config->getSignType();
$array['sign'] = Help::sign($array, $key, $sign_type);
$this->request->setCallback([$this, 'txCallback']);
return $this->send($this->transfers, Help::toXml($array));
}
/**
* @param $url
* @param $data
* @return array|mixed|Result
* @throws \Exception
*/
private function send($url, $data)
{
$this->request->setIsSSL(true);
$this->request->setMethod(WxClient::POST);
$this->request->addHeader('Content-Type', 'text/xml');
return $this->request->send($url, $data);
}
/**
* @param $data
* @return Result
* 提现回调
*/
public function txCallback($data)
{
$array = Help::toArray($data);
if ($array['result_code'] != 'SUCCESS') {
$data = ['code' => $array['err_code'], 'message' => $array['err_code_des']];
} else {
$data = ['code' => 0, 'message' => '支付成功'];
}
return new Result($data);
}
}
-153
View File
@@ -1,153 +0,0 @@
<?php
namespace wchat;
/**
* Class Result
*
* @package app\components
*
* @property $code
* @property $message
* @property $count
* @property $data
*/
class Result
{
public $code;
public $message;
public $count = 0;
public $data;
public $header;
public function __construct(array $data)
{
foreach ($data as $key => $val) {
$this->$key = $val;
}
$this->header = $this->reloadResponse($this->header);
}
/**
* @param $header
*
* @return array
*/
private function reloadResponse($header)
{
$data = [];
$load = explode("\n", $header);
if (!empty($load) && is_array($load)) {
foreach ($load as $key => $val) {
if (empty($val)) continue;
$ex = explode(': ', $val);
if (!empty($ex[0]) && !empty($ex[1])) {
$data[trim($ex[0])] = trim($ex[1]);
}
}
}
return $data;
}
public function __get($name)
{
return $this->$name;
}
public function __set($name, $value)
{
$this->$name = $value;
return $this;
}
public function getTime()
{
return [
'startTime' => $this->startTime,
'requestTime' => $this->requestTime,
'runTime' => $this->runTime,
];
}
/**
* @param $key
* @param $data
* @return $this
* @throws \Exception
*/
public function setAttr($key, $data)
{
if (!property_exists($this, $key)) {
throw new \Exception('未查找到相应对象属性');
}
$this->$key = $data;
return $this;
}
public function isResultsOK()
{
return $this->code == 0;
}
/**
* @param array $headers
* 批量设置返回头
*/
public function setHeaders(array $headers)
{
foreach ($headers as $key => $val) {
$this->setHeader($key, $val);
}
}
/**
* @param $key
* @param $val
* 设置返回头
*/
public function setHeader($key, $val)
{
header($key . ':' . $val);
}
/**
* @param string $name
* @return mixed
*/
public function getData($name = '')
{
if (!$this->isResultsOK()) {
return '';
}
if (!empty($name) && isset($this->data[$name])) {
return $this->data[$name];
}
return $this->data;
}
/**
* @param $key
* @param $data
* @return $this
*/
public function append($key, $data)
{
$this->data[$key] = $data;
return $this;
}
public function getMessage()
{
return $this->message;
}
public function getCode()
{
return $this->code;
}
}
+110
View File
@@ -0,0 +1,110 @@
<?php
namespace wchat\wx;
use wchat\common\Result;
//if (PHP_VERSION > '8.2') {
// enum Scene
// {
//
// case SCENE_INFO;
// case SCENE_REPLY;
// case SCENE_DISCAZ;
// case SCENE_SHEJIAO;
//
//
// public function getValue(): int
// {
// return match ($this) {
// self::SCENE_INFO => 1,
// self::SCENE_REPLY => 2,
// self::SCENE_DISCAZ => 3,
// self::SCENE_SHEJIAO => 4,
// };
// }
// }
//}
/**
* Class SecCheck
* @package wchat
*/
class SecCheck extends SmallProgram
{
private string $_url = '/wxa/img_sec_check?access_token=';
private string $_msgUrl = '/wxa/msg_sec_check?access_token=';
private string $_mediaCheckAsync = '/wxa/media_check_async?access_token=';
const int MEDIA_VIDEO = 1;
const int MEDIA_IMAGE = 1;
/**
* @param string $path
* @return Result
*/
public function image(string $path = ''): Result
{
if (!file_exists($path)) {
return $this->sendError('文件不存在', 404);
}
$access_token = $this->payConfig->getAccessToken();
return $this->upload('api.weixin.qq.com', $this->_url . '?access_token=' . $access_token, [
'media' => new \CURLFile($path)
]);
}
/**
* @param string $url
* @param int $type
* @return mixed
* @throws
*/
public function mediaAsync(string $url, int $type = SecCheck::MEDIA_IMAGE): Result
{
if (!in_array($type, [self::MEDIA_IMAGE, self::MEDIA_VIDEO])) {
throw new \Exception('暂不支持的文件类型');
}
$requestUrl = $this->_mediaCheckAsync . $this->payConfig->getAccessToken();
return $this->post('api.weixin.qq.com', $requestUrl, ['media_url' => $url, 'media_type' => $type]);
}
/**
* @param array $params
* @return ContentAsyncCheck|null
*/
public function readByEvent(array $params): ?ContentAsyncCheck
{
return ContentAsyncCheck::instance($params);
}
/**
* @param string $content
* @param int $scene
* @param string $openId
* @return Result
*/
public function text(string $content, int $scene, string $openId): Result
{
if (empty($content)) {
return $this->sendError('文件不存在', 404);
}
$requestUrl = $this->_msgUrl . $this->payConfig->getAccessToken();
return $this->post('api.weixin.qq.com', $requestUrl, json_encode([
'content' => $content,
'version' => 2,
'scene' => $scene,
'openid' => $openId
], JSON_UNESCAPED_UNICODE), 'application/json');
}
}
+11
View File
@@ -0,0 +1,11 @@
<?php
namespace wchat\wx;
use wchat\common\Multiprogramming;
class SmallProgram extends Multiprogramming
{
}
+32
View File
@@ -0,0 +1,32 @@
<?php
namespace wchat\wx;
/**
* Class Subject
* @package wchat\wx
*/
class Subject extends \wchat\base\Subject
{
/**
* @return string
*/
public function getUrl(): string
{
return 'cgi-bin/message/subscribe/send';
}
/**
* @return string
*/
public function getHost(): string
{
return 'api.weixin.qq.com';
}
}
+12 -119
View File
@@ -6,138 +6,31 @@
* Time: 9:49
*/
namespace wchat;
namespace wchat\wx;
class Template extends Miniprogarampage
/**
* Class Template
* @package wchat\wx
*/
class Template extends \wchat\base\Template
{
private $keywords = [];
private $templateId = '';
private $formId = '';
private $openId = '';
private $defaultUrl = '';
private $page = 'pages/index/index';
private $emphasis_keyword = '';
private $sendUrl = 'https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send';
/**
* @param array $keywords
* @return string
*/
public function setKeywords(array $keywords)
public function getUrl(): string
{
$this->keywords = $keywords;
}
/**
* @param string $templateId
*/
public function setTemplateId(string $templateId)
{
$this->templateId = $templateId;
}
/**
* @param string $formId
*/
public function setFormId(string $formId)
{
$this->formId = $formId;
}
/**
* @param string $openId
*/
public function setOpenId(string $openId)
{
$this->openId = $openId;
}
/**
* @param string $defaultUrl
*/
public function setDefaultUrl(string $defaultUrl)
{
$this->defaultUrl = $defaultUrl;
}
/**
* @param string $page
*/
public function setPage(string $page)
{
$this->page = $page;
}
/**
* @param string $emphasis_keyword
*/
public function setEmphasisKeyword(string $emphasis_keyword)
{
$this->emphasis_keyword = $emphasis_keyword;
}
/**
* @param $index
* @param $context
* @param $color
*/
public function replaceKeyword($index, $context, $color = '')
{
if (empty($color)) {
$color = '#000';
}
$this->keywords['keyword' . $index] = [
'value' => $context,
'color' => $color
];
return '/cgi-bin/message/wxopen/template/send';
}
/**
* @param $color
* @param $context
* @return string
*/
public function addKeyword($context, $color = null)
public function getHost(): string
{
if (empty($color)) {
$color = '#000';
}
$this->keywords['keyword' . count($this->keywords)] = [
'value' => $context,
'color' => $color
];
return 'api.weixin.qq.com';
}
/**
* @return Result
* @throws \Exception
*
* 奴隶交易通知
*/
public function sendTemplate()
{
$url = $this->sendUrl . '?access_token=' . $this->getAccessToken();
$params = json_encode([
"touser" => $this->openId,
"template_id" => $this->templateId,
"page" => $this->page,
"form_id" => $this->formId,
"data" => $this->keywords,
], JSON_UNESCAPED_UNICODE);
if (!empty($this->emphasis_keyword)) {
$params['emphasis_keyword'] = $this->emphasis_keyword;
}
$this->request->setIsSSL(true);
$this->request->addHeader('content-type', 'application/json');
$result = $this->request->post($url, $params);
$result->append('postBody', $params);
return $result;
}
}
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace wchat\wx;
use wchat\common\Result;
class Token extends SmallProgram
{
/**
* @return Result
*/
public function token(): Result
{
$query = ['grant_type' => 'client_credential'];
if ($this->payConfig->typeIsApp()) {
$query['appid'] = $this->payConfig->pay->wx->appId;
$query['secret'] = $this->payConfig->pay->wx->appSecret;
} else {
$query['appid'] = $this->payConfig->appId;
$query['secret'] = $this->payConfig->appSecret;
}
return $this->get('api.weixin.qq.com', 'cgi-bin/token', $query);
}
}
+228
View File
@@ -0,0 +1,228 @@
<?php
namespace wchat\wx\V3\Libs;
use Exception;
class TransferDetail
{
private string $out_bill_no;
private string $transfer_scene_id;
private string $openid;
private string $user_name = '';
private int $transfer_amount;
private string $transfer_remark;
private string $notify_url = '';
private string $user_recv_perception = '';
private array $transfer_scene_report_infos;
/**
* @return string
*/
public function getOutBillNo(): string
{
return $this->out_bill_no;
}
/**
* @param string $out_bill_no
* @return void
*/
public function setOutBillNo(string $out_bill_no): void
{
$this->out_bill_no = $out_bill_no;
}
/**
* @return string
*/
public function getTransferSceneId(): string
{
return $this->transfer_scene_id;
}
/**
* @param string $transfer_scene_id
* @return void
*/
public function setTransferSceneId(string $transfer_scene_id): void
{
$this->transfer_scene_id = $transfer_scene_id;
}
/**
* @return string
*/
public function getOpenid(): string
{
return $this->openid;
}
/**
* @param string $openid
* @return void
*/
public function setOpenid(string $openid): void
{
$this->openid = $openid;
}
/**
* @return string
*/
public function getUserName(): string
{
return $this->user_name;
}
/**
* @param string $user_name
* @return void
*/
public function setUserName(string $user_name): void
{
$this->user_name = $user_name;
}
/**
* @return int
*/
public function getTransferAmount(): int
{
return $this->transfer_amount;
}
/**
* @param int $transfer_amount
* @return void
*/
public function setTransferAmount(int $transfer_amount): void
{
$this->transfer_amount = $transfer_amount;
}
/**
* @return string
*/
public function getTransferRemark(): string
{
return $this->transfer_remark;
}
/**
* @param string $transfer_remark
* @return void
*/
public function setTransferRemark(string $transfer_remark): void
{
$this->transfer_remark = $transfer_remark;
}
/**
* @return string
*/
public function getNotifyUrl(): string
{
return $this->notify_url;
}
/**
* @param string $notify_url
* @return void
*/
public function setNotifyUrl(string $notify_url): void
{
$this->notify_url = $notify_url;
}
/**
* @return string
*/
public function getUserRecvPerception(): string
{
return $this->user_recv_perception;
}
/**
* @param string $user_recv_perception
* @return void
*/
public function setUserRecvPerception(string $user_recv_perception): void
{
$this->user_recv_perception = $user_recv_perception;
}
/**
* @return array<TransferSceneReportInfo>
*/
public function getTransferSceneReportInfos(): array
{
return $this->transfer_scene_report_infos;
}
/**
* @param array $transfer_scene_report_infos
* @return void
*/
public function setTransferSceneReportInfos(TransferSceneReportInfo ...$transfer_scene_report_infos): void
{
$this->transfer_scene_report_infos = $transfer_scene_report_infos;
}
/**
* @return array
* @throws Exception
*/
public function toArray(): array
{
$transfer_scene_report_infos = [];
foreach ($this->transfer_scene_report_infos as $transfer_scene_report_info) {
$transfer_scene_report_infos[] = $transfer_scene_report_info->toArray();
}
$array = [
'out_bill_no' => $this->out_bill_no,
'transfer_scene_id' => $this->transfer_scene_id,
'openid' => $this->openid,
'transfer_amount' => $this->transfer_amount,
'transfer_remark' => $this->transfer_remark,
'transfer_scene_report_infos' => $transfer_scene_report_infos,
];
foreach ($array as $key => $value) {
if (empty($value)) {
throw new Exception('必填项' . $key . '不能为空.');
}
}
if (!empty($this->user_name)) {
$array['user_name'] = $this->user_name;
}
if (!empty($this->notify_url)) {
$array['notify_url'] = $this->notify_url;
}
if (!empty($this->user_recv_perception)) {
$array['user_recv_perception'] = $this->user_recv_perception;
}
return $array;
}
}
+31
View File
@@ -0,0 +1,31 @@
<?php
namespace wchat\wx\V3\Libs;
use Arrayable;
readonly class TransferSceneReportInfo implements Arrayable
{
public function __construct(
public string $info_type,
public string $info_content,
)
{
}
/**
* @return array
*/
public function toArray(): array
{
return [
"info_type" => $this->info_type,
"info_content" => $this->info_content
];
}
}
+24
View File
@@ -0,0 +1,24 @@
<?php
namespace wchat\wx\V3\Notify;
class GoodsDetail
{
public string $goods_remark = "商品备注信息";
public int $quantity = 1;
public int $discount_amount = 1;
public string $goods_id = "M1006";
public int $unit_price = 100;
/**
* @param array $value
*/
public function __construct(readonly public array $value)
{
$this->goods_remark = $this->value['goods_remark'];
$this->quantity = $this->value['quantity'];
$this->discount_amount = $this->value['discount_amount'];
$this->goods_id = $this->value['goods_id'];
$this->unit_price = $this->value['unit_price'];
}
}
+93
View File
@@ -0,0 +1,93 @@
<?php
namespace wchat\wx\V3\Notify;
use JetBrains\PhpStorm\ArrayShape;
class NotifyModel
{
//公众号支付
const string PAY_TYPE_JSAPI = 'JSAPI';
//扫码支付
const string PAY_TYPE_NATIVE = 'NATIVE';
//App支付
const string PAY_TYPE_App = 'App';
//付款码支付
const string PAY_TYPE_MICROPAY = 'MICROPAY';
//H5支付
const string PAY_TYPE_MWEB = 'MWEB';
//刷脸支付
const string PAY_TYPE_FACEPAY = 'FACEPAY';
// 支付成功
const string PAY_RESULT_SUCCESS = 'SUCCESS';
// 转入退款
const string PAY_RESULT_REFUND = 'REFUND';
// 未支付
const string PAY_RESULT_NOTPAY = 'NOTPAY';
// 已关闭
const string PAY_RESULT_CLOSED = 'CLOSED';
// 已撤销(付款码支付)
const string PAY_RESULT_REVOKED = 'REVOKED';
// 用户支付中(付款码支付)
const string PAY_RESULT_USERPAYING = 'USERPAYING';
// 支付失败(其他原因,如银行返回失败)
const string PAY_RESULT_PAYERROR = 'PAYERROR';
public string $appid;
public string $mchid;
public string $out_trade_no;
public string $transaction_id;
public string $trade_type;
public string $trade_state;
public string $trade_state_desc;
public string $bank_type;
public string $attach;
public string $success_time;
/**
* @var array|string[]
*/
#[ArrayShape(['openid' => 'string'])]
public array $payer = ['openid' => ''];
/**
* @var array
*/
#[ArrayShape(['payer_total' => 'int', 'total' => 'int', 'currency' => 'string', 'payer_currency' => 'string'])]
public array $amount = [
"payer_total" => 100,
"total" => 100,
"currency" => "CNY",
"payer_currency" => "CNY"
];
/**
* @var array|string[]
*/
#[ArrayShape(['device_id' => 'string'])]
public array $scene_info = [
'device_id' => ''
];
/**
* @var array<PromotionDetail>
*/
public array $promotion_detail = [];
}
+23
View File
@@ -0,0 +1,23 @@
<?php
namespace wchat\wx\V3\Notify;
class PromotionDetail
{
public int $amount = 100;
public int $wechatpay_contribute = 0;
public string $coupon_id = "109519";
public string $scope = "GLOBAL";
public int $merchant_contribute = 0;
public string $name = "单品惠-6";
public int $other_contribute = 0;
public string $currency = "CNY";
public string $stock_id = "931386";
/**
* @var array<GoodsDetail>
*/
public array $goods_detail = [];
}
+43
View File
@@ -0,0 +1,43 @@
<?php
namespace wchat\wx\V3;
use Exception;
use wchat\wx\SmallProgram;
class WxV3AppPayment extends SmallProgram
{
use WxV3PaymentTait;
/**
* @param string $orderNo
* @param int $total
* @param string|null $openId
* @param string $payer_client_ip
* @return array
* @throws
*/
public function payment(string $orderNo, int $total, ?string $openId = NULL, string $payer_client_ip = '127.0.0.1'): array
{
$body = $this->getInitCore($orderNo, $total);
$body['scene_info'] = ['payer_client_ip' => $payer_client_ip];
$sign = $this->signature('POST', '/v3/pay/transactions/components', $json = json_encode($body, JSON_UNESCAPED_UNICODE));
$client = $this->createClient($sign, $json);
$client->post('/v3/pay/transactions/components');
$client->close();
$json = json_decode($client->getBody(), TRUE);
if (!isset($json['prepay_id'])) {
throw new Exception('微信支付调用失败');
}
return $this->createResponse($json, $body);
}
}
+43
View File
@@ -0,0 +1,43 @@
<?php
namespace wchat\wx\V3;
use Exception;
use JetBrains\PhpStorm\ArrayShape;
use wchat\wx\SmallProgram;
class WxV3NativePayment extends SmallProgram
{
use WxV3PaymentTait;
/**
* @param string $orderNo
* @param int $total
* @param string|null $openId
* @param string $payer_client_ip
* @return array
* @throws
*/
#[ArrayShape(['code_url' => "string"])]
public function payment(string $orderNo, int $total, ?string $openId = NULL, string $payer_client_ip = '127.0.0.1'): array
{
$body = $this->getInitCore($orderNo, $total);
$sign = $this->signature('POST', '/v3/pay/transactions/native', $json = json_encode($body, JSON_UNESCAPED_UNICODE));
$client = $this->createClient($sign, $json);
$client->post('/v3/pay/transactions/native');
$client->close();
$json = json_decode($client->getBody(), TRUE);
if (!isset($json['code_url'])) {
throw new Exception('微信支付调用失败');
}
return ['code_url' => $json['code_url']];
}
}
+44
View File
@@ -0,0 +1,44 @@
<?php
namespace wchat\wx\V3;
use Exception;
use wchat\wx\SmallProgram;
class WxV3Payment extends SmallProgram
{
use WxV3PaymentTait;
/**
* @param string $orderNo
* @param int $total
* @param string|null $openId
* @param string $payer_client_ip
* @return array
* @throws
*/
public function payment(string $orderNo, int $total, ?string $openId = NULL, string $payer_client_ip = '127.0.0.1'): array
{
$body = $this->getInitCore($orderNo, $total);
$body['payer'] = ['openid' => $openId];
$body['scene_info'] = ['payer_client_ip' => $payer_client_ip];
$sign = $this->signature('POST', '/v3/pay/transactions/jsapi', $json = json_encode($body, JSON_UNESCAPED_UNICODE));
$client = $this->createClient($sign, $json);
$client->post('/v3/pay/transactions/jsapi');
$client->close();
$json = json_decode($client->getBody(), TRUE);
if (!isset($json['prepay_id'])) {
throw new Exception('微信支付调用失败: ' . $client->getBody());
}
return $this->createResponse($json, $body);
}
}
+175
View File
@@ -0,0 +1,175 @@
<?php
namespace wchat\wx\V3;
use Exception;
use OpenSSLAsymmetricKey;
use Psr\Http\Message\RequestInterface;
use wchat\wx\SmallProgram;
use wchat\wx\V3\Notify\GoodsDetail;
use wchat\wx\V3\Notify\NotifyModel;
use wchat\wx\V3\Notify\PromotionDetail;
const KEY_TYPE_PUBLIC = 'public';
const KEY_TYPE_PRIVATE = 'private';
class WxV3PaymentNotify extends SmallProgram
{
use WxV3PaymentTait;
/**
* @param string $id
* @param string $create_time
* @param string $resource_type
* @param string $event_type
* @param string $summary
* @param array $resource
*/
public function __construct(
public string $id = "EV-2018022511223320873",
public string $create_time = "2015-05-20T13:29:35+08:00",
public string $resource_type = "encrypt-resource",
public string $event_type = "TRANSACTION.SUCCESS",
public string $summary = "支付成功",
public array $resource = []
)
{
}
/**
* @var NotifyModel
*/
public NotifyModel $notifyModel;
/**
* @param RequestInterface $request
* @return bool
* @throws
*/
public function verify(RequestInterface $request): bool
{
$platformPublicKeyInstance = $this->rsaFrom($this->payConfig->pay->wx->mchKey, KEY_TYPE_PUBLIC);
$inWechatpaySignature = $request->getHeaderLine('wechatpay-signature'); // 请根据实际情况获取
$inWechatpayTimestamp = $request->getHeaderLine('wechatpay-timestamp'); // 请根据实际情况获取
$inWechatpayNonce = $request->getHeaderLine('wechatpay-nonce'); // 请根据实际情况获取
$inBody = $request->getBody()->getContents(); // 请根据实际情况获取,例如: file_get_contents('php://input');
$timeOffsetStatus = 300 >= abs(time() - (int)$inWechatpayTimestamp);
$verifiedStatus = $this->notifyVerify(
$this->lineFeed($inWechatpayTimestamp, $inWechatpayNonce, $inBody),
$inWechatpaySignature,
$platformPublicKeyInstance);
$this->decode($this->resource['ciphertext'], $this->resource['nonce'], $this->resource['associated_data']);
if (!$timeOffsetStatus || !$verifiedStatus) {
return false;
} else {
return true;
}
}
/**
* @param ...$pieces
* @return string
*/
protected function lineFeed(...$pieces): string
{
return implode("\n", array_merge($pieces, ['']));
}
/**
* @return string|bool
*/
protected function body(): string|bool
{
return json_encode(['id' => $this->id, 'create_time' => $this->create_time, 'resource_type' => $this->resource_type, 'event_type' => $this->event_type, 'summary' => $this->summary, 'resource' => $this->resource]);
}
/**
* @param string $message
* @param string $signature
* @param OpenSSLAsymmetricKey $publicKey
* @return bool
*/
protected function notifyVerify(string $message, string $signature, OpenSSLAsymmetricKey $publicKey): bool
{
if (($result = openssl_verify($message, base64_decode($signature), $publicKey, OPENSSL_ALGO_SHA256)) === false) {
throw new \UnexpectedValueException('Verified the input $message failed, please checking your $publicKey whether or nor correct.');
}
return $result === 1;
}
/**
* @param string $thing
* @param string $type
* @return OpenSSLAsymmetricKey
*/
protected function rsaFrom(string $thing, string $type = KEY_TYPE_PRIVATE): OpenSSLAsymmetricKey
{
$pkey = (($isPublic = $type === KEY_TYPE_PUBLIC) ? openssl_pkey_get_public('file://' . $thing) : openssl_pkey_get_private('file://' . $thing));
if (false === $pkey) {
throw new \UnexpectedValueException(sprintf('Cannot load %s from(%s), please take care about the $thing input.', $isPublic ? 'publicKey' : 'privateKey', gettype($thing)));
}
return $pkey;
}
/**
* @param string $ciphertext
* @param string $nonce
* @param string $associated_data
* @return bool
*/
public function decode(string $ciphertext, string $nonce, string $associated_data): bool
{
$data = $this->decrypt($ciphertext, $this->payConfig->pay->wx->secret, $nonce, $associated_data);
$this->notifyModel = new NotifyModel();
$this->notifyModel->amount = $data['amount'];
$this->notifyModel->payer = $data['payer'];
$this->notifyModel->scene_info = $data['payer'];
$this->notifyModel->appid = $data['appid'];
$this->notifyModel->mchid = $data['mchid'];
$this->notifyModel->out_trade_no = $data['out_trade_no'];
$this->notifyModel->transaction_id = $data['transaction_id'];
$this->notifyModel->trade_type = $data['trade_type'];
$this->notifyModel->trade_state = $data['trade_state'];
$this->notifyModel->trade_state_desc = $data['trade_state_desc'];
$this->notifyModel->bank_type = $data['bank_type'];
$this->notifyModel->attach = $data['attach'];
$this->notifyModel->success_time = $data['success_time'];
$this->notifyModel->promotion_detail = [];
if (!isset($data['promotion_detail'])) {
return true;
}
foreach ($data['promotion_detail'] as $datum) {
$detail = new PromotionDetail();
$detail->amount = $datum['amount'];
$detail->wechatpay_contribute = $datum['wechatpay_contribute'];
$detail->coupon_id = $datum['coupon_id'];
$detail->scope = $datum['scope'];
$detail->merchant_contribute = $datum['merchant_contribute'];
$detail->name = $datum['name'];
$detail->other_contribute = $datum['other_contribute'];
$detail->currency = $datum['currency'];
$detail->stock_id = $datum['stock_id'];
$detail->goods_detail = [];
if (isset($data['goods_detail'])) {
foreach ($datum['goods_detail'] as $value) {
$detail->goods_detail[] = new GoodsDetail($value);
}
}
$this->notifyModel->promotion_detail[] = $detail;
}
return true;
}
}
+192
View File
@@ -0,0 +1,192 @@
<?php
namespace wchat\wx\V3;
use Exception;
use Kiri\Client;
use wchat\common\Help;
/**
* Bytes Length of the AES block
*/
const BLOCK_SIZE = 16;
/**
* The `aes-256-gcm` algorithm string
*/
const ALGO_AES_256_GCM = 'aes-256-gcm';
trait WxV3PaymentTait
{
/**
* @param string $orderNo
* @param int $total
* @return array
*/
public function getInitCore(string $orderNo, int $total): array
{
$payConfig = $this->getPayConfig();
if ($payConfig->typeIsApp()) {
$body['appid'] = $payConfig->pay->wx->appId;
} else {
$body['appid'] = $payConfig->appId;
}
$body['mchid'] = $payConfig->pay->wx->mchId;
$body['description'] = $payConfig->getBody();
$body['out_trade_no'] = $orderNo;
$body['notify_url'] = $payConfig->getNotifyUrl();
$body['amount'] = ['total' => $total, 'currency' => $payConfig->getCurrency()];
return $body;
}
/**
* @param string $sign
* @param string $json
* @return Client
*/
public function createClient(string $sign, string $json): Client
{
$client = new Client('api.mch.weixin.qq.com', 80, TRUE);
$client->withAddedHeader('Authorization', $sign)
->withContentType('application/json')->withAddedHeader('User-Agent', 'application/json')
->withAddedHeader("Accept", "*/*");
if (!empty($json)) {
$client->withBody($json);
}
$proxyHost = $this->getPayConfig()->getProxyHost();
$proxyPort = $this->getPayConfig()->getProxyPort();
if (!empty($proxyHost) && $proxyPort > 0) {
$client->withProxyHost($proxyHost)->withProxyPort($proxyPort);
}
return $client;
}
/**
* @param string $orderNo
* @return array
* @throws
*/
public function searchByOutTradeNo(string $orderNo): array
{
return $this->search('/v3/pay/transactions/out-trade-no/' . $orderNo);
}
/**
* @param string $orderNo
* @return array
* @throws
*/
public function searchByTransactionId(string $orderNo): array
{
return $this->search('/v3/pay/transactions/id/' . $orderNo);
}
/**
* @param string $parseUrl
* @return array
* @throws
*/
private function search(string $parseUrl): array
{
$config = $this->getPayConfig();
$sign = $this->signature('GET', $parseUrl . '?mchid=' . $config->pay->wx->mchId);
$client = $this->createClient($sign, '');
$client->withAddedHeader('Accept', 'application/json');
$client->get($parseUrl, ['mchid' => $config->pay->wx->mchId]);
$client->close();
return json_decode($client->getBody(), TRUE);
}
/**
* @param string $http_method
* @param string $canonical_url
* @param string $body
* @return string
* @throws
*/
public function signature(string $http_method, string $canonical_url, string $body = ''): string
{
$payConfig = $this->getPayConfig();
$rand = md5(random_bytes(32));
$time = time();
$message = sprintf("%s\n%s\n%d\n%s\n%s\n", $http_method, $canonical_url, $time, $rand, $body);
$sign = $this->openssl_signature($message);
return sprintf('%s mchid="%s",nonce_str="%s",timestamp="%d",serial_no="%s",signature="%s"', $payConfig->pay->wx->schema,
$payConfig->pay->wx->mchId, $rand, $time, $payConfig->pay->wx->SerialNumber, $sign);
}
/**
* @param string $body
* @return string
*/
public function openssl_signature(string $body): string
{
$payConfig = $this->getPayConfig();
$mch_private_key = openssl_get_privatekey(file_get_contents($payConfig->pay->wx->mchCert));
openssl_sign($body, $raw_sign, $mch_private_key, 'sha256WithRSAEncryption');
return base64_encode($raw_sign);
}
/**
* @param array $json
* @param array $body
* @return array
*/
private function createResponse(array $json, array $body): array
{
$responseArray['appId'] = $body['appid'];
$responseArray['timeStamp'] = (string)time();
$responseArray['nonceStr'] = Help::random(32);
$responseArray['package'] = "prepay_id=" . $json['prepay_id'];
$responseBody = $responseArray['appId'] . PHP_EOL . $responseArray['timeStamp'] . PHP_EOL . $responseArray['nonceStr'] . PHP_EOL . $responseArray['package'] . PHP_EOL;
$responseArray['signType'] = 'RSA';
$responseArray['signBody'] = $responseBody;
$responseArray['paySign'] = $this->openssl_signature($responseBody);
$responseArray['prepay_id'] = $json['prepay_id'];
return $responseArray;
}
/**
* @param string $ciphertext
* @param string $v3Key
* @param string $iv
* @param string $aad
* @return array
*/
public function decrypt(string $ciphertext, string $v3Key, string $iv = '', string $aad = ''): array
{
$ciphertext = base64_decode($ciphertext);
$authTag = substr($ciphertext, $tailLength = 0 - BLOCK_SIZE);
$tagLength = strlen($authTag);
/* Manually checking the length of the tag, because the `openssl_decrypt` was mentioned there, it's the caller's responsibility. */
if ($tagLength > BLOCK_SIZE || ($tagLength < 12 && $tagLength !== 8 && $tagLength !== 4)) {
throw new \RuntimeException('The inputs `$ciphertext` incomplete, the bytes length must be one of 16, 15, 14, 13, 12, 8 or 4.');
}
$plaintext = openssl_decrypt(substr($ciphertext, 0, $tailLength), ALGO_AES_256_GCM, $v3Key, OPENSSL_RAW_DATA, $iv, $authTag, $aad);
if (false === $plaintext) {
throw new \UnexpectedValueException('Decrypting the input $ciphertext failed, please checking your $key and $iv whether or nor correct.');
}
return json_decode($plaintext, true);
}
}
+45
View File
@@ -0,0 +1,45 @@
<?php
namespace wchat\wx\V3;
use Exception;
use JetBrains\PhpStorm\ArrayShape;
use Kiri;
use wchat\wx\SmallProgram;
use wchat\wx\V3\Libs\TransferDetail;
class WxV3Transfer extends SmallProgram
{
use WxV3PaymentTait;
/**
* @param TransferDetail $detail
* @return array<'out_bill_no', 'transfer_bill_no', 'create_time', 'state'>
* @throws Exception
*/
#[ArrayShape([])]
public function transfer(TransferDetail $detail): array
{
$payConfig = $this->getPayConfig();
$body = $detail->toArray();
if ($payConfig->typeIsApp()) {
$body['appid'] = $payConfig->pay->wx->appId;
} else {
$body['appid'] = $payConfig->appId;
}
$sign = $this->signature('POST', '/v3/fund-app/mch-transfer/transfer-bills', $json = json_encode($body, JSON_UNESCAPED_UNICODE));
$client = $this->createClient($sign, $json);
$client->post('/v3/fund-app/mch-transfer/transfer-bills');
$client->close();
Kiri::getLogger()->println($client->getBody());
if ($client->getStatusCode() == 200) {
return json_decode($client->getBody(), TRUE);
}
throw new Exception('转账申请发起失败');
}
}
+99
View File
@@ -0,0 +1,99 @@
<?php
namespace wchat\wx\V3;
use Exception;
use JetBrains\PhpStorm\ArrayShape;
use wchat\wx\SmallProgram;
use wchat\wx\V3\Libs\TransferDetail;
class WxV3Withdrawal extends SmallProgram
{
use WxV3PaymentTait;
/**
* @param string $orderNo
* @param string $batch_name
* @param string $batch_remark
* @param TransferDetail[] $details
* @return array
* @throws
*/
public function payment(string $orderNo, string $batch_name, string $batch_remark, array $details): array
{
$body = $this->create($orderNo, $batch_name, $batch_remark, $details);
$sign = $this->signature('POST', '/v3/pay/transactions/batches', $json = json_encode($body, JSON_UNESCAPED_UNICODE));
$client = $this->createClient($sign, $json);
$client->post('/v3/pay/transactions/batches');
$client->close();
$json = json_decode($client->getBody(), TRUE);
if (!isset($json['prepay_id'])) {
throw new Exception('微信支付调用失败');
}
return $this->createResponse($json, $body);
}
/**
* @param string $orderNo
* @param string $batch_name
* @param string $batch_remark
* @param array $details
* @return array[]
*/
#[ArrayShape(['transfer_detail_list' => "array", 'total_amount' => "int", 'total_num' => "int", 'batch_remark' => "string", 'batch_name' => "string", 'out_batch_no' => ""])]
private function create(string $orderNo, string $batch_name, string $batch_remark, array $details): array
{
$total = 0;
$body = ['transfer_detail_list' => []];
$body['out_batch_no'] = $orderNo;
$body['batch_name'] = $batch_name;
$body['batch_remark'] = $batch_remark;
$body['total_num'] = count($details);
foreach ($details as $detail) {
$total += $detail->transfer_amount;
$body['transfer_detail_list'][] = $detail->toArray();
}
$body['total_amount'] = $total;
return $body;
}
/**
* @param TransferDetail $detail
* @return array<'out_bill_no', 'transfer_bill_no', 'create_time', 'state'>
* @throws Exception
*/
#[ArrayShape([])]
public function transfer(TransferDetail $detail): array
{
$payConfig = $this->getPayConfig();
$body = $detail->toArray();
if ($payConfig->typeIsApp()) {
$body['appid'] = $payConfig->pay->wx->appId;
} else {
$body['appid'] = $payConfig->appId;
}
$sign = $this->signature('POST', '/v3/fund-app/mch-transfer/transfer-bills', $json = json_encode($body, JSON_UNESCAPED_UNICODE));
$client = $this->createClient($sign, $json);
$client->post('/v3/fund-app/mch-transfer/transfer-bills');
$client->close();
Kiri::getLogger()->println($client->getBody());
if ($client->getStatusCode() == 200) {
return json_decode($client->getBody(), TRUE);
}
throw new Exception('转账申请发起失败');
}
}
-77
View File
@@ -1,77 +0,0 @@
<?php
namespace wchat;
class Wx
{
/** @var static $instance */
private static $instance = null;
/** @var Config $config */
private $config = null;
/**
* @return static
*/
public static function getMiniProGaRamPage()
{
if (static::$instance === null) {
static::$instance = new Wx();
}
return static::$instance;
}
/**
* @return Config
*/
public function getConfig()
{
return $this->config;
}
/**
* @param Config $config
* @return $this
*/
public function setConfig(Config $config)
{
$this->config = $config;
return $this;
}
/**
* @return Template
*/
public function getTemplate()
{
return Template::getInstance($this->config);
}
/**
* @return Account
*/
public function getAccount()
{
return Account::getInstance($this->config);
}
/**
* @return Message
*/
public function getMessage()
{
return Message::getInstance($this->config);
}
/**
* @return Recharge
*/
public function getRecharge()
{
return Recharge::getInstance($this->config);
}
}
-396
View File
@@ -1,396 +0,0 @@
<?php
namespace wchat;
use Swoole\Coroutine\Http\Client;
class WxClient
{
private $host = 'api.weixin.qq.com';
private $header = [];
private $callback = null;
private $method = 'get';
private $url = '';
private $isSSL = false;
const POST = 'post';
const GET = 'get';
const PUT = 'put';
const DELETE = 'delete';
const OPTIONS = 'option';
/**
* @param string $host
*/
public function setHost(string $host)
{
$this->host = $host;
}
/**
* @param array $header
*/
public function setHeader(array $header)
{
$this->header = $header;
}
/**
* @param $key
* @param $value
*/
public function addHeader($key, $value)
{
$this->header[$key] = $value;
}
/**
* @param null $callback
*/
public function setCallback($callback)
{
$this->callback = $callback;
}
/**
* @param string $method
*/
public function setMethod(string $method)
{
$this->method = $method;
}
/**
* @param string $url
*/
public function setUrl(string $url)
{
$this->url = $url;
}
/**
* @param bool $isSSL
*/
public function setIsSSL(bool $isSSL)
{
$this->isSSL = $isSSL;
if ($this->isSSL) {
$ssl = Wx::getMiniProGaRamPage()->getConfig();
$this->header['ssl_cert_file'] = $ssl->getSslCert();
$this->header['ssl_key_file'] = $ssl->getSslKey();
}
}
/**
* @param $url
* @param array $data
* @return array|mixed|Result
* @throws \Exception
*/
private function request($url, $data = [])
{
if (
strpos($url, 'http://') === 0 ||
strpos($url, 'https://') === 0
) {
return $this->curl($url, $data);
}
if (function_exists('getIsCli') && getIsCli()) {
return $this->coroutine($url, $data);
}
if ($this->isSSL) {
return $this->curl('https://' . $this->host . '/' . $url, $data);
} else {
return $this->curl('http://' . $this->host . '/' . $url, $data);
}
}
/**
* @param $url
* @param array $data
* @return array|mixed|Result
* @throws \Exception
*
* 使用swoole协程方式请求
*/
private function coroutine($url, $data = [])
{
$_data = $this->paramEncode($data);
if ($this->method == 'get' && is_array($_data)) {
$url .= '?' . http_build_query($_data);
}
$client = $this->getClient($this->getHostPort(), $url, $data);
if ($client->statusCode < 0) {
throw new \Exception('连接错误!');
}
$body = $client->body;
$client->close();
return $this->structure($body, $_data);
}
/**
* @return mixed
*/
private function getHostIp()
{
return array_shift(\Co::getAddrInfo($this->host));
}
/**
* @return int
*/
private function getHostPort()
{
$port = 80;
if ($this->isSSL) $port = 443;
return $port;
}
/**
* @param $port
* @param $url
* @param $data
* @return Client
*/
private function getClient($port, $url, $data)
{
$host = $this->getHostIp();
$client = new Client($host, $port, $this->isSSL);
if (!empty($this->header)) {
$client->setHeaders($this->header);
}
switch (strtolower($this->method)) {
case self::GET:
$client->get($url);
break;
default:
$client->post($url, $data);
}
return $client;
}
/**
* @param $url
* @param array $data
* @return array|mixed|Result
*/
private function curl($url, $data = [])
{
$data = $this->paramEncode($data, self::POST);
$ch = $this->structureCurlRequest($url, $data);
if ($this->method != self::GET) {
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
} else if ($this->method == self::POST) {
curl_setopt($ch, CURLOPT_POST, 1);
}
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, strtoupper($this->method));
$output = curl_exec($ch);
if ($output === FALSE) {
return new Result(['code' => 500, 'message' => curl_error($ch)]);
}
curl_close($ch);
return $this->structure($output, $data);
}
/**
* @param $url
* @param $_data
* @return resource
*/
private function structureCurlRequest($url, $_data)
{
$ch = curl_init();
if ($this->method == self::GET) {
$url = $url . '?' . $_data;
}
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);// 超时设置
curl_setopt($ch, CURLOPT_HEADER, FALSE);
if (!empty($this->header)) {
curl_setopt($ch, CURLOPT_HTTPHEADER, $this->header);
}
if ($this->isSSL) {
curl_setopt($ch, CURLOPT_SSLCERT, $this->header['ssl_cert_file']);
curl_setopt($ch, CURLOPT_SSLKEY, $this->header['ssl_key_file']);
}
curl_setopt($ch, CURLOPT_NOBODY, FALSE);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 1);// 超时设置
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);//返回内容
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);// 跟踪重定向
curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate');
return $ch;
}
/**
* @param $body
* @param $_data
* @return array|mixed|Result
* 构建返回体
*/
private function structure($body, $_data)
{
$this->setIsSSL(false);
$this->setHeaders(null);
if ($this->callback !== NULL) {
$result = call_user_func($this->callback, $body, $_data);
} else {
$result = $this->formatResponseBody($body);
}
$this->setCallback(null);
if (!is_array($result)) {
return $result;
}
return new Result($result);
}
/**
* @param $body
* @return array|Result
*/
private function formatResponseBody($body)
{
$result = [];
if (is_null($results = json_decode($body, TRUE))) {
$data = simplexml_load_string($body, 'SimpleXMLElement', LIBXML_NOCDATA);
$results = json_decode(json_encode($data), TRUE);
}
if (!is_array($results)) {
$result = new Result(['code' => 505, 'message' => '服务器返回体错误!']);
} else if (isset($results['errcode'])) {
$result['code'] = $results['errcode'];
$result['message'] = $results['errmsg'];
} else {
$result['code'] = 0;
$result['message'] = 'system success.';
$result['data'] = $results;
}
return $result;
}
/**
* @param $arr
* @param string $pushType
*
* @return array|string
* 将请求参数进行编码
*/
private function paramEncode($arr, $pushType = 'post')
{
if (!is_array($arr)) {
return $arr;
}
$_tmp = [];
foreach ($arr as $Key => $val) {
$_tmp[$Key] = $val;
}
return ($pushType == 'post' ? $_tmp : http_build_query($_tmp));
}
/**
* @param $url
* @param array $data
* @return array|mixed|Result
* @throws
*/
public function post($url, $data = [])
{
$this->setMethod(self::POST);
return $this->request($url, $data);
}
/**
* @param $url
* @param array $data
* @return array|mixed|Result
* @throws
*/
public function put($url, $data = [])
{
$this->setMethod(self::PUT);
return $this->request($url, $data);
}
/**
* @param $url
* @param array $data
* @return array|mixed|Result
* @throws
*/
public function get($url, $data = [])
{
$this->setMethod(self::GET);
return $this->request($url, $data);
}
/**
* @param $url
* @param array $data
* @return array|mixed|Result
* @throws \Exception
*/
public function option($url, $data = [])
{
$this->setMethod(self::OPTIONS);
return $this->request($url, $data);
}
/**
* @param $url
* @param array $data
* @return array|mixed|Result
* @throws \Exception
*/
public function delete($url, $data = [])
{
$this->setMethod(self::DELETE);
return $this->request($url, $data);
}
/**
* @param $url
* @param array $data
* @return array|mixed|Result
* @throws \Exception
*/
public function send($url, $data = [])
{
return $this->request($url, $data);
}
/**
* @param array $headers
* @return array
*/
public function setHeaders(array $headers)
{
if (empty($headers)) {
return [];
}
foreach ($headers as $key => $val) {
$this->header[] = $key . ':' . $val;
}
return $this->header;
}
}
+27
View File
@@ -0,0 +1,27 @@
<?php
namespace wchat\wx;
use Kiri\Di\Container;
use wchat\common\AppConfig;
class WxFactory
{
/**
* @param string $class
* @param AppConfig $config
* @return object|null
* @throws
*/
public static function get(string $class, AppConfig $config): ?object
{
$container = Container::instance();
$object = $container->get($class);
$object->setPayConfig($config);
return $object;
}
}