rabin 7 years ago
commit
fc10b7d875
58 changed files with 692 additions and 0 deletions
  1. 8 0
      README.rst
  2. 9 0
      admin.py
  3. 1 0
      admin/__init__.py
  4. BIN
      admin/__init__.pyc
  5. 5 0
      admin/main.py
  6. BIN
      admin/main.pyc
  7. 1 0
      admin/page/__init__.py
  8. BIN
      admin/page/__init__.pyc
  9. 2 0
      admin/page/__load__.py
  10. BIN
      admin/page/__load__.pyc
  11. 82 0
      admin/page/record.py
  12. BIN
      admin/page/record.pyc
  13. 159 0
      admin/page/score.py
  14. BIN
      admin/page/score.pyc
  15. 56 0
      conf/dev.conf
  16. 52 0
      conf/env.conf
  17. 9 0
      front.py
  18. 1 0
      front/__init__.py
  19. BIN
      front/__init__.pyc
  20. 4 0
      front/main.py
  21. BIN
      front/main.pyc
  22. 1 0
      front/page/__init__.py
  23. BIN
      front/page/__init__.pyc
  24. 39 0
      front/page/__load__.py
  25. BIN
      front/page/__load__.pyc
  26. 75 0
      front/page/main.py
  27. BIN
      front/page/main.pyc
  28. 1 0
      front/static/mobile/css/index.css
  29. 1 0
      front/static/pc/css/index.css
  30. 9 0
      front/templates/mobile/inc/header.html
  31. 10 0
      front/templates/mobile/index.html
  32. 9 0
      front/templates/pc/inc/header.html
  33. 18 0
      front/templates/pc/index.html
  34. 24 0
      install.py
  35. 1 0
      model/__init__.py
  36. BIN
      model/__init__.pyc
  37. 7 0
      model/__load__.py
  38. BIN
      model/__load__.pyc
  39. 16 0
      model/level.py
  40. BIN
      model/level.pyc
  41. 17 0
      model/record.py
  42. BIN
      model/record.pyc
  43. 15 0
      model/record_type.py
  44. BIN
      model/record_type.pyc
  45. 14 0
      model/score.py
  46. BIN
      model/score.pyc
  47. 17 0
      model/score_rule.py
  48. BIN
      model/score_rule.pyc
  49. 15 0
      opt.py
  50. 6 0
      runtime/__init__.py
  51. 1 0
      runtime/mysql/level
  52. 1 0
      runtime/mysql/manage_admin
  53. 1 0
      runtime/mysql/manage_log
  54. 1 0
      runtime/mysql/manage_role
  55. 1 0
      runtime/mysql/record
  56. 1 0
      runtime/mysql/record_type
  57. 1 0
      runtime/mysql/score
  58. 1 0
      runtime/mysql/score_rule

+ 8 - 0
README.rst

@@ -0,0 +1,8 @@
+# 后台管理系统
+
+安装
+pip install -U git+https://github.com/shemic/demeter
+python install.py
+
+前台:python front.py
+后台:python admin.py

+ 9 - 0
admin.py

@@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*-
+"""
+    demeter web
+    name:admin.py
+"""
+from demeter.core import *
+
+if __name__ == "__main__":
+	Demeter.webInit('admin')

+ 1 - 0
admin/__init__.py

@@ -0,0 +1 @@
+# -*- coding: utf-8 -*-

BIN
admin/__init__.pyc


+ 5 - 0
admin/main.py

@@ -0,0 +1,5 @@
+# -*- coding: utf-8 -*-
+from demeter.web import *
+import demeter.admin.page as admin_page
+import admin.page
+Web.start(application=[admin.page,admin_page])

BIN
admin/main.pyc


+ 1 - 0
admin/page/__init__.py

@@ -0,0 +1 @@
+# -*- coding: utf-8 -*-

BIN
admin/page/__init__.pyc


+ 2 - 0
admin/page/__load__.py

@@ -0,0 +1,2 @@
+# -*- coding: utf-8 -*-
+from demeter.admin.page.__load__ import *

BIN
admin/page/__load__.pyc


+ 82 - 0
admin/page/record.py

@@ -0,0 +1,82 @@
+# -*- coding: utf-8 -*-
+"""
+    demeter web page
+    name:record.py 统计记录相关
+    author:rabin
+"""
+from .__load__ import *
+
+class record_path(Load):
+	@Web.auth
+	@Web.setting
+	def get(self):
+		self.set(
+			name = u'记录点类型管理'
+			,path = '/record/record'
+			,width = '600'
+			,height = '600'
+			,search = (('label-1','cdate-time-start','cdate-time-end','name-input-mlike'), (u'日期范围',u'开始时间',u'截止时间',u'类型名称'))
+			,thead = (u'类型ID', u'类型名称', u'操作类型', u'更新时间')
+			,tbody = ('id','name','type', 'cdate')
+			,state = True
+		)
+
+		self.list('record_type')
+		if self.data['list']:
+			for key, value in enumerate(self.data['list']):
+				id = str(value['id'])
+				param = '?search_site_id-select-=' + id
+				if value['type'] == 1:
+					self.data['list'][key]['type'] = '浏览'
+				else:
+					self.data['list'][key]['type'] = '操作'
+		self.show('list')
+
+class record_update_path(Load):
+	@Web.auth
+	@Web.setting
+	def get(self):
+		typeValue = [{'id':1, 'name':'浏览'}, {'id':2, 'name':'操作'}]
+		self.set(
+			path = '/record/record'
+			,label = (u'类型名称',u'操作类型')
+			,update = ('name-input-required','type-select-required')
+			,update_type = typeValue
+		)
+		self.one('record_type')
+		self.show('update')
+	@Web.auth
+	@Web.setting
+	def post(self):
+		self.update('record_type')
+	@Web.auth
+	@Web.setting
+	def delete(self):
+		self.drop('record_type')
+
+class data_path(Load):
+	@Web.auth
+	@Web.setting
+	def get(self):
+		self.set(
+			name = u'记录数据'
+			,path = '/record/data'
+			,width = '600'
+			,height = '600'
+			,edit = False
+			,add = False
+			,search = (('label-1','cdate-time-start','cdate-time-end','record_type_id-select-'), (u'日期范围',u'开始时间',u'截止时间',u'选择类型'))
+			,thead = (u'操作名', u'记录类型', u'用户', u'更新时间')
+			,tbody = ('name', 'type', 'uid', 'cdate')
+			,state = False
+		)
+
+		self.data['common']['search_record_type_id-select-'] = self.service('common').list('record_type')
+
+		self.list('record')
+		if self.data['list']:
+			for key, value in enumerate(self.data['list']):
+				typeData = self.service('common').one('record_type', id=value['record_type_id'])
+				self.data['list'][key]['type'] = typeData['name']
+
+		self.show('list')

BIN
admin/page/record.pyc


+ 159 - 0
admin/page/score.py

@@ -0,0 +1,159 @@
+# -*- coding: utf-8 -*-
+"""
+    demeter web page
+    name:score.py 积分相关
+    author:rabin
+"""
+from .__load__ import *
+
+class score_path(Load):
+	@Web.auth
+	@Web.setting
+	def get(self):
+		self.set(
+			name = u'积分设置'
+			,path = '/score/score'
+			,width = '600'
+			,height = '600'
+			,search = (('label-1','cdate-time-start','cdate-time-end'), (u'日期范围',u'开始时间',u'截止时间'))
+			,thead = (u'积分名', u'规则', u'更新时间')
+			,tbody = ('name', 'func', 'cdate')
+			,state = True
+		)
+
+		menu = (
+			{'name':'规则列表', 'url':'/score/score_rule'},
+			)
+
+		self.list('score')
+		if self.data['list']:
+			for key, value in enumerate(self.data['list']):
+				id = str(value['id'])
+				param = '?score_id=' + id + '&search_score_id-select-=' + id
+				self.data['list'][key]['func'] = ''
+				for i in menu:
+					self.data['list'][key]['func'] = self.data['list'][key]['func'] + '<a href="'+i['url']+''+param+'">'+i['name']+'</a>&nbsp;&nbsp;&nbsp;&nbsp;'
+
+		self.show('list')
+
+class score_update_path(Load):
+	@Web.auth
+	@Web.setting
+	def get(self):
+		self.set(
+			path = '/score/score'
+			,label = (u'积分名称',)
+			,update = ('name-input-required',)
+		)
+		self.one('score')
+		self.show('update')
+	@Web.auth
+	@Web.setting
+	def post(self):
+		self.update('score')
+	@Web.auth
+	@Web.setting
+	def delete(self):
+		self.drop('score')
+
+class score_rule_path(Load):
+	@Web.auth
+	@Web.setting
+	def get(self):
+		id = str(self.input('score_id'))
+		param = '?score_id=' + id + '&search_score_id-select-=' + id
+		self.set(
+			name = u'积分规则设置'
+			,path = '/score/score_rule'
+			,width = '600'
+			,height = '600'
+			,search = (('label-1','cdate-time-start','cdate-time-end','search_score_id-select-','record_type_id-select-'), (u'日期范围',u'开始时间',u'截止时间', u'选择积分', u'选择记录点类型'))
+			,thead = (u'积分名', u'记录点类型', u'规则', u'更新时间')
+			,tbody = ('name', 'type', 'rule', 'cdate')
+			,state = True
+		)
+
+		self.data['common']['search_record_type_id-select-'] = self.service('common').list('record_type')
+
+		self.data['common']['search_score_id-select-'] = self.service('common').list('score')
+
+		self.list('score_rule')
+		if self.data['list']:
+			for key, value in enumerate(self.data['list']):
+				typeData = self.service('common').one('record_type', id=value['record_type_id'])
+				self.data['list'][key]['type'] = typeData['name']
+
+				score = self.service('common').one('score', id=value['score_id'])
+				self.data['list'][key]['name'] = score['name']
+
+		self.show('list')
+
+class score_rule_update_path(Load):
+	@Web.auth
+	@Web.setting
+	def get(self):
+		self.set(
+			path = '/score/score_rule'
+			,label = (u'积分ID', u'记录点类型', u'积分规则公式')
+			,update = ('score_id-select-required','record_type_id-select-required','rule-text-required')
+			,update_record_type_id = self.service('common').list('record_type')
+			,update_score_id = self.service('common').list('score')
+		)
+		self.one('score_rule')
+		self.show('update')
+	@Web.auth
+	@Web.setting
+	def post(self):
+		self.update('score_rule')
+	@Web.auth
+	@Web.setting
+	def delete(self):
+		self.drop('score_rule')
+
+class level_path(Load):
+	@Web.auth
+	@Web.setting
+	def get(self):
+		id = str(self.input('score_id'))
+		param = '?score_id=' + id + '&search_score_id-select-=' + id
+		self.set(
+			name = u'等级设置'
+			,path = '/score/level'
+			,width = '600'
+			,height = '600'
+			,search = (('label-1','cdate-time-start','cdate-time-end','search_score_id-select-'), (u'日期范围',u'开始时间',u'截止时间', u'选择积分'))
+			,thead = (u'等级名',u'积分名', u'规则', u'更新时间')
+			,tbody = ('name', 'score', 'rule', 'cdate')
+			,state = True
+		)
+
+		self.data['common']['search_score_id-select-'] = self.service('common').list('score')
+
+		self.list('level')
+		if self.data['list']:
+			for key, value in enumerate(self.data['list']):
+				score = self.service('common').one('score', id=value['score_id'])
+				self.data['list'][key]['score'] = score['name']
+
+		self.show('list')
+
+class level_update_path(Load):
+	@Web.auth
+	@Web.setting
+	def get(self):
+		self.set(
+			path = '/score/level'
+			,label = (u'等级名', u'积分ID', u'规则公式')
+			,update = ('name-input-required','score_id-select-required','rule-text-required')
+			,update_score_id = self.service('common').list('score')
+		)
+		self.one('level')
+		self.show('update')
+	@Web.auth
+	@Web.setting
+	def post(self):
+		self.update('level')
+	@Web.auth
+	@Web.setting
+	def delete(self):
+		self.drop('level')

BIN
admin/page/score.pyc


+ 56 - 0
conf/dev.conf

@@ -0,0 +1,56 @@
+[base]
+;开发环境配置
+[setting]
+name				= 答题系统
+site				= http://www.dever.cc/
+copyright			= 2017 dever.cc v1.0.0
+phantomjs			= http://192.168.15.10:8910/
+;打印路由表
+route				= True
+
+[db]
+rdb					= mysql
+
+[mysql]
+host				= 192.168.1.203
+port				= 3307
+username			= root
+password			= 123456
+dbname				= question
+prefix				= demeter
+charset				= utf8
+;允许自动建表
+create				= True
+
+;定义一些tornado的配置,可为空
+[tornado]
+
+;后台配置
+[admin]
+port				= 8087
+debug				= True
+;请求的buffersize
+max_buffer_size		= 210763776
+;子进程
+process				= 0
+;定义后台父级菜单
+menu_parent			= 记录点设置:&#xe62e;,积分等级设置:&#xe62e;
+;定义后台子级菜单
+menu_child			= 记录点类型:/record/record,记录点数据:/record/data;积分设置:/score/score,等级设置:/score/level
+
+;cookie
+cookie_secret       = 61oETzKXQAGaYekL5gEmGeJJFuYh7EQnp2XdTP1o/Vo=
+login_url           = /user/login
+;是否使用安全cookie
+xsrf_cookies        = True
+
+;前台配置
+[front]
+port				= 8088
+debug				= True
+;请求的buffersize
+max_buffer_size		= 210763776
+;子进程
+process				= 0
+;支持手机版
+mobile				= True

+ 52 - 0
conf/env.conf

@@ -0,0 +1,52 @@
+[base]
+;线上环境配置,请设置环境变量DEMETER_CONF = env
+[setting]
+name				= 抢购平台
+site				= http://www.dever.cc/
+copyright			= 2017 dever.cc v1.0.0
+phantomjs			= http://192.168.15.10:8910/
+
+[db]
+rdb					= mysql
+
+[mysql]
+host				= 192.168.1.203
+port				= 3307
+username			= root
+password			= 123456
+dbname				= demeter
+prefix				= demeter
+charset				= utf8
+
+;定义一些tornado的配置,可为空
+[tornado]
+
+;后台配置
+[admin]
+port				= 8087
+debug				= True
+;请求的buffersize
+max_buffer_size		= 210763776
+;子进程
+process				= 0
+;定义后台父级菜单
+menu_parent			= 站点设置:&#xe62e;
+;定义后台子级菜单
+menu_child			= 站点管理:/site/site,抢购商品设置:/site/product
+
+;cookie
+cookie_secret		= 61oETzKXQAGaYekL5gEmGeJJFuYh7EQnp2XdTP1o/Vo=
+login_url			= /user/login
+;是否使用安全cookie
+xsrf_cookies		= True
+
+;前台配置
+[front]
+port				= 8088
+debug				= True
+;请求的buffersize
+max_buffer_size		= 210763776
+;子进程
+process				= 0
+;支持手机版
+mobile				= True

+ 9 - 0
front.py

@@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*-
+"""
+    demeter web
+    name:front.py
+"""
+from demeter.core import *
+
+if __name__ == "__main__":
+	Demeter.webInit('front')

+ 1 - 0
front/__init__.py

@@ -0,0 +1 @@
+# -*- coding: utf-8 -*-

BIN
front/__init__.pyc


+ 4 - 0
front/main.py

@@ -0,0 +1,4 @@
+# -*- coding: utf-8 -*-
+from demeter.web import *
+import front.page
+Web.start(application=[front.page,])

BIN
front/main.pyc


+ 1 - 0
front/page/__init__.py

@@ -0,0 +1 @@
+# -*- coding: utf-8 -*-

BIN
front/page/__init__.pyc


+ 39 - 0
front/page/__load__.py

@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+"""
+    demeter load
+    author:rabin
+"""
+from demeter.web import *
+
+#可以在此定义一些核心类库
+
+# 这个是基类
+class Load(Base):
+	# user是权限
+	KEYS = ('user',)
+
+	def setting(self):
+		self.user()
+
+	def user(self):
+		ajax = self.input('ajax')
+		if ajax:
+			self.data['ajax'] = True
+		else:
+			self.data['ajax'] = False
+		self.data['auth'] = True
+
+		# 权限判断
+		if 'user' in self.data['setting'] and self.data['setting']['user'] > 0:
+			self.data['setting']['userInfo'] = self.service('common').one('farm_user', id=self.data['setting']['user'])
+		else:
+			# 没有权限
+			return
+
+		if '/' in self.request.uri:
+			temp = self.request.uri.split('/')
+			slen = len(temp)
+			if slen > 1 and temp[1]:
+				cur = temp[1]
+		self.data['setting']['cur'] = cur
+

BIN
front/page/__load__.pyc


+ 75 - 0
front/page/main.py

@@ -0,0 +1,75 @@
+# -*- coding: utf-8 -*-
+"""
+    demeter web page
+    name:work.py
+    author:rabin
+"""
+from .__load__ import *
+
+class index_path(Load):
+	#权限控制,需要在Load类中自行做判断
+	#@Web.auth
+	#异步加载,增加执行效率
+	@Web.setting
+	def get(self):
+		self.view("index.html")
+
+# 测试数据库 查询 /main/select
+class select_path(Load):
+	@Web.setting
+	def get(self):
+		# 从get、post获取数据,默认值为1
+		id = int(self.input('site', 1))
+		site = Demeter.model('site')
+		site.id = id
+		self.data['site'] = site.select(type='fetchone')
+
+		product = Demeter.model('product')
+		product.site_id = id
+		self.data['product'] = product.select(col = '*', order = 'cda2te desc', group = '', limit = '0,100')
+		if not self.data['product']:
+			Demeter.echo(product.sql)
+			Demeter.echo(product.bind)
+			Demeter.echo(product.log)
+		self.view('index.html')
+
+# 测试数据库 更新和插入 /main/update
+class update_path(Load):
+	@Web.setting
+	def get(self):
+		id = int(self.input('site', 1))
+		name = self.input('name', 'tests')
+		site = Demeter.model('site')
+		site.id = id
+		state = site.update(name=name)
+
+		self.data['site'] = site.select(type='fetchone')
+
+		self.view('index.html')
+
+# 测试json  /main/json
+class json_path(Load):
+	@Web.setting
+	def get(self):
+		id = int(self.input('site', 1))
+		name = self.input('name', 'tests')
+		site = Demeter.model('site')
+		site.id = id
+		state = site.update(name=name)
+
+		data = site.select(type='fetchone')
+		
+		self.out('yes', data)
+
+# 测试数据库 使用sql(不建议使用) /main/sql.html
+class sql_html(Load):
+	@Web.setting
+	def get(self):
+		id = int(self.input('site', 1))
+		name = self.input('name', 'tests')
+		site = Demeter.model('site')
+		state = site.query('update demeter_site set name = %s where id = %s', (name,id))
+
+		self.data['site'] = site.query('select * from demeter_site where id = %s', (id))
+
+		self.view('index.html')

BIN
front/page/main.pyc


+ 1 - 0
front/static/mobile/css/index.css

@@ -0,0 +1 @@
+.h1{font-size:.56rem;line-height:2.853333rem;background-color:#4a7cf9;text-align:center;color:#fff}

+ 1 - 0
front/static/pc/css/index.css

@@ -0,0 +1 @@
+.h1{font-size:.56rem;line-height:2.853333rem;background-color:#4a7cf9;text-align:center;color:#fff}

+ 9 - 0
front/templates/mobile/inc/header.html

@@ -0,0 +1,9 @@
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
+<meta content="yes" name="apple-mobile-web-app-capable">
+<meta content="black" name="apple-mobile-web-app-status-bar-style">
+<meta content="telephone=no" name="format-detection">
+<title>{{data['setting']['name']}}</title>
+<meta name="Keywords" content="" />
+<meta name="Description" content="" />
+<link href="{{static_url('mobile/css/index.css')}}" rel="stylesheet">

+ 10 - 0
front/templates/mobile/index.html

@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+{%include 'inc/header.html'%}
+</head>
+<body>
+mobile
+</body>
+
+</html>

+ 9 - 0
front/templates/pc/inc/header.html

@@ -0,0 +1,9 @@
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
+<meta content="yes" name="apple-mobile-web-app-capable">
+<meta content="black" name="apple-mobile-web-app-status-bar-style">
+<meta content="telephone=no" name="format-detection">
+<title>{{data['setting']['name']}}</title>
+<meta name="Keywords" content="" />
+<meta name="Description" content="" />
+<link href="{{static_url('pc/css/index.css')}}" rel="stylesheet">

+ 18 - 0
front/templates/pc/index.html

@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+{%include 'inc/header.html'%}
+</head>
+<body>
+<h1>
+pc{% if 'site' in data and data['site'] %}:{{data['site']['name']}}{% end %}
+</h1>
+{% if 'product' in data and data['product'] %}
+<ul>
+	{% for v in data['product'] %}
+    <li><a href="#"><p>{{v['name']}}</p></a></li>
+    {% end %}
+</ul>
+{% end %}
+</body>
+</html>

+ 24 - 0
install.py

@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+from demeter.core import *
+
+def manage():
+	model = Demeter.model('manage_admin')
+	model.id = 1
+	info = model.select(type='fetchone')
+	if not info:
+		model.role_id = 1
+		model.username = 'admin'
+		model.mobile = '15810090845'
+		model.password = '123456'
+		model.insert()
+
+	model = Demeter.model('manage_role')
+	model.id = 1
+	info = model.select(type='fetchone')
+	if not info:
+		model.name = u'管理员'
+		model.insert()
+
+manage()
+
+Demeter.echo('install success!')

+ 1 - 0
model/__init__.py

@@ -0,0 +1 @@
+# -*- coding: utf-8 -*-

BIN
model/__init__.pyc


+ 7 - 0
model/__load__.py

@@ -0,0 +1,7 @@
+# -*- coding: utf-8 -*-
+"""
+    demeter database
+    name:__load__.py
+"""
+from demeter.model import *
+from demeter.core import *

BIN
model/__load__.pyc


+ 16 - 0
model/level.py

@@ -0,0 +1,16 @@
+# -*- coding: utf-8 -*-
+"""
+    demeter database
+    name:level.py 等级表
+"""
+from .__load__ import *
+
+class Level(Model):
+	__table__ = 'level'
+	__comment__ = '等级设置表'
+	id = Fields(type='int', primaryKey=True, autoIncrement=True, comment='ID')
+	name = Fields(type='varchar(200)', comment='等级名称')
+	score_id = Fields(type='int', comment='积分id')
+	rule = Fields(type='varchar(800)', comment='等级规则公式')
+	state = Fields(type='boolean', default='True', comment='数据存在状态')
+	cdate = Fields(type='int', default='time', comment='创建时间')

BIN
model/level.pyc


+ 17 - 0
model/record.py

@@ -0,0 +1,17 @@
+# -*- coding: utf-8 -*-
+"""
+    demeter database
+    name:record.py 统计记录表,暂时用数据库
+"""
+from .__load__ import *
+
+class Record(Model):
+	__table__ = 'record'
+	__comment__ = '记录点表'
+	id = Fields(type='int', primaryKey=True, autoIncrement=True, comment='ID')
+	name = Fields(type='varchar(200)', comment='操作名')
+	record_type_id = Fields(type='int', comment='记录类型')
+	uid = Fields(type='int', comment='用户id')
+	ua = Fields(type='varchar(800)', comment='用户的一些常用信息,后续再加字段')
+	state = Fields(type='boolean', default='True', comment='数据存在状态')
+	cdate = Fields(type='int', default='time', comment='创建时间')

BIN
model/record.pyc


+ 15 - 0
model/record_type.py

@@ -0,0 +1,15 @@
+# -*- coding: utf-8 -*-
+"""
+    demeter database
+    name:record_type.py 统计类型记录表,暂时用数据库
+"""
+from .__load__ import *
+
+class Record_type(Model):
+	__table__ = 'record_type'
+	__comment__ = '记录点类型表'
+	id = Fields(type='int', primaryKey=True, autoIncrement=True, comment='ID')
+	name = Fields(type='varchar(200)', comment='操作名')
+	type = Fields(type='int', default='1', comment='操作类型1是浏览2是操作')
+	state = Fields(type='boolean', default='True', comment='数据存在状态')
+	cdate = Fields(type='int', default='time', comment='创建时间')

BIN
model/record_type.pyc


+ 14 - 0
model/score.py

@@ -0,0 +1,14 @@
+# -*- coding: utf-8 -*-
+"""
+    demeter database
+    name:score.py 积分表
+"""
+from .__load__ import *
+
+class Score(Model):
+	__table__ = 'score'
+	__comment__ = '积分设置表'
+	id = Fields(type='int', primaryKey=True, autoIncrement=True, comment='ID')
+	name = Fields(type='varchar(200)', comment='积分名称')
+	state = Fields(type='boolean', default='True', comment='数据存在状态')
+	cdate = Fields(type='int', default='time', comment='创建时间')

BIN
model/score.pyc


+ 17 - 0
model/score_rule.py

@@ -0,0 +1,17 @@
+# -*- coding: utf-8 -*-
+"""
+    demeter database
+    name:score.py 积分表
+"""
+from .__load__ import *
+
+class Score_rule(Model):
+	__table__ = 'score_rule'
+	__comment__ = '积分规则表'
+	id = Fields(type='int', primaryKey=True, autoIncrement=True, comment='ID')
+	score_id = Fields(type='int', comment='积分id')
+	record_type_id = Fields(type='int', comment='记录点类型id')
+	uid = Fields(type='varchar(200)', comment='用户id,特殊积分')
+	rule = Fields(type='varchar(800)', comment='积分规则公式')
+	state = Fields(type='boolean', default='True', comment='数据存在状态')
+	cdate = Fields(type='int', default='time', comment='创建时间')

BIN
model/score_rule.pyc


+ 15 - 0
opt.py

@@ -0,0 +1,15 @@
+# -*- coding: utf-8 -*-
+"""
+    demeter web
+    name:front.py
+"""
+from demeter.core import *
+
+# 测试命令行传参 python opt.py -a act
+param = {}
+param['action'] = 'a'
+param['name'] = 'n'
+param['param'] = 'p'
+Demeter.getopt(param)
+
+Demeter.echo(Demeter.option['action'])

+ 6 - 0
runtime/__init__.py

@@ -0,0 +1,6 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+"""
+    demeter init
+    author:rabin
+"""

+ 1 - 0
runtime/mysql/level

@@ -0,0 +1 @@
+[["name", 1], ["cdate", 1], ["rule", 1], ["state", 1], ["score_id", 1], ["id", 1]]

+ 1 - 0
runtime/mysql/manage_admin

@@ -0,0 +1 @@
+[["username", 1], ["mobile", 1], ["cdate", 1], ["role_id", 1], ["state", 1], ["password", 1], ["id", 1]]

+ 1 - 0
runtime/mysql/manage_log

@@ -0,0 +1 @@
+[["cdate", 1], ["admin_id", 1], ["method", 1], ["state", 1], ["model", 1], ["data", 1], ["id", 1]]

+ 1 - 0
runtime/mysql/manage_role

@@ -0,0 +1 @@
+[["oper", 1], ["name", 1], ["top", 1], ["state", 1], ["auth", 1], ["cdate", 1], ["id", 1]]

+ 1 - 0
runtime/mysql/record

@@ -0,0 +1 @@
+[["record_type_id", 1], ["name", 1], ["cdate", 1], ["state", 1], ["ua", 1], ["id", 1], ["uid", 1]]

+ 1 - 0
runtime/mysql/record_type

@@ -0,0 +1 @@
+[["type", 1], ["state", 1], ["cdate", 1], ["name", 1], ["id", 1]]

+ 1 - 0
runtime/mysql/score

@@ -0,0 +1 @@
+[["record_type_id", 1], ["name", 1], ["cdate", 1], ["rule", 1], ["state", 1], ["id", 1], ["uid", 1]]

+ 1 - 0
runtime/mysql/score_rule

@@ -0,0 +1 @@
+[["record_type_id", 1], ["uid", 1], ["cdate", 1], ["rule", 1], ["state", 1], ["score_id", 1], ["id", 1]]