Example #1
0
        private void GetUserRolesAndRightsAndCars(string sysflag, int uid, string logintype)
        {
            appvduser.uid = uid.ToString();
            ComSqlHelper csh = new ComSqlHelper();

            SqlParameter[] Parameters = { new SqlParameter("@uid", uid), new SqlParameter("@logintype", logintype) };
            DataSet        ds         = csh.FillDataSet(WebProc.GetAppSysflagKey(sysflag), WebProc.Proc("QWGProc_Appvd_GetUserRolesAndRights"), Parameters);
            DataTable      dtrole     = ds.Tables[0];
            DataTable      dtrights   = ds.Tables[1];

            foreach (DataRow dr in dtrole.Rows)     //获取角色列表
            {
                roleinfo rolei = new roleinfo();
                rolei.roleid   = dr["RID"].ToString();
                rolei.rolename = dr["NAME"].ToString();
                appvdreturn.rolelist.Add(rolei);
            }
            foreach (DataRow dr in dtrights.Rows)   //获取APP功能模块权限列表
            {
                apkinfo apk = new apkinfo();
                apk.apkid       = dr["APK_ID"].ToString();
                apk.apkname     = dr["APK_NAME"].ToString();
                apk.apkpath     = dr["APK_PATH"].ToString();
                apk.apkversion  = dr["APK_VERSION"].ToString();
                apk.publishdate = dr["PUBLISH_DATE"].ToString();
                apk.isupdate    = dr["IS_UPDATE"].ToString();
                appvdreturn.apkright.Add(apk);
            }

            SqlParameter[] Parameters_car = { new SqlParameter("@uid", uid) };
            AppProess      ap             = new AppProess();
            DataTable      dt_carlist     = ap.GetUserCrsbyOnline(sysflag, appvduser.uid);

            foreach (DataRow dr in dt_carlist.Rows)   //获取用户车辆数据权限列表
            {
                carsinfo cars = new carsinfo();
                cars.cid     = dr["cid"].ToString();
                cars.tno     = dr["tno"].ToString();
                cars.carno   = dr["carno"].ToString().Trim();
                cars.sim     = dr["sim"].ToString();
                cars.color   = dr["color"].ToString();
                cars.cartype = dr["cartype"].ToString();
                cars.online  = dr["online"].ToString();
                appvdreturn.carlist.Add(cars);
            }
        }
Example #2
0
        public void ProcessRequest(HttpContext context)
        {
            SessionModel sm         = new SessionModel();
            string       token      = "";
            string       sid        = "";
            string       sysuid     = "0";
            string       sysflag    = "";
            string       onecaruser = "******";

            SysService.LogModel logmodel = new SysService.LogModel();
            //写入操作日志
            sys_log           slog   = new sys_log();
            ResponseAppResult Result = null;

            context.Response.ContentType = "text/plain";
            try
            {
                Dictionary <string, string> inparams = GetParams(context);
                if (inparams == null || inparams.Count == 0)
                {
                    Result = new ResponseAppResult(ResState.ParamsImperfect, "参数错误!格式为JSON格式数据,详见服务接口文档。", null);
                }
                else
                {
                    if (BaseParamsCheck(inparams, out Result))
                    {
                        if (inparams.ContainsKey("sysflag"))
                        {
                            inparams["sysflag"] = WebProc.GetAppSysflagKey(inparams["sysflag"]);
                            sysflag             = inparams["sysflag"];
                        }
                        sid              = inparams["sid"];
                        sysuid           = inparams.Keys.Contains(sysuid) ? inparams["sysuid"] : "0";
                        logmodel.LogType = (int)SysService.LogType.LogTypeEnum.AppWebService;
                        AlarmProess ap    = new AlarmProess();
                        AppProess   app   = new AppProess();
                        AppvdProess appvd = new AppvdProess();
                        ExtYQWL     ey    = new ExtYQWL();
                        switch (sid)
                        {
                            #region APP基本公共接口
                        case "app-car-getallonline":
                            Result = app.AppGetAllOnline(inparams);
                            break;

                        case "app-user-register":
                            Result = app.AppUserRegister(inparams);
                            break;

                        case "app-user-smscheckcode":           //获取短信验证码
                            Result = app.AppSMSCode(inparams);
                            break;

                        case "app-user-login":
                            Result = app.AppUserLogin(inparams);
                            break;

                        case "app-user-login2":
                            Result = app.AppUserLogin2(inparams);
                            break;

                        case "app-user-changepwd":
                            Result = app.AppUserChangePwd(inparams);
                            break;

                        case "app-car-bind":
                            Result = app.AppUserCarBind(inparams);      //用户车辆绑定
                            break;

                        case "app-user-update":
                            Result = app.AppUserUpdate(inparams);
                            break;

                        case "app-car-usercars":
                            Result = app.AppGetUserCars(inparams);
                            break;

                        case "app-car-seachusercars":
                            Result = app.AppSeachUserCars(inparams);        //获取车辆列表
                            break;

                        case "app-car-unwrap":
                            Result = app.AppUnwrapUserCars(inparams);
                            break;

                        case "app-car-lasttrack":
                            Result = app.AppGetCarLastTrack(inparams);
                            break;

                        case "app-car-track":
                            Result = app.AppGetCarTrack(inparams);
                            break;

                        case "app-user-resetpwd":            //重置密码
                            Result = app.AppUserResetPwd(inparams);
                            break;

                        case "app-car-seachforpages":            //用户车辆检索 带分页
                            Result = app.AppSeachForPages(inparams);
                            break;

                        case "app-car-onlinecount":            //用户车辆在线状态统计
                            Result = app.AppCarOnlineCount(inparams);
                            break;

                            #endregion
                            #region 报警器专用接口
                        case "alarm-car-track":
                            Result = ap.AlarmGetCarTrack(inparams);
                            break;

                        case "alarm-car-find":
                            Result = ap.AppSendFindCar(inparams);
                            break;

                        case "alarm-car-status":
                            Result = ap.AppGetCarStatues(inparams);
                            break;

                        case "alarm-car-remotecontrol":
                            Result = ap.AppSendControl(inparams);
                            break;

                        case "alarm-car-alertview":
                            Result = ap.AppGetAppAlarmAlert(inparams);
                            break;

                        case "alarm-obd-sendobddiagn":
                            Result = ap.AppSendOBDDiagn(inparams);
                            break;

                        case "alarm-obd-sendobddriver":
                            Result = ap.AppSendOBDDriver(inparams);
                            break;

                        case "alarm-obd-getobddiagn":
                            Result = ap.AppGetOBDDiagnResult(inparams);
                            break;

                        case "alarm-obd-getobddriver":
                            Result = ap.AppGetOBDDriverResult(inparams);
                            break;

                            #endregion
                            #region 外部专用接口
                        case "ext-yqwl-vinupload":
                            Result = ey.AppVINUpload(inparams);
                            break;

                        case "ext-yqwl-carowner":
                            Result = ey.AppGetCarInfoByCarno(inparams);
                            break;

                            #endregion
                            #region APP应用端接口
                        case "appvd-user-register":         //用户注册
                            Result = appvd.AppvdUserRegister(inparams);
                            break;

                        case "appvd-user-login":            //用户登录
                            Result = appvd.AppUserLogin(inparams);
                            break;

                        case "appvd-user-update":           //用户修改信息
                            Result = appvd.AppvdUserUpdate(inparams);
                            break;

                        case "appvd-apk-version":            //获取APK指定版本
                            Result = appvd.AppvdGetApkVersion(inparams);
                            break;
                            #endregion
                        }
                    }
                    else
                    {
                        Result = new ResponseAppResult(ResState.ParamsImperfect, "参数错误!参数不完整,详见服务接口文档。", null);
                    }
                    Result.sid  = inparams.Keys.Contains("sid") ? inparams["sid"] : "";
                    Result.sequ = inparams.Keys.Contains("sequ") ? inparams["sequ"] : "";
                    //定位监控定时取最新轨迹不记录日志,因操作太频繁
                    if (sid != "" && !sid.Equals("alarm-car-lasttrack") && sysflag != "")
                    {
                        logmodel.SysFlag = sysflag;
                        logmodel.SysName = "AppService";
                        logmodel.UserId  = Int32.Parse(sysuid);
                        if ((ResState)Result.state == ResState.Success)
                        {
                            logmodel.LogResult  = "成功";
                            logmodel.LogContent = "操作成功";
                        }
                        else
                        {
                            logmodel.LogResult  = "失败";
                            logmodel.LogContent = ((ResState)Result.state).ToString() + "-" + Result.msg;
                        }
                        logmodel.OneCarUser = onecaruser;
                        slog.WriteSysLog(logmodel);
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteError("执行异常:", ex);
                Result = new ResponseAppResult(ResState.OperationFailed, ex.Message, "");

                //logmodel.LogContent = LogType.GetEnumName(LogType.LogTypeEnum.excepetion) + ex.Message;
                if (!string.IsNullOrEmpty(sysuid))
                {
                    logmodel.UserId = Int32.Parse(sysuid);
                }
                else
                {
                    logmodel.UserId = -1;
                }
                logmodel.SysFlag    = sysflag;
                logmodel.SysName    = "WebGISAppService";
                logmodel.LogContent = ((ResState)Result.state).ToString() + "-" + ex.Message;
                logmodel.LogResult  = "失败";
                logmodel.OneCarUser = onecaruser;
                //slog.WriteSysLog(logmodel);
            }

            Newtonsoft.Json.Converters.IsoDateTimeConverter timeConverter = new Newtonsoft.Json.Converters.IsoDateTimeConverter();

            timeConverter.DateTimeFormat = "yyyy'-'MM'-'dd' 'HH':'mm':'ss";
            Result.msg = Result.msg.Replace("\"", "");
            string strRes = JsonConvert.SerializeObject(Result, timeConverter);
            if (Result.state != 200)
            {
                LogHelper.WriteInfo("AppService Response:" + strRes);
            }
            context.Response.Write(strRes.Replace("null", "\"\""));
        }