Exemplo n.º 1
0
        /// <summary>
        /// Deletes the or lock entity.
        /// </summary>
        /// <param name="paramJson">The parameter json.</param>
        /// <returns></returns>
        /// Creator:ysx2012
        /// 6/3/2016
        public JsonResult DelOrLockEntity(ParamJson paramJson)
        {
            //var JsonObj = JsonConvert.DeserializeObject<ParamJson>(paramJson);
            string ids      = paramJson.Ids;
            int    isDel    = paramJson.IsDel;
            int    isEnable = paramJson.IsEnable;
            var    result   = new BaseResponse()
            {
                DoFlag = false, DoResult = (isDel > 0) ? "删除失败" : (isEnable > 0 ? "禁用失败" : "启用失败")
            };

            if (string.IsNullOrEmpty(ids))
            {
                result.DoResult = "请您先勾选";
                return(Json(result));
            }
            var      listId         = ids.Split(',').Where(m => !string.IsNullOrEmpty(m)).Select(int.Parse).ToList();
            string   lastoperator   = UserInfo.UserSysNo.ToString();
            DateTime lastupdatetime = DateTime.Now;
            var      res            = WordLibManageConfigClient.Instance.SetIsDelOrEnable(listId, isDel, isEnable, lastoperator, lastupdatetime);

            result.DoFlag   = res.DoFlag;
            result.DoResult = res.DoResult;
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        public ActionResult PostView([FromBody] ParamJson paramsJson)
        {
            string      guid        = Guid.NewGuid().ToString();
            SaveOperate saveOperate = new SaveOperate()
            {
                Id = guid, ParamJson = paramsJson
            };

            _savOperateService.Save(saveOperate);

            var url = $"http://192.168.188.142:8080/DX/index.html#/index?guid={guid}";

            return(Ok(url));
        }
Exemplo n.º 3
0
        public RstArray ApiMsdk(string script_name, Dictionary <string, string> param, Dictionary <string, string> qs, string method, string protocol)
        {
            RstArray result_array = new RstArray();

            string uri = SnsNetWork.MakeQueryString(qs);

            script_name = script_name + "?" + uri;

            string url = protocol + "://" + server_name + script_name;

            Dictionary <string, string> cookie = new Dictionary <string, string>();

            //通过调用以下方法,可以打印出最终发送到openapi服务器的请求参数以及url,不打印可以注释

            PrintRequest(url, param, method);

            ParamJson paramj = new ParamJson {
                appid = param["appid"], openid = param["openid"], openkey = param["openkey"], userip = param["userip"]
            };

            string param_json = JsonConvert.SerializeObject(paramj);

            // 发起请求
            result_array = SnsNetWork.MakeRequest(url, param_json, cookie, method, protocol);
            if (result_array.Ret != 0)
            {
                result_array.Ret += OPENAPI_ERROR_HTPP;
                return(result_array);
            }


            //解析返回结果的返回码
            string stat_ret = "";

            try
            {
                if (this.format == "xml")
                {
                    XmlDocument xml = new XmlDocument();
                    xml.LoadXml(result_array.Msg);
                    stat_ret = xml.LastChild["ret"].InnerText.ToString();
                }
                else
                {
                    JavaScriptSerializer serializer = new JavaScriptSerializer();
                    RstArray             json_obj   = new RstArray();
                    json_obj = serializer.Deserialize <RstArray>(result_array.Msg);
                    stat_ret = json_obj.Ret.ToString();
                }
            }
            catch (Exception e)
            {
                result_array.Msg = e.Message;
                // 远程返回的不是 json或者xml 格式, 说明返回包有问题
                result_array.Ret += OPENAPI_ERROR_RESPONSE_DATA_INVALID;
                return(result_array);
            }


            //通过调用以下方法,可以打印出调用openapi请求的返回码以及错误信息,不打印可以注释
            PrintRespond(result_array);

            return(result_array);
        }