Beispiel #1
0
        public async Task <ActionResult> CheckPhoneRegister(string phone)
        {
            try
            {
                if (!_agencyDa.CheckExitsByPhone(phone, 0))
                {
                    var model = new DN_Agency
                    {
                        Phone      = phone,
                        IsActive   = false,
                        IsVerify   = false,
                        IsBank     = false,
                        IsFdi      = false,
                        IsDelete   = false,
                        CreateDate = DateTime.Now.TotalSeconds(),
                    };
                    _agencyDa.Add(model);
                    _agencyDa.Save();
                }
                //var otp = FDIUtils.RandomOtp(4);
                //var otppost = new PostOtpLoginAppIG4()
                //{
                //    msisdn = phone.Remove(0, 1).Insert(0, "84"),
                //    brandname = "G-STORE",
                //    msgbody = "IG4: Ma xac minh cua ban la " + otp,
                //    user = "******",
                //    pass = "******",
                //    charset = "8"
                //};
                //var url = "http://123.31.20.167:8383/restservice/";
                //var result = await PostDataAsync<List<ResultotpAppIG4>>(url, otppost);
                //if (result.FirstOrDefault()?.Result.code == "200")
                //{
                //    tokenOtpDA.Add(new TokenOtp()
                //    {
                //        ObjectId = phone,
                //        Token = otp,
                //        IsDeleted = false,
                //        IsUsed = false,
                //        TypeToken = (int)TokenOtpType.Authen,
                //        DateCreated = DateTime.Now,
                //    });
                //    tokenOtpDA.Save();
                //}
                //else
                //{
                //    return Json(new JsonMessage(-1, "Gửi mã OTP thất bại"), JsonRequestBehavior.AllowGet);
                //}
            }
            catch (Exception e)
            {
                return(Json(new JsonMessage(-2, e.ToString()), JsonRequestBehavior.AllowGet));
            }

            return(Json(new JsonMessage(200, "Ok"), JsonRequestBehavior.AllowGet));
        }