Commit 2e1dd0f1 by 黄静

hj

parent 4c01bb31
......@@ -28,6 +28,7 @@ from service.label_type_1 import label_type1
from service.select_es_result import hx_company_dict,hx_company_list
from service.hxResult import businessApi
from service.assigned_opportunity import assigned_opportunity
from service.potential import app_website
server = Flask(__name__,static_url_path="",static_folder="")
server.config['JSON_AS_ASCII'] = False
......@@ -59,6 +60,7 @@ hx_company_dict(server)
hx_company_list(server)
businessApi(server)
assigned_opportunity(server)
app_website(server)
#基本信息
@server.route('/base_info', methods=['POST'])
......
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2020/4/28 0028 下午 5:33
# @Author : hj
# @Software: PyCharm
from jinja2 import Environment, FileSystemLoader
from flask_cors import *
import sys,os,flask,pymysql
from DBUtils.PooledDB import PooledDB
from flask import render_template,url_for
interface_path = os.path.dirname(__file__)
sys.path.insert(0, interface_path) # 将当前文件的父目录加入临时系统变量
server = flask.Flask(__name__)
server.config['JSON_AS_ASCII'] = False
CORS(server,supports_credentials=True) #跨域请求
MYSQL_HOST = '123.57.19.89' # 外网地址
PORT = 3306 # 外网端口
USER = 'jeecms'
PASSWORD = '123456.a'
DB = 'wandoujia'
pool_app = PooledDB(pymysql,8, host=MYSQL_HOST, user=USER, passwd=PASSWORD, db=DB, port=PORT)
MYSQL_HOST = '43.247.184.94' # 外网地址
PORT = 7800 # 外网端口
USER = 'nice'
PASSWORD = 'Niceee@2020'
DB = 'AnnualReport'
pool_website = PooledDB(pymysql,8, host=MYSQL_HOST, user=USER, passwd=PASSWORD, db=DB, port=PORT)
# 获取公司logo信息
def appInfo(company_name):
conn = pool_app.connection()
cursor = conn.cursor()
app_info = []
sql = "select * from app_infoss where com_name = '%s'" % company_name
print(sql, "select_app======")
cursor.execute(sql)
gsb_app_info = cursor.fetchall()
for row in gsb_app_info:
app = {}
app_name = row[1]
app_url = row[4]
app_logo = row[5]
app['app_name'] = app_name
if 'http' not in app_url:
app['app_url'] = 'https://' + app_url
else:
app['app_url'] = app_url
app['app_logo'] = app_logo
app_info.append(app)
return app_info
# 获取公司网站信息
def websiteInfo(company_name):
conn = pool_website.connection()
cursor = conn.cursor()
website_info = []
sql = "select DISTINCT(`name`),website from report_webinfo_all_order where gsb_company_name = '%s'" % company_name
print(sql, "select_web======")
cursor.execute(sql)
gsb_website_info = cursor.fetchall()
for row in gsb_website_info:
website = {}
website_url = row[1]
website_name = row[0]
website['website_name'] = website_name
if 'http' not in website_url:
website['website_url'] = 'https://' + website_url
# elif 'http' in website_url and 'https' not in website_url:
# website['website_url'] =
else:
website['website_url'] = website_url
website_info.append(website)
return website_info
def app_website(server):
@server.route('/app-website/<companyName>')
def generate_html(companyName):
app_info = appInfo(companyName)
website_info = websiteInfo(companyName)
return render_template('potential_business.html',**locals())
#
# if __name__ == "__main__":
# server.run(debug=True)
<!DOCTYPE html>
<html lang="utf-8">
<head>
<meta charset="UTF-8">
<title>潜在商机</title>
</head>
<body>
<div id="main">
<!-- <div id="reason">该公司的网站及app详情如下:</div>-->
<div class="app">
<div class="reason">App如下:</div>
<div class="info" >
{% for app_item in app_info %}
<div class="png">
<img style="padding-top: 2%"
src={{app_item.app_logo}}>
<div class="App">
{{app_item.app_name}}
</div>
<div class="app_url">
<input style="margin-top: 1%;margin-bottom: 2%;cursor: pointer" type="button" value="查看" onclick="location.href = '{{app_item.app_url}}'">
</div>
</div>
{% endfor %}
</div>
<div class="reason">网站如下:</div>
<div class="info" >
{% for website in website_info %}
<a class="website" href="{{website.website_url}}">
{{website.website_name}}
</a>
{% endfor %}
</div>
</div>
</div>
</body>
<style>
.App{
font-size: 12px;
}
.website {
font-size: 12px;
margin: 1% 1%;
color: #0a1306;
text-decoration:none
}
a:hover {
color: #0000FF;
}
#main {
height: 100%;
width: 100%;
background-color: #f5f5f5ce;
}
.png {
margin-top: 0.3%;
width: 45%;
background-color: white;
border-bottom: 1px solid #d4d4d4;
margin-bottom: 0.5%;
}
.png:hover {
/* 阴影 */
box-shadow: 2px 2px 10px #909090;
}
.info {
height: 100%;
width: 90%;
margin: 0 auto;
display: flex;
flex-direction: row;
flex-wrap:wrap;
justify-content: space-around;
text-align: center;
}
.reason {
display: block;
margin-block-start: 1em;
margin-block-end: 1em;
margin-inline-start: 0px;
margin-inline-end: 0px;
font-weight: 600;
padding-left: 20px;
font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif;
font-size: 12px;
}
</style>
</html>
\ 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