def up_pack9_default(exlPath="", type=0): """ 打包内置资源 """ resource_name = [] m = MyExcelUtil(exlPath) for j in range(0, 7): for i in range(1, m.get_row_num(j)): # print m.get_rowCol_data(i, 5, j) resource_name.append(m.get_rowCol_data(i, 5, j).strip()) # mydb = MysqldbHelper(host='10.10.19.117', port=3306, user='******', password='******', db='store') # resource_dict = mydb.executeSql( # 'SELECT slug from wx_pack_9_resource where resource_status = 3') # for name in resource_dict: # resource_name.append(name["slug"]) resource_name = list(set(resource_name)) # print len(resource_name) try: print "内置资源个数:" + str(len(resource_name)) if type == 0: resText = reqApi.post_Pack9Add("DefaultPackage 93", "", "DefaultPackage_93", resource_name) else: resText = reqApi.post_shenCutPackAdd("DefaultPackage", "", "DefaultPackage_33", resource_name) if resText.find(u"操作成功") >= 0: print("操作成功 ") except Exception as err: print err print("操作失败")
def up_pack9_default(): mydb = MysqldbHelper(host='10.10.19.117', port=3306, user='******', password='******', db='filmora_es_admin') resource_dict = mydb.executeSql( 'SELECT slug from wx_pack_9_resource where description IN (\"wang auto\" ,\"default Edit\") and resource_status = 3 and slug !=\"Shadow1\"' ) resource_name = [] for name in resource_dict: # print name["slug"] resource_name.append(name["slug"]) resource_name = list(set(resource_name)) # print resource_name try: print "内置资源个数:" + str(len(resource_name)) resText = reqApi.post_Pack9Add("DefaultPackage", "", "DefaultPackage", resource_name) if resText.find(u"操作成功") >= 0: print("操作成功 ") except Exception as err: print err print("操作失败")
def up_set9(exlPath, type=0): """ 打包set :param exlPath: """ mydb = MysqldbHelper(host='192.168.11.43', port=3306, user='******', password='******', db='store') m = MyExcelUtil(exlPath) set_dict = {} set_dict2 = {} for i in range(1, m.get_row_num(6)): if m.get_rowCol_data(i, 2, 6).upper() == "Y": setName = m.get_rowCol_data(i, 1, 6) packName = m.get_rowCol_data(i, 0, 6) sql = 'SELECT id from wx_pack9 where slug = \"{}\"'.format( replace_space(setName)) result = mydb.executeSqlOne(sql) if result is None: set_dict[packName] = setName set_dict2.update({setName: []}) print set_dict2 for k, v in set_dict.items(): if set_dict2.has_key(v): set_dict2[v].append(k.lower()) else: set_dict2[v] = [] print set_dict2 time = 0 for s, p in set_dict2.items(): print p resource_name = [] for j in range(0, 6): for i in range(1, m.get_row_num(j)): if m.get_rowCol_data(i, 4, j).lower() in p: resource_name.append(m.get_rowCol_data(i, 3, j)) MyExcelUtil(exlPath).write_data(i, 5, "PASS", MyExcelUtil.set_style(3), j) # print resource_name print(s, "", replace_space(s), resource_name) try: if len(resource_name) > 0: if type == 0: resText = reqApi.post_Pack9Add(s, "", replace_space(s), resource_name) else: resText = reqApi.post_shenCutPackAdd(s, "", replace_space(s), resource_name) if resText.find(u"操作成功") >= 0: time = time + 1 print("操作成功 " + str(time)) except Exception as err: print err
def up_set9(exlPath): m = MyExcelUtil(exlPath) set_dict = {} set_dict2 = {} for i in range(1, m.get_row_num(6)): if m.get_rowCol_data(i, 2, 6).upper() == "Y": setName = m.get_rowCol_data(i, 1, 6) packName = m.get_rowCol_data(i, 0, 6) set_dict[packName] = setName set_dict2.update({setName: []}) # print set_dict2 for k, v in set_dict.items(): if set_dict2.has_key(v): set_dict2[v].append(k) else: set_dict2[v] = [] # print set_dict2 time = 0 for s, p in set_dict2.items(): print p resource_name = [] for j in range(0, 6): for i in range(1, m.get_row_num(j)): if m.get_rowCol_data(i, 4, j) in p: resource_name.append(m.get_rowCol_data(i, 3, j)) MyExcelUtil(exlPath).write_data(i, 5, "PASS", MyExcelUtil.set_style(3), j) # print resource_name print(s, "", replace_space(s), resource_name) try: if len(resource_name) > 0: resText = reqApi.post_Pack9Add(s, "", replace_space(s), resource_name) if resText.find(u"操作成功") >= 0: time = time + 1 print("操作成功 " + str(time)) except Exception as err: print err
def up_pack9(exlPath): m = MyExcelUtil(exlPath) pack_name = [] for j in range(0, 6): for i in range(1, m.get_row_num(j)): # print m.get_rowCol_data(i, 6, j) if m.get_rowCol_data(i, 5, j).upper() == "Y": data = m.get_rowCol_data(i, 4, j) pack_name.append(data) pack_name = list(set(pack_name)) print pack_name time = 0 for name in pack_name: resource_name = [] for j in range(0, 6): for i in range(1, m.get_row_num(j)): if m.get_rowCol_data(i, 5, j).upper() == "Y" and m.get_rowCol_data( i, 4, j) == name: resource_name.append(m.get_rowCol_data(i, 3, j)) MyExcelUtil(exlPath).write_rowNum_data( i, 5, MyExcelUtil.set_style(3), j, "N", "PASS") # print resource_name # jp = convert_jp(name) jp = "" print(name, "", replace_space(name), resource_name) try: if len(resource_name) > 0: resText = reqApi.post_Pack9Add(name, jp, replace_space(name), resource_name) if resText.find(u"操作成功") >= 0: time = time + 1 print("操作成功 " + str(time)) except Exception as err: print err print("操作失败")