Esempio n. 1
0
        public void Main()
        {
//            var client = new OAuthClient("1234", "5678", "http://shaappt0001.ad.shalu.com:8091/", OAuthType.ClientIdAndSecrect);
            var client = new OAuthClient("admin", "123qwe", "http://localhost:1221/", OAuthType.UserNameAndPassword);
            var returnStr = client.Post("/api/services/app/sys/ResetValidationCode", "{ 'phoneNumber': '18817712347'}");

//            var returnStr = client.Post("/api/services/app/sys/ResetPassword", "{ 'phoneNumber': '18621713857', 'Password':'******', 'Code': '3531'}");
            Console.Write(returnStr);
        }
Esempio n. 2
0
        /// <summary>
        /// 发送手机短信
        /// </summary>
        /// <param name="name"></param>
        /// <param name="param"></param>
        /// <returns></returns>
        public static bool SendPhone(string name, string param)
        {
            //发送验证码  
            OAuthClient oAuthClient = new OAuthClient("qwe", "asd", "http://msg.shalu.com/",
            OAuthType.ClientIdAndSecrect);
            var result = oAuthClient.Post("/api/services/app/message/SendValidationCode",
                JsonConvert.SerializeObject(
                            new
                            {
                                to = name,
                                content = param
                            }));

            var succ = JObject(result);
            if (succ["result"].ToString().Equals("100"))
            {
                return true;
            }
            throw new UserFriendlyException("请重新发送验证码或联系管理员");
        }
Esempio n. 3
0
 /// <summary>
 /// 发送邮件
 /// </summary>
 /// <returns></returns>
 public bool SendEmail(string email, string title, string temp, string param)
 {
     OAuthClient oAuthClient = new OAuthClient("qwe", "asd", "http://msg.shalu.com/",
          OAuthType.ClientIdAndSecrect);
     var result = oAuthClient.Post("/api/services/app/message/SendEmail",
         string.Format("{{'to': '{0}', 'subject':'{1}', 'templateName':'{2}', 'params':{3}}}", email, title, temp,
            param));
     var succ = JObject(result);
     if (succ["result"].ToString().Equals("100"))
     {
         return true;
     }
     throw new UserFriendlyException("请重新发送验证码或联系管理员");
 }