コード例 #1
0
ファイル: views.py プロジェクト: wangjc888/Xiangeqwd
def createMenu(request):
	
	wechat = WechatBasic(appid='wxacfdb1da76aa7763', appsecret='0f0f71dbff7dbde3e3b07897ddd8f78b')
	wechat.create_menu(
		{
		'button':[
			{
				'type': 'view',
				'name': '家家订餐',
				'url': 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxacfdb1da76aa7763&redirect_uri=http%3A%2F%2Fxiangeqwd.9xi.com%2FDiningServer%2Findex%2F&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect'
			},
			{
				'type': 'view',
				'name': '送餐信息',
				'url': 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxacfdb1da76aa7763&redirect_uri=http%3A%2F%2Fxiangeqwd.9xi.com%2FDiningServer%2FlistMyDetailInfoPage%2F&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect'
			},
			{
				'type': 'view',
				'name': '我的订单',
				'url': 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxacfdb1da76aa7763&redirect_uri=http%3A%2F%2Fxiangeqwd.9xi.com%2FDiningServer%2FgetOrdersByType%2F&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect'
			},
				]
		}
	
	)
コード例 #2
0
def update_menu():
    """
    目前仅用作在pyhton shell中调用
    """
    wechat = WechatBasic(appid=APP_ID, appsecret=APP_SECRET)
    # logger.info(wechat.get_menu())
    # 删除当前菜单
    # wechat.delete_menu()
    # 创建菜单
    wechat.create_menu({
        'button': [
            {
                'type': 'view',
                'name': u'排队',
                'url': get_auth_url_without_confirm('#/queue'),
            },
            {
                'type': 'view',
                'name': u'点菜',
                'url': get_auth_url_without_confirm('#/menu'),
            },
            # {
            #     'type': 'view',
            #     'name': u'图片',
            #     'url': get_auth_url_without_confirm('#/photo/index'),
            # },
            # {
            #     'name': '菜单',
            #     'sub_button': [
            #         {
            #             'type': 'view',
            #             'name': '视频',
            #             'url': 'http://v.qq.com/'
            #         },
            #         {
            #             'type': 'click',
            #             'name': '赞一下我们',
            #             'key': 'V1001_GOOD'
            #         }
            #     ]
            # }
        ]
    })
コード例 #3
0
ファイル: utils.py プロジェクト: diankuai/dian-server
def update_menu():
    """
    目前仅用作在pyhton shell中调用
    """
    wechat = WechatBasic(appid=APP_ID, appsecret=APP_SECRET)
    # logger.info(wechat.get_menu())
    # 删除当前菜单
    # wechat.delete_menu()
    # 创建菜单
    wechat.create_menu({
    'button':[
        {
            'type': 'view',
            'name': u'排队',
            'url': get_auth_url_without_confirm('#/queue'),
        },
        {
            'type': 'view',
            'name': u'点菜',
            'url': get_auth_url_without_confirm('#/menu'),
        },
        # {
        #     'type': 'view',
        #     'name': u'图片',
        #     'url': get_auth_url_without_confirm('#/photo/index'),
        # },
        # {
        #     'name': '菜单',
        #     'sub_button': [
        #         {
        #             'type': 'view',
        #             'name': '视频',
        #             'url': 'http://v.qq.com/'
        #         },
        #         {
        #             'type': 'click',
        #             'name': '赞一下我们',
        #             'key': 'V1001_GOOD'
        #         }
        #     ]
        # }
    ]})
コード例 #4
0
ファイル: weixin.py プロジェクト: zguangyu/youdu
def weixin_init(request):
    wechat = WechatBasic(appid=settings.WECHAT_APPID,
                         appsecret=settings.WECHAT_APPSECRET)
    ret = wechat.create_menu(MENU)
    return HttpResponse(ret)
コード例 #5
0
ファイル: config.py プロジェクト: pengshp/green
    auto_reply = TulingAutoReply(tuling_key, tuling_url)
else:
    auto_reply = DefaultAutoReply()

mongo = MongoUtil(db_ip='localhost', db_name=mongo_db_name)

wx_conf = WechatConf(token=wx_token,
                     appid=wx_appid,
                     appsecret=wx_secrert,
                     encrypt_mode=wx_mode)
wechat = WechatBasic(conf=wx_conf)

with open("menu.json") as f:
    menu_str = f.read()
    js = json.loads(menu_str)
    wechat.delete_menu()
    wechat.create_menu(js)

from handle import *

web_handlers = [
    (r'/', common.Index),
    (r'/wx', wx.WX),
    (r"/(favicon\.ico)", tornado.web.StaticFileHandler, {
        "path": os.path.join(os.path.dirname(__file__), "static")
    }),
    (r"/(.*\.html)", tornado.web.StaticFileHandler, {
        "path": "static/"
    }),
]
コード例 #6
0
ファイル: config.py プロジェクト: WesleyDevLab/green
if max_host_count is None:
    max_host_count = 3

auto_reply = None
if auto_reply_mode and tuling_key is not None and tuling_url is not None:
    auto_reply = TulingAutoReply(tuling_key, tuling_url)  # tuling reply
else:
    auto_reply = DefaultAutoReply()  # reply none

mongo = MongoUtil(db_ip='localhost', db_name=mongo_db_name)

wx_conf = WechatConf(token=wx_token, appid=wx_appid, appsecret=wx_secrert, encrypt_mode=wx_mode)
wechat = WechatBasic(conf=wx_conf)

with open("menu.json") as f:
    menu_str = f.read()
    js = json.loads(menu_str)
    wechat.delete_menu()
    wechat.create_menu(js)


from handle import *

web_handlers = [
        (r'/', common.Index),
        (r'/wx', wx.WX),

        (r"/(favicon\.ico)", tornado.web.StaticFileHandler, {"path": os.path.join(os.path.dirname(__file__), "static")}),
        (r"/(.*\.html)", tornado.web.StaticFileHandler, {"path": "static/"}),
        ]
コード例 #7
0
# -*- coding:utf8 -*-
from wechat_sdk.basic import WechatBasic
from wechat_sdk.messages import (
    TextMessage, VoiceMessage, ImageMessage, VideoMessage, LinkMessage, LocationMessage, EventMessage
)
import sys
reload(sys)
sys.setdefaultencoding('utf-8')

#应用程序启动
if __name__ == '__main__':
    wechat = WechatBasic(appid='wxbc6e508bcdd18484', appsecret='4a769c618b870a86e002dd0b1c15deb6')
    result = wechat.create_menu({
        'button':[
            {
                'type': 'click',
                'name': u'绑定设备',
                'key': 'V1001_TODAY_MUSIC'
            },
            {
                'type': 'click',
                'name': u'开/关',
                'key': 'V1001_TODAY_SINGER'
            }
        ]})
    print result