128 lines
5.6 KiB
C#
128 lines
5.6 KiB
C#
using System;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
using System.Configuration;
|
|
using System.Web;
|
|
using System.Net;
|
|
using System.IO;
|
|
using System.Security.Cryptography;
|
|
using System.Xml;
|
|
using System.Collections.Specialized;
|
|
using System.Text.RegularExpressions;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using System.Globalization;
|
|
using System.Web.Security;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using System.Web.UI.WebControls.WebParts;
|
|
using System.Web.UI.HtmlControls;
|
|
using System.Web.Script.Serialization;
|
|
namespace Mtxfw.shop
|
|
{
|
|
public partial class tuiguang_link : System.Web.UI.Page
|
|
{
|
|
/// <summary>
|
|
/// 填写你申请的登录资料
|
|
/// </summary>
|
|
|
|
public Mtxfw.Utility.Config config = new Mtxfw.Utility.Config();
|
|
public Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
|
|
protected string strPic = "", strNCName = "";
|
|
public static string appKey = "", Token = "qbccandgengliu", signature = "", timestamp = "", nonceStr = "", strurl = "", IFApp = "0", IFLink = "1";
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
|
|
if (!IsPostBack)
|
|
{
|
|
string str_u = Request.ServerVariables["HTTP_USER_AGENT"];
|
|
Mtxfw.Utility.Common.WriteHtml("/weixin/ifweixin.txt", str_u);
|
|
if (str_u.IndexOf("MicroMessenger") != -1)
|
|
{
|
|
//微信访问
|
|
IFApp = "1";
|
|
}
|
|
if (IFApp == "1")
|
|
{
|
|
if (Session["MemberId"] == null)
|
|
{
|
|
string RUrl = Request.Url.ToString();
|
|
Session["returnurl"] = RUrl;
|
|
Response.Redirect("/weixinlogin.aspx");
|
|
}
|
|
else
|
|
{
|
|
int ContactID = Convert.ToInt32(Session["MemberId"].ToString());
|
|
Mtxfw.Model.user_info ModelUser = daoUser.GetModel(ContactID);
|
|
if (ModelUser != null)
|
|
{
|
|
if (ModelUser.UserPic != "")
|
|
{
|
|
strPic = "<img src='" + ModelUser.UserPic + "' />";
|
|
}
|
|
if (ModelUser.NCName != "")
|
|
{
|
|
strNCName = ModelUser.NCName;
|
|
}
|
|
else
|
|
{
|
|
if (ModelUser.RealName != "")
|
|
{
|
|
strNCName = ModelUser.RealName;
|
|
}
|
|
else
|
|
{
|
|
strNCName = ModelUser.UserName;
|
|
}
|
|
}
|
|
Page.Title = "请将图片发送给朋友";
|
|
appKey = config.webappKey;
|
|
nonceStr = Mtxfw.Utility.Common.CreatenNonce_str();
|
|
timestamp = Mtxfw.Utility.Common.CreatenTimestamp().ToString();
|
|
strurl = "http://shop.q-b.cc/tuiguang.aspx?invieuser=" + ContactID;
|
|
|
|
string jsapi_ticket = Mtxfw.Utility.Common.getjsapi_ticket(HttpContext.Current, config.webappKey, config.webappSecret, config);
|
|
string string1 = "";
|
|
string tmpStr = Mtxfw.Utility.Common.GetSignature(jsapi_ticket, nonceStr, timestamp, Request.Url.ToString(), out string1);
|
|
signature = tmpStr;
|
|
Mtxfw.Utility.Common.WriteHtml("/weixin/weixin.txt", jsapi_ticket + "|" + tmpStr);
|
|
/*if (Request.QueryString["IFLink"] != null)
|
|
{
|
|
IFLink = Request.QueryString["IFLink"].ToString();
|
|
}
|
|
if (IFLink == "1")
|
|
{
|
|
Page.Title = "请将图片发送给朋友";
|
|
appKey = config.webappKey;
|
|
nonceStr = Mtxfw.Utility.Common.CreatenNonce_str();
|
|
timestamp = Mtxfw.Utility.Common.CreatenTimestamp().ToString();
|
|
strurl = "http://shop.q-b.cc/tuiguang.aspx?invieuser=" + ContactID;
|
|
|
|
string jsapi_ticket = Mtxfw.Utility.Common.getjsapi_ticket(HttpContext.Current, config.webappKey, config.webappSecret, config);
|
|
string string1 = "";
|
|
string tmpStr = Mtxfw.Utility.Common.GetSignature(jsapi_ticket, nonceStr, timestamp, Request.Url.ToString(), out string1);
|
|
signature = tmpStr;
|
|
Mtxfw.Utility.Common.WriteHtml("/weixin/weixin.txt", jsapi_ticket + "|" + tmpStr);
|
|
}
|
|
else
|
|
{
|
|
Page.Title = "友情提示";
|
|
if (ModelUser.uLevel6 == 0)
|
|
{
|
|
Response.Redirect("/tuiguang_link.aspx?IFLink=1");
|
|
}
|
|
}*/
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Response.Redirect("/Member_invite.aspx");
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
} |