go_api_bbs_w_comment.py 1.3 KB

1234567891011121314151617181920212223
  1. from .tool.func import *
  2. def api_bbs_w_comment_n(db_set, bbs_num = "", post_num = "", tool = "length"):
  3. other_set = {}
  4. other_set["bbs_num"] = str(bbs_num)
  5. other_set["post_num"] = str(post_num)
  6. other_set["tool"] = tool
  7. other_set = json.dumps(other_set)
  8. if platform.system() == 'Linux':
  9. if platform.machine() in ["AMD64", "x86_64"]:
  10. data = subprocess.Popen([os.path.join(".", "route_go", "bin", "main.amd64.bin"), sys._getframe().f_code.co_name, db_set, other_set], stdout = subprocess.PIPE).communicate()[0]
  11. else:
  12. data = subprocess.Popen([os.path.join(".", "route_go", "bin", "main.arm64.bin"), sys._getframe().f_code.co_name, db_set, other_set], stdout = subprocess.PIPE).communicate()[0]
  13. else:
  14. if platform.machine() in ["AMD64", "x86_64"]:
  15. data = subprocess.Popen([os.path.join(".", "route_go", "bin", "main.amd64.exe"), sys._getframe().f_code.co_name, db_set, other_set], stdout = subprocess.PIPE).communicate()[0]
  16. else:
  17. data = subprocess.Popen([os.path.join(".", "route_go", "bin", "main.arm64.exe"), sys._getframe().f_code.co_name, db_set, other_set], stdout = subprocess.PIPE).communicate()[0]
  18. data = data.decode('utf8')
  19. return flask.Response(response = data, status = 200, mimetype = 'application/json')