Пример #1
0
        /// <summary>
        /// 根据软件互联平台的用户ID,获取用户的阿里巴巴中文站(或淘宝)帐号。
        /// </summary>
        /// <param name="appId"></param>
        /// <param name="appUserId"></param>
        /// <returns></returns>
        public static string getDomainLoginId(string appId, string appUserId)
        {
            string      code = GetCode;
            ParamsBuild pb   = new ParamsBuild(code);

            pb.AddParam("sip_appkey", appId);
            pb.AddParam("sip_apiname", "alisoft.udb.getDomainLoginId");
            pb.AddParam("sip_timestamp", System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            pb.AddParam("domainid", "1");
            pb.AddParam("userid", appUserId);
            string data = pb.GetURL();



            //解析接口返回值,这里选用XML格式的解析,接口默认返回是XML格式
            XmlDocument xmlDoc = Util.HttpRequest(data);

            XmlNode xn  = xmlDoc.SelectSingleNode("StringResult/code");
            XmlNode xn2 = xmlDoc.SelectSingleNode("StringResult/result");

            if (xn.InnerText != "0")
            {
                return(appUserId);
            }
            else
            {
                return(xn2.InnerText);
            }
        }
Пример #2
0
 public static string getDomainLoginId(string appId, string appUserId)
 {
     ParamsBuild build = new ParamsBuild(GetCode);
     build.AddParam("sip_appkey", appId);
     build.AddParam("sip_apiname", "alisoft.udb.getDomainLoginId");
     build.AddParam("sip_timestamp", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
     build.AddParam("domainid", "1");
     build.AddParam("userid", appUserId);
     XmlDocument document = HttpRequest(build.GetURL());
     XmlNode node = document.SelectSingleNode("StringResult/code");
     XmlNode node2 = document.SelectSingleNode("StringResult/result");
     if (node.InnerText != "0")
     {
         return appUserId;
     }
     return node2.InnerText;
 }