|
@@ -2,6 +2,7 @@ import os
|
|
|
import requests
|
|
|
import json
|
|
|
import time
|
|
|
+import subprocess
|
|
|
from flask import Flask,request,redirect
|
|
|
from flask_cors import CORS
|
|
|
app = Flask(__name__,static_folder="static")
|
|
@@ -11,11 +12,10 @@ CORS(app, resources=r'/*')
|
|
|
# current_path
|
|
|
current_path = os.getcwd()
|
|
|
res_json = {"code":0,"msg":"成功"}
|
|
|
-send_status = {'a':False}
|
|
|
+send_status = False
|
|
|
|
|
|
# 1.小程序打包
|
|
|
def build_mini_program(branch):
|
|
|
- res = False
|
|
|
command_str = (
|
|
|
"cd "+current_path+ ";"
|
|
|
"cd longVideoFactory;"
|
|
@@ -25,8 +25,8 @@ def build_mini_program(branch):
|
|
|
"cnpm install && npm install ;"
|
|
|
"npm run build;"
|
|
|
)
|
|
|
-
|
|
|
- if os.system(command_str) == 0:
|
|
|
+ ret = subprocess.run(command_str,shell=True)
|
|
|
+ if ret.returncode == 0:
|
|
|
res_json["code"] = 0
|
|
|
res_json["msg"] = "打包成功"
|
|
|
|
|
@@ -44,11 +44,11 @@ def create_preview(project,page):
|
|
|
code_img_path = os.path.join(current_path,'1.png')
|
|
|
|
|
|
path = """ '{"pathName":"%s"}' """ % page
|
|
|
- os.system(wx_cli+ " open --project " + dist_path)
|
|
|
- os.system(wx_cli+ " reset-fileutils --project " + dist_path)
|
|
|
- print(wx_cli+" preview --project "+dist_path+" --compile-condition "+path+" --qr-output "+code_img_path+" --qr-format image")
|
|
|
+
|
|
|
+ subprocess.run(wx_cli+ " open --project " + dist_path,shell=True)
|
|
|
+ subprocess.run(wx_cli+ " reset-fileutils --project " + dist_path,shell=True)
|
|
|
f_read = os.popen(wx_cli+" preview --project "+dist_path+" --compile-condition "+path+" --qr-output "+code_img_path+" --qr-format image").read()
|
|
|
- os.system(wx_cli+ " quit")
|
|
|
+ subprocess.run(wx_cli+ " quit",shell=True)
|
|
|
if "[error]" in f_read:
|
|
|
res_json["code"] = 3
|
|
|
res_json["msg"] = f_read
|
|
@@ -248,9 +248,14 @@ if __name__ == '__main__':
|
|
|
# "Authorization":"Bearer "+token,
|
|
|
# "Content-Type": "application/json;charset=UTF-8"
|
|
|
# }
|
|
|
+# print(token)
|
|
|
# url = "https://open.feishu.cn/open-apis/im/v1/chats"
|
|
|
-# res = requests.post(url,headers=headers).json()
|
|
|
+# res = requests.get(url,headers=headers).json()
|
|
|
+# # print(res)
|
|
|
+# url = "https://open.feishu.cn/open-apis/im/v1/chats/" +"oc_0f843f734a583434e28bda3687ffc241"
|
|
|
+# res = requests.get(url,headers=headers).json()
|
|
|
# print(res)
|
|
|
|
|
|
+
|
|
|
# https://open.feishu.cn/open-apis/bot/v2/hook/a243326f-90cf-4a70-ba26-a6b202710971
|
|
|
# https://open.feishu.cn/open-apis/bot/v2/hook/a924b6a5-86ef-4c76-a7e4-eb42056f70cc
|