Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mancheng
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
mancheng
Commits
e53b1534
Commit
e53b1534
authored
Mar 01, 2023
by
dong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix20230228
parent
19e37671
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
81 additions
and
93 deletions
+81
-93
apps/view_choose/choose_view.py
+6
-7
apps/view_choose/fill_data.py
+0
-0
apps/view_xiaocx/view.py
+75
-86
No files found.
apps/view_choose/choose_view.py
View file @
e53b1534
...
@@ -114,12 +114,12 @@ def global_land(key_words, district_name, land_name, land_nature, industry_name,
...
@@ -114,12 +114,12 @@ def global_land(key_words, district_name, land_name, land_nature, industry_name,
))
))
else
:
else
:
carrier_obj
=
CarrierLand
.
query
.
filter
(
carrier_obj
=
CarrierLand
.
query
.
filter
(
and_
(
CarrierLand
.
land_name
.
like
(
'
%
{}
%
'
.
format
(
land_name
))
if
land_name
else
text
(
''
),
CarrierLand
.
land_name
.
like
(
'
%
{}
%
'
.
format
(
land_name
))
if
land_name
else
text
(
''
),
CarrierLand
.
district_name
==
district_name
if
district_name
!=
'晋城市'
else
text
(
''
),
CarrierLand
.
district_name
==
district_name
if
district_name
!=
'晋城市'
else
text
(
''
),
CarrierLand
.
land_nature
==
land_nature
if
land_nature
else
text
(
''
),
CarrierLand
.
land_nature
==
land_nature
if
land_nature
else
text
(
''
),
# CarrierLand.industry_name.like('%{}%'.format(industry_name)) if industry_name else text(''),
# CarrierLand.industry_name.like('%{}%'.format(industry_name)) if industry_name else text(''),
CarrierLand
.
audit_status
==
1
CarrierLand
.
audit_status
==
1
)
)
)
land_obj_list
=
carrier_obj
.
order_by
(
CarrierLand
.
upload_time
.
desc
())
.
paginate
(
page
,
per_page
)
.
items
land_obj_list
=
carrier_obj
.
order_by
(
CarrierLand
.
upload_time
.
desc
())
.
paginate
(
page
,
per_page
)
.
items
carrier_size
=
len
(
land_obj_list
)
carrier_size
=
len
(
land_obj_list
)
...
@@ -167,11 +167,11 @@ def global_factory(key_words, district_name, factory_name, industry_name, page,
...
@@ -167,11 +167,11 @@ def global_factory(key_words, district_name, factory_name, industry_name, page,
else
:
else
:
carrier_obj
=
CarrierFactory
.
query
.
filter
(
carrier_obj
=
CarrierFactory
.
query
.
filter
(
and_
(
CarrierFactory
.
factory_name
.
like
(
'
%
{}
%
'
.
format
(
factory_name
))
if
factory_name
else
text
(
''
),
CarrierFactory
.
factory_name
.
like
(
'
%
{}
%
'
.
format
(
factory_name
))
if
factory_name
else
text
(
''
),
CarrierFactory
.
district_name
==
district_name
if
district_name
!=
'晋城市'
else
text
(
''
),
CarrierFactory
.
district_name
==
district_name
if
district_name
!=
'晋城市'
else
text
(
''
),
CarrierFactory
.
attract_status
.
like
(
'
%
{}
%
'
.
format
(
industry_name
))
if
industry_name
else
text
(
''
),
CarrierFactory
.
attract_status
.
like
(
'
%
{}
%
'
.
format
(
industry_name
))
if
industry_name
else
text
(
''
),
CarrierFactory
.
audit_status
==
1
CarrierFactory
.
audit_status
==
1
)
)
)
carrier_size
=
carrier_obj
.
count
()
carrier_size
=
carrier_obj
.
count
()
factory_obj_list
=
carrier_obj
.
order_by
(
CarrierFactory
.
upload_time
.
desc
())
.
paginate
(
page
,
per_page
)
.
items
factory_obj_list
=
carrier_obj
.
order_by
(
CarrierFactory
.
upload_time
.
desc
())
.
paginate
(
page
,
per_page
)
.
items
if
factory_obj_list
:
if
factory_obj_list
:
...
@@ -218,12 +218,12 @@ def global_build(key_words, district_name, build_name, industry_name, build_type
...
@@ -218,12 +218,12 @@ def global_build(key_words, district_name, build_name, industry_name, build_type
))
))
else
:
else
:
carrier_obj
=
CarrierBuild
.
query
.
filter
(
carrier_obj
=
CarrierBuild
.
query
.
filter
(
and_
(
CarrierBuild
.
build_name
.
like
(
'
%
{}
%
'
.
format
(
build_name
))
if
build_name
else
text
(
''
),
CarrierBuild
.
build_name
.
like
(
'
%
{}
%
'
.
format
(
build_name
))
if
build_name
else
text
(
''
),
CarrierBuild
.
district_name
==
district_name
if
district_name
!=
'晋城市'
else
text
(
''
),
CarrierBuild
.
district_name
==
district_name
if
district_name
!=
'晋城市'
else
text
(
''
),
CarrierBuild
.
build_type
.
like
(
'
%
{}
%
'
.
format
(
build_type
))
if
build_type
else
text
(
''
),
CarrierBuild
.
build_type
.
like
(
'
%
{}
%
'
.
format
(
build_type
))
if
build_type
else
text
(
''
),
CarrierBuild
.
attract_status
.
like
(
'
%
{}
%
'
.
format
(
industry_name
))
if
industry_name
else
text
(
''
),
CarrierBuild
.
attract_status
.
like
(
'
%
{}
%
'
.
format
(
industry_name
))
if
industry_name
else
text
(
''
),
CarrierBuild
.
audit_status
==
1
CarrierBuild
.
audit_status
==
1
)
)
)
build_obj_list
=
carrier_obj
.
order_by
(
CarrierBuild
.
upload_time
.
desc
())
.
paginate
(
page
,
per_page
)
.
items
build_obj_list
=
carrier_obj
.
order_by
(
CarrierBuild
.
upload_time
.
desc
())
.
paginate
(
page
,
per_page
)
.
items
carrier_size
=
len
(
build_obj_list
)
carrier_size
=
len
(
build_obj_list
)
...
@@ -362,7 +362,6 @@ def search_all():
...
@@ -362,7 +362,6 @@ def search_all():
return
jsonify
(
code
=
RET
.
PARAMERR
,
msg
=
"选择选址偏好时,必须选择所属行业!"
)
return
jsonify
(
code
=
RET
.
PARAMERR
,
msg
=
"选择选址偏好时,必须选择所属行业!"
)
industry_id
=
''
industry_id
=
''
if
industry_name
:
if
industry_name
:
# industry_id = IndustryChain.query.filter_by(industry_name=industry_name).first()
industry_id
=
IndustryChain
.
query
.
filter
(
IndustryChain
.
industry_name
.
like
(
"
%
{}
%
"
.
format
(
industry_name
)))
.
first
()
industry_id
=
IndustryChain
.
query
.
filter
(
IndustryChain
.
industry_name
.
like
(
"
%
{}
%
"
.
format
(
industry_name
)))
.
first
()
if
not
district_name
:
if
not
district_name
:
district_name
=
get_district_name
(
token
)
district_name
=
get_district_name
(
token
)
...
...
apps/view_choose/fill_data.py
View file @
e53b1534
This diff is collapsed.
Click to expand it.
apps/view_xiaocx/view.py
View file @
e53b1534
...
@@ -15,12 +15,66 @@ from apps.utils.neo4j_conn import conn_neo4j
...
@@ -15,12 +15,66 @@ from apps.utils.neo4j_conn import conn_neo4j
from
apps.view_xiaocx
import
api_xiaocx
from
apps.view_xiaocx
import
api_xiaocx
# 首页搜索
from
apps.utils.vxconfig
import
WxConfig
from
apps.utils.vxconfig
import
WxConfig
from
apps.inves_manage.siku_view
import
get_num
,
write_dynamic
from
apps.inves_manage.siku_view
import
get_num
,
write_dynamic
from
apps.view_choose.choose_view
import
global_region
,
global_land
,
global_factory
,
global_build
# 全部搜索功能
@api_xiaocx.route
(
"/SearchAll"
,
methods
=
[
"POST"
])
# @login_required
def
search_all
():
req_dict
=
request
.
get_json
()
key_words
=
req_dict
[
'key_words'
]
# 关键字
industry_name
=
req_dict
[
'industry_name'
]
# 所属行业
district_name
=
req_dict
[
'district_name'
]
# 所属区县
carrier_type_id
=
req_dict
[
'carrier_type_id'
]
# 载体类型id(1:园区;2:土地;3:楼宇;4:厂房。)
preference
=
req_dict
.
get
(
"preference"
)
# 选址偏好 [f,f,t,f,f,f]
page
=
req_dict
.
get
(
"page"
)
# 页码
per_page
=
int
(
req_dict
.
get
(
"per_page"
))
# 每页大小
token
=
request
.
headers
[
'token'
]
if
any
([
preference
[
0
],
preference
[
1
],
preference
[
2
],
preference
[
3
],
preference
[
4
]]):
if
not
industry_name
:
return
jsonify
(
code
=
RET
.
PARAMERR
,
msg
=
"选择选址偏好时,必须选择所属行业!"
)
industry_id
=
''
if
industry_name
:
industry_id
=
IndustryChain
.
query
.
filter
(
IndustryChain
.
industry_name
.
like
(
"
%
{}
%
"
.
format
(
industry_name
)))
.
first
()
# if not district_name:
# district_name = get_district_name(token)
data_list
=
[]
if
carrier_type_id
==
0
:
# 行政区
if
not
industry_name
:
region_data
=
global_region
(
industry_id
,
preference
,
key_words
,
district_name
,
page
,
per_page
)
data_list
.
append
(
region_data
)
# 土地
land_data
=
global_land
(
key_words
,
district_name
,
''
,
''
,
industry_name
,
page
,
per_page
)
data_list
.
append
(
land_data
)
# 厂房
factory_data
=
global_factory
(
key_words
,
district_name
,
''
,
industry_name
,
page
,
per_page
)
data_list
.
append
(
factory_data
)
# 楼宇
build_data
=
global_build
(
key_words
,
district_name
,
''
,
industry_name
,
''
,
page
,
per_page
)
data_list
.
append
(
build_data
)
return
jsonify
(
code
=
RET
.
OK
,
data
=
data_list
,
msg
=
'全部数据查询成功!'
)
if
carrier_type_id
==
1
:
# 土地
data
=
global_land
(
key_words
,
district_name
,
''
,
''
,
industry_name
,
page
,
per_page
)
return
jsonify
(
data
)
if
carrier_type_id
==
2
:
# 厂房
data
=
global_factory
(
key_words
,
district_name
,
''
,
industry_name
,
page
,
per_page
)
return
jsonify
(
data
)
if
carrier_type_id
==
3
:
# 楼宇
data
=
global_build
(
key_words
,
district_name
,
''
,
industry_name
,
''
,
page
,
per_page
)
return
jsonify
(
data
)
else
:
data
=
{
"code"
:
RET
.
PARAMERR
,
"msg"
:
'参数错误!'
}
return
jsonify
(
data
)
# 首页搜索
@api_xiaocx.route
(
'/IndexSearch'
,
methods
=
[
'POST'
])
@api_xiaocx.route
(
'/IndexSearch'
,
methods
=
[
'POST'
])
# @login_required
# @login_required
def
index_search
():
def
index_search
():
...
@@ -744,14 +798,16 @@ def wechat_login():
...
@@ -744,14 +798,16 @@ def wechat_login():
# 参数获取与校验
# 参数获取与校验
req_dict
=
request
.
get_json
()
req_dict
=
request
.
get_json
()
code
=
req_dict
.
get
(
'code'
)
# 微信登录code
code
=
req_dict
.
get
(
'code'
)
# 微信登录code
token
=
request
.
headers
.
environ
[
'HTTP_TOKEN'
]
access_token
=
request
.
headers
[
'access_token'
]
# 微信登录code
print
(
code
)
# 校验参数完整性
# 校验参数完整性
if
not
all
([
code
]):
if
not
all
([
code
]):
return
jsonify
(
code
=
RET
.
PARAMERR
,
msg
=
"参数不完整"
)
return
jsonify
(
code
=
RET
.
PARAMERR
,
msg
=
"参数不完整"
)
app_id
=
'wx67c0a99d684274f8'
#
app_id = 'wx67c0a99d684274f8'
app_secret
=
'd89755bb5d2d3f85e97d0f08c30dbebc'
#
app_secret = 'd89755bb5d2d3f85e97d0f08c30dbebc'
# 获取token
# url = 'https://api.weixin.qq.com/cgi-bin/token'
# url = 'https://api.weixin.qq.com/cgi-bin/token'
# params = {
# params = {
# 'appid': app_id,
# 'appid': app_id,
...
@@ -759,19 +815,20 @@ def wechat_login():
...
@@ -759,19 +815,20 @@ def wechat_login():
# 'grant_type': 'client_credential'
# 'grant_type': 'client_credential'
# }
# }
# res = requests.get(url, params=params).json()
# res = requests.get(url, params=params).json()
#
# print(res['access_token'])
# # try:
# 获取电话号码
# params1 = {
url1
=
'https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=ACCESS_TOKEN'
# # 'access_token': res['access_token'],
params1
=
{
# 'access_token': token,
"code"
:
code
# 'code': code,
}
# }
# # except:
headers
=
{
# # return None
# "access_token": res['access_token']
#
"access_token"
:
access_token
# url1 = 'https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=ACCESS_TOKEN'
}
# res1 = requests.post(url1, data=params1)
# print(res1)
res1
=
requests
.
post
(
url1
,
data
=
params1
,
headers
=
headers
)
print
(
res1
)
try
:
try
:
...
@@ -791,70 +848,3 @@ def wechat_login():
...
@@ -791,70 +848,3 @@ def wechat_login():
# return jsonify(code=RET.USERERR, msg="登录成功", user_info=uinfo)
# return jsonify(code=RET.USERERR, msg="登录成功", user_info=uinfo)
return
jsonify
(
code
=
RET
.
USERERR
,
msg
=
"授权成功"
)
return
jsonify
(
code
=
RET
.
USERERR
,
msg
=
"授权成功"
)
# vx登陆后绑定手机号
# @api_xiaocx.route("/BindMobile", methods=["POST"])
# def bind_mobile():
# '''
# 绑定已有账号
# :return:
# '''
# req_dict = request.get_json()
# openid = req_dict.get("openid") # vxopenid
# unionid = req_dict.get("unionid") # vxunionid
# mobile = req_dict.get('mobile') # 手机号
# sms_code = req_dict.get("sms_code") # 验证码
#
# # 校验参数完整性
# if not all([openid, unionid, mobile, sms_code]):
# return jsonify(code=RET.PARAMERR, msg="参数不完整")
#
# # 校验手机号格式
# if not re.match(r"1[23456789]\d{9}$", mobile):
# return jsonify(code=RET.PARAMERR, msg="手机号格式错误")
#
# # 获取短信验证码
# try:
# real_sms_code = redis_store.get('sms_code_{}'.format(mobile)).decode()
# except Exception as e:
# current_app.logger.error(e)
# return jsonify(code=RET.DBERR, msg="redis数据库异常")
#
# # 获取用户
# try:
# user = User.query.filter_by(mobile=mobile).first()
# except Exception as e:
# current_app.logger.error(e)
# return jsonify(code=RET.DBERR, msg="获取用户信息失败")
#
# # 判断用户填写短信验证码是否一致
# if real_sms_code != sms_code:
# return jsonify(code=RET.DATAERR, msg="短信验证码错误")
# # 删除redis中的短信验证码,防止重复校验
# try:
# redis_store.delete("sms_code_{}".format(mobile))
# except Exception as e:
# current_app.logger.error(e)
#
# try:
# if user:
# user.vxopenid = openid
# user.vxunionid = unionid
# db.session.commit()
# if user.status != 1:
# jsonify(code=RET.OK, msg="绑定成功,当前用户被禁止登录,请联系管理员")
# else:
# user = User(name=mobile, mobile=mobile, vxopenid=openid, vxunionid=unionid, flag=1, status=1)
# # user.password = password
# db.session.add(user)
# db.session.commit()
# except Exception as e:
# # 表示操作失败,回滚数据库操作
# db.session.rollback()
# current_app.logger.error(e)
# return jsonify(code=RET.DBERR, msg="数据库异常")
#
# # 若成功保存登录状态
# token = create_token(user.id)
# return jsonify(code=RET.OK, msg="绑定成功,登录成功", data={"token": token, "flag": user.flag})
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment