# -*- coding: utf-8 -*- # !/usr/bin/env python import sys from base import init_env, setup_logger, get_logger init_env(interactive = True) if len(sys.argv) < 2: logger = get_logger(__name__) else: logger = setup_logger(filename = sys.argv[1], namespace = __name__) from apps.web.core.bridge.wechat.WechatClientProxy import MyWeChatClient # agentId = '' # agent = Agent.objects.get(id = agentId) appId = 'wx3ee7c9976c456472' secret = '21f3a615b61eae67b5b987bfbafb247f' wechatClient = MyWeChatClient(appId, secret) agentId_testing = '5b5d87ebaa4fca310e25c5b1' _testing_d = { 'type': 'view', 'name': '经销商后台', 'url': 'http://develop.5tao5ai.com/dealerAccess?agentId=%s' % agentId_testing } _testing_a = { 'type': 'view', 'name': '代理商登录', 'url': 'http://develop.5tao5ai.com/agents/login.html' } _testing_u = { 'type': 'view', 'name': '个人中心', 'url': 'http://develop.5tao5ai.com/userLogin?agentId=' + agentId_testing + '&redirect=%2Fuser%2Findex.html%23%2Fuser%2Fme' } _testing_g = { 'type': 'view', 'name': '周边设备', 'url': 'http://develop.5tao5ai.com/userLogin?agentId=' + agentId_testing + '&redirect=%2Fuser%2Findex.html%23%2Fuser%2Findex' } agentId_staging = '639fad2b149f0b937978480a' _staging_d = { 'type': 'view', 'name': '经销商后台', 'url': 'https://manyi.5tao5ai.com/dealerAccess?agentId=%s' % agentId_staging } _staging_u = { 'type': 'view', 'name': '个人中心', 'url': 'https://manyi.5tao5ai.com/userLogin?agentId=' + agentId_staging + '&redirect=%2Fuser%2Findex.html%23%2Fuser%2Fme' } _staging_g = { 'type': 'view', 'name': '周边设备', 'url': 'https://manyi.5tao5ai.com/userLogin?agentId=' + agentId_staging + '&redirect=%2Fuser%2Findex.html%23%2Fuser%2Findex' } _staging_a = { 'type': 'view', 'name': '代理商登录', 'url': 'http://manyi.5tao5ai.com/agents/login.html' } menu = { "button": [ { "name": u"测试环境", "sub_button": [_testing_a, _testing_g, _testing_u, _testing_d] }, { "name": u"体验环境", "sub_button": [_staging_a, _staging_g, _staging_u, _staging_d] } ] } print "12313213213" print wechatClient.menu.create(menu)