smartpush 1.9.9__py3-none-any.whl → 2.0.0__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.
- smartpush/base/request_base.py +4 -2
- smartpush/base/url_enum.py +3 -3
- smartpush/crowd/crowd.py +153 -398
- smartpush/email/activity.py +1 -1
- smartpush/email/schema.py +55 -54
- smartpush/email/universal_content.py +48 -32
- smartpush/form/form_after.py +10 -10
- smartpush/test.py +0 -0
- smartpush/utils/ListDictUtils.py +53 -1
- {smartpush-1.9.9.dist-info → smartpush-2.0.0.dist-info}/METADATA +1 -1
- {smartpush-1.9.9.dist-info → smartpush-2.0.0.dist-info}/RECORD +13 -12
- {smartpush-1.9.9.dist-info → smartpush-2.0.0.dist-info}/WHEEL +0 -0
- {smartpush-1.9.9.dist-info → smartpush-2.0.0.dist-info}/top_level.txt +0 -0
smartpush/base/request_base.py
CHANGED
|
@@ -41,21 +41,23 @@ class RequestBase:
|
|
|
41
41
|
}
|
|
42
42
|
response_json = None
|
|
43
43
|
default_kwargs.update(kwargs)
|
|
44
|
-
if default_kwargs.get('data') and isinstance(default_kwargs.get('data'), dict):
|
|
44
|
+
if default_kwargs.get('data') and isinstance(default_kwargs.get('data'), dict):
|
|
45
45
|
data = json.dumps(default_kwargs.get('data'))
|
|
46
46
|
default_kwargs.update({'data': data})
|
|
47
|
+
response = None
|
|
47
48
|
try:
|
|
48
49
|
print("请求参数为:\n", json.dumps(default_kwargs, ensure_ascii=False))
|
|
49
50
|
response = self.session.request(method, url, **default_kwargs)
|
|
50
51
|
response.raise_for_status()
|
|
51
52
|
response_json = response.json()
|
|
52
53
|
print("响应内容为:\n", json.dumps(response_json, ensure_ascii=False))
|
|
53
|
-
# assert response_json['code'] == 1
|
|
54
54
|
return response_json
|
|
55
55
|
except requests.exceptions.RequestException as e:
|
|
56
56
|
print(f"请求失败: {e}")
|
|
57
57
|
return None
|
|
58
58
|
except Exception as e:
|
|
59
|
+
print("响应:\n", response)
|
|
60
|
+
print("响应内容为:\n", json.dumps(response.json(), ensure_ascii=False))
|
|
59
61
|
raise e
|
|
60
62
|
|
|
61
63
|
|
smartpush/base/url_enum.py
CHANGED
|
@@ -25,9 +25,9 @@ class URL:
|
|
|
25
25
|
"""
|
|
26
26
|
:type:表单报告
|
|
27
27
|
"""
|
|
28
|
-
pageFormReportDetail = '/formReport/detail/pageFormReportDetail',
|
|
29
|
-
getFormReportDetail = '/formReport/getFormReportDetail',
|
|
30
|
-
getFormPerformanceTrend = 'formReport/getFormPerformanceTrend',
|
|
28
|
+
pageFormReportDetail = '/formReport/detail/pageFormReportDetail', POST # 获取表单收集数据
|
|
29
|
+
getFormReportDetail = '/formReport/getFormReportDetail', POST # 获取表单报告数据(曝光/点击)
|
|
30
|
+
getFormPerformanceTrend = 'formReport/getFormPerformanceTrend', POST
|
|
31
31
|
|
|
32
32
|
class Crowd(BaseEnum):
|
|
33
33
|
"""
|
smartpush/crowd/crowd.py
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import json
|
|
2
2
|
import time
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
from smartpush.base.request_base import CrowdRequestBase, RequestBase
|
|
5
5
|
from smartpush.base.url_enum import URL
|
|
6
|
-
from smartpush.export.basic.ExcelExportChecker import
|
|
7
|
-
from smartpush.
|
|
6
|
+
from smartpush.export.basic.ExcelExportChecker import compare_dicts
|
|
7
|
+
from smartpush.utils import ListDictUtils
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class Crowd(CrowdRequestBase):
|
|
@@ -37,7 +37,8 @@ class Crowd(CrowdRequestBase):
|
|
|
37
37
|
requestParam = {"id": self.crowd_id, "page": page, "pageSize": pageSize}
|
|
38
38
|
if filter_value is not None:
|
|
39
39
|
requestParam["filter"] = {filter_type: {operator: filter_value}}
|
|
40
|
-
result = self.request(method=URL.Crowd.crowdPersonListInPackage.method,
|
|
40
|
+
result = self.request(method=URL.Crowd.crowdPersonListInPackage.method,
|
|
41
|
+
path=URL.Crowd.crowdPersonListInPackage.url,
|
|
41
42
|
data=requestParam)
|
|
42
43
|
resultData = result['resultData']
|
|
43
44
|
return resultData
|
|
@@ -52,7 +53,8 @@ class Crowd(CrowdRequestBase):
|
|
|
52
53
|
requestParam = {"id": self.crowd_id, "page": page, "pageSize": pageSize, "filter": {}}
|
|
53
54
|
# if filter_value is not None:
|
|
54
55
|
# requestParam["filter"] = {filter_type: {"in": filter_value}}
|
|
55
|
-
result = self.request(method=URL.Crowd.crowdPackageDetail.method, path=URL.Crowd.crowdPackageDetail.url,
|
|
56
|
+
result = self.request(method=URL.Crowd.crowdPackageDetail.method, path=URL.Crowd.crowdPackageDetail.url,
|
|
57
|
+
data=requestParam)
|
|
56
58
|
resultData = result['resultData']
|
|
57
59
|
return resultData
|
|
58
60
|
|
|
@@ -95,31 +97,32 @@ class CrowdList(RequestBase):
|
|
|
95
97
|
if __name__ == '__main__':
|
|
96
98
|
host = "https://test.smartpushedm.com/bff/api-em-ec2"
|
|
97
99
|
headers = {
|
|
98
|
-
"cookie": "sl_lc_session_id=
|
|
99
|
-
"authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NjA2NzA4MzUsImp0aSI6ImQyZTkxMzMyLTYwMTMtNGI3NC04NzAzLWQzZDAxMzkyNTdjNSIsInVzZXJJbmZvIjp7ImlkIjowLCJ1c2VySWQiOiI0NjAwNjAyNTM4IiwidXNlcm5hbWUiOiIiLCJlbWFpbCI6Imx1Lmx1QHNob3BsaW5lLmNvbSIsInVzZXJSb2xlIjoib3duZXIiLCJwbGF0Zm9ybVR5cGUiOjcsInN1YlBsYXRmb3JtIjoxLCJwaG9uZSI6IiIsImxhbmd1YWdlIjoiemgtaGFucy1jbiIsImF1dGhUeXBlIjoiIiwiYXR0cmlidXRlcyI6eyJjb3VudHJ5Q29kZSI6IkNOIiwiY3VycmVuY3kiOiJVU0QiLCJjdXJyZW5jeVN5bWJvbCI6IlVTJCIsImRvbWFpbiI6Imx1LWx1LmVtYWlsIiwibGFuZ3VhZ2UiOiJ6aC1oYW50LXR3IiwibWVyY2hhbnRFbWFpbCI6Imx1Lmx1QHNob3BsaW5lLmNvbSIsIm1lcmNoYW50TmFtZSI6Imx1bHUzODIt6K6i6ZiF5byP55S15ZWGIiwicGhvbmUiOiIiLCJzY29wZUNoYW5nZWQiOmZhbHNlLCJzdGFmZkxhbmd1YWdlIjoiemgtaGFucy1jbiIsInN0YXR1cyI6MCwidGltZXpvbmUiOiJBc2lhL1NoYW5naGFpIn0sInN0b3JlSWQiOiIxNzQ1Mzc3NzA1OTM2IiwiaGFuZGxlIjoibHVsdTM4MiIsImVudiI6IkNOIiwic3RlIjoiIiwidmVyaWZ5IjoiIn0sImxvZ2luVGltZSI6MTc1ODA3ODgzNTYwMiwic2NvcGUiOlsiZW1haWwtbWFya2V0IiwiY29va2llIiwic2wtZWNvbS1lbWFpbC1tYXJrZXQtbmV3LXRlc3QiLCJlbWFpbC1tYXJrZXQtbmV3LWRldi1mcyIsImFwaS11Yy1lYzIiLCJhcGktc3UtZWMyIiwiYXBpLWVtLWVjMiIsImZsb3ctcGx1Z2luIiwiYXBpLXNwLW1hcmtldC1lYzIiXSwiY2xpZW50X2lkIjoiZW1haWwtbWFya2V0In0.ZMtJ83tH8i-BArVnSvfS4rKCD49N8WLsnhxVJ11BddI"
|
|
100
|
+
"cookie": "sl_lc_session_id=ARdgF0IxFkAHFAOZAAAAAAAAABJgXW48NEPOu5SFl0dmT_3mihLHpce906zxUbThGnBe; _ga=GA1.1.676535481.1761883127; _ga_D2KXR23WN3=GS2.1.s1761883127$o1$g0$t1761883170$j17$l0$h0; sl_lr_session_id=ARdiIhhRFkAHFBUHAAAAAAAAAF08xxHuy0uKhjUqNs0ySkc050947mcvDaYK1whe3bi0; sp-session-open=true; osudb_lang=; sl_sc_session_id=ARdjNlKHFkAHFBUHAAAAAAAAACKxXGuiEEi6p_f7aB_GsR1asT_RaDMApK3eKmrzF7K4; sl_sr_session_id=ARdjNlKHFkAHFBUHAAAAAAAAALw794pz7UbdgxmE9hqsfoCD0maOX-3IE8uxltg4-wSI; osudb_appid=SMARTPUSH; osudb_subappid=1; osudb_uid=4600602538; osudb_oar=#01#SID0000142BPp54f8NDtV4PIn2E2jFeSWv0Yvr3/bJiObNipUuVmL68bE0gjeq6e4AvQlafd9IfQNXzplOpO1uv7soFJlYEudAcdY+RHiefXV9GaweU3oaqcQhHDeybhaEVH1wYJxato/m3SY4rrPu/mgUba51; JSESSIONID=176938AB2D7E2F1BBEDB9B71E88EE8D5",
|
|
101
|
+
# "authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NjA2NzA4MzUsImp0aSI6ImQyZTkxMzMyLTYwMTMtNGI3NC04NzAzLWQzZDAxMzkyNTdjNSIsInVzZXJJbmZvIjp7ImlkIjowLCJ1c2VySWQiOiI0NjAwNjAyNTM4IiwidXNlcm5hbWUiOiIiLCJlbWFpbCI6Imx1Lmx1QHNob3BsaW5lLmNvbSIsInVzZXJSb2xlIjoib3duZXIiLCJwbGF0Zm9ybVR5cGUiOjcsInN1YlBsYXRmb3JtIjoxLCJwaG9uZSI6IiIsImxhbmd1YWdlIjoiemgtaGFucy1jbiIsImF1dGhUeXBlIjoiIiwiYXR0cmlidXRlcyI6eyJjb3VudHJ5Q29kZSI6IkNOIiwiY3VycmVuY3kiOiJVU0QiLCJjdXJyZW5jeVN5bWJvbCI6IlVTJCIsImRvbWFpbiI6Imx1LWx1LmVtYWlsIiwibGFuZ3VhZ2UiOiJ6aC1oYW50LXR3IiwibWVyY2hhbnRFbWFpbCI6Imx1Lmx1QHNob3BsaW5lLmNvbSIsIm1lcmNoYW50TmFtZSI6Imx1bHUzODIt6K6i6ZiF5byP55S15ZWGIiwicGhvbmUiOiIiLCJzY29wZUNoYW5nZWQiOmZhbHNlLCJzdGFmZkxhbmd1YWdlIjoiemgtaGFucy1jbiIsInN0YXR1cyI6MCwidGltZXpvbmUiOiJBc2lhL1NoYW5naGFpIn0sInN0b3JlSWQiOiIxNzQ1Mzc3NzA1OTM2IiwiaGFuZGxlIjoibHVsdTM4MiIsImVudiI6IkNOIiwic3RlIjoiIiwidmVyaWZ5IjoiIn0sImxvZ2luVGltZSI6MTc1ODA3ODgzNTYwMiwic2NvcGUiOlsiZW1haWwtbWFya2V0IiwiY29va2llIiwic2wtZWNvbS1lbWFpbC1tYXJrZXQtbmV3LXRlc3QiLCJlbWFpbC1tYXJrZXQtbmV3LWRldi1mcyIsImFwaS11Yy1lYzIiLCJhcGktc3UtZWMyIiwiYXBpLWVtLWVjMiIsImZsb3ctcGx1Z2luIiwiYXBpLXNwLW1hcmtldC1lYzIiXSwiY2xpZW50X2lkIjoiZW1haWwtbWFya2V0In0.ZMtJ83tH8i-BArVnSvfS4rKCD49N8WLsnhxVJ11BddI"
|
|
102
|
+
}
|
|
100
103
|
|
|
101
|
-
crowd_id = "687a028fa34ae35465dc91a2"
|
|
102
104
|
|
|
105
|
+
# crowd_id = "687a028fa34ae35465dc91a2"
|
|
103
106
|
|
|
104
107
|
# def diff_person(_crowd_id, path):
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
108
|
+
## 这里是查询群组的人的差异
|
|
109
|
+
# list_len = 0
|
|
110
|
+
# flag = True
|
|
111
|
+
# page = 1
|
|
112
|
+
# crowd = Crowd(crowd_id=_crowd_id, host=host, headers=headers)
|
|
113
|
+
# result_list = []
|
|
114
|
+
#
|
|
115
|
+
# while flag:
|
|
116
|
+
# result = crowd.callCrowdPersonListInPackage(pageSize=100, page=page)
|
|
117
|
+
# page += 1
|
|
118
|
+
# num = result['num']
|
|
119
|
+
# list_len += len(result['responseResult'])
|
|
120
|
+
# for data in result['responseResult']:
|
|
121
|
+
# result_list.append(data['id'])
|
|
122
|
+
# if list_len >= num:
|
|
123
|
+
# break
|
|
124
|
+
# print(result_list)
|
|
125
|
+
# print("es查询群组数量:", len(result_list))
|
|
123
126
|
|
|
124
127
|
# # 这里是解析本地文件,查看
|
|
125
128
|
# key = ["user_id"]
|
|
@@ -129,378 +132,130 @@ if __name__ == '__main__':
|
|
|
129
132
|
# compare_lists(list(data.get("crowd_id")))
|
|
130
133
|
#
|
|
131
134
|
#
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
# "num": "1"
|
|
257
|
-
# },
|
|
258
|
-
# {
|
|
259
|
-
# "crowd_id": "687a193aa34ae35465dc91fc",
|
|
260
|
-
# "num": "2"
|
|
261
|
-
# },
|
|
262
|
-
# {
|
|
263
|
-
# "crowd_id": "6894456558bb063f71fd58ee",
|
|
264
|
-
# "num": "14"
|
|
265
|
-
# },
|
|
266
|
-
# {
|
|
267
|
-
# "crowd_id": "689445030241ad76344e3bd2",
|
|
268
|
-
# "num": "3"
|
|
269
|
-
# },
|
|
270
|
-
# {
|
|
271
|
-
# "crowd_id": "68942bb20241ad76344e3bac",
|
|
272
|
-
# "num": "12"
|
|
273
|
-
# },
|
|
274
|
-
# {
|
|
275
|
-
# "crowd_id": "689448b10241ad76344e3bdf",
|
|
276
|
-
# "num": "39"
|
|
277
|
-
# },
|
|
278
|
-
# {
|
|
279
|
-
# "crowd_id": "68942aa258bb063f71fd58c4",
|
|
280
|
-
# "num": "6"
|
|
281
|
-
# },
|
|
282
|
-
# {
|
|
283
|
-
# "crowd_id": "6894447b58bb063f71fd58e8",
|
|
284
|
-
# "num": "1256"
|
|
285
|
-
# },
|
|
286
|
-
# {
|
|
287
|
-
# "crowd_id": "6873eeddf1ac104346194bde",
|
|
288
|
-
# "num": "8"
|
|
289
|
-
# },
|
|
290
|
-
# {
|
|
291
|
-
# "crowd_id": "689d9df3cb5cfd0392532206",
|
|
292
|
-
# "num": "24"
|
|
293
|
-
# },
|
|
294
|
-
# {
|
|
295
|
-
# "crowd_id": "689443d70241ad76344e3bcb",
|
|
296
|
-
# "num": "5"
|
|
297
|
-
# },
|
|
298
|
-
# {
|
|
299
|
-
# "crowd_id": "687b0207a34ae35465dc92da",
|
|
300
|
-
# "num": "1"
|
|
301
|
-
# },
|
|
302
|
-
# {
|
|
303
|
-
# "crowd_id": "689a0f2fb96a557a6d78bf3c",
|
|
304
|
-
# "num": "11"
|
|
305
|
-
# },
|
|
306
|
-
# {
|
|
307
|
-
# "crowd_id": "6889f03c48f6a30bd07aa14e",
|
|
308
|
-
# "num": "3"
|
|
309
|
-
# },
|
|
310
|
-
# {
|
|
311
|
-
# "crowd_id": "68c7ebc168575727b9f01445",
|
|
312
|
-
# "num": "68"
|
|
313
|
-
# },
|
|
314
|
-
# {
|
|
315
|
-
# "crowd_id": "687e16dfa5e5180731e2126e",
|
|
316
|
-
# "num": "12"
|
|
317
|
-
# },
|
|
318
|
-
# {
|
|
319
|
-
# "crowd_id": "68942b7158bb063f71fd58c7",
|
|
320
|
-
# "num": "8"
|
|
321
|
-
# },
|
|
322
|
-
# {
|
|
323
|
-
# "crowd_id": "687b0269a34ae35465dc92db",
|
|
324
|
-
# "num": "3"
|
|
325
|
-
# },
|
|
326
|
-
# {
|
|
327
|
-
# "crowd_id": "68832876f0cc690fd7105324",
|
|
328
|
-
# "num": "93"
|
|
329
|
-
# },
|
|
330
|
-
# {
|
|
331
|
-
# "crowd_id": "687e1908a5e5180731e21272",
|
|
332
|
-
# "num": "1314"
|
|
333
|
-
# },
|
|
334
|
-
# {
|
|
335
|
-
# "crowd_id": "6879f8c6a34ae35465dc9185",
|
|
336
|
-
# "num": "22"
|
|
337
|
-
# },
|
|
338
|
-
# {
|
|
339
|
-
# "crowd_id": "687df922a5e5180731e211d0",
|
|
340
|
-
# "num": "4"
|
|
341
|
-
# },
|
|
342
|
-
# {
|
|
343
|
-
# "crowd_id": "689c4ba7c73a8e68c750ef9c",
|
|
344
|
-
# "num": "8"
|
|
345
|
-
# },
|
|
346
|
-
# {
|
|
347
|
-
# "crowd_id": "687b3c0ba34ae35465dc9303",
|
|
348
|
-
# "num": "51"
|
|
349
|
-
# },
|
|
350
|
-
# {
|
|
351
|
-
# "crowd_id": "689420620241ad76344e3b9e",
|
|
352
|
-
# "num": "22"
|
|
353
|
-
# },
|
|
354
|
-
# {
|
|
355
|
-
# "crowd_id": "687de8eaa5e5180731e21123",
|
|
356
|
-
# "num": "3"
|
|
357
|
-
# },
|
|
358
|
-
# {
|
|
359
|
-
# "crowd_id": "68c78afb70b5fc0b7a37992c",
|
|
360
|
-
# "num": "1"
|
|
361
|
-
# },
|
|
362
|
-
# {
|
|
363
|
-
# "crowd_id": "689444cd58bb063f71fd58ea",
|
|
364
|
-
# "num": "2"
|
|
365
|
-
# },
|
|
366
|
-
# {
|
|
367
|
-
# "crowd_id": "6877c4aaf40cc91244b1ea05",
|
|
368
|
-
# "num": "1289"
|
|
369
|
-
# },
|
|
370
|
-
# {
|
|
371
|
-
# "crowd_id": "689c4cc2801953000707b9b9",
|
|
372
|
-
# "num": "1315"
|
|
373
|
-
# },
|
|
374
|
-
# {
|
|
375
|
-
# "crowd_id": "689443f758bb063f71fd58e5",
|
|
376
|
-
# "num": "2"
|
|
377
|
-
# },
|
|
378
|
-
# {
|
|
379
|
-
# "crowd_id": "68b68f041532400e8327b305",
|
|
380
|
-
# "num": "12"
|
|
381
|
-
# },
|
|
382
|
-
# {
|
|
383
|
-
# "crowd_id": "6880a6a146fc3040a4851cff",
|
|
384
|
-
# "num": "105"
|
|
385
|
-
# },
|
|
386
|
-
# {
|
|
387
|
-
# "crowd_id": "68c9027c68575727b9f01d1b",
|
|
388
|
-
# "num": "9"
|
|
389
|
-
# },
|
|
390
|
-
# {
|
|
391
|
-
# "crowd_id": "68ade82592874335048e92c4",
|
|
392
|
-
# "num": "3"
|
|
393
|
-
# },
|
|
394
|
-
# {
|
|
395
|
-
# "crowd_id": "68942abf58bb063f71fd58c5",
|
|
396
|
-
# "num": "1267"
|
|
397
|
-
# },
|
|
398
|
-
# {
|
|
399
|
-
# "crowd_id": "6894457c0241ad76344e3bd4",
|
|
400
|
-
# "num": "4"
|
|
401
|
-
# },
|
|
402
|
-
# {
|
|
403
|
-
# "crowd_id": "6894452e58bb063f71fd58ec",
|
|
404
|
-
# "num": "9"
|
|
405
|
-
# },
|
|
406
|
-
# {
|
|
407
|
-
# "crowd_id": "6894455258bb063f71fd58ed",
|
|
408
|
-
# "num": "1"
|
|
409
|
-
# },
|
|
410
|
-
# {
|
|
411
|
-
# "crowd_id": "68b543d5f66289676b17fa6c",
|
|
412
|
-
# "num": "12"
|
|
413
|
-
# },
|
|
414
|
-
# {
|
|
415
|
-
# "crowd_id": "689a2c95079db40c09aa710d",
|
|
416
|
-
# "num": "1314"
|
|
417
|
-
# },
|
|
418
|
-
# {
|
|
419
|
-
# "crowd_id": "689add237430a236d5cb6efc",
|
|
420
|
-
# "num": "1306"
|
|
421
|
-
# },
|
|
422
|
-
# {
|
|
423
|
-
# "crowd_id": "68c38fd2617bb73ea09f7da0",
|
|
424
|
-
# "num": "2"
|
|
425
|
-
# },
|
|
426
|
-
# {
|
|
427
|
-
# "crowd_id": "687b38dda34ae35465dc92ef",
|
|
428
|
-
# "num": "9"
|
|
429
|
-
# },
|
|
430
|
-
# {
|
|
431
|
-
# "crowd_id": "68942b9258bb063f71fd58c8",
|
|
432
|
-
# "num": "5"
|
|
433
|
-
# },
|
|
434
|
-
# {
|
|
435
|
-
# "crowd_id": "68a02fc81625ac62b727fae2",
|
|
436
|
-
# "num": "24"
|
|
437
|
-
# },
|
|
438
|
-
# {
|
|
439
|
-
# "crowd_id": "6879fc29a34ae35465dc9198",
|
|
440
|
-
# "num": "25"
|
|
441
|
-
# },
|
|
442
|
-
# {
|
|
443
|
-
# "crowd_id": "689a1e17b96a557a6d78bf4d",
|
|
444
|
-
# "num": "1"
|
|
445
|
-
# },
|
|
446
|
-
# {
|
|
447
|
-
# "crowd_id": "6894461e58bb063f71fd58ef",
|
|
448
|
-
# "num": "1"
|
|
449
|
-
# },
|
|
450
|
-
# {
|
|
451
|
-
# "crowd_id": "68ba5e0d5259840710f2e457",
|
|
452
|
-
# "num": "1"
|
|
453
|
-
# },
|
|
454
|
-
# {
|
|
455
|
-
# "crowd_id": "687a0dada34ae35465dc91be",
|
|
456
|
-
# "num": "59"
|
|
457
|
-
# },
|
|
458
|
-
# {
|
|
459
|
-
# "crowd_id": "689444620241ad76344e3bcf",
|
|
460
|
-
# "num": "50"
|
|
461
|
-
# },
|
|
462
|
-
# {
|
|
463
|
-
# "crowd_id": "687b649aa34ae35465dc934a",
|
|
464
|
-
# "num": "14"
|
|
465
|
-
# },
|
|
466
|
-
# {
|
|
467
|
-
# "crowd_id": "6894209858bb063f71fd58b1",
|
|
468
|
-
# "num": "21"
|
|
469
|
-
# },
|
|
470
|
-
# {
|
|
471
|
-
# "crowd_id": "687b632ca34ae35465dc933b",
|
|
472
|
-
# "num": "57"
|
|
473
|
-
# },
|
|
474
|
-
# {
|
|
475
|
-
# "crowd_id": "686dea326424e217d9c0c86a",
|
|
476
|
-
# "num": "2"
|
|
477
|
-
# },
|
|
478
|
-
# {
|
|
479
|
-
# "crowd_id": "687e05e8a5e5180731e2122b",
|
|
480
|
-
# "num": "2"
|
|
481
|
-
# },
|
|
482
|
-
# {
|
|
483
|
-
# "crowd_id": "689bf254801953000707b8fe",
|
|
484
|
-
# "num": "1315"
|
|
485
|
-
# },
|
|
486
|
-
# {
|
|
487
|
-
# "crowd_id": "689420c258bb063f71fd58b4",
|
|
488
|
-
# "num": "13"
|
|
489
|
-
# },
|
|
490
|
-
# {
|
|
491
|
-
# "crowd_id": "689c133a801953000707b996",
|
|
492
|
-
# "num": "1306"
|
|
493
|
-
# },
|
|
494
|
-
# {
|
|
495
|
-
# "crowd_id": "687dec77a5e5180731e21143",
|
|
496
|
-
# "num": "10"
|
|
497
|
-
# },
|
|
498
|
-
# {
|
|
499
|
-
# "crowd_id": "6881a1d97fe4b22a4d5feec6",
|
|
500
|
-
# "num": "1"
|
|
501
|
-
# }
|
|
502
|
-
# ]
|
|
503
|
-
# diff_crowd_num(sql_result_list)
|
|
135
|
+
def diff_crowd_num(sql_result_list):
|
|
136
|
+
## 比较哪些群组数量不一致
|
|
137
|
+
_sql_result_list = {item["crowd_id"]: item["num"] for item in sql_result_list}
|
|
138
|
+
crowd_list = CrowdList(host=host, headers=headers)
|
|
139
|
+
cc = crowd_list.callCrowdPackageList(1, 100)
|
|
140
|
+
crowd_dict = {i['id']: i['nums'] for i in cc['responseList']}
|
|
141
|
+
|
|
142
|
+
print("-----sql_result_list-----:\n", json.dumps(sql_result_list, ensure_ascii=False))
|
|
143
|
+
print("****crowd_dict*****:\n", json.dumps(cc, ensure_ascii=False))
|
|
144
|
+
print(f"人群列表数量:{len(crowd_dict)},hive数量:{len(_sql_result_list)}")
|
|
145
|
+
print(":::::差异:::::\n", json.dumps(compare_dicts(crowd_dict, _sql_result_list), ensure_ascii=False))
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
sql_result_list = [
|
|
149
|
+
{
|
|
150
|
+
"crowd_id": "682b0aca244a981570817656",
|
|
151
|
+
"num": "4"
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"crowd_id": "69086abbd283550420102410",
|
|
155
|
+
"num": "19"
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"crowd_id": "6822ad71d917d574ee10133c",
|
|
159
|
+
"num": "3"
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"crowd_id": "6858f2e0a4025622a4245310",
|
|
163
|
+
"num": "3"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"crowd_id": "68e880910d5a50be1f816898",
|
|
167
|
+
"num": "1"
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"crowd_id": "682c2cc8da627a549206b8eb",
|
|
171
|
+
"num": "152"
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"crowd_id": "68e87fd00d5a50be1f816897",
|
|
175
|
+
"num": "2"
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"crowd_id": "68e87f440d5a50be1f816896",
|
|
179
|
+
"num": "2"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"crowd_id": "68244081702ed60ff73adbc6",
|
|
183
|
+
"num": "4"
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
"crowd_id": "68c93bfe68575727b9f02269",
|
|
187
|
+
"num": "1"
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"crowd_id": "6923fc88870f8d72c6d05de7",
|
|
191
|
+
"num": "19"
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
"crowd_id": "6923fec9870f8d72c6d05e01",
|
|
195
|
+
"num": "15"
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"crowd_id": "691e7c1de425257bf240470a",
|
|
199
|
+
"num": "155"
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"crowd_id": "6923fcf8870f8d72c6d05dec",
|
|
203
|
+
"num": "18"
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
"crowd_id": "6923ff07870f8d72c6d05e08",
|
|
207
|
+
"num": "2"
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"crowd_id": "6923fcbe870f8d72c6d05dea",
|
|
211
|
+
"num": "1"
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
"crowd_id": "6923fda9870f8d72c6d05df5",
|
|
215
|
+
"num": "14"
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
"crowd_id": "6923fdfc870f8d72c6d05df9",
|
|
219
|
+
"num": "8"
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"crowd_id": "6912db312f12dc67394a50d1",
|
|
223
|
+
"num": "2"
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
"crowd_id": "6923fe45870f8d72c6d05dfb",
|
|
227
|
+
"num": "6"
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
"crowd_id": "69240e54870f8d72c6d05e87",
|
|
231
|
+
"num": "6"
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
"crowd_id": "691d98b8ff6d32155eeb5efc",
|
|
235
|
+
"num": "152"
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
"crowd_id": "6923ff57870f8d72c6d05e13",
|
|
239
|
+
"num": "4"
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
"crowd_id": "6923ff40870f8d72c6d05e12",
|
|
243
|
+
"num": "12"
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
"crowd_id": "6923ff1d870f8d72c6d05e0c",
|
|
247
|
+
"num": "5"
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
"crowd_id": "6923fd66870f8d72c6d05df0",
|
|
251
|
+
"num": "15"
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
"crowd_id": "6924101b870f8d72c6d05e91",
|
|
255
|
+
"num": "10"
|
|
256
|
+
}
|
|
257
|
+
]
|
|
258
|
+
diff_crowd_num(sql_result_list)
|
|
504
259
|
|
|
505
260
|
# diff_person(_crowd_id="687a028fa34ae35465dc91a2",
|
|
506
261
|
# path="/Users/lulu/Downloads/临时文件2_20250719155155.xls")
|
smartpush/email/activity.py
CHANGED
|
@@ -39,7 +39,7 @@ class ActivityTemplate(ActivityTemplateRequestBase, RequestBase):
|
|
|
39
39
|
"currentHtml": "",
|
|
40
40
|
"currentJsonSchema": final_currentJsonSchema,
|
|
41
41
|
"previewJsonSchema": final_currentJsonSchema,
|
|
42
|
-
"schemaAnalysis": genSchemaAnalysis(json.loads(final_currentJsonSchema))}
|
|
42
|
+
"schemaAnalysis": BlockSchema.genSchemaAnalysis(json.loads(final_currentJsonSchema))}
|
|
43
43
|
|
|
44
44
|
result = self.request(path=URL.Activity.step2.url, method=URL.Activity.step2.method,
|
|
45
45
|
data=requestParam)
|
smartpush/email/schema.py
CHANGED
|
@@ -508,68 +508,69 @@ class BlockSchema(Enum):
|
|
|
508
508
|
]
|
|
509
509
|
}
|
|
510
510
|
|
|
511
|
-
|
|
512
|
-
def genSection(block_list: list):
|
|
513
|
-
"""
|
|
514
|
-
根据Block生成Section结构体
|
|
515
|
-
:param block_list:
|
|
516
|
-
:return:
|
|
511
|
+
@staticmethod
|
|
512
|
+
def genSection(block_list: list):
|
|
517
513
|
"""
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
514
|
+
根据Block生成Section结构体
|
|
515
|
+
:param block_list:
|
|
516
|
+
:return:
|
|
517
|
+
"""
|
|
518
|
+
section = BlockSchema.Section
|
|
519
|
+
if section.value['children'][0]['type'] == 'Column':
|
|
520
|
+
section.value['children'][0]['children'] = block_list
|
|
521
|
+
return section
|
|
523
522
|
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
递归遍历嵌套字典结构,提取所有层级的type和对应的id
|
|
527
|
-
相同type的id将以列表形式汇总(按遍历顺序追加)
|
|
528
|
-
|
|
529
|
-
Args:
|
|
530
|
-
data: 嵌套字典/列表结构(支持单节点字典或children列表)
|
|
531
|
-
|
|
532
|
-
Returns:
|
|
533
|
-
dict: key为type值,value为id列表(即使只有一个id也保持列表格式)
|
|
534
|
-
:param schema:
|
|
523
|
+
@staticmethod
|
|
524
|
+
def genSchemaAnalysis(schema):
|
|
535
525
|
"""
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
def recursive_parse(node):
|
|
539
|
-
if isinstance(node, dict):
|
|
540
|
-
if 'type' in node and 'id' in node:
|
|
541
|
-
type_val = node['type']
|
|
542
|
-
id_val = node['id']
|
|
543
|
-
result.setdefault(type_val, []).append(id_val)
|
|
526
|
+
递归遍历嵌套字典结构,提取所有层级的type和对应的id
|
|
527
|
+
相同type的id将以列表形式汇总(按遍历顺序追加)
|
|
544
528
|
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
recursive_parse(child)
|
|
548
|
-
elif isinstance(node, list):
|
|
549
|
-
for item in node:
|
|
550
|
-
recursive_parse(item)
|
|
529
|
+
Args:
|
|
530
|
+
data: 嵌套字典/列表结构(支持单节点字典或children列表)
|
|
551
531
|
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
532
|
+
Returns:
|
|
533
|
+
dict: key为type值,value为id列表(即使只有一个id也保持列表格式)
|
|
534
|
+
:param schema:
|
|
535
|
+
"""
|
|
536
|
+
result = {}
|
|
555
537
|
|
|
538
|
+
def recursive_parse(node):
|
|
539
|
+
if isinstance(node, dict):
|
|
540
|
+
if 'type' in node and 'id' in node:
|
|
541
|
+
type_val = node['type']
|
|
542
|
+
id_val = node['id']
|
|
543
|
+
result.setdefault(type_val, []).append(id_val)
|
|
556
544
|
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
545
|
+
if 'children' in node and isinstance(node['children'], list):
|
|
546
|
+
for child in node['children']:
|
|
547
|
+
recursive_parse(child)
|
|
548
|
+
elif isinstance(node, list):
|
|
549
|
+
for item in node:
|
|
550
|
+
recursive_parse(item)
|
|
551
|
+
recursive_parse(schema if isinstance(schema, dict) else schema.value)
|
|
552
|
+
schemaAnalysis = {"schema": result}
|
|
553
|
+
return json.dumps(schemaAnalysis)
|
|
564
554
|
|
|
555
|
+
@staticmethod
|
|
556
|
+
def genAllBlockSchema():
|
|
557
|
+
"""
|
|
558
|
+
获取所有的BlockSchema
|
|
559
|
+
:return:
|
|
560
|
+
"""
|
|
561
|
+
temp_list = [i.value for i in BlockSchema if
|
|
562
|
+
i not in (BlockSchema.Section, BlockSchema.Footer, BlockSchema.Header)]
|
|
563
|
+
return temp_list
|
|
565
564
|
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
565
|
+
@staticmethod
|
|
566
|
+
def genAllBlockSchemaList():
|
|
567
|
+
"""
|
|
568
|
+
获取所有的BlockSchema
|
|
569
|
+
:return:
|
|
570
|
+
"""
|
|
571
|
+
temp_list = [i.name for i in BlockSchema if
|
|
572
|
+
i not in (BlockSchema.Section, BlockSchema.Footer, BlockSchema.Header)]
|
|
573
|
+
return temp_list
|
|
573
574
|
|
|
574
575
|
|
|
575
576
|
if __name__ == '__main__':
|
|
@@ -581,4 +582,4 @@ if __name__ == '__main__':
|
|
|
581
582
|
# BlockSchema.ImageText,
|
|
582
583
|
# BlockSchema.Button, BlockSchema.Divider, BlockSchema.Social, BlockSchema.HTMLCode]
|
|
583
584
|
|
|
584
|
-
print(genSchemaAnalysis(BlockSchema.Section))
|
|
585
|
+
print(genSchemaAnalysis(BlockSchema.Section))
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import json
|
|
2
2
|
import time
|
|
3
|
+
|
|
3
4
|
from smartpush.base.request_base import RequestBase
|
|
4
5
|
from smartpush.base.url_enum import *
|
|
5
6
|
from smartpush.email.schema import *
|
|
@@ -33,7 +34,8 @@ class UniversalContent(RequestBase):
|
|
|
33
34
|
|
|
34
35
|
# 创建universal
|
|
35
36
|
def create_universal(self, requestParam):
|
|
36
|
-
result = self.request(method=URL.UniversalContent.saveUniversalContent.method,
|
|
37
|
+
result = self.request(method=URL.UniversalContent.saveUniversalContent.method,
|
|
38
|
+
path=URL.UniversalContent.saveUniversalContent.url,
|
|
37
39
|
data=requestParam)
|
|
38
40
|
return result
|
|
39
41
|
|
|
@@ -48,7 +50,8 @@ class UniversalContent(RequestBase):
|
|
|
48
50
|
requestParam = {'universalName': universa_name}
|
|
49
51
|
if blockType_list and type(blockType_list) == list:
|
|
50
52
|
requestParam.update(blockType=blockType_list)
|
|
51
|
-
result = self.request(method=URL.UniversalContent.queryUniversalContent.method,
|
|
53
|
+
result = self.request(method=URL.UniversalContent.queryUniversalContent.method,
|
|
54
|
+
path=URL.UniversalContent.queryUniversalContent.url,
|
|
52
55
|
data=requestParam)
|
|
53
56
|
return result
|
|
54
57
|
|
|
@@ -72,8 +75,10 @@ class UniversalContent(RequestBase):
|
|
|
72
75
|
"data": universal_list,
|
|
73
76
|
"type": _type
|
|
74
77
|
}
|
|
75
|
-
result = self.request(method=URL.UniversalContent.updateUniversalContent.method,
|
|
78
|
+
result = self.request(method=URL.UniversalContent.updateUniversalContent.method,
|
|
79
|
+
path=URL.UniversalContent.updateUniversalContent.url,
|
|
76
80
|
data=requestParam)
|
|
81
|
+
# TODO 未完成
|
|
77
82
|
return result
|
|
78
83
|
|
|
79
84
|
# 删除universal
|
|
@@ -84,7 +89,8 @@ class UniversalContent(RequestBase):
|
|
|
84
89
|
:return:
|
|
85
90
|
"""
|
|
86
91
|
requestParam = {'universalId': universalId}
|
|
87
|
-
result = self.request(method=URL.UniversalContent.deleteUniversalContent.method,
|
|
92
|
+
result = self.request(method=URL.UniversalContent.deleteUniversalContent.method,
|
|
93
|
+
path=URL.UniversalContent.deleteUniversalContent.url,
|
|
88
94
|
params=requestParam)
|
|
89
95
|
return result
|
|
90
96
|
|
|
@@ -97,7 +103,8 @@ class UniversalContent(RequestBase):
|
|
|
97
103
|
:return:
|
|
98
104
|
"""
|
|
99
105
|
requestParam = {"type": _type, "campaignId": campaignId, "universalIds": universalIds}
|
|
100
|
-
result = self.request(method=URL.UniversalContent.updateCampaignUsed.method,
|
|
106
|
+
result = self.request(method=URL.UniversalContent.updateCampaignUsed.method,
|
|
107
|
+
path=URL.UniversalContent.updateCampaignUsed.url,
|
|
101
108
|
data=requestParam)
|
|
102
109
|
return result
|
|
103
110
|
|
|
@@ -165,7 +172,8 @@ if __name__ == '__main__':
|
|
|
165
172
|
universalName=gen_universal_name(block))
|
|
166
173
|
result_list.append(block_schema)
|
|
167
174
|
print(result_list)
|
|
168
|
-
section_schema = get_universal_schema(genSection(result_list), _id=generate_UUID(9),
|
|
175
|
+
section_schema = get_universal_schema(BlockSchema.genSection(result_list), _id=generate_UUID(9),
|
|
176
|
+
universalId=sectionUniversalId,
|
|
169
177
|
universalName=sectionUniversalName)
|
|
170
178
|
universal_request_param = gen_universal_request_param(sectionUniversalId, section_schema)
|
|
171
179
|
print(universal_request_param)
|
|
@@ -174,32 +182,40 @@ if __name__ == '__main__':
|
|
|
174
182
|
"Content-Type": "application/json", "accept-language": "zh-CN"}
|
|
175
183
|
universal = UniversalContent(headers=head, host='https://test.smartpushedm.com/bff/api-sp-market-ec2')
|
|
176
184
|
try:
|
|
177
|
-
universal.create_universal(requestParam=universal_request_param)
|
|
178
|
-
universal.assert_block_in_the_section(sectionUniversalName, result_list)
|
|
185
|
+
# universal.create_universal(requestParam=universal_request_param)
|
|
186
|
+
# universal.assert_block_in_the_section(sectionUniversalName, result_list)
|
|
187
|
+
_list =[
|
|
188
|
+
{"universalId": "ec5d5278-4ed7-4933-8010-2b0c6a776356", "universalName": "Auto-Logo-2025-11-26 00:35:35",
|
|
189
|
+
"schema": "{\"id\":\"96997bb0a\",\"universalId\":\"ec5d5278-4ed7-4933-8010-2b0c6a776356\",\"universalName\":\"Auto-Logo-2025-11-26 00:35:35\",\"type\":\"Logo\",\"props\":{\"width\":120,\"height\":120,\"imgRatio\":1,\"src\":\"https://cdn.smartpushedm.com/frontend/smart-push/staging/1741054956275/1758595834300_74d62ae6.png?width=120&height=120\",\"href\":\"https://smartpush4.myshoplinestg.com\",\"align\":\"center\",\"containerBackgroundColor\":\"#b46b6b\",\"paddingLeft\":\"20px\",\"paddingRight\":\"20px\",\"paddingTop\":\"20px\",\"paddingBottom\":\"20px\",\"paddingCondition\":\"true\",\"segmentTypeConfig\":1},\"children\":[]}",
|
|
190
|
+
"subUniversalId": "ec5d5278-4ed7-4933-8010-2b0c6a776356", "type": 0, "blockType": "Logo",
|
|
191
|
+
"flowModal": ""}]
|
|
192
|
+
universal.update_universal(_list)
|
|
179
193
|
except:
|
|
180
194
|
raise
|
|
181
195
|
finally:
|
|
182
|
-
universal.delete_universal(sectionUniversalId)
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
196
|
+
# universal.delete_universal(sectionUniversalId)
|
|
197
|
+
# pass
|
|
198
|
+
pass
|
|
199
|
+
#
|
|
200
|
+
# if __name__ == '__main__':
|
|
201
|
+
# sectionUniversalId = generate_UUID()
|
|
202
|
+
# sectionUniversalName = gen_universal_name(BlockSchema.Section)
|
|
203
|
+
# print(sectionUniversalName)
|
|
204
|
+
# block_list = [BlockSchema.Logo] # 添加block
|
|
205
|
+
#
|
|
206
|
+
# block_dict = {}
|
|
207
|
+
# result_list = []
|
|
208
|
+
# blockUniversalNameList = []
|
|
209
|
+
# for block in block_list:
|
|
210
|
+
# name = block.name
|
|
211
|
+
# block_schema = get_universal_schema(block, _id=generate_UUID(9), universalId=generate_UUID(),
|
|
212
|
+
# universalName=gen_universal_name(block))
|
|
213
|
+
# result_list.append(block_schema)
|
|
214
|
+
# print(result_list)
|
|
215
|
+
# # vars['result_list'] = result_list
|
|
216
|
+
# section_schema = get_universal_schema(BlockSchema.genSection(result_list), _id=generate_UUID(9),
|
|
217
|
+
# universalId=sectionUniversalId,
|
|
218
|
+
# universalName=sectionUniversalName)
|
|
219
|
+
# universal_request_param = gen_universal_request_param(sectionUniversalId, section_schema)
|
|
220
|
+
# vars['universal_request_param'] = universal_request_param
|
|
221
|
+
# print(universal_request_param)
|
smartpush/form/form_after.py
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import json
|
|
2
|
-
from tenacity import retry, stop_after_attempt, wait_fixed
|
|
3
1
|
from smartpush.base.request_base import FormRequestBase
|
|
4
2
|
from smartpush.base.url_enum import URL
|
|
5
|
-
from smartpush.crowd import crowd
|
|
6
|
-
from smartpush.export.basic.GetOssUrl import log_attempt
|
|
7
3
|
|
|
8
4
|
|
|
9
5
|
class FormAfter(FormRequestBase):
|
|
@@ -22,38 +18,38 @@ class FormAfter(FormRequestBase):
|
|
|
22
18
|
if start_time is not None and end_time is not None:
|
|
23
19
|
requestParam["startTime"] = start_time
|
|
24
20
|
requestParam["endTime"] = end_time
|
|
25
|
-
result = self.request(method=URL.pageFormReportDetail.method, path=URL.pageFormReportDetail.url,
|
|
21
|
+
result = self.request(method=URL.FormReport.pageFormReportDetail.method, path=URL.FormReport.pageFormReportDetail.url,
|
|
26
22
|
data=requestParam)
|
|
27
23
|
persons_list = result["resultData"]["reportDetailData"]["datas"]
|
|
28
24
|
return persons_list
|
|
29
25
|
|
|
30
26
|
def callGetFormReportDetail(self):
|
|
31
27
|
requestParam = {"formId": self.form_id}
|
|
32
|
-
result = self.request(method=URL.getFormReportDetail.method, path=URL.getFormReportDetail.url,
|
|
28
|
+
result = self.request(method=URL.FormReport.getFormReportDetail.method, path=URL.FormReport.getFormReportDetail.url,
|
|
33
29
|
data=requestParam)
|
|
34
30
|
resultData = result["resultData"]
|
|
35
31
|
return resultData
|
|
36
32
|
|
|
37
33
|
def callGetFormPerformanceTrend(self):
|
|
38
34
|
requestParam = {"formId": self.form_id}
|
|
39
|
-
result = self.request(method=URL.getFormPerformanceTrend.method, path=URL.getFormPerformanceTrend.url,
|
|
35
|
+
result = self.request(method=URL.FormReport.getFormPerformanceTrend.method, path=URL.FormReport.getFormPerformanceTrend.url,
|
|
40
36
|
data=requestParam)
|
|
41
37
|
resultData = result["resultData"]
|
|
42
38
|
return resultData
|
|
43
39
|
|
|
44
40
|
def callGetFormList(self, formName):
|
|
45
41
|
requestParam = {'page': 1, 'pageSize': 10, 'name': formName}
|
|
46
|
-
result = self.request(method=URL.getFormList.method, path=URL.getFormList.url, data=requestParam)
|
|
42
|
+
result = self.request(method=URL.Form.getFormList.method, path=URL.Form.getFormList.url, data=requestParam)
|
|
47
43
|
return result["resultData"]['datas']
|
|
48
44
|
|
|
49
45
|
def callGetFormInfo(self):
|
|
50
46
|
requestParam = {'formId': self.form_id}
|
|
51
|
-
result = self.request(method=URL.getFormInfo.method, path=URL.getFormInfo.url, params=requestParam)
|
|
47
|
+
result = self.request(method=URL.Form.getFormInfo.method, path=URL.Form.getFormInfo.url, params=requestParam)
|
|
52
48
|
return result['resultData']
|
|
53
49
|
|
|
54
50
|
def callDeleteForm(self, merchant_id):
|
|
55
51
|
requestParam = {"formId": self.form_id, "merchant_id": merchant_id}
|
|
56
|
-
result = self.request(method=URL.deleteForm.method, path=URL.deleteForm.url, params=requestParam)
|
|
52
|
+
result = self.request(method=URL.Form.deleteForm.method, path=URL.Form.deleteForm.url, params=requestParam)
|
|
57
53
|
assert result['code'] == 1
|
|
58
54
|
print(f"删除id:{self.form_id}表单成功")
|
|
59
55
|
|
|
@@ -75,6 +71,7 @@ class FormAfter(FormRequestBase):
|
|
|
75
71
|
return True, person
|
|
76
72
|
else:
|
|
77
73
|
return False, None
|
|
74
|
+
return None
|
|
78
75
|
|
|
79
76
|
def FormReportNumQuery(self, num_type="viewNum", assertNum=None):
|
|
80
77
|
"""
|
|
@@ -89,6 +86,7 @@ class FormAfter(FormRequestBase):
|
|
|
89
86
|
return var
|
|
90
87
|
else:
|
|
91
88
|
return data.get(num_type) == assertNum
|
|
89
|
+
return None
|
|
92
90
|
|
|
93
91
|
def getFormAttributionSales(self, key, start_time=None, end_time=None):
|
|
94
92
|
"""
|
|
@@ -109,6 +107,7 @@ class FormAfter(FormRequestBase):
|
|
|
109
107
|
return True, order
|
|
110
108
|
else:
|
|
111
109
|
return False, None
|
|
110
|
+
return None
|
|
112
111
|
|
|
113
112
|
def getFormLineChart(self, date=None, num_type="viewNum", assertNum=None):
|
|
114
113
|
"""
|
|
@@ -125,6 +124,7 @@ class FormAfter(FormRequestBase):
|
|
|
125
124
|
assert data.get(num_type) == assertNum
|
|
126
125
|
else:
|
|
127
126
|
return data.get(num_type)
|
|
127
|
+
return None
|
|
128
128
|
|
|
129
129
|
def getCrowdPersonList(self, _id, page=1, pageSize=20, filter_type="email", filter_value=""):
|
|
130
130
|
self.callCrowdPersonList(self, _id, page, pageSize, filter_type, filter_value)
|
smartpush/test.py
ADDED
|
File without changes
|
smartpush/utils/ListDictUtils.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import json
|
|
2
2
|
|
|
3
|
-
from deepdiff import DeepDiff
|
|
3
|
+
# from deepdiff import DeepDiff
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
def compare_lists(temp1, temp2, check_key=["completedCount"], all_key=False, num=1):
|
|
@@ -83,3 +83,55 @@ def check_values_in_list_set(a, b):
|
|
|
83
83
|
return [True, "匹配成功"]
|
|
84
84
|
else:
|
|
85
85
|
return [False, "匹配失败,不匹配数据" + str(missing_values)]
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def is_json_equal(a, b, exclude_fields=None):
|
|
89
|
+
"""
|
|
90
|
+
递归比较两段JSON(字典/列表/基础类型)是否一致,排除指定字段
|
|
91
|
+
|
|
92
|
+
:param a: 第一段JSON数据(dict/list/str/int/float/bool/None)
|
|
93
|
+
:param b: 第二段JSON数据(dict/list/str/int/float/bool/None)
|
|
94
|
+
:param exclude_fields: 需要排除的字段列表(如["id", "updateTime"])
|
|
95
|
+
:return: bool - 一致返回True,不一致返回False
|
|
96
|
+
"""
|
|
97
|
+
# 初始化排除字段列表(默认空)
|
|
98
|
+
exclude_fields = exclude_fields or []
|
|
99
|
+
|
|
100
|
+
# 1. 类型不同直接判定不一致
|
|
101
|
+
if type(a) != type(b):
|
|
102
|
+
return False
|
|
103
|
+
|
|
104
|
+
# 2. 处理字典类型:排除指定字段后比较键值对
|
|
105
|
+
if isinstance(a, dict):
|
|
106
|
+
# 获取排除字段后的键集合
|
|
107
|
+
keys_a = {k for k in a.keys() if k not in exclude_fields}
|
|
108
|
+
keys_b = {k for k in b.keys() if k not in exclude_fields}
|
|
109
|
+
|
|
110
|
+
# 键集合不同则不一致
|
|
111
|
+
if keys_a != keys_b:
|
|
112
|
+
return False
|
|
113
|
+
|
|
114
|
+
# 递归比较每个键对应的值
|
|
115
|
+
for key in keys_a:
|
|
116
|
+
if not is_json_equal(a[key], b[key], exclude_fields):
|
|
117
|
+
return False
|
|
118
|
+
return True
|
|
119
|
+
|
|
120
|
+
# 3. 处理列表类型:按顺序递归比较每个元素
|
|
121
|
+
elif isinstance(a, list):
|
|
122
|
+
# 列表长度不同则不一致
|
|
123
|
+
if len(a) != len(b):
|
|
124
|
+
return False
|
|
125
|
+
|
|
126
|
+
# 逐个比较列表元素
|
|
127
|
+
for item_a, item_b in zip(a, b):
|
|
128
|
+
if not is_json_equal(item_a, item_b, exclude_fields):
|
|
129
|
+
return False
|
|
130
|
+
return True
|
|
131
|
+
|
|
132
|
+
# 4. 处理基础类型(str/int/float/bool/None):直接比较值
|
|
133
|
+
else:
|
|
134
|
+
# 特殊处理浮点数精度问题(可选,根据需求开启)
|
|
135
|
+
# if isinstance(a, float) and isinstance(b, float):
|
|
136
|
+
# return abs(a - b) < 1e-9
|
|
137
|
+
return a == b
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
smartpush/__init__.py,sha256=XJrl1vhGATHSeSVqKmPXxYqxyseriUpvY5tLIXir3EE,24
|
|
2
2
|
smartpush/get_jira_info.py,sha256=s3hPwC6KePS5BtqNS9o15eCh7Nx2gn16bn6tfYK0iQI,18112
|
|
3
|
+
smartpush/test.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
4
|
smartpush/account/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
5
|
smartpush/account/operate_account.py,sha256=nzJLLAEwNElavZeWVqnA_MSGTBzQrSrknmezYBwtvWs,1525
|
|
5
6
|
smartpush/base/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
7
|
smartpush/base/faker_data.py,sha256=TOd5EKVImxZpsKEW_dtKa2iqiUGqU7OBkOM8pvqKVUc,24643
|
|
7
|
-
smartpush/base/request_base.py,sha256=
|
|
8
|
-
smartpush/base/url_enum.py,sha256=
|
|
8
|
+
smartpush/base/request_base.py,sha256=jQRnURl9-BA5BnymjyD5auqFc256CtmepM_woFVkE6g,2754
|
|
9
|
+
smartpush/base/url_enum.py,sha256=vVg4Y1w8ayT_jD3DDzQCEzD6cWpnRr-7MxPeEqU5OTU,2226
|
|
9
10
|
smartpush/crowd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
-
smartpush/crowd/crowd.py,sha256=
|
|
11
|
+
smartpush/crowd/crowd.py,sha256=KNwvX-BnBnMVVuHM79a-VeBMp_guB-Kqw3tFaAPiAp8,9768
|
|
11
12
|
smartpush/email/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
-
smartpush/email/activity.py,sha256=
|
|
13
|
-
smartpush/email/schema.py,sha256=
|
|
14
|
-
smartpush/email/universal_content.py,sha256=
|
|
13
|
+
smartpush/email/activity.py,sha256=bFiuxp8wb5qxQP0hg2BSqztqnLy7jxuaUONpqF9dl0M,3493
|
|
14
|
+
smartpush/email/schema.py,sha256=790z_2aym1L4yd3igslgMmugvDOJ_XXwzMFrgfUsqg0,31208
|
|
15
|
+
smartpush/email/universal_content.py,sha256=_SHnp1QeZK076U0MEWIFsSSgzEWt2W1R2oMEMbMOa08,11502
|
|
15
16
|
smartpush/export/__init__.py,sha256=D9GbWcmwnetEndFDty5XbVienFK1WjqV2yYcQp3CM84,99
|
|
16
17
|
smartpush/export/basic/ExcelExportChecker.py,sha256=YqWmDGSFadQdK2vNJ070Qvad9ZtqEwiQyPkOemlACfs,21508
|
|
17
18
|
smartpush/export/basic/GetOssUrl.py,sha256=zxNZj6x7Ph9N3P5k82pLpBFjZxKrDfbgqS2fTYyhvso,8467
|
|
@@ -22,18 +23,18 @@ smartpush/flow/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
22
23
|
smartpush/flow/global_flow.py,sha256=D1hCpO5fsWTEfl4yNpi3O8PFhz_UmKLHSIQhKtypkvU,2817
|
|
23
24
|
smartpush/flow/history_flow.py,sha256=Gds1FI6i9ue-n1WwpNgL2JlQ2PhSR8VK7dvZ9JemZKw,4854
|
|
24
25
|
smartpush/form/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
25
|
-
smartpush/form/form_after.py,sha256=
|
|
26
|
+
smartpush/form/form_after.py,sha256=KHatgVQvOiCykbfXm5TD07gvGvMgQYqQIQkcIKkAnQU,8348
|
|
26
27
|
smartpush/form/form_assert.py,sha256=wPIRfQHhr7lN1fFd-mp0z_qKMtF4jfrNxRWvp2xfqCg,257
|
|
27
28
|
smartpush/form/form_before.py,sha256=CCvAC_2yWPlnQGtjEA8LPLy9853Nq3nNjcL2GewFWIs,175
|
|
28
29
|
smartpush/form/form_client_operation.py,sha256=gg-5uHXCyMa_ypBSYPYFVxXdwZdYBJsNtUCqayknMBw,303
|
|
29
30
|
smartpush/utils/DataTypeUtils.py,sha256=BC7ioztO3vAfKd1EOoNvXdVuXYY8qjNskV1DP7LhW-M,1082
|
|
30
31
|
smartpush/utils/EmailUtlis.py,sha256=DAHd73bJ8hiJCLEXtD0xcwxPD7SOPSmBB7Jvlf6gN6s,11201
|
|
31
|
-
smartpush/utils/ListDictUtils.py,sha256=
|
|
32
|
+
smartpush/utils/ListDictUtils.py,sha256=Xc8kfSOZjX_k026Au4cfvtgFh5WoHxw4yRJWASyA_Cc,5041
|
|
32
33
|
smartpush/utils/StringUtils.py,sha256=n8mo9k0JQN63MReImgv-66JxmmymOGknR8pH2fkQrAo,4139
|
|
33
34
|
smartpush/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
34
35
|
smartpush/utils/date_utils.py,sha256=Xgx2DbmWYri71xXBiaKYTZDeh2a8MFhYns_xB0U2JOA,13159
|
|
35
36
|
smartpush/utils/form_utils.py,sha256=ld-g_Dm_ZlnagQt7imYfUc87bcBRVlTctywuLtzmjXQ,849
|
|
36
|
-
smartpush-
|
|
37
|
-
smartpush-
|
|
38
|
-
smartpush-
|
|
39
|
-
smartpush-
|
|
37
|
+
smartpush-2.0.0.dist-info/METADATA,sha256=v4plV_C6P-VNEfK4waKSnHj2DvCLvAl_6ASXVz1RZ5Y,131
|
|
38
|
+
smartpush-2.0.0.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
|
39
|
+
smartpush-2.0.0.dist-info/top_level.txt,sha256=5_CXqu08EfbPaKLjuSAOAqCmGU6shiatwDU_ViBGCmg,10
|
|
40
|
+
smartpush-2.0.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|