123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- # -*- coding: utf-8 -*-
- """
- demeter web page
- name:main.py
- author:rabin
- """
- from .__load__ import *
- import json
- class Core(object):
- @staticmethod
- def check(self):
- pass
- # 同步数据
- class sync_path(Load):
- @Web.setting
- def post(self):
- Core.check(self)
- data = self.input('data')
- data = json.loads(data)
- table = self.input('table')
- if data:
- for v in data:
- update = {}
- info = self.service('common').one(table, id=v['id'])
- if info:
- id = v['id']
- del v['cdate']
- if 'udate' in v:
- del v['udate']
- del v['id']
- for i in v:
- if v[i]:
- update[i] = v[i]
- self.service('common').update(table, id, update, cdate=False)
- else:
- del v['cdate']
- if 'udate' in v:
- del v['udate']
- for i in v:
- if v[i]:
- update[i] = v[i]
- self.service('common').update(table, False, update)
-
- self.out('ok')
|