Exemple #1
0
    def get(self):
        servicecode = "ivr-lbxz1002-2"
        try:
            remote_ip = self.request.remote_ip

            mobile = self.get_argument("mobile", None)
            orderdest = self.get_argument("spnumber", None)
            ivrtotal = self.get_argument("validtime", None)
            linkid = self.get_argument("linkid", None);
            ivrtotal = lang.num(ivrtotal)
            endtime = "1"
            starttime = "1"
            serviceOrderId = linkid

            msg = dict(
                serviceOrderId=serviceOrderId,
                servicecode=servicecode,
                status=1,
                statusstring='',
                mobile=mobile,
                orderdest=orderdest,
                starttime=starttime,
                endtime=endtime,
                ivrtotal=ivrtotal,
                ivrunit=60,
            )

            orderlog.info("receive:[%s],[%s],[%s],ok" % (serviceOrderId, servicecode, self.request.query))
            unionapi.serviceProcess(msg)
        except:
            orderlog.error("receive:[%s],[%s],[%s],err" % (servicecode, self.request.query, lang.trace_back()))
        finally:
            self.finish('OK')
Exemple #2
0
    def get(self):
        status = 1
        try:
            remote_ip = self.request.remote_ip
            # if remote_ip != '211.151.66.84' and remote_ip != '127.0.0.1':
            #     log.info("[%s], errorip:[%s], query:[%s]" % ('ivr-zyhl1001-2,5', remote_ip, self.request.query))
            #     self.write('')
            #     return
            linkid = self.get_argument("Linkid", None)
            cmdid = self.get_argument("MO_Msg", None)
            mobile = self.get_argument("statphone", None)
            status = self.get_argument("stat", None)
            starttime = lang.now()
            endtime = starttime

            if cmdid == '02042':
                servicecode = "smsdb-gzyh1001-1"
            else:
                orderlog.info("receive:[%s],[%s],[%s],[%s],[%s],error" % (
                    linkid, 0, servicecode, self.request.uri, self.request.query))
                return
            status = 1 if status == 'DELIVRD' else 0
            if status != 1:
                orderlog.info("receive:[%s],[%s],[%s],[%s],[%s],error" % (
                    linkid, 0, servicecode, self.request.uri, self.request.query))
                return

            serviceOrderId = lang.uuid()
            msg = dict(
                serviceOrderId=serviceOrderId,
                servicecode=servicecode,
                status=status,
                statusstring='',
                mobile=mobile,
                starttime=starttime,
                endtime=endtime,
                ivrtotal=1,
            )

            orderlog.info("receive:[%s],[%s],[%s],[%s],[%s],ok" % (
                linkid, serviceOrderId, servicecode, self.request.uri, self.request.query))
            unionapi.serviceProcess(msg)

        except:
            orderlog.error("receive:[%s],[%s],err: %s" % (self.request.uri, self.request.query, lang.trace_back()))
            self.finish("0")
        finally:
            self.finish('ok')
Exemple #3
0
    def post(self):
        servicecode = "ivr-lbxz1002"
        content = self.request.body
        try:
            remote_ip = self.request.remote_ip
            if remote_ip != '221.174.25.62' and remote_ip != '221.174.25.59' and remote_ip != '127.0.0.1':
                log.info("[%s], errorip:[%s], query:[%s]" % (servicecode, remote_ip, content))
                self.write('')
                return

            ssock = StringIO.StringIO(content)
            xmldoc = minidom.parse(ssock)
            ssock.close()
            callNum = xmldoc.getElementsByTagName('callNum')[0].firstChild.data
            calledNum = xmldoc.getElementsByTagName('calledNum')[0].firstChild.data
            #serviceId = xmldoc.getElementsByTagName('serviceId')[0].firstChild.data
            #fee = xmldoc.getElementsByTagName('fee')[0].firstChild.data
            #tradeId = xmldoc.getElementsByTagName('tradeId')[0].firstChild.data
            tradeId = lang.uuid()
            startTime = xmldoc.getElementsByTagName('startTime')[0].firstChild.data
            starttime = datetime.datetime.strptime(startTime, '%Y%m%d%H%M%S')
            endTime = xmldoc.getElementsByTagName('endTime')[0].firstChild.data
            endtime = datetime.datetime.strptime(endTime, '%Y%m%d%H%M%S')
            #md5str = xmldoc.getElementsByTagName('md5')[0].firstChild.data
            #siteType = xmldoc.getElementsByTagName('siteType')[0].firstChild.data
            #serviceKey = '3ecdad1d-40e0-4a5e-bc85-e35b649ef9a7'
            #verify = hashlib.md5('%s%s%s' % (callNum, endTime, serviceKey)).hexdigest()

            msg = dict(
                serviceOrderId=tradeId,
                servicecode=servicecode,
                status=1,
                statusstring='',
                mobile=callNum,
                orderdest=calledNum,
                starttime=starttime,
                endtime=endtime,
                ivrtotal=30,
                ivrunit=60,
            )
            orderlog.info("receive:[%s],[%s],[%s],[%s],ok" % (tradeId, servicecode, self.request.uri, content))
            unionapi.serviceProcess(msg)
        except:
            orderlog.error("receive:[%s],[%s],[%s],err" % (servicecode, content, lang.trace_back()))
        finally:
            self.finish('<?xml version = "1.0" encoding="utf-8"?><spserviceresp><status>ok</status></spserviceresp>')
Exemple #4
0
    def get(self):
        servicecode = "ivr-hnxl1003"
        try:
            report = self.get_argument("report", None)
            if (report != 'DELIVRD'):
                return

            mobile = self.get_argument("mobile", None)
            orderdest = self.get_argument("spnum", None)
            momsg = self.get_argument("msg", None)
            if len(momsg) > 5:
                momsg = momsg[5:]
            else:
                momsg = '0'
            orderdest = orderdest + momsg
            ivrtotal = 30
            endtime = datetime.datetime.now()
            endtime = endtime.strftime('%Y-%m-%d %H:%M:%S')
            starttime = datetime.datetime.now()
            starttime = starttime.strftime('%Y-%m-%d %H:%M:%S')
            serviceOrderId = lang.uuid()

            msg = dict(
                serviceOrderId=serviceOrderId,
                servicecode=servicecode,
                status=1,
                statusstring='',
                mobile=mobile,
                orderdest=orderdest,
                starttime=starttime,
                endtime=endtime,
                ivrtotal=ivrtotal,
                ivrunit=9999,
            )

            orderlog.info(
                "receive:[%s],[%s],[%s],[%s],ok" % (serviceOrderId, servicecode, orderdest, self.request.query))
            unionapi.serviceProcess(msg)
        except:
            orderlog.error("receive:[%s],[%s],[%s],err" % (servicecode, self.request.query, lang.trace_back()))
        finally:
            self.finish('OK')
Exemple #5
0
    def get(self):
        servicecode = "ivr-hnjl1003"
        status = 1
        try:
            remote_ip = self.request.remote_ip
            # if remote_ip != '211.151.66.84' and remote_ip != '127.0.0.1':
            #     log.info("[%s], errorip:[%s], query:[%s]" % (servicecode, remote_ip, self.request.query))
            #     self.write('')
            #     return

            mobile = self.get_argument("mobile", None)
            orderdest = self.get_argument("lnum", None)
            starttime = self.get_argument("starttime", None)
            endtime = self.get_argument("endtime", None)
            ivrtotal = self.get_argument("lmin", None)
            ivrtotal = lang.num(ivrtotal)
            serviceOrderId = lang.uuid()
            msg = dict(
                serviceOrderId=serviceOrderId,
                servicecode=servicecode,
                status=status,
                statusstring='',
                mobile=mobile,
                orderdest=orderdest,
                starttime=starttime,
                endtime=endtime,
                ivrtotal=ivrtotal,
            )

            orderlog.info(
                "receive:[%s],[%s],[%s],[%s],ok" % (serviceOrderId, servicecode, self.request.uri, self.request.query))
            unionapi.serviceProcess(msg)

        except:
            orderlog.error("receive:[%s],[%s],err" % (self.request.uri, self.request.query))
            self.finish("0")
        finally:
            self.finish('ok')
Exemple #6
0
    def get(self):
        status = 1
        try:
            remote_ip = self.request.remote_ip
            # if remote_ip != '211.151.66.84' and remote_ip != '127.0.0.1':
            #     log.info("[%s], errorip:[%s], query:[%s]" % ('ivr-zyhl1001-2,5', remote_ip, self.request.query))
            #     self.write('')
            #     return
            linkid = self.get_argument("linkid", None)
            cmdid = self.get_argument("cmdid", None)
            mobile = self.get_argument("mobileid", None)
            status = self.get_argument("state", None)
            starttime = lang.now()
            endtime = starttime

            if cmdid == 'HYT':
                servicecode = "smsdb-zyhl1001-2-1"
            elif cmdid == 'HYT2':
                servicecode = "smsdb-zyhl1001-2"
            elif cmdid == 'DMT2':
                servicecode = "smsdb-zyhl1001-5"
            elif cmdid == 'DMT4':
                servicecode = "smsdb-zyhl1001-5-2"
            elif cmdid == 'DMT5':
                servicecode = "smsdb-zyhl1001-5-3"
            elif cmdid == 'DMT6':
                servicecode = "smsdb-zyhl1001-5-4"
            elif cmdid == 'DMM4':
                servicecode = "smsdb-zyhl1001-5-5"
            elif cmdid == 'DMM3':
                servicecode = "smsdb-zyhl1001-5-6"
            elif cmdid == 'HYM3':
                servicecode = "smsdb-zyhl1001-2-2"
            elif cmdid == 'HYM4':
                servicecode = "smsdb-zyhl1001-2-3"
            elif cmdid == 'HYM5':
                servicecode = "smsdb-zyhl1001-2-4"
            elif cmdid == 'DMD1':
                servicecode = "smsdb-zyhl1001-5-7"
            elif cmdid == 'DMD2':
                servicecode = "smsdb-zyhl1001-5-8"
            elif cmdid == 'HYM9':
                servicecode = "smsdb-zyhl1001-2-5"
            elif cmdid == 'DMD3':
                servicecode = "smsdb-zyhl1001-5-9"
            elif cmdid == 'DMD4':
                servicecode = "smsdb-zyhl1001-5-10"
            elif cmdid == 'DMD5':
                servicecode = "smsdb-zyhl1001-5-11"
            elif cmdid == 'DMD6':
                servicecode = "smsdb-zyhl1001-5-12"
            elif cmdid == 'DMD7':
                servicecode = "smsdb-zyhl1001-5-13"
            elif cmdid == 'HYG1':
                servicecode = "smsdb-zyhl1001-2-6"
            elif cmdid == 'HYG2':
                servicecode = "smsdb-zyhl1001-2-7"
            elif cmdid == 'DMG1':
                servicecode = "smsdb-zyhl1001-5-14"
            elif cmdid == 'DMG2':
                servicecode = "smsdb-zyhl1001-5-15"
            elif cmdid == 'DMG3':
                servicecode = "smsdb-zyhl1001-5-16"
            elif cmdid == 'DMG4':
                servicecode = "smsdb-zyhl1001-5-17"
            elif cmdid == 'DMG5':
                servicecode = "smsdb-zyhl1001-5-18"
            elif cmdid == 'DMG6':
                servicecode = "smsdb-zyhl1001-5-19"
            elif cmdid == 'DMG7':
                servicecode = "smsdb-zyhl1001-5-20"
            elif cmdid == 'DMG8':
                servicecode = "smsdb-zyhl1001-5-21"
            elif cmdid == 'DMG9':
                servicecode = "smsdb-zyhl1001-5-22"
            elif cmdid == 'DMA1':
                servicecode = "smsdb-zyhl1001-5-23"
            elif cmdid == 'DMA2':
                servicecode = "smsdb-zyhl1001-5-24"
            elif cmdid == 'DMA3':
                servicecode = "smsdb-zyhl1001-5-25"
            else:
                orderlog.info("receive:[%s],[%s],[%s],[%s],[%s],error" % (
                    linkid, 0, servicecode, self.request.uri, self.request.query))
                return
            status = 1 if status == 'DELIVRD' else 0
            if status != 1:
                orderlog.info("receive:[%s],[%s],[%s],[%s],[%s],error" % (
                    linkid, 0, servicecode, self.request.uri, self.request.query))
                return

            serviceOrderId = lang.uuid()
            msg = dict(
                serviceOrderId=serviceOrderId,
                servicecode=servicecode,
                status=status,
                statusstring='',
                mobile=mobile,
                starttime=starttime,
                endtime=endtime,
                ivrtotal=1,
            )

            orderlog.info("receive:[%s],[%s],[%s],[%s],[%s],ok" % (
                linkid, serviceOrderId, servicecode, self.request.uri, self.request.query))
            unionapi.serviceProcess(msg)

        except:
            orderlog.error("receive:[%s],[%s],err: %s" % (self.request.uri, self.request.query, lang.trace_back()))
        finally:
            self.finish('1')