当前位置: 首页>>代码示例>>Python>>正文


Python SMSHelper.send_update_to_terminal方法代码示例

本文整理汇总了Python中helpers.smshelper.SMSHelper.send_update_to_terminal方法的典型用法代码示例。如果您正苦于以下问题:Python SMSHelper.send_update_to_terminal方法的具体用法?Python SMSHelper.send_update_to_terminal怎么用?Python SMSHelper.send_update_to_terminal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在helpers.smshelper.SMSHelper的用法示例。


在下文中一共展示了SMSHelper.send_update_to_terminal方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: post

# 需要导入模块: from helpers.smshelper import SMSHelper [as 别名]
# 或者: from helpers.smshelper.SMSHelper import send_update_to_terminal [as 别名]
    def post(self):
        status = ErrorCode.SUCCESS
        try:
            data = json_decode(self.request.body)
            logging.info("[LOG] message request: %s", data)
            sms_type = data.get('sms_type')
            tmobile = data.get('tmobile')
            content = ''
            if check_phone(tmobile) is None:
                status = ErrorCode.ILLEGAL_MOBILE
                self.write_ret(status)
            else:
                if sms_type == 'JH':
                    umobile = data.get('umobile')
                    if check_phone(umobile):
                        content = ':SIM' + ' ' + umobile + ':' + tmobile
                        SMSHelper.send_to_terminal(tmobile, content)
                        self.write_ret(status)
                    else:
                        status = ErrorCode.ILLEGAL_MOBILE
                        self.write_ret(status)
                elif sms_type == 'JB':
                    content = ':' + sms_type
                    is_clear = data.get('is_clear')
                    ret = SMSHelper.send_to_terminal(tmobile, content)
                    ret = json_decode(ret)
                    terminal = self.acbdb.get("SELECT id, tid, owner_mobile, login"
                                              "  FROM T_TERMINAL_INFO"
                                              "  WHERE mobile = %s"
                                              "    AND service_status = 1",
                                              tmobile)
                    if not terminal:
                        status = ErrorCode.TERMINAL_NOT_EXISTED
                        logging.error("The terminal with tmobile: %s does not exist!", 
                                      tmobile)
                        self.write_ret(status)
                        return
                    umobile = terminal.owner_mobile

                    if ret['status'] == 0:
                        self.acbdb.execute("UPDATE T_TERMINAL_INFO"
                                           "  SET service_status = 2"
                                           "  WHERE mobile = %s",
                                           tmobile)
                        # terminals = self.acbdb.query("SELECT id FROM T_TERMINAL_INFO"
                        #                              "  WHERE owner_mobile = %s"
                        #                              "    AND service_status = 1",
                        #                              umobile)
                        # clear user
                        # if len(terminals) == 0:
                        #    self.acbdb.execute("DELETE FROM T_USER"
                        #                        "  WHERE mobile = %s",
                        #                        umobile)
                    if is_clear == 1:
                        clear_data(terminal['tid'], self.acbdb, self.redis)
                    self.write_ret(status)

                elif sms_type == 'CQ':
                    content = ':' + sms_type
                    SMSHelper.send_to_terminal(tmobile, content)
                    self.write_ret(status)
                elif sms_type == 'REBOOT':
                    content = ':' + sms_type
                    # SMSHelper.send_to_terminal(tmobile,content)
                    SMSHelper.send_update_to_terminal(tmobile, content)
                    self.write_ret(status)
                elif sms_type == 'TEST':
                    content = u'尊敬的顾客,您好:这是一条测试短信,收到本条短信,说明短信提示服务正常,本短信不需要回复,如有问题,请和客服人员联系。感谢使用我们的产品,您的移动卫士。'
                    SMSHelper.send(tmobile, content)
                    self.write_ret(status)
                elif sms_type == 'KQLY':
                    content = ':%s 30' % sms_type
                    SMSHelper.send_to_terminal(tmobile, content)
                    self.write_ret(status)
                elif sms_type == 'LQGZ':
                    content = ':%s 30' % sms_type
                    SMSHelper.send_to_terminal(tmobile, content)
                    self.write_ret(status)
                elif sms_type == 'DW':
                    content = ':' + sms_type
                    SMSHelper.send_to_terminal(tmobile, content)
                    self.write_ret(status)

                elif sms_type == 'UPDATE':
                    content = ':' + sms_type
                    SMSHelper.send_update_to_terminal(tmobile, content)
                    self.write_ret(status)

                elif sms_type == 'DEL':
                    terminal = self.acbdb.get(
                        'SELECT tid FROM T_TERMINAL_INFO WHERE mobile=%s', tmobile)
                    if terminal:
                        delete_terminal(
                            terminal.tid, self.acbdb, self.redis, del_user=False)
                    self.write_ret(status)

                elif sms_type == 'DOMAIN':
                    ip = data.get('domain')
                    content = ':DOMAIN ' + ip
                    info = self.acbdb.get(
#.........这里部分代码省略.........
开发者ID:jcsy521,项目名称:ydws,代码行数:103,代码来源:message.py


注:本文中的helpers.smshelper.SMSHelper.send_update_to_terminal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。