MCPcopy
hub / github.com/LawRefBook/Laws / update_status

Function update_status

scripts/database.py:167–209  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

165
166
167def update_status():
168 params = [
169 # ('xlwj', ['02', '03', '04', '05', '06', '07', '08']), # 法律法规
170 # ("fgbt", "中华人民共和国澳门特别行政区基本法"),
171 ("fgxlwj", "xzfg"), # 行政法规
172 ('type', 'sfjs'),
173 ("zdjg", "4028814858a4d78b0158a50f344e0048&4028814858a4d78b0158a50fa2ba004c"), # 北京
174 ("zdjg", "4028814858b9b8e50158bed591680061&4028814858b9b8e50158bed64efb0065"), # 河南
175 ("zdjg", "4028814858b9b8e50158bec45e9a002d&4028814858b9b8e50158bec500350031"), # 上海
176 # ("zdjg", "4028814858b9b8e50158bec5c28a0035&4028814858b9b8e50158bec6abbf0039"), # 江苏
177 ("zdjg", "4028814858b9b8e50158bec7c42f003d&4028814858b9b8e50158beca3c590041"), # 浙江
178 ("zdjg", "4028814858b9b8e50158bed40f6d0059&4028814858b9b8e50158bed4987a005d"), # 山东
179 # ("zdjg", "4028814858b9b8e50158bef1d72600b9&4028814858b9b8e50158bef2706800bd"), # 陕西省
180 ]
181
182 adding_pub = False
183
184 req = request.LawParser()
185 req.request.searchType = "1,9"
186 for param in params:
187 req.request.params = [param]
188 for item in req.lawList():
189 title = item["title"].replace("中华人民共和国", "")
190 if "publish" in item and item["publish"]:
191 item["publish"] = item["publish"].split(" ")[0]
192 if "expiry" in item and item["expiry"]:
193 item["expiry"] = item["expiry"].split(" ")[0]
194 if adding_pub:
195 laws = law_db.get_laws(title)
196 else:
197 laws = law_db.get_laws(title, item["publish"])
198 if not laws:
199 print(f"{title} 不存在")
200 continue
201 if len(laws) != 1:
202 print(f"{title} 存在两份数据,请手动处理")
203 continue
204 law = laws[0]
205 law.publish = item["publish"].strip()
206 law.valid_from = item["expiry"].strip()
207 law.expired = int(item["status"]) == 9
208 law.save()
209 print("saved", law)
210
211
212def update_ver():

Callers

nothing calls this directly

Calls 2

lawListMethod · 0.95
get_lawsMethod · 0.80

Tested by

no test coverage detected