Esempio n. 1
0
        public HttpResponseMessage AppSaveJgcOrOrg([FromBody] JObject jdata)
        {
            //{
            //"model": {
            //        "OrgType": "2",
            //        "ComPanyName": "十一号线经理部",
            //        "CompanyId": "6247574415609954304",
            //        "ProjectOrgAllId": "6247574415609954304",
            //        "ProjectOrgAllName": "十一号线经理部",
            //        "ProjectId": "6245721945602523136",
            //        "RoleCode": "6352967650544590848",
            //        "UserCode": "102787",
            //        "UserId": "6487716734823440384",
            //        "UserName": "******",
            //        "LoginTime": "2019-04-25 15:31:11",
            //        "LoginToken": "9BD8717A3C93C93C5CAEE8FBA126D353AD4562C10CE22F487CA47731EB6E842E3B6064B1DC8A4B75",
            //        "IsSystem": false,
            //        "IsDriver": false,
            //        "ProcessFactoryCode": "",
            //        "ProcessFactoryName": "所有加工厂"
            //    }
            //,type:"Jgc"
            //}
            string modelstr = jdata["model"] == null ? "" : jdata["model"].ToString();
            string type     = jdata["type"] == null ? "" : jdata["type"].ToString();

            if (string.IsNullOrWhiteSpace(modelstr) || string.IsNullOrWhiteSpace(type))
            {
                return(AjaxResult.Error("参数错误").ToJsonApi());
            }
            var             model         = JsonEx.JsonToObj <CurrentUserInfo>(modelstr);
            CurrentUserInfo operatorModel = null;

            if (type == "Jgc")
            {
                operatorModel = _User.AppSaveProcessFactoryCode(model);
            }
            else if (type == "Org")
            {
                operatorModel = _User.AppSaveProjectOrg(model);
            }
            OperatorProvider.Provider.RemoveCurrent();           //先移除Cookie或者Session
            OperatorProvider.Provider.AddCurrent(operatorModel); //在添加Cookie或者Session
            return(operatorModel.ToJsonApi());
        }