Commit b2b9fe2c authored by xiao-hesheng's avatar xiao-hesheng
Browse files

优化脚本,增加写入文件函数

解决yaml文件中文乱码问题
修改tag内容
parent 6a17afd1
......@@ -2,7 +2,7 @@
__author__ = "xiaohesheng"
"""
case_tag:api,mdm-web境内,id2232,sit,on
case_tag:api,mdm-web境内,id2232,id2232-1,sit,on
主数据平台:注册企业接口
"""
......
......@@ -2,7 +2,7 @@
__author__ = "xiaohesheng"
"""
case_tag:api,mdm-web2,id2232,sit,on
case_tag:api,mdm-web2,id2232,id2232-3,sit,on
主数据平台:注册企业接口_注册时_有附件
"""
......
......@@ -2,7 +2,7 @@
__author__ = "xiaohesheng"
"""
case_tag:api,mdm-web1,id2232,sit,on
case_tag:api,mdm-web1,id2232,id2232-4,it,on
主数据平台:注册企业接口_注册时_有附件
"""
......
......@@ -2,7 +2,7 @@
__author__ = "xiaohesheng"
"""
case_tag:api,mdm-web,id2232,sit,on
case_tag:api,mdm-web,id2232,id2232-2,sit,on
主数据平台:注册企业接口
"""
......
......@@ -2,7 +2,7 @@
__author__ = "xiaohesheng"
"""
case_tag:api,mdm-web正常注册,id2232,sit,on
case_tag:api,mdm-web正常注册,id2232,id2232-5,sit,on
主数据平台:注册企业接口
"""
......
......@@ -2,7 +2,7 @@
__author__ = "xiaohesheng"
"""
case_tag:api,mdm-web注册企业已存在,id2232,sit,on
case_tag:api,mdm-web注册企业已存在,id2232,id2232-6,sit,on
主数据平台:注册企业接口
"""
......
......@@ -2,7 +2,7 @@
__author__ = "xiaohesheng"
"""
case_tag:api,mdm-web生产厂商正常注册,id2232,sit,on
case_tag:api,mdm-web生产厂商正常注册,id2232,id2232-7,sit,on
主数据平台:生产厂商_企业注册提交_正常注册
"""
......
......@@ -2,7 +2,7 @@
__author__ = "xiaohesheng"
"""
case_tag:api,mdm-web经销商正常注册,id2232,sit,on
case_tag:api,mdm-web经销商正常注册,id2232,id2232-8,sit,on
主数据平台:经销商_企业注册提交_正常注册
"""
......
......@@ -3,7 +3,7 @@
__author__ = "xiaohesheng"
"""
case_tag:api,mdm-web,公立医院注册,id2249,sit,on,10086
case_tag:api,mdm-web,公立医院注册,id2249,id2249-1,sit,on,10086
主数据平台:公立医院注册
"""
from common.common_func import commonFuc
......
......@@ -4,7 +4,7 @@ __author__ = "xiaohesheng"
"""
暂未调试脚本
case_tag:api,mdm-web私立医院注册,id2249,sit,on,10086
case_tag:api,mdm-web私立医院注册,id2249,id2249-2,sit,on,10086
主数据平台:私立医院注册
"""
from common.common_func import commonFuc
......
......@@ -5,7 +5,7 @@ from common.timeUtils import timeUtils
__author__ = "xiaohesheng"
"""
case_tag:api,mdm-web,注册医院审核通过,id2249,sit,on,20230907
case_tag:api,mdm-web,注册医院审核通过,id2249,id2249-3,sit,on,20230907
主数据平台:注册医院审核通过
"""
from common.common_func import commonFuc
......
......@@ -5,7 +5,7 @@ from common.timeUtils import timeUtils
__author__ = "xiaohesheng"
"""
case_tag:api,mdm-web,注册医院审核驳回,id2249,sit,on,202309072
case_tag:api,mdm-web,注册医院审核驳回,id2249,id2249-4,sit,on,202309072
主数据平台:注册医院审核驳回
"""
from common.common_func import commonFuc
......
......@@ -4,7 +4,7 @@ from common.timeUtils import timeUtils
__author__ = "xiaohesheng"
"""
case_tag:api,mdm-web企业审核,id2248,sit,on,2023090802
case_tag:api,mdm-web企业审核,id2248,id2248-1,sit,on,2023091201
主数据平台:产品新增和审核通过
"""
......@@ -222,8 +222,8 @@ def p_m_a():
# print('code',code)
commonFuc().check_text_exist(code,result)
print('username',username)
return username
return username,goodsName,module
# p_m_a()
from common.timeUtils import timeUtils
from common.rw import Rw
Rw().w_info(p_m_a())
from common.fileUtls import FileUtils
FileUtils().w_info(p_m_a(),'产品新增')
......@@ -6,7 +6,7 @@ from common.timeUtils import timeUtils
__author__ = "xiaohesheng"
"""
case_tag:api,mdm-web企业审核,id2248,sit,on,2023090802
case_tag:api,mdm-web企业审核,id2248,id2248-2,sit,on,2023091202
主数据平台:产品新增和审核通过
"""
......
......@@ -535,6 +535,6 @@ class commonFuc(object):
def get_pro_path(self):
import os
curPath = os.path.abspath(os.path.dirname(__file__)) # 获取当前文件的所在目录的绝对路径
print(os.path.split(curPath))
# print(os.path.split(curPath))
rootPath = os.path.split(curPath)[0]
return rootPath
\ No newline at end of file
loginusername1:
loginusername: 国药集团公司aVD9#
loginusername: 国药集团公司!n0d(
goodsname: 一次性注射器NbfHr
import os
from ruamel import yaml
from common.db.db import dbOP
import datetime
curpath = os.path.dirname(os.path.realpath(__file__))
rootPath = os.path.split(curpath)[0]
# 数据读入和写入文件
class FileUtils(object):
def w_info(self, info,keyname):
module=info[2]
dict = {}
value = {}
value['username'] = info[0]
value['goodsname'] = info[1]
key=keyname
dict[key] = value
w_path=rootPath+os.sep+'data'+os.sep+module
# print(w_path)
yamlpath = os.path.join(w_path, "message")
# 写入到yaml文件
with open(yamlpath, "w", encoding="utf-8") as f:
yaml.dump(dict, f, Dumper=yaml.RoundTripDumper,allow_unicode=True)
def r_info(self, module,keyname):
w_path = rootPath + os.sep + 'data' + os.sep + module
yamlpath = os.path.join(w_path, "message")
file_value = open(yamlpath, 'r',encoding='utf-8')
result = yaml.load(file_value.read(), Loader=yaml.Loader)
if result is not None:
key = keyname
if key in result:
return result[key]
else:
return None
else:
return None
if __name__ == '__main__':
# info=("aaaa","bbbbbb","mdm3-pim")
# FileUtils().w_info(info,"产品新增")
aa=FileUtils().r_info("mdm3-pim","产品新增")
print(aa)
import os
from ruamel import yaml
from common.db.db import dbOP
import datetime
curpath = os.path.dirname(os.path.realpath(__file__))
......@@ -23,10 +24,11 @@ class Rw:
yaml.dump(dict, f, Dumper=yaml.RoundTripDumper)
return token
def w_info(self, username):
def w_info(self, info):
dict = {}
value = {}
value["loginusername"] = username
value["loginusername"] = info[0]
value["goodsname"] = info[1]
key="loginusername1"
dict[key] = value
yamlpath = os.path.join(curpath, "data")
......
产品新增:
username: 国药集团公司&ms2w
goodsname: 一次性注射器jtwfK
......@@ -54,8 +54,8 @@
</tr>
<tr width="600">
<td class='details-col-elapsed'>2</td>
<td class='details-col-elapsed'>2</td>
<td class='details-col-elapsed'>1</td>
<td class='details-col-elapsed'>1</td>
<td class='details-col-elapsed'>0分2秒</td>
<td class="details-col-elapsed">100.0%</td>
</tr>
......@@ -74,14 +74,7 @@
<tr width="600">
<td class="details-col-elapsed"><a href='../log/产品新增和审核通过/log.html' target='_blank'>产品新增和审核通过</a></td>
<td class="success">成功</td>
<td class="details-col-elapsed">2.548</td>
<td class="details-col-elapsed">xiaohesheng</td>
</tr>
<tr width="600">
<td class="details-col-elapsed"><a href='../log/产品规格新增和审核通过/log.html' target='_blank'>产品规格新增和审核通过</a></td>
<td class="success">成功</td>
<td class="details-col-elapsed">0.002</td>
<td class="details-col-elapsed">2.531</td>
<td class="details-col-elapsed">xiaohesheng</td>
</tr>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment