예제 #1
0
        public void Refresh()
        {
            M_Third_PlatInfo thirdMod = B_Third_PlatInfo.SelByFlag("点触");

            if (thirdMod != null)
            {
                PUBKEY = thirdMod.APPKey;
                PRIKEY = thirdMod.APPSecret;
            }
        }
예제 #2
0
 //-----
 //private static Dictionary<int, string> TokenDir = new Dictionary<int, string>();
 //private string GetTokenByUid()
 //{
 //    M_AdminInfo adminMod = B_Admin.GetLogin();
 //    if (TokenDir.ContainsKey(adminMod.AdminId)) { return TokenDir[adminMod.AdminId]; }
 //    else { return ""; }
 //}
 //private void AddToken(string token)
 //{
 //    try
 //    {
 //        M_AdminInfo adminMod = B_Admin.GetLogin();
 //        if (TokenDir.ContainsKey(adminMod.AdminId))
 //        {
 //            TokenDir[adminMod.AdminId] = token;
 //        }
 //        else { TokenDir.Add(adminMod.AdminId, token); }
 //    }
 //    catch (Exception ex) { throw new Exception("AddToken,"+ex.Message); }
 //}
 //---------------------------------------------
 public static void CheckLogin()
 {
     if (string.IsNullOrEmpty(AccessToken))
     {
         C_CopyRight      crBll   = new C_CopyRight();
         M_Third_PlatInfo infoMod = B_Third_PlatInfo.SelByFlag("版权印");
         InfoCheck(infoMod);
         crBll.UserToToken(infoMod.UserName, infoMod.UserPwd);
         if (!string.IsNullOrEmpty(AccessToken))
         {
             HttpContext.Current.Response.Redirect(HttpContext.Current.Request.RawUrl);
         }
     }
 }
예제 #3
0
 public C_CopyRight()
 {
     //Client_ID = "24165684208467970";
     //Client_Secret = "24165684208467971";
     if (string.IsNullOrEmpty(Client_ID))
     {
         M_Third_PlatInfo infoMod = B_Third_PlatInfo.SelByFlag("版权印");
         InfoCheck(infoMod);
         Client_ID     = infoMod.APPKey;
         Client_Secret = infoMod.APPSecret;
         if (string.IsNullOrEmpty(AccessToken))
         {
             UserToToken(infoMod.UserName, infoMod.UserPwd);
         }
     }
 }
예제 #4
0
        /// <summary>
        /// VideoCloud 构造方法
        /// </summary>
        /// <param name="timeOut">网络超时,默认60秒</param>
        public C_TencentMVS(int timeOut = 60)
        {
            this.timeOut = timeOut * 1000;
            M_Third_PlatInfo infoMod = B_Third_PlatInfo.SelByFlag("微视频");

            if (infoMod == null)
            {
                function.WriteErrMsg("未设置微视频信息,请先<a href='/" + SiteConfig.SiteOption.ManageDir + "/Config/PlatInfoList.aspx'>完成配置</a>");
            }
            appId     = DataConverter.CLng(infoMod.APPID);
            secretId  = infoMod.APPSecret;
            secretKey = infoMod.APPKey;

            //---发出请求测试是否key、id等是否正确
            string  result = GetFolderStat("", "");
            JObject obj    = JsonConvert.DeserializeObject <JObject>(result);

            if (!obj["code"].ToString().Equals("0"))
            {
                function.WriteErrMsg("微视频配置信息不正确,请先<a href='/" + SiteConfig.SiteOption.ManageDir + "/Config/PlatInfoList.aspx'>完成配置</a>");
            }
        }
예제 #5
0
        public void ProcessRequest(HttpContext context)
        {
            M_AdminInfo adminMod = B_Admin.GetLogin();

            retMod.retcode = M_APIResult.Failed;
            //retMod.callback = CallBack;//暂不开放JsonP
            M_Third_PlatInfo infoMod = B_Third_PlatInfo.SelByFlag("版权印");

            if (infoMod == null || string.IsNullOrEmpty(infoMod.APPKey) || string.IsNullOrEmpty(infoMod.APPSecret))
            {
                retMod.retmsg = "未配置版权印接口"; RepToClient(retMod);
            }
            crAPI = new C_CopyRight();
            try
            {
                int gid = DataConvert.CLng(Req("gid"));
                switch (Action)
                {
                case "add":
                {
                    M_CommonData conMod = conBll.SelReturnModel(gid);
                    if (conMod == null)
                    {
                        retMod.retmsg = "未指定内容!"; break;
                    }
                    else
                    {
                        JObject obj = Add(conMod);
                        if (DataConvert.CLng(obj["value"]) == 1)
                        {
                            retMod.result  = obj["data"].ToString();
                            retMod.retcode = M_APIResult.Success;
                        }
                        else
                        {
                            retMod.retmsg = obj["msg"].ToString();
                        }
                    }
                }
                break;

                case "del":
                {
                    M_Content_CR crMod = crBll.SelByGid(gid);
                    if (crMod == null)
                    {
                        retMod.retmsg = "该内容未生成版权印"; break;
                    }
                    string  delResult = crAPI.Remove(crMod.WorksID);
                    JObject delObj    = JsonConvert.DeserializeObject <JObject>(delResult);
                    if (DataConvert.CLng(delObj["value"]) != 1)
                    {
                        retMod.retmsg = "删除失败,返回" + delResult;
                    }
                    else
                    {
                        crBll.Del(crMod.ID);
                        retMod.retcode = M_APIResult.Success;
                    }
                }
                break;

                case "readd":
                {
                    //删除
                    M_Content_CR crMod = crBll.SelByGid(gid);
                    if (crMod == null)
                    {
                        retMod.retmsg = "该内容未生成版权印"; break;
                    }
                    string  delResult = crAPI.Remove(crMod.WorksID);
                    JObject delObj    = JsonConvert.DeserializeObject <JObject>(delResult);
                    if (DataConvert.CLng(delObj["value"]) != 1)
                    {
                        retMod.retmsg = "删除失败,返回" + delResult; break;
                    }
                    else
                    {
                        crBll.Del(crMod.ID);
                    }
                    //重新添加
                    M_CommonData conMod = conBll.SelReturnModel(gid);
                    JObject      addObj = Add(conMod);
                    if (DataConvert.CLng(addObj["value"]) == 1)
                    {
                        retMod.result  = addObj["data"].ToString();
                        retMod.retcode = M_APIResult.Success;
                    }
                    else
                    {
                        retMod.retmsg = addObj["msg"].ToString();
                    }
                }
                break;

                case "get":
                {
                    M_Content_CR crMod = crBll.SelByGid(gid);
                    if (crMod != null)
                    {
                        retMod.retcode = M_APIResult.Success; retMod.result = JsonConvert.SerializeObject(crMod);
                    }
                }
                break;

                default:
                    retMod.retmsg = "[" + Action + "]接口不存在";
                    break;
                }
            }
            catch (Exception ex) { retMod.retmsg = ex.Message; }
            RepToClient(retMod);
        }