public ActionResult SaveEWM(QMActivity CuObj, FormCollection form) { JsonSMsg rMsg = new JsonSMsg(); try { CuObj.MdName = CuObj.MdName.ToString(); //double x = 0; //double y = 0; //bd_decrypt(CuObj.Lat.Value, CuObj.Lng.Value, ref y, ref x); //CuObj.Lat = y; //CuObj.Lng = x; //CuObj.MIMAGE_ID = form["MIMAGE_ID"]; int num = _service.SaveQMActivity(CuObj); WeiPage wp = new WeiPage(); string url = "https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=" + wp.Token(AppConfig.FWHOriginalID); //这里需要修改 string d = @"{ ""action_name"": ""QR_LIMIT_SCENE"", ""action_info"": {""scene"": {""scene_id"": {0}}} }"; d = d.Replace("{0}", num.ToString()); string mes = WeiPage.HttpXmlPostRequest(url, d, Encoding.UTF8); //Response.Write(mes); string[] b = mes.Split('\"'); string ticket = Server.UrlEncode(b[3]); CuObj.Id = num; CuObj.Ticket = "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=" + ticket; CuObj.MdSel = "qrscene_" + num.ToString(); num = _service.SaveQMActivity(CuObj); if (num > 0) { rMsg.Status = 0; rMsg.Message = "保存成功"; } else { rMsg.Status = -1; rMsg.Message = "保存失败"; } } catch (Exception ex) { rMsg.Status = -1; rMsg.Message = ex.Message; } return(Json(rMsg)); }
/// <summary> /// 保存二维码 /// </summary> /// <param name="sys"></param> /// <returns></returns> public int SaveQMActivity(QMActivity sys) { return(_set.SaveQMActivity(sys)); }