parent
06469c598e
commit
bdabcbff19
@ -1 +0,0 @@
|
||||
default_app_config = 'main.apps.MainConfig'
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,31 +0,0 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from django.apps import apps, AppConfig
|
||||
# Register your models here.
|
||||
|
||||
from dj2.settings import dbName as schemaName
|
||||
from main.users_model import users
|
||||
from main.config_model import config
|
||||
|
||||
try:
|
||||
from main.models import *
|
||||
except:
|
||||
pass
|
||||
# change title
|
||||
admin.site.site_title = schemaName # 设置页面标题
|
||||
admin.site.site_header = schemaName # 设置网站页头
|
||||
admin.site.index_title = schemaName # 设置首页标语
|
||||
|
||||
allModels = apps.get_app_config('main').get_models()
|
||||
|
||||
for ind, model in enumerate(allModels):
|
||||
|
||||
class modelsite(admin.ModelAdmin):
|
||||
list_display = []
|
||||
for col in model._meta.fields:
|
||||
list_display.append(col.name)
|
||||
|
||||
search_fields = list_display
|
||||
|
||||
|
||||
admin.site.register(model, modelsite)
|
@ -1,6 +0,0 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class MainConfig(AppConfig):
|
||||
name = 'main'
|
||||
verbose_name = verbose_name_plural = r'刷表模块'
|
@ -1,21 +0,0 @@
|
||||
# coding:utf-8
|
||||
__author__ = "ila"
|
||||
|
||||
from django.db import models
|
||||
|
||||
from .model import BaseModel
|
||||
|
||||
|
||||
class config(BaseModel):
|
||||
# id=models.BigIntegerField(verbose_name="自增id")
|
||||
name = models.CharField(max_length=100, verbose_name=u'键名')
|
||||
value = models.CharField(max_length=100, verbose_name=u'键值')
|
||||
|
||||
__tablename__ = 'config'
|
||||
|
||||
class Meta:
|
||||
db_table = 'config'
|
||||
verbose_name = verbose_name_plural = u'配置表'
|
||||
|
||||
# def __str__(self):
|
||||
# return self.name
|
@ -1,131 +0,0 @@
|
||||
# coding:utf-8
|
||||
__author__ = "ila"
|
||||
|
||||
import logging
|
||||
|
||||
from django.http import JsonResponse
|
||||
|
||||
from .config_model import config
|
||||
from util.codes import *
|
||||
from util import message as mes
|
||||
|
||||
|
||||
def config_page(request):
|
||||
'''
|
||||
获取参数信息
|
||||
:return:
|
||||
'''
|
||||
if request.method in ["POST", "GET"]:
|
||||
msg = {"code": normal_code, "msg": mes.normal_code,
|
||||
"data": {"currPage": 1, "totalPage": 1, "total": 1, "pageSize": 10, "list": []}}
|
||||
req_dict = request.session.get('req_dict')
|
||||
msg['data']['list'], msg['data']['currPage'], msg['data']['totalPage'], msg['data']['total'], \
|
||||
msg['data']['pageSize'] = config.page(config, config, req_dict)
|
||||
return JsonResponse(msg)
|
||||
|
||||
|
||||
def config_list(request):
|
||||
'''
|
||||
'''
|
||||
if request.method in ["POST", "GET"]:
|
||||
msg = {"code": normal_code, "msg": mes.normal_code,
|
||||
"data": {"currPage": 1, "totalPage": 1, "total": 1, "pageSize": 10, "list": []}}
|
||||
req_dict = request.session.get("req_dict")
|
||||
|
||||
msg['data']['list'], msg['data']['currPage'], msg['data']['totalPage'], msg['data']['total'], \
|
||||
msg['data']['pageSize'] = config.page(config, config, req_dict)
|
||||
|
||||
return JsonResponse(msg)
|
||||
|
||||
|
||||
def config_info(request, id_):
|
||||
'''
|
||||
'''
|
||||
if request.method in ["POST", "GET"]:
|
||||
msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}
|
||||
|
||||
data = config.getbyid(config, config, int(id_))
|
||||
if len(data) > 0:
|
||||
msg['data'] = data[0]
|
||||
return JsonResponse(msg)
|
||||
|
||||
|
||||
def config_detail(request, id_):
|
||||
'''
|
||||
'''
|
||||
if request.method in ["POST", "GET"]:
|
||||
msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}
|
||||
|
||||
data = config.getbyid(config, config, int(id_))
|
||||
if len(data) > 0:
|
||||
msg['data'] = data[0]
|
||||
return JsonResponse(msg)
|
||||
|
||||
|
||||
def config_save(request):
|
||||
'''
|
||||
创建参数信息
|
||||
:return:
|
||||
'''
|
||||
if request.method in ["POST", "GET"]:
|
||||
msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}
|
||||
|
||||
req_dict = request.session.get('req_dict')
|
||||
param1 = config.getbyparams(config, config, req_dict)
|
||||
if param1:
|
||||
msg['code'] = id_exist_code
|
||||
msg['msg'] = mes.id_exist_code
|
||||
return JsonResponse(msg)
|
||||
|
||||
error = config.createbyreq(config, config, req_dict)
|
||||
logging.warning("save_config.res=========>{}".format(error))
|
||||
if error != None:
|
||||
msg['code'] = crud_error_code
|
||||
msg['msg'] = error
|
||||
return JsonResponse(msg)
|
||||
|
||||
|
||||
def config_add(request):
|
||||
'''
|
||||
'''
|
||||
if request.method in ["POST", "GET"]:
|
||||
msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}
|
||||
req_dict = request.session.get("req_dict")
|
||||
|
||||
error = config.createbyreq(config, config, req_dict)
|
||||
if error != None:
|
||||
msg['code'] = crud_error_code
|
||||
msg['msg'] = error
|
||||
return JsonResponse(msg)
|
||||
|
||||
|
||||
def config_update(request):
|
||||
'''
|
||||
更新参数信息
|
||||
:return:
|
||||
'''
|
||||
if request.method in ["POST", "GET"]:
|
||||
msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}
|
||||
|
||||
req_dict = request.session.get('req_dict')
|
||||
|
||||
config.updatebyparams(config, config, req_dict)
|
||||
|
||||
return JsonResponse(msg)
|
||||
|
||||
|
||||
def config_delete(request):
|
||||
'''
|
||||
删除参数信息
|
||||
:return:
|
||||
'''
|
||||
if request.method in ["POST", "GET"]:
|
||||
msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}
|
||||
|
||||
req_dict = request.session.get('req_dict')
|
||||
config.deletes(config,
|
||||
config,
|
||||
req_dict.get("ids")
|
||||
)
|
||||
|
||||
return JsonResponse(msg)
|
@ -1,219 +0,0 @@
|
||||
# Generated by Django 2.0 on 2022-08-14 05:19
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='cheweileixing',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('addtime', models.DateTimeField(verbose_name='创建时间')),
|
||||
('cheweileixing', models.CharField(max_length=255, unique=True, verbose_name='车位类型')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': '车位类型',
|
||||
'verbose_name_plural': '车位类型',
|
||||
'db_table': 'cheweileixing',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='cheweiweihu',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('addtime', models.DateTimeField(verbose_name='创建时间')),
|
||||
('cheweibianhao', models.CharField(max_length=255, verbose_name='车位编号')),
|
||||
('cheweimingcheng', models.CharField(max_length=255, null=True, verbose_name='车位名称')),
|
||||
('cheweileixing', models.CharField(max_length=255, null=True, verbose_name='车位类型')),
|
||||
('cheweiweizhi', models.CharField(max_length=255, null=True, verbose_name='车位位置')),
|
||||
('weihuleixing', models.CharField(max_length=255, verbose_name='维护类型')),
|
||||
('weihuxiangmu', models.CharField(max_length=255, null=True, verbose_name='维护项目')),
|
||||
('weihushijian', models.DateTimeField(verbose_name='维护时间')),
|
||||
('weihuxiangqing', models.TextField(null=True, verbose_name='维护详情')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': '车位维护',
|
||||
'verbose_name_plural': '车位维护',
|
||||
'db_table': 'cheweiweihu',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='cheweixinxi',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('addtime', models.DateTimeField(verbose_name='创建时间')),
|
||||
('cheweibianhao', models.CharField(max_length=255, unique=True, verbose_name='车位编号')),
|
||||
('cheweimingcheng', models.CharField(max_length=255, null=True, verbose_name='车位名称')),
|
||||
('cheweileixing', models.CharField(max_length=255, null=True, verbose_name='车位类型')),
|
||||
('cheweitupian', models.CharField(max_length=255, null=True, verbose_name='车位图片')),
|
||||
('cheweiweizhi', models.CharField(max_length=255, null=True, verbose_name='车位位置')),
|
||||
('cheweizhuangtai', models.CharField(max_length=255, verbose_name='车位状态')),
|
||||
('tingchejiage', models.IntegerField(verbose_name='停车价格')),
|
||||
('shoufeibiaozhun', models.CharField(max_length=255, null=True, verbose_name='收费标准')),
|
||||
('cheweixiangqing', models.TextField(null=True, verbose_name='车位详情')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': '车位信息',
|
||||
'verbose_name_plural': '车位信息',
|
||||
'db_table': 'cheweixinxi',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='chuchangjiaofei',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('addtime', models.DateTimeField(verbose_name='创建时间')),
|
||||
('cheweibianhao', models.CharField(max_length=255, verbose_name='车位编号')),
|
||||
('cheweimingcheng', models.CharField(max_length=255, null=True, verbose_name='车位名称')),
|
||||
('cheweileixing', models.CharField(max_length=255, null=True, verbose_name='车位类型')),
|
||||
('cheweitupian', models.CharField(max_length=255, null=True, verbose_name='车位图片')),
|
||||
('tingchejiage', models.IntegerField(null=True, verbose_name='停车价格')),
|
||||
('ruchangshijian', models.CharField(max_length=255, null=True, verbose_name='入场时间')),
|
||||
('chuchangshijian', models.DateTimeField(verbose_name='出场时间')),
|
||||
('tingcheshizhang', models.IntegerField(verbose_name='停车时长')),
|
||||
('tingchefeiyong', models.IntegerField(null=True, verbose_name='停车费用')),
|
||||
('xinxibeizhu', models.CharField(max_length=255, null=True, verbose_name='信息备注')),
|
||||
('yonghuming', models.CharField(max_length=255, null=True, verbose_name='用户名')),
|
||||
('shouji', models.CharField(max_length=255, null=True, verbose_name='手机')),
|
||||
('chepai', models.CharField(max_length=255, null=True, verbose_name='车牌')),
|
||||
('sfsh', models.CharField(default='否', max_length=255, null=True, verbose_name='是否审核')),
|
||||
('shhf', models.TextField(null=True, verbose_name='审核回复')),
|
||||
('ispay', models.CharField(default='未支付', max_length=255, null=True, verbose_name='是否支付')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': '出场缴费',
|
||||
'verbose_name_plural': '出场缴费',
|
||||
'db_table': 'chuchangjiaofei',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='config',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=100, verbose_name='键名')),
|
||||
('value', models.CharField(max_length=100, verbose_name='键值')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': '配置表',
|
||||
'verbose_name_plural': '配置表',
|
||||
'db_table': 'config',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='huiyuan',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('addtime', models.DateTimeField(verbose_name='创建时间')),
|
||||
('yonghuming', models.CharField(max_length=255, unique=True, verbose_name='用户名')),
|
||||
('mima', models.CharField(max_length=255, verbose_name='密码')),
|
||||
('xingming', models.CharField(max_length=255, null=True, verbose_name='姓名')),
|
||||
('touxiang', models.CharField(max_length=255, null=True, verbose_name='头像')),
|
||||
('xingbie', models.CharField(max_length=255, null=True, verbose_name='性别')),
|
||||
('shouji', models.CharField(max_length=255, null=True, verbose_name='手机')),
|
||||
('chepai', models.CharField(max_length=255, null=True, verbose_name='车牌')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': '会员',
|
||||
'verbose_name_plural': '会员',
|
||||
'db_table': 'huiyuan',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='messages',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('addtime', models.DateTimeField(verbose_name='创建时间')),
|
||||
('userid', models.BigIntegerField(verbose_name='留言人id')),
|
||||
('username', models.CharField(max_length=255, null=True, verbose_name='用户名')),
|
||||
('content', models.TextField(verbose_name='留言内容')),
|
||||
('reply', models.TextField(null=True, verbose_name='回复内容')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': '留言板',
|
||||
'verbose_name_plural': '留言板',
|
||||
'db_table': 'messages',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='news',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('addtime', models.DateTimeField(verbose_name='创建时间')),
|
||||
('title', models.CharField(max_length=255, verbose_name='标题')),
|
||||
('introduction', models.TextField(null=True, verbose_name='简介')),
|
||||
('picture', models.CharField(max_length=255, verbose_name='图片')),
|
||||
('content', models.TextField(verbose_name='内容')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': '公告信息',
|
||||
'verbose_name_plural': '公告信息',
|
||||
'db_table': 'news',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='ruchangtingche',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('addtime', models.DateTimeField(verbose_name='创建时间')),
|
||||
('cheweibianhao', models.CharField(max_length=255, verbose_name='车位编号')),
|
||||
('cheweimingcheng', models.CharField(max_length=255, null=True, verbose_name='车位名称')),
|
||||
('cheweileixing', models.CharField(max_length=255, null=True, verbose_name='车位类型')),
|
||||
('cheweitupian', models.CharField(max_length=255, null=True, verbose_name='车位图片')),
|
||||
('cheweiweizhi', models.CharField(max_length=255, null=True, verbose_name='车位位置')),
|
||||
('cheweizhuangtai', models.CharField(max_length=255, null=True, verbose_name='车位状态')),
|
||||
('shoufeibiaozhun', models.CharField(max_length=255, null=True, verbose_name='收费标准')),
|
||||
('tingchejiage', models.IntegerField(null=True, verbose_name='停车价格')),
|
||||
('ruchangshijian', models.DateTimeField(verbose_name='入场时间')),
|
||||
('ruchangbeizhu', models.CharField(max_length=255, null=True, verbose_name='入场备注')),
|
||||
('yonghuming', models.CharField(max_length=255, null=True, verbose_name='用户名')),
|
||||
('shouji', models.CharField(max_length=255, null=True, verbose_name='手机')),
|
||||
('chepai', models.CharField(max_length=255, null=True, verbose_name='车牌')),
|
||||
('sfsh', models.CharField(default='否', max_length=255, null=True, verbose_name='是否审核')),
|
||||
('shhf', models.TextField(null=True, verbose_name='审核回复')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': '入场停车',
|
||||
'verbose_name_plural': '入场停车',
|
||||
'db_table': 'ruchangtingche',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='storeup',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('addtime', models.DateTimeField(verbose_name='创建时间')),
|
||||
('userid', models.BigIntegerField(verbose_name='用户id')),
|
||||
('refid', models.BigIntegerField(null=True, verbose_name='收藏id')),
|
||||
('tablename', models.CharField(max_length=255, null=True, verbose_name='表名')),
|
||||
('name', models.CharField(max_length=255, verbose_name='收藏名称')),
|
||||
('picture', models.CharField(max_length=255, verbose_name='收藏图片')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': '收藏表',
|
||||
'verbose_name_plural': '收藏表',
|
||||
'db_table': 'storeup',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='users',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('username', models.CharField(max_length=100, verbose_name='账号')),
|
||||
('password', models.CharField(max_length=100, verbose_name='密码')),
|
||||
('role', models.CharField(max_length=100, verbose_name='角色')),
|
||||
('addtime', models.DateTimeField(verbose_name='创建时间')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': '管理员表',
|
||||
'verbose_name_plural': '管理员表',
|
||||
'db_table': 'users',
|
||||
},
|
||||
),
|
||||
]
|
Binary file not shown.
Binary file not shown.
@ -1,3 +0,0 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
@ -1,148 +0,0 @@
|
||||
# coding:utf-8
|
||||
__author__ = "ila"
|
||||
|
||||
import os
|
||||
from django.urls import path
|
||||
from main import users_v, config_v, schema_v
|
||||
|
||||
# from dj2.settings import dbName as schemaName
|
||||
|
||||
# url规则列表
|
||||
urlpatterns = [
|
||||
path(r'users/register', users_v.users_register),
|
||||
path(r'users/login', users_v.users_login),
|
||||
path(r'users/logout', users_v.users_logout),
|
||||
path(r'users/session', users_v.users_session),
|
||||
path(r'users/page', users_v.users_page),
|
||||
path(r'users/save', users_v.users_save),
|
||||
path(r'users/info/<id_>', users_v.users_info),
|
||||
path(r'users/update', users_v.users_update),
|
||||
path(r'users/delete', users_v.users_delete),
|
||||
|
||||
path(r'config/page', config_v.config_page),
|
||||
path(r'config/list', config_v.config_list),
|
||||
path(r'config/save', config_v.config_save),
|
||||
path(r'config/add', config_v.config_add),
|
||||
path(r'config/info/<id_>', config_v.config_info),
|
||||
path(r'config/detail/<id_>', config_v.config_detail),
|
||||
path(r'config/update', config_v.config_update),
|
||||
path(r'config/delete', config_v.config_delete),
|
||||
|
||||
]
|
||||
# main app的路径
|
||||
mainDir = os.path.join(os.getcwd(), "main")
|
||||
|
||||
# 过滤文件的列表
|
||||
excludeList = [
|
||||
"schema_v.py",
|
||||
"users_v.py",
|
||||
"config_v.py",
|
||||
]
|
||||
|
||||
# 循环当前目录下的py文件
|
||||
|
||||
view_tuple = set()
|
||||
for i in os.listdir(mainDir):
|
||||
if i not in excludeList and i[-5:] == "_v.py":
|
||||
viewName = i[:-3] # 去掉.py后缀字符串
|
||||
view_tuple.add("from main import {}".format(viewName))
|
||||
|
||||
# 组合成import字符串
|
||||
import_str = '\n'.join(view_tuple)
|
||||
# print(import_str)
|
||||
exec(import_str)
|
||||
|
||||
for i in os.listdir(mainDir):
|
||||
if i not in excludeList and i[-5:] == "_v.py":
|
||||
tableName = i[:-5]
|
||||
tableName = tableName.replace(" ", "").strip()
|
||||
print("tableName============>", tableName, len(tableName))
|
||||
|
||||
urlpatterns.extend(
|
||||
[
|
||||
path(r'{}/register'.format(tableName.lower()),
|
||||
eval("{}_v.{}_register".format(tableName.capitalize(), tableName.lower()))),
|
||||
path(r'{}/login'.format(tableName.lower()),
|
||||
eval("{}_v.{}_login".format(tableName.capitalize(), tableName.lower()))),
|
||||
path(r'{}/logout'.format(tableName.lower()),
|
||||
eval("{}_v.{}_logout".format(tableName.capitalize(), tableName.lower()))),
|
||||
path(r'{}/resetPass'.format(tableName.lower()),
|
||||
eval("{}_v.{}_resetPass".format(tableName.capitalize(), tableName.lower()))),
|
||||
path(r'{}/session'.format(tableName.lower()),
|
||||
eval("{}_v.{}_session".format(tableName.capitalize(), tableName.lower()))),
|
||||
path(r'{}/default'.format(tableName.lower()),
|
||||
eval("{}_v.{}_default".format(tableName.capitalize(), tableName.lower()))),
|
||||
path(r'{}/page'.format(tableName.lower()),
|
||||
eval("{}_v.{}_page".format(tableName.capitalize(), tableName.lower()))),
|
||||
path(r'{}/autoSort'.format(tableName.lower()),
|
||||
eval("{}_v.{}_autoSort".format(tableName.capitalize(), tableName.lower()))),
|
||||
|
||||
path(r'{}/save'.format(tableName.lower()),
|
||||
eval("{}_v.{}_save".format(tableName.capitalize(), tableName.lower()))),
|
||||
path(r'{}/add'.format(tableName.lower()),
|
||||
eval("{}_v.{}_add".format(tableName.capitalize(), tableName.lower()))),
|
||||
path(r'{}/thumbsup/<id_>'.format(tableName.lower()),
|
||||
eval("{}_v.{}_thumbsup".format(tableName.capitalize(), tableName.lower()))),
|
||||
path(r'{}/info/<id_>'.format(tableName.lower()),
|
||||
eval("{}_v.{}_info".format(tableName.capitalize(), tableName.lower()))),
|
||||
path(r'{}/detail/<id_>'.format(tableName.lower()),
|
||||
eval("{}_v.{}_detail".format(tableName.capitalize(), tableName.lower()))),
|
||||
path(r'{}/update'.format(tableName.lower()),
|
||||
eval("{}_v.{}_update".format(tableName.capitalize(), tableName.lower()))),
|
||||
path(r'{}/delete'.format(tableName.lower()),
|
||||
eval("{}_v.{}_delete".format(tableName.capitalize(), tableName.lower()))),
|
||||
path(r'{}/vote/<id_>'.format(tableName.lower()),
|
||||
eval("{}_v.{}_vote".format(tableName.capitalize(), tableName.lower()))),
|
||||
]
|
||||
)
|
||||
|
||||
# examrecord特定接口
|
||||
if tableName.lower() == "examrecord":
|
||||
urlpatterns.extend(
|
||||
[
|
||||
path(r'{}/groupby'.format(tableName.lower()),
|
||||
eval("{}_v.{}_groupby".format(tableName.capitalize(), tableName.lower()))),
|
||||
path(r'{}/deleteRecords'.format(tableName.lower()),
|
||||
eval("{}_v.{}_deleterecords".format(tableName.capitalize(), tableName.lower()))),
|
||||
]
|
||||
)
|
||||
|
||||
# forum特定接口
|
||||
if tableName.lower() == "forum":
|
||||
urlpatterns.extend(
|
||||
[
|
||||
path(r'{}/flist'.format(tableName.lower()),
|
||||
eval("{}_v.{}_flist".format(tableName.capitalize(), tableName.lower()))),
|
||||
path(r'{}/list/<id_>'.format(tableName.lower()),
|
||||
eval("{}_v.{}_list_id".format(tableName.capitalize(), tableName.lower()))),
|
||||
]
|
||||
)
|
||||
else:
|
||||
urlpatterns.extend(
|
||||
[
|
||||
path(r'{}/list'.format(tableName.lower()),
|
||||
eval("{}_v.{}_list".format(tableName.capitalize(), tableName.lower()))),
|
||||
]
|
||||
)
|
||||
urlpatterns.extend(
|
||||
[
|
||||
path(r'cal/<str:tableName>/<str:columnName>', schema_v.schemaName_cal),
|
||||
path(r'file/download', schema_v.schemaName_file_download),
|
||||
path(r'file/upload', schema_v.schemaName_file_upload),
|
||||
path(r'follow/<tableName>/<columnName>/<level>/<parent>', schema_v.schemaName_follow_level),
|
||||
path(r'follow/<tableName>/<columnName>', schema_v.schemaName_follow),
|
||||
path(r'location', schema_v.schemaName_location),
|
||||
path(r'matchFace', schema_v.schemaName_matchface),
|
||||
path(r'option/<tableName>/<columnName>', schema_v.schemaName_option),
|
||||
path(r'remind/<tableName>/<columnName>/<type>', schema_v.schemaName_remind_tablename_columnname_type),
|
||||
# 前台提醒接口(通用接口,不需要登陆)
|
||||
path(r'<tableName>/remind/<columnName>/<type>', schema_v.schemaName_tablename_remind_columnname_type),
|
||||
# 后台提醒接口 (每个表的单独接口,需登录)
|
||||
path(r'sh/<tableName>', schema_v.schemaName_sh),
|
||||
path(r'upload/<fileName>', schema_v.schemaName_upload),
|
||||
path(r'group/<tableName>/<columnName>', schema_v.schemaName_group_quyu),
|
||||
path(r'value/<tableName>/<xColumnName>/<yColumnName>', schema_v.schemaName_value_quyu),
|
||||
]
|
||||
)
|
||||
|
||||
# print(urlpatterns)
|
@ -1,22 +0,0 @@
|
||||
# coding:utf-8
|
||||
__author__ = "ila"
|
||||
|
||||
from django.db import models
|
||||
|
||||
from .model import BaseModel
|
||||
|
||||
|
||||
class users(BaseModel):
|
||||
# id=models.BigIntegerField(verbose_name="自增id")
|
||||
username = models.CharField(max_length=100, verbose_name=u'账号')
|
||||
password = models.CharField(max_length=100, verbose_name=u'密码')
|
||||
role = models.CharField(max_length=100, verbose_name=u'角色')
|
||||
addtime = models.DateTimeField(auto_now_add=False, verbose_name=u'创建时间')
|
||||
__tablename__ = 'users'
|
||||
|
||||
class Meta:
|
||||
db_table = 'users'
|
||||
verbose_name = verbose_name_plural = u'管理员表'
|
||||
|
||||
# def __str__(self):
|
||||
# return self.username
|
@ -1,161 +0,0 @@
|
||||
# coding:utf-8
|
||||
__author__ = "ila"
|
||||
|
||||
from django.http import JsonResponse
|
||||
|
||||
from .users_model import users
|
||||
from util.codes import *
|
||||
from util.auth import Auth
|
||||
import util.message as mes
|
||||
|
||||
|
||||
def users_login(request):
|
||||
if request.method in ["POST", "GET"]:
|
||||
msg = {'code': normal_code, "msg": mes.normal_code}
|
||||
req_dict = request.session.get("req_dict")
|
||||
if req_dict.get('role')!=None:
|
||||
del req_dict['role']
|
||||
datas = users.getbyparams(users, users, req_dict)
|
||||
if not datas:
|
||||
msg['code'] = password_error_code
|
||||
msg['msg'] = mes.password_error_code
|
||||
return JsonResponse(msg)
|
||||
|
||||
req_dict['id'] = datas[0].get('id')
|
||||
return Auth.authenticate(Auth, users, req_dict)
|
||||
|
||||
|
||||
def users_register(request):
|
||||
if request.method in ["POST", "GET"]:
|
||||
msg = {'code': normal_code, "msg": mes.normal_code}
|
||||
req_dict = request.session.get("req_dict")
|
||||
|
||||
error = users.createbyreq(users, users, req_dict)
|
||||
if error != None:
|
||||
msg['code'] = crud_error_code
|
||||
msg['msg'] = error
|
||||
return JsonResponse(msg)
|
||||
|
||||
|
||||
def users_session(request):
|
||||
'''
|
||||
'''
|
||||
if request.method in ["POST", "GET"]:
|
||||
msg = {"code": normal_code,"msg":mes.normal_code, "data": {}}
|
||||
|
||||
req_dict = {"id": request.session.get('params').get("id")}
|
||||
msg['data'] = users.getbyparams(users, users, req_dict)[0]
|
||||
|
||||
return JsonResponse(msg)
|
||||
|
||||
|
||||
def users_logout(request):
|
||||
if request.method in ["POST", "GET"]:
|
||||
msg = {
|
||||
"msg": "退出成功",
|
||||
"code": 0
|
||||
}
|
||||
|
||||
return JsonResponse(msg)
|
||||
|
||||
|
||||
def users_page(request):
|
||||
'''
|
||||
'''
|
||||
if request.method in ["POST", "GET"]:
|
||||
msg = {"code": normal_code, "msg": mes.normal_code,
|
||||
"data": {"currPage": 1, "totalPage": 1, "total": 1, "pageSize": 10, "list": []}}
|
||||
req_dict = request.session.get("req_dict")
|
||||
tablename = request.session.get("tablename")
|
||||
try:
|
||||
__hasMessage__ = users.__hasMessage__
|
||||
except:
|
||||
__hasMessage__ = None
|
||||
if __hasMessage__ and __hasMessage__ != "否":
|
||||
|
||||
if tablename != "users":
|
||||
req_dict["userid"] = request.session.get("params").get("id")
|
||||
if tablename == "users":
|
||||
msg['data']['list'], msg['data']['currPage'], msg['data']['totalPage'], msg['data']['total'], \
|
||||
msg['data']['pageSize'] = users.page(users, users, req_dict)
|
||||
else:
|
||||
msg['data']['list'], msg['data']['currPage'], msg['data']['totalPage'], msg['data']['total'], \
|
||||
msg['data']['pageSize'] = [],1,0,0,10
|
||||
|
||||
return JsonResponse(msg)
|
||||
|
||||
|
||||
def users_info(request, id_):
|
||||
'''
|
||||
'''
|
||||
if request.method in ["POST", "GET"]:
|
||||
msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}
|
||||
|
||||
data = users.getbyid(users, users, int(id_))
|
||||
if len(data) > 0:
|
||||
msg['data'] = data[0]
|
||||
# 浏览点击次数
|
||||
try:
|
||||
__browseClick__ = users.__browseClick__
|
||||
except:
|
||||
__browseClick__ = None
|
||||
|
||||
if __browseClick__ and "clicknum" in users.getallcolumn(users, users):
|
||||
click_dict = {"id": int(id_), "clicknum": str(int(data[0].get("clicknum", 0)) + 1)}
|
||||
ret = users.updatebyparams(users, users, click_dict)
|
||||
if ret != None:
|
||||
msg['code'] = crud_error_code
|
||||
msg['msg'] = ret
|
||||
return JsonResponse(msg)
|
||||
|
||||
|
||||
def users_save(request):
|
||||
'''
|
||||
'''
|
||||
if request.method in ["POST", "GET"]:
|
||||
msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}
|
||||
req_dict = request.session.get("req_dict")
|
||||
error = users.createbyreq(users, users, req_dict)
|
||||
if error != None:
|
||||
msg['code'] = crud_error_code
|
||||
msg['msg'] = error
|
||||
return JsonResponse(msg)
|
||||
|
||||
|
||||
def users_update(request):
|
||||
'''
|
||||
'''
|
||||
if request.method in ["POST", "GET"]:
|
||||
msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}
|
||||
req_dict = request.session.get("req_dict")
|
||||
if req_dict.get("mima") and req_dict.get("password"):
|
||||
if "mima" not in users.getallcolumn(users,users):
|
||||
del req_dict["mima"]
|
||||
if "password" not in users.getallcolumn(users,users):
|
||||
del req_dict["password"]
|
||||
try:
|
||||
del req_dict["clicknum"]
|
||||
except:
|
||||
pass
|
||||
error = users.updatebyparams(users, users, req_dict)
|
||||
if error != None:
|
||||
msg['code'] = crud_error_code
|
||||
msg['msg'] = error
|
||||
return JsonResponse(msg)
|
||||
|
||||
|
||||
def users_delete(request):
|
||||
'''
|
||||
'''
|
||||
if request.method in ["POST", "GET"]:
|
||||
msg = {"code": normal_code, "msg": mes.normal_code, "data": {}}
|
||||
req_dict = request.session.get("req_dict")
|
||||
|
||||
error = users.deletes(users,
|
||||
users,
|
||||
req_dict.get("ids")
|
||||
)
|
||||
if error != None:
|
||||
msg['code'] = crud_error_code
|
||||
msg['msg'] = error
|
||||
return JsonResponse(msg)
|
@ -1,3 +0,0 @@
|
||||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
Loading…
Reference in new issue