reywechat 1.0.37__py3-none-any.whl → 1.0.39__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- reywechat/rdb.py +42 -42
- reywechat/rwechat.py +1 -0
- {reywechat-1.0.37.dist-info → reywechat-1.0.39.dist-info}/METADATA +1 -1
- {reywechat-1.0.37.dist-info → reywechat-1.0.39.dist-info}/RECORD +6 -6
- {reywechat-1.0.37.dist-info → reywechat-1.0.39.dist-info}/WHEEL +0 -0
- {reywechat-1.0.37.dist-info → reywechat-1.0.39.dist-info}/licenses/LICENSE +0 -0
reywechat/rdb.py
CHANGED
@@ -31,6 +31,7 @@ __all__ = (
|
|
31
31
|
class WeChatDatabase(BaseWeChat):
|
32
32
|
"""
|
33
33
|
WeChat database type.
|
34
|
+
Can create database used `self.build` method.
|
34
35
|
"""
|
35
36
|
|
36
37
|
|
@@ -69,7 +70,7 @@ class WeChatDatabase(BaseWeChat):
|
|
69
70
|
throw(TypeError, database)
|
70
71
|
|
71
72
|
## Database path name.
|
72
|
-
self.
|
73
|
+
self.db_names = {
|
73
74
|
'wechat': 'wechat',
|
74
75
|
'wechat.contact_user': 'contact_user',
|
75
76
|
'wechat.contact_room': 'contact_room',
|
@@ -84,9 +85,6 @@ class WeChatDatabase(BaseWeChat):
|
|
84
85
|
text='not suitable for SQLite databases'
|
85
86
|
throw(AssertionError, text=text)
|
86
87
|
|
87
|
-
# Build.
|
88
|
-
self.build()
|
89
|
-
|
90
88
|
# Add handler.
|
91
89
|
self.__add_receiver_handler_to_contact_user()
|
92
90
|
self.__add_receiver_handler_to_contact_room()
|
@@ -100,7 +98,7 @@ class WeChatDatabase(BaseWeChat):
|
|
100
98
|
|
101
99
|
def build(self) -> None:
|
102
100
|
"""
|
103
|
-
Check and build all standard databases and tables, by `self.
|
101
|
+
Check and build all standard databases and tables, by `self.db_names`.
|
104
102
|
"""
|
105
103
|
|
106
104
|
# Set parameter.
|
@@ -108,7 +106,7 @@ class WeChatDatabase(BaseWeChat):
|
|
108
106
|
## WeChatDatabase.
|
109
107
|
databases = [
|
110
108
|
{
|
111
|
-
'name': self.
|
109
|
+
'name': self.db_names['wechat']
|
112
110
|
}
|
113
111
|
]
|
114
112
|
|
@@ -117,7 +115,7 @@ class WeChatDatabase(BaseWeChat):
|
|
117
115
|
|
118
116
|
### 'contact_user'.
|
119
117
|
{
|
120
|
-
'path': (self.
|
118
|
+
'path': (self.db_names['wechat'], self.db_names['wechat.contact_user']),
|
121
119
|
'fields': [
|
122
120
|
{
|
123
121
|
'name': 'create_time',
|
@@ -162,7 +160,7 @@ class WeChatDatabase(BaseWeChat):
|
|
162
160
|
|
163
161
|
### 'contact_room'.
|
164
162
|
{
|
165
|
-
'path': (self.
|
163
|
+
'path': (self.db_names['wechat'], self.db_names['wechat.contact_room']),
|
166
164
|
'fields': [
|
167
165
|
{
|
168
166
|
'name': 'create_time',
|
@@ -207,7 +205,7 @@ class WeChatDatabase(BaseWeChat):
|
|
207
205
|
|
208
206
|
### 'contact_room_user'.
|
209
207
|
{
|
210
|
-
'path': (self.
|
208
|
+
'path': (self.db_names['wechat'], self.db_names['wechat.contact_room_user']),
|
211
209
|
'fields': [
|
212
210
|
{
|
213
211
|
'name': 'create_time',
|
@@ -259,7 +257,7 @@ class WeChatDatabase(BaseWeChat):
|
|
259
257
|
|
260
258
|
### 'message_receive'.
|
261
259
|
{
|
262
|
-
'path': (self.
|
260
|
+
'path': (self.db_names['wechat'], self.db_names['wechat.message_receive']),
|
263
261
|
'fields': [
|
264
262
|
{
|
265
263
|
'name': 'create_time',
|
@@ -349,7 +347,7 @@ class WeChatDatabase(BaseWeChat):
|
|
349
347
|
|
350
348
|
### 'message_send'.
|
351
349
|
{
|
352
|
-
'path': (self.
|
350
|
+
'path': (self.db_names['wechat'], self.db_names['wechat.message_send']),
|
353
351
|
'fields': [
|
354
352
|
{
|
355
353
|
'name': 'create_time',
|
@@ -373,7 +371,7 @@ class WeChatDatabase(BaseWeChat):
|
|
373
371
|
'name': 'send_id',
|
374
372
|
'type': 'int unsigned',
|
375
373
|
'constraint': 'NOT NULL AUTO_INCREMENT',
|
376
|
-
'comment': 'Send
|
374
|
+
'comment': 'Send ID.'
|
377
375
|
},
|
378
376
|
{
|
379
377
|
'name': 'status',
|
@@ -440,6 +438,7 @@ class WeChatDatabase(BaseWeChat):
|
|
440
438
|
],
|
441
439
|
'comment': 'Message send table.'
|
442
440
|
}
|
441
|
+
|
443
442
|
]
|
444
443
|
|
445
444
|
## View stats.
|
@@ -447,13 +446,13 @@ class WeChatDatabase(BaseWeChat):
|
|
447
446
|
|
448
447
|
### 'stats'.
|
449
448
|
{
|
450
|
-
'path': (self.
|
449
|
+
'path': (self.db_names['wechat'], self.db_names['wechat.stats']),
|
451
450
|
'items': [
|
452
451
|
{
|
453
452
|
'name': 'count_receive',
|
454
453
|
'select': (
|
455
454
|
'SELECT COUNT(1)\n'
|
456
|
-
'FROM `wechat`.`message_receive`'
|
455
|
+
f'FROM `{self.db_names['wechat']}`.`{self.db_names['wechat.message_receive']}`'
|
457
456
|
),
|
458
457
|
'comment': 'Message receive count.'
|
459
458
|
},
|
@@ -461,7 +460,7 @@ class WeChatDatabase(BaseWeChat):
|
|
461
460
|
'name': 'count_send',
|
462
461
|
'select': (
|
463
462
|
'SELECT COUNT(1)\n'
|
464
|
-
'FROM `wechat`.`message_send`\n'
|
463
|
+
f'FROM `{self.db_names['wechat']}`.`{self.db_names['wechat.message_send']}`\n'
|
465
464
|
'WHERE `status` = 2'
|
466
465
|
),
|
467
466
|
'comment': 'Message send count.'
|
@@ -470,7 +469,7 @@ class WeChatDatabase(BaseWeChat):
|
|
470
469
|
'name': 'count_user',
|
471
470
|
'select': (
|
472
471
|
'SELECT COUNT(1)\n'
|
473
|
-
'FROM `wechat`.`contact_user`'
|
472
|
+
f'FROM `{self.db_names['wechat']}`.`{self.db_names['wechat.contact_user']}`'
|
474
473
|
),
|
475
474
|
'comment': 'Contact user count.'
|
476
475
|
},
|
@@ -478,7 +477,7 @@ class WeChatDatabase(BaseWeChat):
|
|
478
477
|
'name': 'count_room',
|
479
478
|
'select': (
|
480
479
|
'SELECT COUNT(1)\n'
|
481
|
-
'FROM `wechat`.`contact_room`'
|
480
|
+
f'FROM `{self.db_names['wechat']}`.`{self.db_names['wechat.contact_room']}`'
|
482
481
|
),
|
483
482
|
'comment': 'Contact room count.'
|
484
483
|
},
|
@@ -486,7 +485,7 @@ class WeChatDatabase(BaseWeChat):
|
|
486
485
|
'name': 'count_room_user',
|
487
486
|
'select': (
|
488
487
|
'SELECT COUNT(1)\n'
|
489
|
-
'FROM `wechat`.`contact_room_user`'
|
488
|
+
f'FROM `{self.db_names['wechat']}`.`{self.db_names['wechat.contact_room_user']}`'
|
490
489
|
),
|
491
490
|
'comment': 'Contact room user count.'
|
492
491
|
},
|
@@ -494,7 +493,7 @@ class WeChatDatabase(BaseWeChat):
|
|
494
493
|
'name': 'last_time_receive',
|
495
494
|
'select': (
|
496
495
|
'SELECT MAX(`message_time`)\n'
|
497
|
-
'FROM `wechat`.`message_receive`'
|
496
|
+
f'FROM `{self.db_names['wechat']}`.`{self.db_names['wechat.message_receive']}`'
|
498
497
|
),
|
499
498
|
'comment': 'Message last receive time.'
|
500
499
|
},
|
@@ -502,13 +501,14 @@ class WeChatDatabase(BaseWeChat):
|
|
502
501
|
'name': 'last_time_send',
|
503
502
|
'select': (
|
504
503
|
'SELECT MAX(`status_time`)\n'
|
505
|
-
'FROM `wechat`.`message_send`\n'
|
504
|
+
f'FROM `{self.db_names['wechat']}`.`{self.db_names['wechat.message_send']}`\n'
|
506
505
|
'WHERE `status` = 2'
|
507
506
|
),
|
508
507
|
'comment': 'Message last send time.'
|
509
508
|
}
|
510
509
|
]
|
511
510
|
}
|
511
|
+
|
512
512
|
]
|
513
513
|
|
514
514
|
# Build.
|
@@ -552,7 +552,7 @@ class WeChatDatabase(BaseWeChat):
|
|
552
552
|
## Insert.
|
553
553
|
if contact_table != []:
|
554
554
|
conn.execute_insert(
|
555
|
-
(self.
|
555
|
+
(self.db_names['wechat'], self.db_names['wechat.contact_user']),
|
556
556
|
user_data,
|
557
557
|
'update'
|
558
558
|
)
|
@@ -560,12 +560,12 @@ class WeChatDatabase(BaseWeChat):
|
|
560
560
|
## Update.
|
561
561
|
if user_ids == []:
|
562
562
|
sql = (
|
563
|
-
'UPDATE `wechat`.`contact_user`\n'
|
563
|
+
f'UPDATE `{self.db_names['wechat']}`.`{self.db_names['wechat.contact_user']}`\n'
|
564
564
|
'SET `contact` = 0'
|
565
565
|
)
|
566
566
|
else:
|
567
567
|
sql = (
|
568
|
-
'UPDATE `wechat`.`contact_user`\n'
|
568
|
+
f'UPDATE `{self.db_names['wechat']}`.`{self.db_names['wechat.contact_user']}`\n'
|
569
569
|
'SET `contact` = 0\n'
|
570
570
|
'WHERE `user_id` NOT IN :user_ids'
|
571
571
|
)
|
@@ -608,7 +608,7 @@ class WeChatDatabase(BaseWeChat):
|
|
608
608
|
## Insert.
|
609
609
|
if contact_table != []:
|
610
610
|
conn.execute_insert(
|
611
|
-
(self.
|
611
|
+
(self.db_names['wechat'], self.db_names['wechat.contact_room']),
|
612
612
|
room_data,
|
613
613
|
'update'
|
614
614
|
)
|
@@ -616,12 +616,12 @@ class WeChatDatabase(BaseWeChat):
|
|
616
616
|
## Update.
|
617
617
|
if room_ids == []:
|
618
618
|
sql = (
|
619
|
-
'UPDATE `wechat`.`contact_room`\n'
|
619
|
+
f'UPDATE `{self.db_names['wechat']}`.`{self.db_names['wechat.contact_room']}`\n'
|
620
620
|
'SET `contact` = 0'
|
621
621
|
)
|
622
622
|
else:
|
623
623
|
sql = (
|
624
|
-
'UPDATE `wechat`.`contact_room`\n'
|
624
|
+
f'UPDATE `{self.db_names['wechat']}`.`{self.db_names['wechat.contact_room']}`\n'
|
625
625
|
'SET `contact` = 0\n'
|
626
626
|
'WHERE `room_id` NOT IN :room_ids'
|
627
627
|
)
|
@@ -686,7 +686,7 @@ class WeChatDatabase(BaseWeChat):
|
|
686
686
|
## Insert.
|
687
687
|
if room_user_data != []:
|
688
688
|
conn.execute_insert(
|
689
|
-
(self.
|
689
|
+
(self.db_names['wechat'], self.db_names['wechat.contact_room_user']),
|
690
690
|
room_user_data,
|
691
691
|
'update'
|
692
692
|
)
|
@@ -694,18 +694,18 @@ class WeChatDatabase(BaseWeChat):
|
|
694
694
|
## Update.
|
695
695
|
if room_user_ids == []:
|
696
696
|
sql = (
|
697
|
-
'UPDATE `wechat`.`contact_room_user`\n'
|
697
|
+
f'UPDATE `{self.db_names['wechat']}`.`{self.db_names['wechat.contact_room_user']}`\n'
|
698
698
|
'SET `contact` = 0'
|
699
699
|
)
|
700
700
|
elif room_id is None:
|
701
701
|
sql = (
|
702
|
-
'UPDATE `wechat`.`contact_room_user`\n'
|
702
|
+
f'UPDATE `{self.db_names['wechat']}`.`{self.db_names['wechat.contact_room_user']}`\n'
|
703
703
|
'SET `contact` = 0\n'
|
704
704
|
"WHERE CONCAT(`room_id`, ',', `user_id`) NOT IN :room_user_ids"
|
705
705
|
)
|
706
706
|
else:
|
707
707
|
sql = (
|
708
|
-
'UPDATE `wechat`.`contact_room_user`\n'
|
708
|
+
f'UPDATE `{self.db_names['wechat']}`.`{self.db_names['wechat.contact_room_user']}`\n'
|
709
709
|
'SET `contact` = 0\n'
|
710
710
|
'WHERE (\n'
|
711
711
|
' `room_id` = :room_id\n'
|
@@ -754,7 +754,7 @@ class WeChatDatabase(BaseWeChat):
|
|
754
754
|
|
755
755
|
## Insert.
|
756
756
|
self.database_wechat.execute_insert(
|
757
|
-
(self.
|
757
|
+
(self.db_names['wechat'], self.db_names['wechat.contact_user']),
|
758
758
|
data,
|
759
759
|
'update'
|
760
760
|
)
|
@@ -795,7 +795,7 @@ class WeChatDatabase(BaseWeChat):
|
|
795
795
|
|
796
796
|
### 'contact_room'.
|
797
797
|
self.database_wechat.execute_insert(
|
798
|
-
(self.
|
798
|
+
(self.db_names['wechat'], self.db_names['wechat.contact_room']),
|
799
799
|
data,
|
800
800
|
'update'
|
801
801
|
)
|
@@ -817,7 +817,7 @@ class WeChatDatabase(BaseWeChat):
|
|
817
817
|
|
818
818
|
## Update.
|
819
819
|
self.database_wechat.execute_update(
|
820
|
-
(self.
|
820
|
+
(self.db_names['wechat'], self.db_names['wechat.contact_room']),
|
821
821
|
data
|
822
822
|
)
|
823
823
|
|
@@ -839,7 +839,7 @@ class WeChatDatabase(BaseWeChat):
|
|
839
839
|
|
840
840
|
## Update.
|
841
841
|
self.database_wechat.execute_update(
|
842
|
-
(self.
|
842
|
+
(self.db_names['wechat'], self.db_names['wechat.contact_room']),
|
843
843
|
data
|
844
844
|
)
|
845
845
|
|
@@ -919,7 +919,7 @@ class WeChatDatabase(BaseWeChat):
|
|
919
919
|
|
920
920
|
# Insert.
|
921
921
|
self.database_wechat.execute_insert(
|
922
|
-
(self.
|
922
|
+
(self.db_names['wechat'], self.db_names['wechat.message_receive']),
|
923
923
|
data,
|
924
924
|
'ignore'
|
925
925
|
)
|
@@ -958,7 +958,7 @@ class WeChatDatabase(BaseWeChat):
|
|
958
958
|
|
959
959
|
# Update.
|
960
960
|
self.database_wechat.execute_update(
|
961
|
-
(self.
|
961
|
+
(self.db_names['wechat'], self.db_names['wechat.message_send']),
|
962
962
|
data
|
963
963
|
)
|
964
964
|
|
@@ -1026,7 +1026,7 @@ class WeChatDatabase(BaseWeChat):
|
|
1026
1026
|
')'
|
1027
1027
|
)
|
1028
1028
|
result = conn.execute_select(
|
1029
|
-
(self.
|
1029
|
+
(self.db_names['wechat'], self.db_names['wechat.message_send']),
|
1030
1030
|
['send_id', 'type', 'receive_id', 'parameter', 'file_id'],
|
1031
1031
|
where,
|
1032
1032
|
order='`plan_time` DESC, `send_id`'
|
@@ -1043,7 +1043,7 @@ class WeChatDatabase(BaseWeChat):
|
|
1043
1043
|
for row in table
|
1044
1044
|
]
|
1045
1045
|
sql = (
|
1046
|
-
'UPDATE `wechat`.`message_send`\n'
|
1046
|
+
f'UPDATE `{self.db_names['wechat']}`.`{self.db_names['wechat.message_send']}`\n'
|
1047
1047
|
'SET `status` = 1\n'
|
1048
1048
|
'WHERE `send_id` IN :send_ids'
|
1049
1049
|
)
|
@@ -1110,7 +1110,7 @@ class WeChatDatabase(BaseWeChat):
|
|
1110
1110
|
## User.
|
1111
1111
|
if message.room is None:
|
1112
1112
|
result = message.receiver.wechat.database.database_wechat.execute_select(
|
1113
|
-
(self.
|
1113
|
+
(self.db_names['wechat'], self.db_names['wechat.contact_user']),
|
1114
1114
|
['valid'],
|
1115
1115
|
'`user_id` = :user_id',
|
1116
1116
|
limit=1,
|
@@ -1122,13 +1122,13 @@ class WeChatDatabase(BaseWeChat):
|
|
1122
1122
|
sql = (
|
1123
1123
|
'SELECT (\n'
|
1124
1124
|
' SELECT `valid`\n'
|
1125
|
-
' FROM `wechat`.`contact_room_user`\n'
|
1125
|
+
f' FROM `{self.db_names['wechat']}`.`{self.db_names['wechat.contact_room_user']}`\n'
|
1126
1126
|
' WHERE `room_id` = :room_id AND `user_id` = :user_id\n'
|
1127
1127
|
' LIMIT 1\n'
|
1128
1128
|
') AS `valid`\n'
|
1129
1129
|
'FROM (\n'
|
1130
1130
|
' SELECT `valid`\n'
|
1131
|
-
' FROM `wechat`.`contact_room`\n'
|
1131
|
+
f' FROM `{self.db_names['wechat']}`.`{self.db_names['wechat.contact_room']}`\n'
|
1132
1132
|
' WHERE `room_id` = :room_id\n'
|
1133
1133
|
' LIMIT 1\n'
|
1134
1134
|
') AS `a`\n'
|
@@ -1262,6 +1262,6 @@ class WeChatDatabase(BaseWeChat):
|
|
1262
1262
|
|
1263
1263
|
# Insert.
|
1264
1264
|
self.database_wechat.execute_insert(
|
1265
|
-
(self.
|
1265
|
+
(self.db_names['wechat'], self.db_names['wechat.message_send']),
|
1266
1266
|
data
|
1267
1267
|
)
|
reywechat/rwechat.py
CHANGED
@@ -3,15 +3,15 @@ reywechat/rall.py,sha256=zEW-mLL2uP8aT2_foCMFGmMi_3RCrGl8qutnSVkmY1E,397
|
|
3
3
|
reywechat/rbase.py,sha256=0NunIUIXra2ML2N6odwMk5oENTE0r6VSBHWXUvgI-lc,1124
|
4
4
|
reywechat/rcache.py,sha256=Hh_HE-t_KUMlrz4gEFPh1AjmhnrSgH520IFJPumWb7A,908
|
5
5
|
reywechat/rclient.py,sha256=MEvQB3pHb5ORukKbKntalRtFcKIOP9BGtDsMt5ihQfM,22524
|
6
|
-
reywechat/rdb.py,sha256=
|
6
|
+
reywechat/rdb.py,sha256=1l7BGx-WC_DdDDAJrI-EsHUbdLApaQWGrxqAyggYXIA,42187
|
7
7
|
reywechat/rlog.py,sha256=x4WFLNoeKqGjPVoI81ZZNEd9ctdYToSg5hEFuESmCQY,5254
|
8
8
|
reywechat/rreceive.py,sha256=RkUwPsWz6k_Ua3ovrbXRMVajeNOJQqvpPXz_CvJyUPQ,35162
|
9
9
|
reywechat/rschedule.py,sha256=bZEEZV3K4zrJvupe1Eq6kGR7kunbVq5dfGnqFKYF3JI,1857
|
10
10
|
reywechat/rsend.py,sha256=UmdKCOb1cPKEmBPHt9htjxB8fPyi5jW5pGwpRQIZdKA,13720
|
11
11
|
reywechat/rtrigger.py,sha256=n8kUNovh62r7crlXrp33uaKvbILT-wcfvUqeyGt7YhM,4956
|
12
|
-
reywechat/rwechat.py,sha256=
|
12
|
+
reywechat/rwechat.py,sha256=xkHQUUXDEqq4Q_DHF6vc3Dd33A8oOCkKyJN7v7p2leM,4935
|
13
13
|
reywechat/data/client_api.dll,sha256=H9uj-x9Ztg0jFZK0yY6NsnyH5_119dQRFfoVVMidxRs,592384
|
14
|
-
reywechat-1.0.
|
15
|
-
reywechat-1.0.
|
16
|
-
reywechat-1.0.
|
17
|
-
reywechat-1.0.
|
14
|
+
reywechat-1.0.39.dist-info/METADATA,sha256=YpRoJrcy0zs50O7BQKnVt9ukABoVK2APC2akitEv5AA,1551
|
15
|
+
reywechat-1.0.39.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
16
|
+
reywechat-1.0.39.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
|
17
|
+
reywechat-1.0.39.dist-info/RECORD,,
|
File without changes
|
File without changes
|