Example #1
0
 def checkTimeOut(self, msg, nTimeOut=600, nTimeNow=-1):
     #时间校检, 十分钟内缓存数据有效(过早时间数据忽略)
     msgTime = msg.get('time', -1)
     if (nTimeNow < 0): nTimeNow = myData_Trans.Tran_ToTime_int()
     if (abs(msgTime - nTimeNow) >= 600):
         myDebug.Warnning("已超时::", nTimeNow, ",", msgTime)
         return True
     return False
Example #2
0
    def init_MQ(self, bStart=False):
        #初始消息接收队列
        self.mqName = 'zxcMQ_usrWin'
        if (self.mqRecv == None):
            self.mqRecv = myMQ_Rabbit.myMQ_Rabbit(False)
            self.mqRecv.Init_Queue(self.mqName, True)
            self.mqRecv.Init_callback_RecvMsg(self.callback_RecvMsg)  #消息接收回调
            myDebug.Print("消息队列(" + self.mqName + ")创建成功...")

        #接收消息
        if (bStart):
            self.mqRecv.Start()
            self.mqTimeNow = myData_Trans.Tran_ToTime_int()  #接收开始时间
Example #3
0
    def Init_MQ(self, bStart=False):
        if (gol._Get_Value("msgSet_usrMQ", False) == False):
            self.Init_Swap(bStart)
            return

        #初始消息接收队列
        self.mqName = 'zxcMQ_wx'
        if (self.mqRecv == None):
            self.mqRecv = myMQ_Rabbit.myMQ_Rabbit(False)
            self.mqRecv.Init_Queue(self.mqName, True)
            self.mqRecv.Init_callback_RecvMsg(self.callback_RecvMsg)  #消息接收回调
            myDebug.Print("消息队列(" + self.mqName + ")创建成功...")

        #接收消息
        if (bStart):
            self.mqRecv.Start()
            self.mqTimeNow = myData_Trans.Tran_ToTime_int()  #接收开始时间
Example #4
0
    def Init_Swap(self, bStart=False):
        #初始消息接收-Swap
        self.swapName = 'zxcSwap_wx'
        if (self.swapRecv == None):
            self.swapRecv = gol._Get_Value('dataSwap_msgWx')
            self.swapOut = gol._Get_Value('dataSwap_msgWx_out')

            @self.swapRecv.changeDataSwap()
            def Reply(lstData):
                for x in lstData:
                    if (self.Done_Swap(x)):
                        self.swapRecv.ackDataSwap(x)
                    pass

            myDebug.Print("消息Swap(" + self.swapName + ")创建成功...")

        #接收消息
        if (bStart):
            self.swapOut.startSwap()
            self.swapRecv.startSwap()
            self.mqTimeNow = myData_Trans.Tran_ToTime_int()  #接收开始时间
Example #5
0
 def OnCreatMsg(self, bCreatTime=True):
     msg = copy.deepcopy(self.msgExramp)
     if (bCreatTime):
         msg['time'] = myData_Trans.Tran_ToTime_int()
     return msg