Ejemplo n.º 1
0
 public string GetChannelList()
 {
     common.visitorRecord();
     DataTable dt = new DataTable();
     try
     {
         dt = new Bus.DAL.appkey().GetChannelList().Tables[0];
     }
     catch (Exception ex)
     {
         dt.Columns.Add("ErrMessage", typeof(string));
         dt.Rows.Add(ex.Message);
     }
     return dt.ToJson("Tracks");
 }
Ejemplo n.º 2
0
    //验证appkey值
    private static bool verifyKey(string appkey)
    {
        try
        {

            DataTable dt = null;
            if (HttpRuntime.Cache["keymap"] == null)
            {
                dt = new Bus.DAL.appkey().GetList("app_status=1").Tables[0];
                string dbpath = HttpContext.Current.Server.MapPath("~/app_data/bus_api.sqlite");
                HttpRuntime.Cache.Insert("keymap", dt, new System.Web.Caching.CacheDependency(dbpath), System.Web.Caching.Cache.NoAbsoluteExpiration, System.Web.Caching.Cache.NoSlidingExpiration);
            }
            else
            {
                dt = HttpRuntime.Cache["keymap"] as DataTable;
            }
            if (dt.Rows.Count < 1) return false;
            DataRow[] drs = dt.Select("app_key='" + appkey + "'");
            if (drs.Count() < 1) return false;
            else return true;
        }
        catch(Exception ex)
        {
            log.error("验证授权key失败", ex.Message, "appkey=" + appkey);
            return false;
        }
    }
Ejemplo n.º 3
0
 public static int visitorRecord(string appkey)
 {
     HttpRequest request = HttpContext.Current.Request;
     Bus.Model.Vistor model = new Bus.Model.Vistor();
     model.ip = request.UserHostAddress;
     model.ref_url = request.UrlReferrer == null ? "direct access" : request.UrlReferrer.ToString();
     model.time = DateTime.Now;
     model.UA = request.UserAgent;
     model.url = request.Url.ToString();
     model.appkey = appkey;
     int r = new Bus.DAL.appkey().record(model);
     return r;
 }
Ejemplo n.º 4
0
    protected void channelid_Click(object sender, EventArgs e)
    {
        DataTable dt = new Bus.DAL.appkey().GetChannelList().Tables[0];
        gv.DataSource = dt;
        gv.DataBind();

        txtresult.Text = new musics().GetChannelList();
    }
Ejemplo n.º 5
0
 //appkey
 protected void Button11_Click(object sender, EventArgs e)
 {
     try
     {
         Bus.Model.AppKey m = new Bus.Model.AppKey();
         m.app_key = Guid.NewGuid().ToString();
         m.app_owner = "walker";
         m.app_url = "bus.fm";
         m.app_usage = "test";
         int s = new Bus.DAL.appkey().Add(m);
         lblmsg.Text = s + "位用户被添加"+m.app_key;
         s += DBHelper.SQLiteHelper.ExecuteNonQuery("select count(*) from appkey where app_key=@appkey", m.app_key);
         lblmsg.Text = s + "";
         s = new Bus.DAL.appkey().Delete(m.app_key);
         lblmsg.Text += "<br/>" + s + "位用户被删除"+m.app_key;
     }
     catch (Exception ex)
     {
         lblmsg.Text = ex.Message;
     }
 }
Ejemplo n.º 6
0
 //guid
 protected void Button10_Click(object sender, EventArgs e)
 {
     try
     {
         DataTable dt = new Bus.DAL.appkey().GetList("app_status=3").Tables[0];
         lblmsg.Text = "done";
     }
     catch (Exception ex)
     {
         lblmsg.Text = ex.Message;
     }
 }