예제 #1
0
        public object FaceRegistration()
        {
            try
            {
                var user = CurrentUserView;
                if (user == null)
                {
                    throw new Exception("获取用户信息失败!");
                }
                var http = HttpContext.Current;
                var form = http.Request.Form;

                string image  = form["image"];
                string source = RoleType.Supplier.ToString();
                using (ClientSiteClientProxy proxy = new ClientSiteClientProxy(ProxyEx(user)))
                {
                    var userFaceResult = proxy.AddAIUserFaceInfo(user.UserId, image, source);

                    if (userFaceResult.Flag == EResultFlag.Success && userFaceResult.Data == 1)
                    {
                        return(APIResult.GetSuccessResult(MsgCode.Success, "操作成功!"));
                    }
                    else
                    {
                        return(APIResult.GetErrorResult(MsgCode.CommonError, "操作失败!"));
                    }
                }
            }
            catch
            {
                return(APIResult.GetErrorResult(MsgCode.UserInfoError, "获取用户信息错误!"));
            }
        }
예제 #2
0
        public object ValidateToken(string token, int type)
        {
            string   tempToken  = "";
            DateTime expiryTime = DateTime.MinValue;

            Result <Base_User> login = new Result <Base_User>();

            using (ClientSiteClientProxy proxy = new ClientSiteClientProxy(ProxyEx(token)))
            {
                login = proxy.GetBaseUserByToken(token, type);
                if (login.Flag == 0)
                {
                    var data = login.Data;
                    tempToken  = type == 1 ? data.AndroidToken : data.IosToken;                     //模拟用户数据库中的token
                    expiryTime = type == 1 ? data.AndroidTokenTime.Value : data.IosTokenTime.Value; //模拟用户数据库中的token过期时间
                }
            }

            //没有根据token查到用户
            if (token == tempToken && DateTime.Now <= expiryTime)
            {
                return(APIResult.GetSuccessResult(new { token }));
            }
            return(APIResult.GetErrorResult(MsgCode.InvalidToken));
        }
예제 #3
0
 public object GetList(string signTime = "2018-05-21 08:55:00")
 {
     signTime = APIAESTool.AesEncrypt(signTime);
     if (!string.IsNullOrEmpty(signTime))
     {
         var isSign = CheckSignTime(signTime);
         if (!isSign)
         {
             return(Json(APIResult.GetErrorResult(MsgCode.SignTimeError)));
         }
     }
     return(APIResult.GetSuccessResult("token验证通过,已取得数据!"));
 }
예제 #4
0
        public object GetAuthTicket(string user, string pwd)
        {
            string tokenTicket = "";
            //登录
            var loginResult = login(user, pwd, Sys, out tokenTicket);

            if (loginResult)
            {
                var obj = new
                {
                    token = tokenTicket
                };
                return(APIResult.GetSuccessResult(obj));
            }
            return(APIResult.GetErrorResult(MsgCode.LoginError));
        }
예제 #5
0
        public object UpdatePwd(UserPwd model)
        {
            if (model == null)
            {
                return(Json(APIResult.GetErrorResult("请输入旧密码!")));
            }

            string oldpwd = model.oldpwd;
            string pwd    = model.pwd;

            if (string.IsNullOrWhiteSpace(oldpwd))
            {
                return(Json(APIResult.GetErrorResult("请输入旧密码!")));
            }
            if (string.IsNullOrWhiteSpace(pwd))
            {
                return(Json(APIResult.GetErrorResult("请输入新密码!")));
            }
            if (pwd.Equals(oldpwd))
            {
                return(Json(APIResult.GetErrorResult("新密码不能和旧密码相同!")));
            }

            oldpwd = APIAESTool.AesDecrypt(oldpwd);
            oldpwd = DesTool.DesEncrypt(oldpwd);

            pwd = APIAESTool.AesDecrypt(pwd);
            pwd = DesTool.DesEncrypt(pwd);

            var user = CurrentUserView;

            if (user != null)
            {
                using (ClientSiteClientProxy proxy = new ClientSiteClientProxy(ProxyEx(user)))
                {
                    var result = proxy.UpdatePassword(user.UserId, oldpwd, pwd);
                    if (result.Flag == EResultFlag.Success)
                    {
                        return(Json(APIResult.GetSuccessResult("密码修改成功!")));
                    }
                    return(Json(APIResult.GetErrorResult(MsgCode.CommonError, result.Exception.Decription)));
                }
            }
            return(Json(APIResult.GetErrorResult(MsgCode.InvalidToken)));
        }
예제 #6
0
        public object FaceDistinguish()
        {
            SignFaceAI model = new SignFaceAI();

            try
            {
                var user = CurrentUserView;
                if (user == null)
                {
                    throw new Exception("获取用户信息失败!");
                }
                var http = HttpContext.Current;
                var form = http.Request.Form;
                model.Image          = form["image"];
                model.ProjectId      = Convert.ToInt64(form["projectId"]);
                model.ProjectName    = form["projectName"];
                model.Longitude      = form["longitude"];
                model.Latitude       = form["latitude"];
                model.OilStationName = form["oilStationName"];
                model.UserId         = user.UserId;
                using (ClientSiteClientProxy proxy = new ClientSiteClientProxy(ProxyEx(user)))
                {
                    var userFaceResult = proxy.SearchUserFace(model);

                    if (userFaceResult.Flag == EResultFlag.Success && userFaceResult.Data == 1)
                    {
                        return(APIResult.GetSuccessResult(MsgCode.Success, "操作成功!"));
                    }
                    else
                    {
                        string msg = "人脸不匹配!";
                        if (userFaceResult.Exception != null)
                        {
                            msg = userFaceResult.Exception.Decription;
                        }
                        return(APIResult.GetErrorResult(MsgCode.CommonError, msg));
                    }
                }
            }
            catch
            {
                return(APIResult.GetErrorResult(MsgCode.UserInfoError, "获取用户信息错误!"));
            }
        }
예제 #7
0
        public object GetUser()
        {
            try
            {
                var user = CurrentUserView;
                if (user == null)
                {
                    throw new Exception("获取用户信息失败!");
                }

                Dictionary <long, string> userPhoto = null;
                bool userFace = false;
                using (ClientSiteClientProxy proxy = new ClientSiteClientProxy(ProxyEx("")))
                {
                    userPhoto = AppCommonHelper.GetUserProfilePhotoList(proxy, new List <long>()
                    {
                        user.UserId
                    });
                    var userFaceResult = proxy.GetAIUserFace(user.UserId);
                    if (userFaceResult.Flag == EResultFlag.Success && userFaceResult.Data != null)
                    {
                        userFace = true;
                    }
                }
                var data = new
                {
                    userId      = user.UserId,
                    userName    = user.RealName,
                    img         = AppCommonHelper.GetUserProfilePhoto(user.UserId, userPhoto, user),
                    phone       = user.Phone,
                    companyName = user.CompanyName,
                    qq          = user.Qq,
                    weChat      = user.WeChat,
                    mail        = user.Email,
                    isFace      = userFace
                };

                return(APIResult.GetSuccessResult(data));
            }
            catch
            {
                return(APIResult.GetErrorResult(MsgCode.UserInfoError, "获取用户信息错误!"));
            }
        }
예제 #8
0
        public object GetAppVersion()
        {
            string appNum = AppNum;

            if (string.IsNullOrWhiteSpace(appNum))
            {
                return(APIResult.GetErrorResult("获取更新版本失败!"));
            }

            using (ClientSiteClientProxy proxy = new ClientSiteClientProxy(ProxyEx("")))
            {
                var result = proxy.GetAppVersion(appNum);

                if (result.Flag == EResultFlag.Failure)
                {
                    return(APIResult.GetErrorResult(result.Exception));
                }

                if (result.Data == null)
                {
                    return(APIResult.GetSuccessNoData());
                }

                var data = new
                {
                    appNum      = result.Data.AppNum,      //包名
                    versionCode = result.Data.VersionCode, //版本号
                    version     = result.Data.VersionSn,   //版本名称
                    url         = result.Data.Url,         //版本下载路径
                    isForced    = result.Data.IsForced,    //是否强更:1-强制更新、2-普通更新
                    log         = result.Data.UpdateLog    //版本更新说明
                };

                return(APIResult.GetSuccessResult(data));
            }
        }
예제 #9
0
        public object NewAddMonitor(long projectId)
        {
            //判断项目ID是否为空
            if (projectId <= 0)
            {
                return(APIResult.GetErrorResult("请选择所属项目!"));
            }

            #region 整合变量定义
            var user = CurrentUserView;
            //角色权限定义
            string roleType = string.Empty;
            //监理ID类型
            long jlUserId = 0;
            #endregion

            //获取实体数据表结构checkItemList
            List <Epm_CheckItem>   checkItemList = new List <Epm_CheckItem>();
            List <Epm_InspectItem> itemDraftList = new List <Epm_InspectItem>();
            using (ClientSiteClientProxy proxy = new ClientSiteClientProxy(ProxyEx(user)))
            {
                #region RoleType(角色权限控制)
                bool isAgency = proxy.IsAgencyUser(user.UserId);
                if (!isAgency)
                {
                    bool isBranch = proxy.IsBranchCompanyUser(user.UserId);
                    if (!isBranch)
                    {
                        bool isSupervisor = proxy.IsSupervisor(projectId, user.UserId);
                        if (isSupervisor)
                        {
                            roleType = RoleTypeEnum.JL.ToString();
                        }
                        else
                        {
                            roleType = RoleTypeEnum.ZJL.ToString();
                        }
                    }
                    else
                    {
                        roleType = RoleTypeEnum.FGS.ToString();
                        var getProjectCompanyResult = proxy.GetProjectCompanyByProjectId(projectId);
                        if (getProjectCompanyResult.Flag == EResultFlag.Success && getProjectCompanyResult.Data != null)
                        {
                            var company = getProjectCompanyResult.Data.FirstOrDefault(t => t.IsSupervisor == 1);
                            if (company != null)
                            {
                                jlUserId = company.LinkManId.Value;
                            }
                        }
                    }
                }
                else
                {
                    roleType = RoleTypeEnum.SGS.ToString();
                }

                #endregion }
                //获取所有检查项目内容级节点
                checkItemList = proxy.GetCheckItemAll().Data;
                itemDraftList = proxy.GetInspectItemDraft(projectId).Data;
                Epm_Project project = proxy.GetProject(projectId).Data;


                var distinctcheckItem = checkItemList.Where(t => t.RoleType == roleType && t.Level == 3).Select(a => new
                {
                    a.ScoreCompany,
                }).Distinct().ToList();

                var data = new
                {
                    address    = project.Name,
                    date       = DateTime.Now.AddDays(1).ToString("yyyy-MM-dd"),
                    checkItems = checkItemList.OrderBy(t => t.Sort).Where(t => t.RoleType == roleType && t.Level == 1).Select(a => new
                    {
                        id       = a.Id,
                        name     = a.Name,
                        level    = 1,
                        selected = false,
                    }),
                    questionType = GetListQue(checkItemList, roleType),
                    //整改单位
                    companies = GetListCom(checkItemList, roleType, projectId),
                    //整改人
                    //rectification = GetListPer(checkItemList, roleType),
                    //分值
                    score = checkItemList.OrderBy(t => t.Sort).Where(t => t.RoleType == roleType && t.Level == 3).FirstOrDefault().ScoreRange.Split(','),
                };
                return(APIResult.GetSuccessResult(data));
            }
        }
예제 #10
0
        public object LevelChecklists(long projectId, long checkidlist, int level)
        {
            #region 整合变量定义
            var user = CurrentUserView;
            //角色权限定义
            string roleType = string.Empty;
            //监理ID类型
            long jlUserId = 0;
            #endregion
            //获取实体数据表结构checkItemList
            List <Epm_CheckItem>   checkItemList = new List <Epm_CheckItem>();
            List <Epm_InspectItem> itemDraftList = new List <Epm_InspectItem>();
            using (ClientSiteClientProxy proxy = new ClientSiteClientProxy(ProxyEx(user)))
            {
                #region RoleType(角色权限控制)
                bool isAgency = proxy.IsAgencyUser(user.UserId);
                if (!isAgency)
                {
                    bool isBranch = proxy.IsBranchCompanyUser(user.UserId);
                    if (!isBranch)
                    {
                        bool isSupervisor = proxy.IsSupervisor(projectId, user.UserId);
                        if (isSupervisor)
                        {
                            roleType = RoleTypeEnum.JL.ToString();
                        }
                        else
                        {
                            roleType = RoleTypeEnum.ZJL.ToString();
                        }
                    }
                    else
                    {
                        roleType = RoleTypeEnum.FGS.ToString();
                        var getProjectCompanyResult = proxy.GetProjectCompanyByProjectId(projectId);
                        if (getProjectCompanyResult.Flag == EResultFlag.Success && getProjectCompanyResult.Data != null)
                        {
                            var company = getProjectCompanyResult.Data.FirstOrDefault(t => t.IsSupervisor == 1);
                            if (company != null)
                            {
                                jlUserId = company.LinkManId.Value;
                            }
                        }
                    }
                }
                else
                {
                    roleType = RoleTypeEnum.SGS.ToString();
                }

                #endregion }
                //获取所有检查项目内容级节点
                checkItemList = proxy.GetCheckItemAll().Data;
                itemDraftList = proxy.GetInspectItemDraft(projectId).Data;
                Epm_Project project = proxy.GetProject(projectId).Data;
                #region 根据推送级别查询2,3级详细数据
                if (level == 2)
                {
                    var data = new
                    {
                        checkItems = checkItemList.OrderBy(t => t.Sort).Where(t => t.RoleType == roleType && t.Level == level && t.ParentId == checkidlist).Select(b => new
                        {
                            id         = b.Id,
                            parentId   = b.ParentId,
                            parentName = b.Name,
                            name       = b.Name,
                            level      = level,
                            selected   = false,
                        })
                    };
                    return(APIResult.GetSuccessResult(data));
                }
                else
                {
                    var data = new
                    {
                        checkItems = checkItemList.Where(t => t.RoleType == roleType && t.Level == 3 && t.ParentId == checkidlist && !string.IsNullOrEmpty(t.RectificationManName)).Select(c => new
                        {
                            id           = c.Id,
                            parentId     = c.ParentId,
                            parentName   = c.ParentName = (c.ParentName == null) ? "" : c.ParentName,
                            name         = c.Remark,
                            level        = level,
                            selected     = false,
                            questionType = GetListQue(checkItemList, roleType),
                            //整改单位/整改人
                            companies = GetListComs(checkItemList, roleType, projectId, c.Id),
                            //分值
                            score = string.IsNullOrEmpty(c.ScoreRange) ? (new string[1] {
                                "10"
                            }) : c.ScoreRange.Split(','),
                        })
                    };
                    return(APIResult.GetSuccessResult(data));
                }
                #endregion
            }
        }
예제 #11
0
        public object GetUserMenu(long projectId)
        {
            try
            {
                if (projectId <= 0)
                {
                    return(APIResult.GetSuccessNoDatas());
                }

                var user = CurrentUserView;
                if (user != null)
                {
                    var list = Enum <BusinessType> .AsEnumerable().ToDictionary(i => i.ToString(), j => j.GetText()).Select(p => new { code = p.Key }).ToList();

                    if (user.CompanyType.Equals(RoleType.Owner.ToString()))
                    {
                        list = list.Where(p =>
                                          p.code == BusinessType.SecurityCheck.ToString() ||
                                          p.code == BusinessType.Question.ToString()).ToList();
                    }
                    if (user.CompanyType.Equals(RoleType.Supplier.ToString()))
                    {
                        using (ClientSiteClientProxy proxy = new ClientSiteClientProxy(ProxyEx(user)))
                        {
                            if (proxy.IsSupervisor(projectId, user.UserId))
                            {
                                list = list.Where(p =>
                                                  p.code == BusinessType.Log.ToString() ||
                                                  p.code == BusinessType.Equipment.ToString() ||
                                                  p.code == BusinessType.Visa.ToString() ||
                                                  p.code == BusinessType.Question.ToString() ||
                                                  p.code == BusinessType.SecurityCheck.ToString() || //返回监理现场检查类型;
                                                  p.code == BusinessType.Rectification.ToString() || //发起整改单
                                                  p.code == BusinessType.Dangerous.ToString()).ToList();
                            }
                            else
                            {
                                list = list.Where(p =>
                                                  p.code == BusinessType.Track.ToString() ||
                                                  p.code == BusinessType.DelayApply.ToString() ||
                                                  p.code == BusinessType.Question.ToString()).ToList();

                                //list.Add(new
                                //{
                                //    code = SystemRight.UploadSecurityCheck.ToString()
                                //});
                                list.Add(new
                                {
                                    code = SystemRight.UploadWork.ToString()
                                });
                            }
                        }
                    }
                    list.Add(new
                    {
                        code = SystemRight.UploadSecurityCheck.ToString()
                    });
                    list.Add(new
                    {
                        code = SystemRight.FaceAI.ToString()
                    });
                    return(APIResult.GetSuccessResult(list));
                }
                return(APIResult.GetErrorResult(MsgCode.InvalidToken));
            }
            catch (Exception ex)
            {
                return(APIResult.GetErrorResult(ex.Message));
            }
            finally
            {
            }
        }
예제 #12
0
        public object InitInfo()
        {
            //Dictionary<long, string> projectList = new Dictionary<long, string>();
            List <Epm_Project>       projectList = new List <Epm_Project>();
            Epm_AdPutRecord          ad          = new Epm_AdPutRecord();
            Dictionary <string, int> dic         = new Dictionary <string, int>();
            List <Epm_OilStation>    oilList     = new List <Epm_OilStation>();
            string        adUrl      = "";
            List <string> attendance = new List <string>();

            using (ClientSiteClientProxy proxy = new ClientSiteClientProxy(ProxyEx("")))
            {
                QueryCondition qc = new QueryCondition();
                qc.ConditionList.Add(new ConditionExpression()
                {
                    ExpName     = "AdTargetNum",
                    ExpValue    = 0,
                    ExpOperater = eConditionOperator.Equal,
                    ExpLogical  = eLogicalOperator.And
                });

                // todo : 添加广告查询条件
                var adResult = proxy.GetAdShowList(qc);
                if (adResult.Flag == EResultFlag.Success && adResult.Data.Any())
                {
                    ad = adResult.Data.FirstOrDefault() ?? new Epm_AdPutRecord();
                    var filesResult = proxy.GetBaseFiles(new List <long>()
                    {
                        ad.Id
                    });
                    if (filesResult.Flag == EResultFlag.Success && filesResult.Data.Any())
                    {
                        string type = ad.GetType().Name;
                        var    file = filesResult.Data.FirstOrDefault(p => p.TableId == ad.Id && p.TableName == type && (p.ImageType == "big" || p.ImageType == "start"));
                        adUrl = file == null ? "" : file.Url;
                    }
                }

                var user = CurrentUserView;

                QueryCondition qc1 = new QueryCondition()
                {
                    PageInfo = GetPageInfo(1, false)
                };

                qc1.PageInfo.isAllowPage = false;

                qc1.ConditionList = new List <ConditionExpression>
                {
                    new ConditionExpression()
                    {
                        ExpName     = "State",
                        ExpValue    = (int)ProjectState.Construction,
                        ExpOperater = eConditionOperator.Equal,
                        ExpLogical  = eLogicalOperator.And
                    }
                };
                qc1.SortList.Add(new SortExpression()
                {
                    SortName = "OperateTime",
                    SortType = eSortType.Desc
                });

                if (user != null)
                {
                    var proList = proxy.GetProjectListById(user.CompanyId, user.UserId).Data;
                    if (proList != null)
                    {
                        projectList = proxy.GetProjectListById(user.CompanyId, user.UserId).Data;
                    }
                }
                //获取油站列表
                var oilStationResult = proxy.GetOilStationAllList();
                if (oilStationResult.Flag == EResultFlag.Success && oilStationResult.Data.Any())
                {
                    oilList = oilStationResult.Data;
                }

                //考勤设置信息
                var attendanceList = proxy.GetAttendanceModel();

                if (attendanceList.Flag == EResultFlag.Success && attendanceList.Data != null)
                {
                    attendance = attendanceList.Data.AttendanceTimeList;
                }
            }
            //签到距离
            string value = ConfigurationManager.AppSettings["FaceAIDistance"];
            var    data  = new
            {
                adInfo = new
                {
                    id    = ad.Id,
                    image = AppCommonHelper.SystemSetting["resourceUrl"] + "/Content/screen.jpg",
                    url   = ""
                },
                projectList = projectList.Select(p => new
                {
                    projectId   = p.Id,
                    projectName = p.Name,
                    latitude    = p.ProjectSubjectId == null ? 0 : GetOilInfo(oilList, p.ProjectSubjectId.Value) == null ? 0 : GetOilInfo(oilList, p.ProjectSubjectId.Value).Latitude,
                    longitude   = p.ProjectSubjectId == null ? 0 : GetOilInfo(oilList, p.ProjectSubjectId.Value) == null ? 0 : GetOilInfo(oilList, p.ProjectSubjectId.Value).Longitude,
                    //latitude = "34.231696",
                    //longitude = "108.93393",
                    //oilStationName = GetOilInfo(oilList, p.ProjectSubjectId.Value) == null ? "" : GetOilInfo(oilList, p.ProjectSubjectId.Value).Name,
                    distance = value ?? "0",
                }),
                waitList = new
                {
                    approvalCount = 0, //dic.ContainsKey("approvalCount") ? dic["approvalCount"] : 0,
                    unreadMsg     = 0  //dic.ContainsKey("unreadMsg") ? dic["unreadMsg"] : 0
                },
                timedReminderList = getAttendence(attendance),
                sysSetting        = AppCommonHelper.SystemSetting
            };

            return(Json(APIResult.GetSuccessResult(data)));
        }
예제 #13
0
        public object GetNewsInfo()
        {
            List <Epm_AdPutRecord> adList      = new List <Epm_AdPutRecord>();
            QuestionModel          question    = new QuestionModel();
            List <Epm_Project>     projectList = new List <Epm_Project>();
            List <Base_Files>      files       = new List <Base_Files>();

            List <long> ids = new List <long>();

            using (ClientSiteClientProxy proxy = new ClientSiteClientProxy(ProxyEx("")))
            {
                #region 广告
                // 获取广告编码
                string value = ConfigurationManager.AppSettings["AdCode"] ?? "";

                QueryCondition qcad = new QueryCondition()
                {
                    PageInfo = GetPageInfo(1, true)
                };

                qcad.ConditionList.Add(new ConditionExpression()
                {
                    ExpName     = "AdTargetNum",
                    ExpValue    = value,
                    ExpOperater = eConditionOperator.Equal,
                    ExpLogical  = eLogicalOperator.And
                });

                var adResult = proxy.GetAdShowList(qcad);
                if (adResult.Flag == EResultFlag.Success && adResult.Data.Any())
                {
                    adList = adResult.Data;
                    ids.AddRange(adResult.Data.Select(p => p.Id));
                }

                #endregion

                #region 头像

                //头像
                Dictionary <long, string> userPhoto = new Dictionary <long, string>();
                var questionResult = proxy.GetHotQuestion();
                if (questionResult.Flag == EResultFlag.Success && questionResult.Data != null)
                {
                    question = questionResult.Data;
                    if (question != null)
                    {
                        userPhoto = AppCommonHelper.GetUserProfilePhotoList(proxy, new List <long>()
                        {
                            question.submitUserId.Value
                        });
                    }
                }

                #endregion

                #region 项目展示

                QueryCondition qcProject = new QueryCondition()
                {
                    PageInfo = GetPageInfo(1, true)
                };
                qcProject.ConditionList = new List <ConditionExpression>
                {
                    new ConditionExpression()
                    {
                        ExpName     = "State",
                        ExpValue    = (int)ProjectState.Construction,
                        ExpOperater = eConditionOperator.Equal,
                        ExpLogical  = eLogicalOperator.And
                    }
                };
                qcProject.SortList.Add(new SortExpression()
                {
                    SortName = "OperateTime",
                    SortType = eSortType.Desc
                });
                var projectResult = proxy.GetProjectList(qcProject);
                if (projectResult.Flag == EResultFlag.Success && projectResult.Data.Any())
                {
                    projectList = projectResult.Data.Take(1).ToList();
                }

                #endregion

                #region 获取所有附件

                if (ids.Any())
                {
                    files = AppCommonHelper.GetBaseFileList(proxy, ids);
                }

                #endregion

                #region 组织数据
                //附件
                Func <long, BaseBusiness, string> getImageUrl = delegate(long id, BaseBusiness model)
                {
                    string type = model.GetType().Name;
                    var    file = files.FirstOrDefault(p => p.TableId == id && p.TableName == type && (p.ImageType == "small" || p.ImageType == "start"));
                    if (file == null)
                    {
                        return("");
                    }
                    return(AppCommonHelper.GetResourceUrl(file));
                };

                var data = new
                {
                    banner = adList.Select(p => new
                    {
                        id    = p.Id,
                        image = getImageUrl(p.Id, p),
                        url   = p.AdUrl ?? ""
                    }),
                    hotQuestionList = (question.id == 0) ? null : (new
                    {
                        question.id,
                        question.name,
                        desc = question.workContent,
                        question.type,
                        question.answerCount,
                        submitTime = string.Format("{0:yyyy-MM-dd}", question.submitTime),
                        question.submitUserName,
                        headerUrl = AppCommonHelper.GetUserProfilePhoto(question.submitUserId.Value, userPhoto, null),
                        files = files.Where(x => x.TableId == question.id)
                    }),
                    projectList = projectList.Select(p => new
                    {
                        id          = p.Id,
                        name        = p.Name ?? "",
                        description = p.Description ?? "",
                        imageUrl    = AppCommonHelper.SystemSetting["resourceUrl"] + "/Content/projectdefaut.png"
                                      //projectFiles.Where(x => x.TableId == p.Id && x.TableColumn == "Thumbnail").FirstOrDefault() == null ? "" : (AppCommonHelper.SystemSetting["resourceUrl"] + projectFiles.Where(x => x.TableId == p.Id && x.TableColumn == "Thumbnail").FirstOrDefault().Url)
                    }),
                    companyInfo = new
                    {
                        shortname = "中国石油本省销售分公司",
                        content   = "",
                        address   = "本省省武汉市江汉区常青路149号",
                        phone     = "15829297065",
                        linkman   = "姜斌",
                        imageUrl  = AppCommonHelper.SystemSetting["resourceUrl"] + "/Content/zylog.png"
                    },
                };

                #endregion

                return(Json(APIResult.GetSuccessResult(data)));
            }
        }
예제 #14
0
        public object GetTime()
        {
            string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

            return(APIResult.GetSuccessResult(new { time }));
        }
예제 #15
0
 public object GetMsgInfo()
 {
     return(APIResult.GetSuccessResult(MsgView));
 }