Пример #1
0
        public ActionResult ConfigureResource(ResourceConfigModel model)
        {
            if(ModelState.IsValid)
            {
                resourceMgt = new ResourceManagement(User.Identity.GetUserId<int>());
                Resrouce_interface api = new Resrouce_interface()
                {
                    Id = model.Id,
                    Resource_id = model.ResoucedId,
                    APIURL = model.ApiUrl,
                    ProductApiUrl = model.ProductFetchUrl,
                    CallBackUrl = model.CallBack,
                    Interface_classname = model.InterfaceName,
                    Interface_assemblyname = model.InterfaceAssemblyName,
                    Username = model.UserName,
                    Userpassword = model.Password,
                    AppKey=model.AppKey,
                    AppSecret=model.AppSecret,
                    GetTokenUrl=model.GetTokenURL,
                    QueryStatusUrl=model.QueryStatusURL
                };

                if(resourceMgt.UpdateResrouceInterface(api))
                {
                    return RedirectToAction("Resources");
                }
            }

            return View();
        }
Пример #2
0
        public ActionResult ConfigureResource(int resourceId)
        {
            if(resourceId<=0)
            {
                ViewBag.Message = "落地资源编号不正确";
                return View("Error");
            }

            ResourceConfigModel model = new ResourceConfigModel() { Id=0,ResoucedId=resourceId};
            resourceMgt = new ResourceManagement(User.Identity.GetUserId<int>());
            if(!resourceMgt.CurrentLoginUser.Permission.CONFIGURE_RESOURCE)
            {
                ViewBag.Message = "没有权限配置落地资源接口信息";
                return View("Error");
            }

            try
            {
                KMBit.DAL.Resrouce_interface api = resourceMgt.GetResrouceInterface(resourceId);
                if (api != null)
                {
                    model.Id = api.Id;
                    model.InterfaceName = api.Interface_classname;
                    model.Password = KMAes.DecryptStringAES(api.Userpassword);
                    model.UserName = api.Username;
                    model.ResoucedId = api.Resource_id;
                    model.ApiUrl = api.APIURL;
                    model.CallBack = api.CallBackUrl;
                    model.ProductFetchUrl = api.ProductApiUrl;
                    model.AppSecret = api.AppSecret;
                    model.AppKey = api.AppKey;
                    model.GetTokenURL = api.GetTokenUrl;
                    model.QueryStatusURL = api.QueryStatusUrl;
                    model.InterfaceAssemblyName = api.Interface_assemblyname;
                }
            }
            catch (KMBitException ex)
            {
                ViewBag.Message = ex.Message;
                return View("Error");
            }
            
            return View(model);
        }