create_menus.py 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. # -*- coding: utf-8 -*-
  2. """
  3. Created on 2021-12-13 10:04:03
  4. ---------
  5. @summary: 快捷创建meaus配置
  6. """
  7. from feapder.db.mongodb import MongoDB
  8. class Details:
  9. _to_db = None
  10. _to_db_xs = None
  11. db_name = 'mgp_list'
  12. # 定义mongo链接
  13. @property
  14. def to_db(self):
  15. if not self._to_db:
  16. self._to_db = MongoDB()
  17. return self._to_db
  18. @property
  19. def to_db_xs(self):
  20. if not self._to_db_xs:
  21. self._to_db_xs = MongoDB(port=27001,db='editor')
  22. return self._to_db_xs
  23. def main(self,page):
  24. menus_list = []
  25. data = self.to_db_xs.find("luaconfig",{"modifyuser":"maguopeng","param_common":{"$elemMatch": {"$regex": "中国南方航空采购招标网", "$options": "$i"}}})
  26. # print(data)
  27. for item in data:
  28. # print(item)
  29. channls = item.get("param_common")[2]
  30. code = item.get("code")
  31. href = item.get("param_common")[11]
  32. print("Menu"+"(",f"'{channls}',",f"'{code}',\n",f"'{href}',",page,"),")
  33. # menus_list.append(f'''Menu({channls},{code},{href},{page})''')
  34. # print(menus_list)
  35. Details().main(2)