项目介绍
租房数据分析系统是一个基于Hadoop的大数据平台,通过采用B/S架构,Django框架以及MySQL数据库技术,旨在为用户提供全面的租房信息和数据支持。该系统具备丰富的功能,包括管理员端的系统首页、个人中心、用户管理、房屋信息管理、租房数据管理和系统管理,以及前台端的首页、房屋信息、租房数据、房屋资讯和个人中心等模块。通过这些功能,用户可以方便地查找合适的房源,了解租金走势和热门区域等信息,同时管理员可以对用户和房屋信息进行有效管理,保证系统的正常运行和数据的安全性。该系统利用Hadoop技术处理和分析大量租房数据,为用户提供准确的市场分析和决策参考,帮助用户更好地了解租房市场的情况。无论是对于房东、租客还是房产中介来说,租房数据分析系统都是一个不可或缺的工具,为租房市场的健康发展提供了有力支持。
开发环境
编程语言:Python
数据库 :Mysql
系统架构:B/S
前端技术:Vue
编译工具:pycharm
支持定做:java/php/python/android/小程序vue/爬虫/c#/asp.net
系统截图
核心代码
# coding:utf-8
__author__ = "ila"
import logging, os, json, configparser
import time
from datetime import datetime
from flask import request, jsonify,session
from sqlalchemy.sql import func,and_,or_,case
from sqlalchemy import cast, Integer,Float
from api.models.brush_model import *
from . import main_bp
from utils.codes import *
from utils.jwt_auth import Auth
from configs import configs
from utils.helper import *
import random
import smtplib
from email.mime.text import MIMEText
from email.utils import formataddr
from email.header import Header
from utils.baidubce_api import BaiDuBce
from api.models.config_model import config
from flask import current_app as app
from utils.spark_func import spark_read_mysql
from utils.hdfs_func import upload_to_hdfs
from utils.mapreduce1 import MRMySQLAvg
# 注册接口
@main_bp.route("/python63we0i0p/fangwuxinxi/register", methods=['POST'])
def python63we0i0p_fangwuxinxi_register():
if request.method == 'POST':
msg = {
'code': normal_code, 'message': 'success', 'data': [{
}]}
req_dict = session.get("req_dict")
error = fangwuxinxi.createbyreq(fangwuxinxi, fangwuxinxi, req_dict)
if error!=None:
msg['code'] = crud_error_code
msg['msg'] = "注册用户已存在"
return jsonify(msg)
# 登录接口
@main_bp.route("/python63we0i0p/fangwuxinxi/login", methods=['GET','POST'])
def python63we0i0p_fangwuxinxi_login():
if request.method == 'GET' or request.method == 'POST':
msg = {
"code": normal_code, "msg": "success", "data": {
}}
req_dict = session.get("req_dict")
req_model = session.get("req_dict")
try:
del req_model['role']
except:
pass
datas = fangwuxinxi.getbyparams(fangwuxinxi, fangwuxinxi, req_model)
if not datas:
msg['code'] = password_error_code
msg['msg']='密码错误或用户不存在'
return jsonify(msg)
req_dict['id'] = datas[0].get('id')
try:
del req_dict['mima']
except:
pass
return Auth.authenticate(Auth, fangwuxinxi, req_dict)
# 登出接口
@main_bp.route("/python63we0i0p/fangwuxinxi/logout", methods=['POST'])
def python63we0i0p_fangwuxinxi_logout():
if request.method == 'POST':
msg = {
"msg": "退出成功",
"code": 0
}
req_dict = session.get("req_dict")
return jsonify(msg)
# 重置密码接口
@main_bp.route("/python63we0i0p/fangwuxinxi/resetPass", methods=['POST'])
def python63we0i0p_fangwuxinxi_resetpass():
'''
'''
if request.method == 'POST':
msg = {
"code": normal_code, "msg": "success"}
req_dict = session.get("req_dict")
if req_dict.get('mima') != None:
req_dict['mima'] = '123456'
error = fangwuxinxi.updatebyparams(fangwuxinxi, fangwuxinxi, req_dict)
if error != None:
msg['code'] = crud_error_code
msg['msg'] = error
else:
msg['msg'] = '密码已重置为:123456'
return jsonify(msg)
# 获取会话信息接口
@main_bp.route("/python63we0i0p/fangwuxinxi/session", methods=['GET'])
def python63we0i0p_fangwuxinxi_session():
'''
'''
if request.method == 'GET':
msg = {
"code": normal_code, "data": {
}}
req_dict={
"id":session.get('params').get("id")}
msg['data'] = fangwuxinxi.getbyparams(fangwuxinxi, fangwuxinxi, req_dict)[0]
return jsonify(msg)
# 分类接口(后端)
@main_bp.route("/python63we0i0p/fangwuxinxi/page", methods=['GET'])
def python63we0i0p_fangwuxinxi_page():
'''
'''
if request.method == 'GET':
msg = {
"code": normal_code, "msg": "success", "data":{
"currPage":1,"totalPage":1,"total":1,"pageSize":10,"list":[]}}
req_dict = session.get("req_dict")
userinfo = session.get("params")
try:
__hasMessage__=fangwuxinxi.__hasMessage__
except:
__hasMessage__=None
if __hasMessage__ and __hasMessage__!="否":
tablename=session.get("tablename")
if tablename!="users" and session.get("params")!=None and fangwuxinxi!='chat':
req_dict["userid"]=session.get("params").get("id")
tablename=session.get("tablename")
if tablename=="users" :
try:
pass
except:
pass
else:
mapping_str_to_object = {
}
for model in Base_model._decl_class_registry.values():
if hasattr(model, '__tablename__'):
mapping_str_to_object[model.__tablename__] = model
try:
__isAdmin__=mapping_str_to_object[tablename]