12345678910111213141516171819202122232425262728293031323334353637383940 |
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- """
- demeter service
- name:record_msg.py 处理消息数据
- author:rabin
- key:msg/type_key/farm_id/uid
- """
- import time
- import json
- from demeter.core import *
- class Record_msg(object):
- def handle(self, record, config, value):
- model = Demeter.model('msg_type')
- model.key = config['type']
- msg_type = model.select(type='fetchone')
- if msg_type:
- data = value.split('||')
- model = Demeter.model('msg')
- model.farm_id = config['parent']
- model.uid = config['child']
- model.type_id = config['type']
- model.content = data[0]
- model.link = data[1]
- if not data[2]:
- data[2] = msg_type['push']
- model.push = data[2]
- if 'sms' in model.push:
- self.sendSms(model)
- if 'weixin' in model.push:
- self.sendWeixin(model)
- id = model.insert()
- def sendSms(self, model):
- return
- def sendWeixin(self, model):
- return
-
|