def get_url_by_name(self, name, args=(), query_string={}, openid=False): try: url = reverse(name, args=args) if query_string: string = '' for key in query_string: string += key+'='+str(query_string[key]) + '&' url = url + '?' + string.rstrip('&') except: url = '' url = 'http://'+settings.DOMAIN+url if openid: return get_openid_api_url(self, url) #得到用户openid else: return get_weixin_site_url(self, url)
def get_vote_url(self): '''投票''' url = reverse('appsite:vote', args=(self.token,)) url = 'http://%s%s' % (DOMAIN, url) return get_openid_api_url(self, url)
def get_kefu_url(self): '''微站客服页面''' url = 'http://%s/appsite/%s/kefu/' % (DOMAIN, self.token) return get_openid_api_url(self, url)
def get_driving_url(self): url = 'http://%s/appsite/%s/navigation-detail/%s/driving/' % (DOMAIN, self.appitem.token, self.id) return get_openid_api_url(self.appitem, url)