@ -0,0 +1,7 @@
|
||||
<component name="ProjectDictionaryState">
|
||||
<dictionary name="风华">
|
||||
<words>
|
||||
<w>wzjz</w>
|
||||
</words>
|
||||
</dictionary>
|
||||
</component>
|
@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="jdk" jdkName="Python 3.6 (untitled1) (2)" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
<component name="TemplatesService">
|
||||
<option name="TEMPLATE_FOLDERS">
|
||||
<list>
|
||||
<option value="$MODULE_DIR$/templates" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
</module>
|
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="JavaScriptSettings">
|
||||
<option name="languageLevel" value="ES6" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.6 (untitled1) (2)" project-jdk-type="Python SDK" />
|
||||
</project>
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/jz.iml" filepath="$PROJECT_DIR$/.idea/jz.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,203 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="d6a74cf0-67c5-432a-992e-517f510b56ef" name="默认更改列表" comment="" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="DatabaseView">
|
||||
<option name="SHOW_INTERMEDIATE" value="true" />
|
||||
<option name="GROUP_DATA_SOURCES" value="true" />
|
||||
<option name="GROUP_SCHEMA" value="true" />
|
||||
<option name="GROUP_CONTENTS" value="false" />
|
||||
<option name="SORT_POSITIONED" value="false" />
|
||||
<option name="SHOW_EMPTY_GROUPS" value="false" />
|
||||
<option name="AUTO_SCROLL_FROM_SOURCE" value="false" />
|
||||
<option name="HIDDEN_KINDS">
|
||||
<set />
|
||||
</option>
|
||||
<expand />
|
||||
<select />
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="HTML4 File" />
|
||||
<option value="Python Script" />
|
||||
<option value="HTML File" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectId" id="1amshvw4woMhFZpFep3cbTd11t2" />
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showExcludedFiles" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="DefaultHtmlFileTemplate" value="HTML File" />
|
||||
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
|
||||
<property name="WebServerToolWindowFactoryState" value="false" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$/../../../数据库系统概论/PythonWeb数据库应用讲座资料/PythonFlaskDemo/app.py" />
|
||||
<property name="node.js.detected.package.eslint" value="true" />
|
||||
<property name="node.js.detected.package.tslint" value="true" />
|
||||
<property name="node.js.path.for.package.eslint" value="project" />
|
||||
<property name="node.js.path.for.package.tslint" value="project" />
|
||||
<property name="node.js.selected.package.eslint" value="(autodetect)" />
|
||||
<property name="node.js.selected.package.tslint" value="(autodetect)" />
|
||||
<property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PythonContentEntriesConfigurable" />
|
||||
</component>
|
||||
<component name="RunManager" selected="Python.jz">
|
||||
<configuration name="wzjz.html" type="JavascriptDebugType" temporary="true" nameIsGenerated="true" uri="http://localhost:63342/jz/wzjz.html" useBuiltInWebServerPort="true">
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<configuration name="app" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
|
||||
<module name="jz" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
<envs>
|
||||
<env name="PYTHONUNBUFFERED" value="1" />
|
||||
</envs>
|
||||
<option name="SDK_HOME" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/../../../数据库系统概论/PythonWeb数据库应用讲座资料/PythonFlaskDemo" />
|
||||
<option name="IS_MODULE_SDK" value="false" />
|
||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/../../../数据库系统概论/PythonWeb数据库应用讲座资料/PythonFlaskDemo/app.py" />
|
||||
<option name="PARAMETERS" value="" />
|
||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||
<option name="EMULATE_TERMINAL" value="false" />
|
||||
<option name="MODULE_MODE" value="false" />
|
||||
<option name="REDIRECT_INPUT" value="false" />
|
||||
<option name="INPUT_FILE" value="" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<configuration name="jz" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
|
||||
<module name="jz" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
<envs>
|
||||
<env name="PYTHONUNBUFFERED" value="1" />
|
||||
</envs>
|
||||
<option name="SDK_HOME" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
<option name="IS_MODULE_SDK" value="true" />
|
||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/jz.py" />
|
||||
<option name="PARAMETERS" value="" />
|
||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||
<option name="EMULATE_TERMINAL" value="false" />
|
||||
<option name="MODULE_MODE" value="false" />
|
||||
<option name="REDIRECT_INPUT" value="false" />
|
||||
<option name="INPUT_FILE" value="" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<configuration name="yingyong" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
|
||||
<module name="jz" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
<envs>
|
||||
<env name="PYTHONUNBUFFERED" value="1" />
|
||||
</envs>
|
||||
<option name="SDK_HOME" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
<option name="IS_MODULE_SDK" value="true" />
|
||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/yingyong.py" />
|
||||
<option name="PARAMETERS" value="" />
|
||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||
<option name="EMULATE_TERMINAL" value="false" />
|
||||
<option name="MODULE_MODE" value="false" />
|
||||
<option name="REDIRECT_INPUT" value="false" />
|
||||
<option name="INPUT_FILE" value="" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<recent_temporary>
|
||||
<list>
|
||||
<item itemvalue="Python.jz" />
|
||||
<item itemvalue="Python.app" />
|
||||
<item itemvalue="Python.yingyong" />
|
||||
<item itemvalue="JavaScript Debug.wzjz.html" />
|
||||
</list>
|
||||
</recent_temporary>
|
||||
</component>
|
||||
<component name="SvnConfiguration">
|
||||
<configuration />
|
||||
</component>
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="d6a74cf0-67c5-432a-992e-517f510b56ef" name="默认更改列表" comment="" />
|
||||
<created>1587352225125</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1587352225125</updated>
|
||||
<workItem from="1587352251153" duration="3742000" />
|
||||
<workItem from="1587367946103" duration="32600000" />
|
||||
<workItem from="1587478533169" duration="5159000" />
|
||||
<workItem from="1587507013467" duration="105835000" />
|
||||
<workItem from="1588773509414" duration="2134000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="version" value="1" />
|
||||
</component>
|
||||
<component name="WindowStateProjectService">
|
||||
<state x="386" y="82" key="#Inspections" timestamp="1587368625040">
|
||||
<screen x="0" y="0" width="1536" height="824" />
|
||||
</state>
|
||||
<state x="386" y="82" key="#Inspections/0.0.1536.824@0.0.1536.824" timestamp="1587368625040" />
|
||||
<state x="361" y="71" key="#com.intellij.execution.impl.EditConfigurationsDialog" timestamp="1588175645233">
|
||||
<screen x="0" y="0" width="1536" height="824" />
|
||||
</state>
|
||||
<state x="361" y="71" key="#com.intellij.execution.impl.EditConfigurationsDialog/0.0.1536.824@0.0.1536.824" timestamp="1588175645233" />
|
||||
<state x="573" y="165" key="FileChooserDialogImpl" timestamp="1588176301100">
|
||||
<screen x="0" y="0" width="1536" height="824" />
|
||||
</state>
|
||||
<state x="573" y="165" key="FileChooserDialogImpl/0.0.1536.824@0.0.1536.824" timestamp="1588176301100" />
|
||||
<state width="1493" height="210" key="GridCell.Tab.0.bottom" timestamp="1588773992565">
|
||||
<screen x="0" y="0" width="1536" height="824" />
|
||||
</state>
|
||||
<state width="1493" height="210" key="GridCell.Tab.0.bottom/0.0.1536.824@0.0.1536.824" timestamp="1588773992565" />
|
||||
<state width="1493" height="210" key="GridCell.Tab.0.center" timestamp="1588773992565">
|
||||
<screen x="0" y="0" width="1536" height="824" />
|
||||
</state>
|
||||
<state width="1493" height="210" key="GridCell.Tab.0.center/0.0.1536.824@0.0.1536.824" timestamp="1588773992565" />
|
||||
<state width="1493" height="210" key="GridCell.Tab.0.left" timestamp="1588773992565">
|
||||
<screen x="0" y="0" width="1536" height="824" />
|
||||
</state>
|
||||
<state width="1493" height="210" key="GridCell.Tab.0.left/0.0.1536.824@0.0.1536.824" timestamp="1588773992565" />
|
||||
<state width="1493" height="210" key="GridCell.Tab.0.right" timestamp="1588773992565">
|
||||
<screen x="0" y="0" width="1536" height="824" />
|
||||
</state>
|
||||
<state width="1493" height="210" key="GridCell.Tab.0.right/0.0.1536.824@0.0.1536.824" timestamp="1588773992565" />
|
||||
<state x="270" y="54" key="SettingsEditor" timestamp="1587425421505">
|
||||
<screen x="0" y="0" width="1536" height="824" />
|
||||
</state>
|
||||
<state x="270" y="54" key="SettingsEditor/0.0.1536.824@0.0.1536.824" timestamp="1587425421505" />
|
||||
<state x="801" y="240" key="com.intellij.ide.util.TipDialog" timestamp="1588773510866">
|
||||
<screen x="0" y="0" width="1536" height="824" />
|
||||
</state>
|
||||
<state x="801" y="240" key="com.intellij.ide.util.TipDialog/0.0.1536.824@0.0.1536.824" timestamp="1588773510866" />
|
||||
<state x="162" y="176" width="1157" height="572" maximized="true" key="dock-window-1" timestamp="1587652446308">
|
||||
<screen x="0" y="0" width="1536" height="824" />
|
||||
</state>
|
||||
<state x="162" y="176" width="1157" height="572" maximized="true" key="dock-window-1/0.0.1536.824@0.0.1536.824" timestamp="1587652446308" />
|
||||
<state x="431" y="145" width="672" height="678" key="search.everywhere.popup" timestamp="1587711664940">
|
||||
<screen x="0" y="0" width="1536" height="824" />
|
||||
</state>
|
||||
<state x="431" y="145" width="672" height="678" key="search.everywhere.popup/0.0.1536.824@0.0.1536.824" timestamp="1587711664940" />
|
||||
</component>
|
||||
<component name="com.intellij.coverage.CoverageDataManagerImpl">
|
||||
<SUITE FILE_PATH="coverage/jz$app.coverage" NAME="app Coverage Results" MODIFIED="1588773987697" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/../../../数据库系统概论/PythonWeb数据库应用讲座资料/PythonFlaskDemo" />
|
||||
<SUITE FILE_PATH="coverage/jz$jz.coverage" NAME="jz Coverage Results" MODIFIED="1588773992545" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
||||
<SUITE FILE_PATH="coverage/jz$yingyong.coverage" NAME="yingyong Coverage Results" MODIFIED="1587470350609" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,17 @@
|
||||
INSERT INTO `budget` (`Pro_id`, `ma_id`, `number`) VALUES ('514113007583765545A20001', 1, 2000);
|
||||
INSERT INTO `budget` (`Pro_id`, `ma_id`, `number`) VALUES ('514113007583765545A20001', 2, 5000);
|
||||
INSERT INTO `budget` (`Pro_id`, `ma_id`, `number`) VALUES ('514113007583765545A20001', 6, 50000);
|
||||
INSERT INTO `budget` (`Pro_id`, `ma_id`, `number`) VALUES ('514113007583765545A20001', 13, 2000);
|
||||
INSERT INTO `budget` (`Pro_id`, `ma_id`, `number`) VALUES ('514113007583765545A20001', 14, 1500);
|
||||
INSERT INTO `budget` (`Pro_id`, `ma_id`, `number`) VALUES ('514113007583765545A20001', 15, 200);
|
||||
INSERT INTO `budget` (`Pro_id`, `ma_id`, `number`) VALUES ('514113007583765545A20001', 16, 5000);
|
||||
INSERT INTO `budget` (`Pro_id`, `ma_id`, `number`) VALUES ('531100005620503332A20010', 1, NULL);
|
||||
INSERT INTO `budget` (`Pro_id`, `ma_id`, `number`) VALUES ('531100005620503332A20010', 2, NULL);
|
||||
INSERT INTO `budget` (`Pro_id`, `ma_id`, `number`) VALUES ('531100005620503332A20010', 3, NULL);
|
||||
INSERT INTO `budget` (`Pro_id`, `ma_id`, `number`) VALUES ('531100005620503332A20010', 4, NULL);
|
||||
INSERT INTO `budget` (`Pro_id`, `ma_id`, `number`) VALUES ('531100005620503332A20010', 5, NULL);
|
||||
INSERT INTO `budget` (`Pro_id`, `ma_id`, `number`) VALUES ('531100005620503332A20010', 6, NULL);
|
||||
INSERT INTO `budget` (`Pro_id`, `ma_id`, `number`) VALUES ('531100005620503332A20010', 7, NULL);
|
||||
INSERT INTO `budget` (`Pro_id`, `ma_id`, `number`) VALUES ('531100005620503332A20010', 8, NULL);
|
||||
INSERT INTO `budget` (`Pro_id`, `ma_id`, `number`) VALUES ('531100005620503332A20010', 9, NULL);
|
||||
INSERT INTO `budget` (`Pro_id`, `ma_id`, `number`) VALUES ('531100005620503332A20010', 10, NULL);
|
@ -0,0 +1,2 @@
|
||||
INSERT INTO `charity` (`id`, `name`, `mobile`, `e_mail`, `password`) VALUES ('514113007583765545', '南阳市慈善总会', '037763121116', 'nyscszh@163.com', 'nycszh');
|
||||
INSERT INTO `charity` (`id`, `name`, `mobile`, `e_mail`, `password`) VALUES ('531100005620503332', '北京春苗慈善基金会', '01084137619', 'chunmiaojjh@163.com', 'szhszh');
|
@ -0,0 +1 @@
|
||||
INSERT INTO `jk` (`Pro_id`, `User_id`, `money`) VALUES ('531100005620503332A20010', '565793455', 1000);
|
@ -0,0 +1,224 @@
|
||||
from flask import Flask, render_template, request, redirect
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
|
||||
app = Flask(__name__)
|
||||
db = SQLAlchemy(app)
|
||||
# 设置数据库连接
|
||||
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql://root:20000521@127.0.0.1:3306/donation'
|
||||
|
||||
|
||||
# 定义模型
|
||||
class Platform(db.Model):
|
||||
platform_id = db.Column(db.String(14), primary_key=True)
|
||||
name = db.Column(db.String(255), unique=True)
|
||||
mobile = db.Column(db.String(15), nullable=True)
|
||||
e_mail = db.Column(db.String(25), unique=True)
|
||||
address = db.Column(db.String(255), nullable=False)
|
||||
|
||||
|
||||
class unit(db.Model):
|
||||
unit_id = db.Column(db.String(50), primary_key=True)
|
||||
unit_name = db.Column(db.String(255), unique=True)
|
||||
|
||||
|
||||
class Material(db.Model):
|
||||
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
||||
name = db.Column(db.String(255), unique=True)
|
||||
Price = db.Column(db.Float, nullable=False)
|
||||
|
||||
|
||||
class Charity(db.Model):
|
||||
id = db.Column(db.String(19), primary_key=True)
|
||||
name = db.Column(db.String(255), unique=True)
|
||||
mobile = db.Column(db.String(15), nullable=False)
|
||||
e_mail = db.Column(db.String(50), nullable=False)
|
||||
password = db.Column(db.String(16), nullable=False)
|
||||
|
||||
|
||||
class Project(db.Model):
|
||||
id = db.Column(db.String(24), primary_key=True)
|
||||
name = db.Column(db.String(255), nullable=False)
|
||||
propose = db.Column(db.String(255), nullable=False)
|
||||
goal = db.Column(db.Integer, nullable=False)
|
||||
rate = db.Column(db.Integer)
|
||||
plat_id = db.Column(db.String(14), db.ForeignKey(Platform.platform_id), nullable=False)
|
||||
c_id = db.Column(db.String(19), db.ForeignKey(Charity.id), nullable=False)
|
||||
|
||||
|
||||
class support(db.Model):
|
||||
Pro_id = db.Column(db.String(24), db.ForeignKey(Project.id), primary_key=True, nullable=False)
|
||||
unit_id = db.Column(db.String(50), db.ForeignKey(unit.unit_id), primary_key=True, nullable=False)
|
||||
ma_id = db.Column(db.Integer, db.ForeignKey(Material.id), primary_key=True, nullable=False)
|
||||
number = db.Column(db.Integer, nullable=False)
|
||||
|
||||
|
||||
class budget(db.Model):
|
||||
Pro_id = db.Column(db.String(24), db.ForeignKey(Project.id), primary_key=True)
|
||||
ma_id = db.Column(db.Integer, db.ForeignKey(Material.id), primary_key=True)
|
||||
number = db.Column(db.Integer)
|
||||
|
||||
|
||||
class user(db.Model):
|
||||
user_ID = db.Column(db.String(20), primary_key=True)
|
||||
pass_word = db.Column(db.String(16), nullable=False)
|
||||
plat_id = db.Column(db.String(14), db.ForeignKey(Platform.platform_id))
|
||||
|
||||
|
||||
class jk(db.Model):
|
||||
Pro_id = db.Column(db.String(24), db.ForeignKey(Project.id), primary_key=True)
|
||||
User_id = db.Column(db.String(20), db.ForeignKey(user.user_ID), primary_key=True)
|
||||
money = db.Column(db.Integer, nullable=False)
|
||||
|
||||
|
||||
# 查询捐赠项目
|
||||
@app.route('/select', methods=['GET'])
|
||||
def select_project(user_id):
|
||||
user_id = user_id
|
||||
project = db.session.query(Project.id, Project.name, Project.propose, Project.goal, Project.rate, Charity.name,
|
||||
Project.plat_id).filter(Project.c_id == Charity.id).filter(
|
||||
Project.plat_id == Platform.platform_id).all()
|
||||
platform = Platform.query.first()
|
||||
return render_template("wzjz.html", pro_list=project, plat_list=platform, user_id=user_id)
|
||||
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
return redirect('/enter')
|
||||
|
||||
|
||||
@app.route('/enter', methods=['GET','POST'])
|
||||
def user_enter():
|
||||
if request.method == 'GET':
|
||||
return render_template('enter.html')
|
||||
else:
|
||||
user_id = request.form['user_id']
|
||||
pass_word = str(request.form['password'])
|
||||
ser = user.query.filter(user.user_ID == user_id).first()
|
||||
if pass_word == ser.pass_word:
|
||||
return select_project(user_id)
|
||||
else:
|
||||
return redirect('/')
|
||||
|
||||
|
||||
# 查看项目详情
|
||||
@app.route("/chakan", methods=['GET'])
|
||||
def select_detail():
|
||||
id = request.args.get('id')
|
||||
user_id = request.args.get('user_id')
|
||||
project = Project.query.filter(Project.id == id).first()
|
||||
charity = Charity.query.filter(Charity.id == project.c_id).first()
|
||||
yu = db.session.query(Material.name, Material.Price, budget.number).filter(Material.id == budget.ma_id).filter(
|
||||
budget.Pro_id == id).all()
|
||||
sp = db.session.query(unit.unit_name, Material.name, support.number).filter(unit.unit_id == support.unit_id).filter(
|
||||
Material.id == support.ma_id).filter(support.Pro_id == id).all()
|
||||
return render_template("chakan.html", cha_list=charity, pro=project, yu_list=yu, sp_list=sp, user_id=user_id)
|
||||
|
||||
|
||||
@app.route('/alter', methods=['GET', 'POST'])
|
||||
def donate():
|
||||
if request.method == 'GET':
|
||||
user_id = request.args.get('user_id')
|
||||
id = request.args.get('id')
|
||||
project = Project.query.filter(Project.id == id).first()
|
||||
return render_template('alter.html', project=project, user_id=user_id)
|
||||
else:
|
||||
user_id = request.form['user_id']
|
||||
id = request.form['id']
|
||||
money = int(request.form['money'])
|
||||
jke = jk(Pro_id=id, User_id=user_id, money=money)
|
||||
db.session.add(jke)
|
||||
db.session.commit()
|
||||
donation = Project.query.filter(Project.id == id).first()
|
||||
donation.rate = donation.rate + (money / donation.goal) * 100
|
||||
db.session.commit()
|
||||
return select_project(user_id)
|
||||
|
||||
|
||||
@app.route('/insert', methods=['GET', 'POST'])
|
||||
def insert_project():
|
||||
if request.method == 'GET':
|
||||
cha_id = request.args.get('cha_id')
|
||||
plat_id = request.args.get('plat_id')
|
||||
return render_template('insert.html', plat_id=plat_id, cha_id=cha_id)
|
||||
else:
|
||||
id = request.form['id']
|
||||
name = request.form['name']
|
||||
propose = request.form['propose']
|
||||
goal = int(request.form['number'])
|
||||
plat_id = request.form['plat_id']
|
||||
c_id = request.form['cha_id']
|
||||
print(plat_id)
|
||||
project = Project(id=id, name=name, propose=propose, goal=goal, rate=0, plat_id=plat_id, c_id=c_id)
|
||||
db.session.add(project)
|
||||
db.session.commit()
|
||||
pro = Project.query.filter(Project.c_id == c_id).all()
|
||||
return render_template("cha_select.html", pro_list=pro)
|
||||
|
||||
|
||||
@app.route('/delete', methods=['GET'])
|
||||
def pro_delete():
|
||||
id = request.args.get('pro_id')
|
||||
c_id = request.args.get('cha_id')
|
||||
sp = support.query.filter(support.Pro_id == id).all()
|
||||
for spp in sp:
|
||||
db.session.delete(spp)
|
||||
db.session.commit()
|
||||
bd = budget.query.filter(budget.Pro_id == id).all()
|
||||
for each in bd:
|
||||
db.session.delete(each)
|
||||
db.session.commit()
|
||||
project = Project.query.filter(Project.id == id).first()
|
||||
db.session.delete(project)
|
||||
db.session.commit()
|
||||
pro = Project.query.filter(Project.c_id == c_id).all()
|
||||
return render_template("cha_select.html", pro_list=pro)
|
||||
|
||||
|
||||
@app.route('/cha_pass', methods=['GET', 'POST'])
|
||||
def cha_project():
|
||||
if request.method == 'GET':
|
||||
plat_id = request.args.get('plat_id')
|
||||
plat = Platform.query.filter(Platform.platform_id == plat_id).first()
|
||||
return render_template("cha_pass.html", plat_id=plat)
|
||||
else:
|
||||
plat_id = request.form['plat_id']
|
||||
cha_name = request.form['cha_name']
|
||||
cha_password = request.form.get('password')
|
||||
c_id = db.session.query(Charity.id).filter(Charity.name == cha_name).first()
|
||||
pass_word = db.session.query(Charity.password).filter(Charity.id == c_id).first()
|
||||
if cha_password == pass_word[0]:
|
||||
project = Project.query.filter(Project.c_id == c_id).all()
|
||||
return render_template("cha_select.html", pro_list=project)
|
||||
else:
|
||||
return render_template('cha_pass.html', plat_id=plat_id)
|
||||
|
||||
|
||||
@app.route('/update', methods=['GET', 'POST'])
|
||||
def pro_update():
|
||||
if request.method == 'GET':
|
||||
pro_id = request.args.get('id')
|
||||
a = pro_id
|
||||
return render_template('update.html', pro_id=a)
|
||||
else:
|
||||
pro_id = request.form['pro_id']
|
||||
ma_name = request.form['ma_name']
|
||||
number = int(request.form['number'])
|
||||
area_name = request.form.get('area_name')
|
||||
ma_id = db.session.query(Material.id).filter(Material.name == ma_name).first()
|
||||
pro = db.session.query(Charity.id).filter(Charity.id == Project.c_id).filter(Project.id == pro_id).first()
|
||||
project = Project.query.filter(Project.c_id == pro).all()
|
||||
area_id = db.session.query(unit.unit_id).filter(unit.unit_name == area_name).first()
|
||||
ap = support(Pro_id=pro_id, area_id=area_id[0], ma_id=ma_id[0], number=number)
|
||||
db.session.add(ap)
|
||||
db.session.commit()
|
||||
return render_template('cha_select.html', pro_list=project)
|
||||
|
||||
@app.route('/jk_detail')
|
||||
def jk_detail():
|
||||
pro_id = request.args.get('pro_id')
|
||||
jz = jk.query.filter(jk.Pro_id == pro_id)
|
||||
return render_template("detail.html", jk_list = jz)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(debug=True, host='0.0.0.0', port=8800)
|
@ -0,0 +1 @@
|
||||
INSERT INTO `platform` (`platform_id`, `name`, `mobile`, `e_mail`, `address`) VALUES ('Z2000133000019', '支付宝', '057128997058', 'resume@alipay.com', '浙江省杭州市文三路478号华星时代广场22楼');
|
@ -0,0 +1,2 @@
|
||||
INSERT INTO `project` (`id`, `name`, `propose`, `goal`, `rate`, `plat_id`, `c_id`) VALUES ('514113007583765545A20001', '防控疫情,大爱无疆', '为南阳市新冠肺炎疫情严重的防疫一线地区筹募资金,购置防护物资', 2000000, 100, 'Z2000133000019', '514113007583765545');
|
||||
INSERT INTO `project` (`id`, `name`, `propose`, `goal`, `rate`, `plat_id`, `c_id`) VALUES ('531100005620503332A20010', '抗击疫情,众志成城', '为湖北、北京等各地医院及群众筹集善款采购疫情专项物资', 10000000, 86, 'Z2000133000019', '531100005620503332');
|
@ -0,0 +1,2 @@
|
||||
/** layui-v2.4.5 MIT License By https://www.layui.com */
|
||||
html #layuicss-skincodecss{display:none;position:absolute;width:1989px}.layui-code-h3,.layui-code-view{position:relative;font-size:12px}.layui-code-view{display:block;margin:10px 0;padding:0;border:1px solid #e2e2e2;border-left-width:6px;background-color:#F2F2F2;color:#333;font-family:Courier New}.layui-code-h3{padding:0 10px;height:32px;line-height:32px;border-bottom:1px solid #e2e2e2}.layui-code-h3 a{position:absolute;right:10px;top:0;color:#999}.layui-code-view .layui-code-ol{position:relative;overflow:auto}.layui-code-view .layui-code-ol li{position:relative;margin-left:45px;line-height:20px;padding:0 5px;border-left:1px solid #e2e2e2;list-style-type:decimal-leading-zero;*list-style-type:decimal;background-color:#fff}.layui-code-view pre{margin:0}.layui-code-notepad{border:1px solid #0C0C0C;border-left-color:#3F3F3F;background-color:#0C0C0C;color:#C2BE9E}.layui-code-notepad .layui-code-h3{border-bottom:none}.layui-code-notepad .layui-code-ol li{background-color:#3F3F3F;border-left:none}
|
After Width: | Height: | Size: 5.8 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 5.7 KiB |
After Width: | Height: | Size: 701 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 274 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 5.4 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 7.3 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 6.6 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 5.1 KiB |
After Width: | Height: | Size: 9.6 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 7.9 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 6.3 KiB |
After Width: | Height: | Size: 5.6 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 5.2 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 5.7 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 777 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 5.7 KiB |
After Width: | Height: | Size: 6.3 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 5.2 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 4.1 KiB |