Commit be8fc2fd authored by pengxiong's avatar pengxiong

fix

parent 0a880f7e
...@@ -9,5 +9,5 @@ ...@@ -9,5 +9,5 @@
from app.api.app import app from app.api.app import app
if __name__ == '__main__': if __name__ == '__main__':
app.run('0.0.0.0', port=8000, debug=False) app.run('0.0.0.0', port=8000, debug=True)
...@@ -3,10 +3,12 @@ dev: ...@@ -3,10 +3,12 @@ dev:
tamp_product_db: tamp_product tamp_product_db: tamp_product
tamp_order_db: tamp_order tamp_order_db: tamp_order
tamp_user_db: tamp_user tamp_user_db: tamp_user
tamp_fund_db: tamp_fund
tamp_diagnose_app_db: tamp_diagnose_app
host: 47.101.189.151 host: 47.101.189.151
port: 31931 port: 31931
user: root user: dev
password: mysql password: qimeng123
redis: redis:
host: localhost host: localhost
port: 6379 port: 6379
......
...@@ -56,6 +56,12 @@ class TemplateManage(Resource): ...@@ -56,6 +56,12 @@ class TemplateManage(Resource):
args = self.parser.parse_args() args = self.parser.parse_args()
args['ifa_id'] = self.ifa_id args['ifa_id'] = self.ifa_id
add_template(args) add_template(args)
resp = {
"statusCode": "0000",
"message": "成功",
"attributes": []
}
return resp
def put(self): def put(self):
"""更新模版.""" """更新模版."""
...@@ -79,12 +85,18 @@ class TemplateManage(Resource): ...@@ -79,12 +85,18 @@ class TemplateManage(Resource):
self.parser.add_argument('id', type=str, required=True, help='模版id') self.parser.add_argument('id', type=str, required=True, help='模版id')
args = self.parser.parse_args() args = self.parser.parse_args()
args['ifa_id'] = self.ifa_id args['ifa_id'] = self.ifa_id
delete_template(args) res = delete_template(args)
resp = { resp = {
"statusCode": "0000", "statusCode": "0000",
"message": "成功", "message": "成功",
"attributes": [] "attributes": []
} }
if not res:
resp = {
"statusCode": "9002",
"message": "删除失败",
"attributes": []
}
return resp return resp
...@@ -102,7 +114,7 @@ class TemplateList(Resource): ...@@ -102,7 +114,7 @@ class TemplateList(Resource):
self.parser = reqparse.RequestParser() self.parser = reqparse.RequestParser()
def get(self): def get(self):
"""获取模版列表,分页.""" """获取模版列表分页数据."""
self.parser.add_argument('type', type=int, required=True, help='0为全部1为持仓报告2为诊断报告') self.parser.add_argument('type', type=int, required=True, help='0为全部1为持仓报告2为诊断报告')
self.parser.add_argument('pageNumber', type=int, required=False) self.parser.add_argument('pageNumber', type=int, required=False)
self.parser.add_argument('pageSize', type=int, required=False) self.parser.add_argument('pageSize', type=int, required=False)
......
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
# @Email : acepengxiong@163.com # @Email : acepengxiong@163.com
# @Software : PyCharm # @Software : PyCharm
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
import datetime
from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base() Base = declarative_base()
...@@ -17,6 +19,6 @@ class BaseModel(): ...@@ -17,6 +19,6 @@ class BaseModel():
pass pass
def to_dict(self): def to_dict(self):
return {c.name: getattr(self, c.name) for c in self.__table__.columns} return {c.name: int(getattr(self, c.name).timestamp()) if isinstance(getattr(self, c.name), datetime.datetime) else getattr(self, c.name) for c in self.__table__.columns}
...@@ -50,7 +50,7 @@ def add_template(args): ...@@ -50,7 +50,7 @@ def add_template(args):
args['default_template'] = json.dumps(hold_default_template) args['default_template'] = json.dumps(hold_default_template)
args['create_by'] = args.get('ifa_id') args['create_by'] = args.get('ifa_id')
args['create_time'] = datetime.datetime.now() args['create_time'] = datetime.datetime.now()
fund_report_manange = FundReportManange(args) fund_report_manange = FundReportManange(**args)
tamp_diagnose_session.add(fund_report_manange) tamp_diagnose_session.add(fund_report_manange)
def update_template(args): def update_template(args):
...@@ -98,13 +98,17 @@ def delete_template(args): ...@@ -98,13 +98,17 @@ def delete_template(args):
""".""" """."""
with TAMP_SQL(tamp_diagnose_app_engine) as tamp_diagnose_app: with TAMP_SQL(tamp_diagnose_app_engine) as tamp_diagnose_app:
tamp_diagnose_session = tamp_diagnose_app.session tamp_diagnose_session = tamp_diagnose_app.session
tamp_diagnose_session.query(FundReportManange).filter( res = tamp_diagnose_session.query(FundReportManange).filter(and_(
FundReportManange.id == args.get(id) FundReportManange.id == args.get('id'),
).update({ FundReportManange.ifa_id == args.get('ifa_id')
)).update({
'delete_tag': 1, 'delete_tag': 1,
'update_by': args.get('ifa_id'), 'update_by': args.get('ifa_id'),
'update_time': datetime.datetime.now() 'update_time': datetime.datetime.now()
}) })
if res > 0:
return True
return False
def get_template_list(args): def get_template_list(args):
......
#!/bin/bash #!/bin/bash
gunicorn -w 2 -k gevent -D -p tamp_order.pid -b 127.0.0.1:8000 app.api.app:api prod gunicorn -w 2 -k gevent -D -p fund_report.pid -b 127.0.0.1:8000 app.api.app:api prod
\ No newline at end of file \ No newline at end of file
Markdown is supported
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