电脑音箱和耳机可以同时插在机箱后面吗
7个回答
展开全部
# -*- coding: utf-8 -*-
import hashlib
import web
import lxml
import time
import os
import urllib2,json
from lxml import etree
import MySQLdb
import os
import sys
import string
import sae.const
class WeixinInterface:
def __init__(self):
self.app_root = os.path.dirname(__file__)
self.templates_root = os.path.join(self.app_root, 'templates')
self.render = web.template.render(self.templates_root)
def GET(self):
#获取输入参数
conn=MySQLdb.connect(host=sae.const.MYSQL_HOST,user=sae.const.MYSQL_USER,passwd=sae.const.MYSQL_PASS,db=sae.const.MYSQL_DB,port=int(sae.const.MYSQL_PORT),charset='utf8')
cur=conn.cursor()#cursorclass=MySQLdb.cursors.DictCursor)
cur.execute("select light from test where id = 1" ) #为游标建立查询
lst=cur.fetchall()
n=lst[0][0]
return n
def GET(self):
#获取输入参数
data = web.input()
signature=data.signature
timestamp=data.timestamp
nonce=data.nonce
echostr=data.echostr
#自己的token
token="weixin" #这里改写你在微信公众平台里输入的token
#字典序排序
list=[token,timestamp,nonce]
list.sort()
sha1=hashlib.sha1()
map(sha1.update,list)
hashcode=sha1.hexdigest()
#sha1加密算法
#如果是来自微信的请求,则回复echostr
if hashcode == signature:
return echostr
def POST(self):
str_xml=web.data() #获得post来的数据
xml=etree.fromstring(str_xml)#进行XML解析
#content=xml.find("Content").text#获得用户所输入的内容
msgType=xml.find("MsgType").text
fromUser=xml.find("FromUserName").text
toUser=xml.find("ToUserName").text
curr.execute("select id, name from nlist")
dd = dict([ name in curr])
if msgType=='text':
content=xml.find("Content").text
if content=='open':
conn=MySQLdb.connect(host=sae.const.MYSQL_HOST,user=sae.const.MYSQL_USER,passwd=sae.const.MYSQL_PASS,db=sae.const.MYSQL_DB,port=int(sae.const.MYSQL_PORT),charset='utf8')
cur=conn.cursor()
# cur.execute("select light from test where id = 1" ) #为游标建立查询
cur.execute("update test set light= "+ `1` +" where id = 1 ")
conn.commit()
conn.close()
return self.render.reply_text(fromUser, toUser, int(time.time()),"您已下达开启命令,灯将会在3秒内完成操作")
if content=='close':
conn=MySQLdb.connect(host=sae.const.MYSQL_HOST,user=sae.const.MYSQL_USER,passwd=sae.const.MYSQL_PASS,db=sae.const.MYSQL_DB,port=int(sae.const.MYSQL_PORT),charset='utf8')
cur=conn.cursor()
# cur.execute("select light from test where id = 1" ) #为游标建立查询
cur.execute("update test set light= "+ `0` +" where id = 1 ")
conn.commit()
conn.close()
return self.render.reply_text(fromUser, toUser, int(time.time()),"您已下达关闭命令,灯将会在3秒内完成操作")
if content=='search':
conn=MySQLdb.connect(host=sae.const.MYSQL_HOST,user=sae.const.MYSQL_USER,passwd=sae.const.MYSQL_PASS,db=sae.const.MYSQL_DB,port=int(sae.const.MYSQL_PORT),charset='utf8')
cur=conn.cursor()#cursorclass=MySQLdb.cursors.DictCursor)
cur.execute("select light from test where id = 1" ) #为游标建立查询
lst=cur.fetchall()
n=lst[0][0]
if n==1:
return self.render.reply_text(fromUser, toUser, int(time.time()), "您所查询的灯现在的状态是开着的")
else:
return self.render.reply_text(fromUser, toUser, int(time.time()), "您所查询的灯现在的状态是关着的")
else:
return self.render.reply_text(fromUser, toUser, int(time.time()), "哎呀请您输入open,close或search来执行操作~")
if msgType=='event':
if xml.find("Event").text=='subscribe':#关注的时候的欢迎语
return self.render.reply_text(fromUser, toUser, int(time.time()), u"欢迎使用智能控制微信号")
import hashlib
import web
import lxml
import time
import os
import urllib2,json
from lxml import etree
import MySQLdb
import os
import sys
import string
import sae.const
class WeixinInterface:
def __init__(self):
self.app_root = os.path.dirname(__file__)
self.templates_root = os.path.join(self.app_root, 'templates')
self.render = web.template.render(self.templates_root)
def GET(self):
#获取输入参数
conn=MySQLdb.connect(host=sae.const.MYSQL_HOST,user=sae.const.MYSQL_USER,passwd=sae.const.MYSQL_PASS,db=sae.const.MYSQL_DB,port=int(sae.const.MYSQL_PORT),charset='utf8')
cur=conn.cursor()#cursorclass=MySQLdb.cursors.DictCursor)
cur.execute("select light from test where id = 1" ) #为游标建立查询
lst=cur.fetchall()
n=lst[0][0]
return n
def GET(self):
#获取输入参数
data = web.input()
signature=data.signature
timestamp=data.timestamp
nonce=data.nonce
echostr=data.echostr
#自己的token
token="weixin" #这里改写你在微信公众平台里输入的token
#字典序排序
list=[token,timestamp,nonce]
list.sort()
sha1=hashlib.sha1()
map(sha1.update,list)
hashcode=sha1.hexdigest()
#sha1加密算法
#如果是来自微信的请求,则回复echostr
if hashcode == signature:
return echostr
def POST(self):
str_xml=web.data() #获得post来的数据
xml=etree.fromstring(str_xml)#进行XML解析
#content=xml.find("Content").text#获得用户所输入的内容
msgType=xml.find("MsgType").text
fromUser=xml.find("FromUserName").text
toUser=xml.find("ToUserName").text
curr.execute("select id, name from nlist")
dd = dict([ name in curr])
if msgType=='text':
content=xml.find("Content").text
if content=='open':
conn=MySQLdb.connect(host=sae.const.MYSQL_HOST,user=sae.const.MYSQL_USER,passwd=sae.const.MYSQL_PASS,db=sae.const.MYSQL_DB,port=int(sae.const.MYSQL_PORT),charset='utf8')
cur=conn.cursor()
# cur.execute("select light from test where id = 1" ) #为游标建立查询
cur.execute("update test set light= "+ `1` +" where id = 1 ")
conn.commit()
conn.close()
return self.render.reply_text(fromUser, toUser, int(time.time()),"您已下达开启命令,灯将会在3秒内完成操作")
if content=='close':
conn=MySQLdb.connect(host=sae.const.MYSQL_HOST,user=sae.const.MYSQL_USER,passwd=sae.const.MYSQL_PASS,db=sae.const.MYSQL_DB,port=int(sae.const.MYSQL_PORT),charset='utf8')
cur=conn.cursor()
# cur.execute("select light from test where id = 1" ) #为游标建立查询
cur.execute("update test set light= "+ `0` +" where id = 1 ")
conn.commit()
conn.close()
return self.render.reply_text(fromUser, toUser, int(time.time()),"您已下达关闭命令,灯将会在3秒内完成操作")
if content=='search':
conn=MySQLdb.connect(host=sae.const.MYSQL_HOST,user=sae.const.MYSQL_USER,passwd=sae.const.MYSQL_PASS,db=sae.const.MYSQL_DB,port=int(sae.const.MYSQL_PORT),charset='utf8')
cur=conn.cursor()#cursorclass=MySQLdb.cursors.DictCursor)
cur.execute("select light from test where id = 1" ) #为游标建立查询
lst=cur.fetchall()
n=lst[0][0]
if n==1:
return self.render.reply_text(fromUser, toUser, int(time.time()), "您所查询的灯现在的状态是开着的")
else:
return self.render.reply_text(fromUser, toUser, int(time.time()), "您所查询的灯现在的状态是关着的")
else:
return self.render.reply_text(fromUser, toUser, int(time.time()), "哎呀请您输入open,close或search来执行操作~")
if msgType=='event':
if xml.find("Event").text=='subscribe':#关注的时候的欢迎语
return self.render.reply_text(fromUser, toUser, int(time.time()), u"欢迎使用智能控制微信号")
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
可以的。
只是机箱后面一般都只有一个音频输出孔,你怎么插呢?
只是机箱后面一般都只有一个音频输出孔,你怎么插呢?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询