public HttpResponseMessage GetTempFoods(TestReq req) { //var userId = Convert.ToInt32(req.userId); //var r = CacheHelper.GetTempFoods(userId); //return ControllerHelper.Instance.JsonResult(200, JsonConvert.SerializeObject(r), ""); return(null); }
public async Task <IActionResult> Test([FromBody] TestReq input) { switch (input.Id) { case 1: var resp = new TestResp { Id = 1, Info = $"The Msg from request is: {input.Msg.ToUpper()}" }; return(Ok(resp)); case 2: return(BadRequest(new Error { ErrorCode = 400, ErrorMsg = "Error...." })); case 3: return(Unauthorized()); case 4: return(NotFound(new string[] { "404", "Not", "Found" })); case 5: return(StatusCode((int)HttpStatusCode.InternalServerError)); default: return(StatusCode((int)HttpStatusCode.NotImplemented)); } }
public HttpResponseMessage GetCancelCache(TestReq req) { var userId = Convert.ToInt32(req.userId); var cache = CacheHelper.GetCancelCache(userId); return(ControllerHelper.Instance.JsonResult(200, JsonConvert.SerializeObject(cache), "")); }
public HttpResponseMessage GetRiderToken(TestReq req) { var userId = Convert.ToInt32(req.userId); var token = cache.GetModel <Token>("Ta_RiderToken_" + userId); return(ControllerHelper.Instance.JsonResult(200, JsonConvert.SerializeObject(token), token.GetToken())); }
public string GetPhoneV(TestReq req) { var phone = req.phone; //cache.Get("Ta_VerificationCode_UserPhone=" + phone); var r = CacheHelper.GetUserVerificationCode(phone); return(r); }
public bool test6(TestReq req) { Regex reg = new Regex(@"^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$"); string str = @"^[t]?[0-9]+\.[xy]{1,2}$"; reg = new Regex(str); return(reg.IsMatch(req.str)); }
public object test8(TestReq req) { var ids = new string[2]; ids[0] = "1"; ids[1] = "2"; var temps = Array.ConvertAll <string, int>(ids, s => int.Parse(s)); return(temps); }
public HttpResponseMessage test2(TestReq req) { var item = new OrderInfo(); var date = DateTime.Now; var price = 1.99m; string str = $"On {date}, the price of {item} was {price} per."; var b = 0; var r = CacheHelper.GetById <OrderInfo>("orderinfo", 1); return(ControllerHelper.Instance.JsonResultObject(200, new int[0], "")); }
//[ValidateModel] public object test(TestReq req) { var list = new List <testrr> { new testrr { name = "txy", sex = 1 }, new testrr { name = "wz", sex = 0 }, }; cache.Add("test", JsonConvert.SerializeObject(list), DateTime.Now.AddDays(1)); var r = cache.Get("test"); //return r; var list2 = JsonConvert.DeserializeObject <List <testrr> >(r.ToString()); return(list2); }
// Use this for initialization void Start() { session = new HTTPSession("http://goshit.luzexi.com/index.php/"); session.onDataError = showError; Hashtable head = new Hashtable(); head["cookie"] = "ok123"; head["token"] = "123"; session.m_cHeader = head; TestReq req = new TestReq(); req.arg1 = "1"; req.arg2 = 0; req.arg3 = 0.3f; session.SendGET(req, (TestAck ack) => { Debug.Log("ok"); Debug.Log("username: "******"password : "******" token : " + ack.data.token); }); }
public string test4(TestReq req) { return("1"); //var dict = new Dictionary<string, string>(); ////dict.Add("@userId", "6"); //var list = (List<UserInfo>)CacheHelper.GetByCondition<UserInfo>("UserInfo", " id=17", dict); var dict = new Dictionary <string, string>(); dict.Add("@str", "%童晓翊%"); var list = CacheHelper.GetDistinctCount <OrderTryJoin>("ordertryjoin", " riderName like @str or userName like @str", dict); return(""); //CacheHelper.LockCache(""); //var list = (List<FoodView>)CacheHelper.GetByCondition<FoodView>("FoodView", " isweek=0"); //txyInfoOper txyOper = new txyInfoOper(); //txyInfo txy = new txyInfo(); //txy.id = 119; //txy.ttime = DateTime.Now; //txyOper.Update(txy); //string isServer = ConfigurationManager.AppSettings.Get("111"); //var aaaa = isServer == "a"; //string str = "123456"; //var a = MD5Helper.StrToMD5_UTF8(str); //return a +" "; //var user = userOper.GetById(req.userId); //List<string> list = new List<string>(); //list.Add(user.deviceToken); //int id = 999; //string key = StringHelper.Instance.IntToKey(id); //var aa = StringHelper.Instance.Encrypt(id.ToString(), key); //return StringHelper.Instance.Decrypt(aa, key); //var r = Convert.ToDateTime(DateTime.Now.GetDateTimeFormats('D')[0]); //return ""; ////return AndroidPush.PostMany(list, "测试消息"); //var str = "123456789,"; //str = str.Substring(0, str.Length - 1); //return str; //var a = (DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000; //return a.ToString(); //return MD5Helper.StrToMD5("fandiapp"); //var xml = "<xml><return_code><![CDATA[SUCCESS]]></return_code>\n<return_msg><![CDATA[OK]]></return_msg>\n<appid><![CDATA[wxd8482615c33b8859]]></appid>\n<mch_id><![CDATA[1494504712]]></mch_id>\n<nonce_str><![CDATA[6WPU0BTi2HQvv1sQ]]></nonce_str>\n<sign><![CDATA[7C5E95B9554A3F3D74DBCD179679494E]]></sign>\n<result_code><![CDATA[SUCCESS]]></result_code>\n<prepay_id><![CDATA[wx2017122512475225abf6579d0315873400]]></prepay_id>\n<trade_type><![CDATA[APP]]></trade_type>\n</xml>"; //XmlDocument doc = new XmlDocument(); //doc.LoadXml(xml); //string json = Newtonsoft.Json.JsonConvert.SerializeXmlNode(doc); //return json; ////return StringHelper.Instance.CreateOrderNo(order); }