1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- using LYFZ.WeixinServiceDate.DAL;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- namespace LYFZ.WeixinServers.WxAuthorize
- {
- public partial class OfficialAccountList : System.Web.UI.Page
- {
- public string table = "";
- DAL_CustomerInterfaces officialAccountDal = new DAL_CustomerInterfaces();
- public string eid = "";
- protected void Page_Load(object sender, EventArgs e)
- {
-
- if (Request.QueryString["eid"] != null)
- {
- eid = Request.QueryString["eid"];
- }
- if (Request.QueryString["delid"] == null)
- {
- string strWhere = String.Format("Token='{0}'", eid);
- System.Data.DataTable officialAccountTb = officialAccountDal.GetOfficialAccountList(eid);
- if (officialAccountTb != null)
- {
- foreach (System.Data.DataRow dr in officialAccountTb.Rows)
- {
- string AuthorizeStatus = "未授权";
- if (dr["AuthorizeStatus"] != null)
- {
- AuthorizeStatus = (dr["AuthorizeStatus"].ToString() == "1" ? "已授权" : "未授权");
- }
- table += "<tr>";
- table += " <td>" + dr["OfficialAccountName"] + "</td>";
- table += " <td>" + dr["AppSecret"] + "</td>";
- table += " <td>" + dr["AppID"] + "</td>";
- table += " <td><span id=\"#foo\">http://wx.lyfz.net/WxInterface.aspx?eid=" + eid + "&appid=" + dr["AppID"] + "</span> "+
- " <button class=\"layui-icon\" data-clipboard-text=\"http://wx.lyfz.net/WxInterface.aspx?eid=" + eid + "&appid=" + dr["AppID"] + "\"></button></td>";
- table += " <td>" + AuthorizeStatus + "</td>";
- table += " <td>"
- + " <a class=\"layui-btn\" href=\"AddOfficialAccount.aspx?id=" + dr["id"] + "&eid=" + eid + "\">编辑</a>"
- + " <a class=\"layui-btn\" target=\"_blank\" href=\"" + GetAuthorizationAndBindUrl(dr["AppID"].ToString(), String.Format("{0}{1}",eid, dr["AppID"])) + "\">授权</a>"
- + " <a class=\"layui-btn\" href=\"OfficialAccountList.aspx?delid=" + dr["id"] + "&eid=" + eid + "\">删除</a>"
- + "</td>";
- table += "</tr>";
- }
- }
- }
- else {
- delOfficialAccount(eid);
- }
- }
- void delOfficialAccount(string eid)
- {
- try
- {
- int delid = -1;
- if (Request.QueryString["delid"] != null)
- {
- if (!String.IsNullOrEmpty(Request.QueryString["delid"]))
- {
- delid = Convert.ToInt32(Request.QueryString["delid"]);
- }
- }
- if (delid > 0)
- {
- officialAccountDal.Delete(delid);
- }
- Response.Redirect(String.Format("OfficialAccountList.aspx?eid={0}", eid));
- }
- catch { }
- }
- /// <summary>
- /// 获取微信接口授权并绑定URL
- /// </summary>
- /// <param name="appid"></param>
- /// <param name="yuname"></param>
- /// <returns></returns>
- public static string GetAuthorizationAndBindUrl(string appid, string yuname)
- {
- return "http://wx.lyfz.net/Authorize.aspx?appid=" + appid + "&yuname=" + LYFZ.WinAPI.SDKSecurity.Encode(yuname);
- }
- }
- }
|