当前位置: 首页>>代码示例>>C#>>正文


C# UserRepository.GetUserInfoByOpenid方法代码示例

本文整理汇总了C#中UserRepository.GetUserInfoByOpenid方法的典型用法代码示例。如果您正苦于以下问题:C# UserRepository.GetUserInfoByOpenid方法的具体用法?C# UserRepository.GetUserInfoByOpenid怎么用?C# UserRepository.GetUserInfoByOpenid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserRepository的用法示例。


在下文中一共展示了UserRepository.GetUserInfoByOpenid方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PostInitialize

        public async Task<HttpResponseMessage> PostInitialize([FromBody]LoginParameter postParameter)
        {
            string openid = postParameter.openID;
            if (string.IsNullOrEmpty(openid))
            {
                return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, null, HttpStatusCode.OK, customStatus.InvalidArguments);
            }

            using (UserRepository userRepository = new UserRepository())
            {
                userinfo = await userRepository.GetUserInfoByOpenid(openid);
                if (userinfo == null)
                {
                    return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, null, HttpStatusCode.OK, customStatus.NotFound);
                }
                userinfo.NumOfContacts = await userRepository.GetUserContactNumber(userinfo.uuid);
                userinfo.NumOfVisitor = await userRepository.GetUserVisitorNumber(userinfo.uuid);
                userinfo.NumOfFavorite = await userRepository.GetuserFavoriteNumber(userinfo.uuid);
                using(SystemRepository systemRepository = new SystemRepository())
                {
                    userinfo.Hometown = await systemRepository.GetShortAddress(userinfo.HometownProvince,userinfo.HometownCity);
                }
                return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, userinfo, HttpStatusCode.OK, customStatus.Success);
            }


        }
开发者ID:amwtke,项目名称:bkwecaht,代码行数:27,代码来源:MyRecordsController.cs

示例2: PostFindProfessors

        public async Task<HttpResponseMessage> PostFindProfessors([FromBody]BaseParameter postParameter)
        {
            string openid = postParameter.openID;
            if (string.IsNullOrEmpty(openid))
            {
                return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, null, HttpStatusCode.OK, customStatus.InvalidArguments);
            }
            //获取用户uuid 学校与院系与专业信息。
            Guid useruuid; string xuexiaoname, yuanxiname; long? rf;
            using (UserRepository userRepository = new UserRepository())
            {
                var userinfo = await userRepository.GetUserInfoByOpenid(openid);
                useruuid = userinfo.uuid;
                xuexiaoname = userinfo.Unit;
                yuanxiname = userinfo.Faculty;
                rf = userinfo.ResearchFieldId;

                if (string.IsNullOrEmpty(xuexiaoname) || string.IsNullOrEmpty(yuanxiname))
                    return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, "学校,院系有个为空!", HttpStatusCode.OK, customStatus.InvalidArguments);

                //获取score
                double univScore, depScore;
                FindHelper.GetUnivDeptScore(xuexiaoname, yuanxiname, out univScore, out depScore);
                    //return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, "学校,院系名称不正规!", HttpStatusCode.OK, customStatus.InvalidArguments);

                //拿到三个集合
                double rfScore = Convert.ToDouble(rf.Value);
                var set = await FindHelper.GetThreeSet(true, univScore, depScore, rfScore);

                var retUuid = FindHelper.FindProfessorRule(useruuid,set.Item1, set.Item2, set.Item3, postParameter.pageIndex, postParameter.pageSize);

                List<Tuple<UserInfo, string, bool>> ret = new List<Tuple<UserInfo, string, bool>>();
                if (retUuid != null && retUuid.Count > 0)
                {
                    using (UserRepository repo = new UserRepository())
                    {
                        List<string> eduList = await ProfessorManager.GetUserEducations(userinfo.uuid);
                        var list = await ProfessorManager.Search_UUid(retUuid);
                        foreach (var v in list)
                        {
                            Guid uuid = Guid.Parse(v.Id);
                            var tempUserinfo = await repo.GetUserInfoByUuidAsync(uuid);
                            string three = !string.IsNullOrEmpty(v.Diwei) ? v.Diwei.Trim() : "";
                            bool isXY = ProfessorManager.IsXiaoYou(eduList, v.Education);
                            ret.Add(Tuple.Create(tempUserinfo, three, isXY));
                        }
                    }
                }
                return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, ret, HttpStatusCode.OK, customStatus.Success);
            }
        }
开发者ID:amwtke,项目名称:bkwecaht,代码行数:51,代码来源:FindPepoleController.cs

示例3: SaveUserInfo

        public static async Task<bool> SaveUserInfo(ComplementParameter complementParameter, pre_register preRegister)
        {
            bool saveresult = false;
            bool createresult = false;
            UserInfoRedis userinfoRedis = await GetUserInfoRedisByOpenid(complementParameter.openID);
            UserInfo userinfo = null;
            using (UserRepository userRepository = new UserRepository())
            {
                userinfo = await userRepository.GetUserInfoByOpenid(complementParameter.openID);
                if (userinfo == null)
                {
                    userinfo = new UserInfo()
                    {
                        AccountEmail = preRegister.accountemail,
                        Password = preRegister.password,
                        CreateTime = preRegister.createtime,
                        Name = preRegister.name,
                        Gender = userinfoRedis.Sex,
                        Phone = preRegister.accountemail.Substring(0, 11),
                        IsBusiness = preRegister.validate
                    };
                    createresult = true;
                }
                else
                {
                    userinfo.Name = complementParameter.name;
                    userinfo.Gender = complementParameter.Gender;
                }
                await CheckUserInfoPhoto(userinfo, userinfoRedis);

                userinfo.Unit = complementParameter.university;
                userinfo.Faculty = complementParameter.faculty;
                userinfo.ResearchFieldId = complementParameter.researchFieldId;
                userinfo.Degree = complementParameter.degree;
                if (userinfo.IsBusiness==2)
                    userinfo.Enrollment = complementParameter.enrollment;
                if (userinfo.IsBusiness == 0 && !string.IsNullOrEmpty(complementParameter.position))
                    userinfo.Position = complementParameter.position;
                userinfo.Province = complementParameter.province;
                userinfo.City = complementParameter.city;
                userinfo.Birthday = complementParameter.birthday;
                userinfo.HometownProvince = complementParameter.hometownProvince;
                userinfo.HometownCity = complementParameter.hometownCity;
                userinfo.Position = complementParameter.position;
                saveresult = await userRepository.SaveUserInfo(userinfo);

                if (saveresult & createresult)
                    await userRepository.SaveUserOpenid(userinfo.uuid, userinfoRedis.Openid, userinfoRedis.Unionid);
            }
            return saveresult;
        }
开发者ID:amwtke,项目名称:bkwecaht,代码行数:51,代码来源:UserInfoControllerHelper.cs

示例4: PostSearchrf

        public async Task<HttpResponseMessage> PostSearchrf([FromBody]ProfessorSearchParameter postParameter)
        {
            string openid = postParameter.openID;
            int diwei = string.IsNullOrEmpty(postParameter.labels) ? 0 : ProfessorManager.GetDiweiScore(postParameter.labels);
            bool xiaoyou = postParameter.xiaoyou != null ? postParameter.xiaoyou.Value : false;
            string danwei = postParameter.danwei;

            int index = postParameter.pageIndex;
            int size = postParameter.pageSize;

            if (string.IsNullOrEmpty(openid))
            {
                return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, null, HttpStatusCode.OK, customStatus.InvalidArguments);
            }
            Guid Myuuid;
            using (UserRepository repo = new UserRepository())
            {
                Myuuid = (await repo.GetUserInfoByOpenid(openid)).uuid;
            }


            var list = await ProfessorManager.Search_rf3(Myuuid, xiaoyou, danwei, diwei, postParameter.address, postParameter.pageIndex, postParameter.pageSize);

            List<Tuple<UserInfo, string, bool>> ret = new List<Tuple<UserInfo, string, bool>>();
            if (list != null && list.Count > 0)
            {
                using (UserRepository repo = new UserRepository())
                {
                    List<string> eduList = await ProfessorManager.GetUserEducations(Myuuid);
                    foreach (var v in list)
                    {
                        Guid uuid = Guid.Parse(v.Id);
                        var userinfo = await repo.GetUserInfoByUuidAsync(uuid);
                        string three = !string.IsNullOrEmpty(v.Diwei) ? v.Diwei.Trim() : "";
                        bool isXY = ProfessorManager.IsXiaoYou(eduList, v.Education);
                        ret.Add(Tuple.Create(userinfo, three, isXY));
                    }
                }
            }
            return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, ret, HttpStatusCode.OK, customStatus.Success);
        }
开发者ID:amwtke,项目名称:bkwecaht,代码行数:41,代码来源:ProfessorSearchController.cs

示例5: PostEkCommentAdd

        public async Task<HttpResponseMessage> PostEkCommentAdd([FromBody]EKCommentParameter postParameter)
        {
            string openid = postParameter.openID;
            long ekid = postParameter.Id;
            string content = postParameter.Content;
            if (string.IsNullOrEmpty(openid) || ekid == 0 || string.IsNullOrEmpty(content))
            {
                return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, null, HttpStatusCode.OK, customStatus.InvalidArguments);
            }

            using (UserRepository userR = new UserRepository())
            {
                var userinfo = await userR.GetUserInfoByOpenid(openid);
                if (EKCommentMessageMQOp.SendMessage(userinfo.uuid.ToString(), ekid, content))
                {
                    await EKArticleManager.AddCommentCountAsync(ekid);//评论数增加
                    return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, "OK", HttpStatusCode.OK, customStatus.Success);
                }

                return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, "Failed", HttpStatusCode.OK, customStatus.Fail);
            }
        }
开发者ID:amwtke,项目名称:bkwecaht,代码行数:22,代码来源:EKCommentController.cs

示例6: PostSearch

        public async Task<HttpResponseMessage> PostSearch([FromBody]EKCommentParameter postParameter)
        {
            string openid = postParameter.openID;
            string queryStr = postParameter.Content;
            int index = postParameter.pageIndex;
            int size = postParameter.pageSize;

            if (string.IsNullOrEmpty(openid) || string.IsNullOrEmpty(queryStr))
            {
                return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, null, HttpStatusCode.OK, customStatus.InvalidArguments);
            }
            UserInfo myUserInfo = null;
            using (UserRepository repo = new UserRepository())
            {
                myUserInfo = await repo.GetUserInfoByOpenid(openid);
            }
                List<Tuple<UserInfo, string, bool>> ret = new List<Tuple<UserInfo, string, bool>>();
            var list = await ProfessorManager.Search(myUserInfo.uuid,queryStr, index, size);
            if (list != null && list.Count > 0)
            {
                
                using (UserRepository repo = new UserRepository())
                {
                    List<string> eduList = await ProfessorManager.GetUserEducations(myUserInfo.uuid);
                    foreach (var v in list)
                    {
                        Guid uuid = Guid.Parse(v.Id);
                        var userinfo = await repo.GetUserInfoByUuidAsync(uuid);

                        string three = !string.IsNullOrEmpty(v.Diwei) ? v.Diwei.Trim() : "";
                        bool isXY = ProfessorManager.IsXiaoYou(eduList, v.Education);
                        ret.Add(Tuple.Create(userinfo, three, isXY));
                    }
                }
            }
            return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, ret, HttpStatusCode.OK, customStatus.Success);
        }
开发者ID:amwtke,项目名称:bkwecaht,代码行数:37,代码来源:ProfessorSearchController.cs

示例7: PostInitialize

        public async Task<HttpResponseMessage> PostInitialize([FromBody]LoginParameter loginParameter)
        {
            string openid = loginParameter.openID;
            if (string.IsNullOrEmpty(openid))
            {
                return WebApiHelper.HttpRMtoJson(loginParameter.jsonpCallback, null, HttpStatusCode.OK, customStatus.InvalidArguments);
            }

            using (UserRepository userRepository = new UserRepository())
            {
                userinfo = await userRepository.GetUserInfoByOpenid(openid);
                if (userinfo == null)
                {
                    return WebApiHelper.HttpRMtoJson(loginParameter.jsonpCallback, null, HttpStatusCode.OK, customStatus.NotFound);
                }
                userinfo.NumOfContacts = await userRepository.GetUserContactNumber(userinfo.uuid);
                userinfo.NumOfBeenTo = await userRepository.GetUserBeenToNumber(userinfo.uuid);
                userinfo.NumOfFavorite = await userRepository.GetuserFavoriteNumber(userinfo.uuid);
                
                return WebApiHelper.HttpRMtoJson(userinfo, HttpStatusCode.OK, customStatus.Success);
            }


        }
开发者ID:amwtke,项目名称:bkwecaht,代码行数:24,代码来源:MyIndexController.cs

示例8: PostUpdateResearchField

        public async Task<HttpResponseMessage> PostUpdateResearchField([FromBody]DualParameter postParameter)
        {
            string openid = postParameter.openID;
            
            if (string.IsNullOrEmpty(openid) || string.IsNullOrEmpty(postParameter.textMsg))
            {
                return WebApiHelper.HttpRMtoJson(null, HttpStatusCode.OK, customStatus.InvalidArguments);
            }
            using (UserRepository userRepository = new UserRepository())
            {
                var userUuid = await userRepository.GetUserUuidByOpenid(openid);
                if (userUuid == Guid.Empty)
                {
                    return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, null, HttpStatusCode.OK, customStatus.NotFound);
                }
                else
                {
                    UserInfo userinfo = await userRepository.GetUserInfoByOpenid(openid);

                    //更新研究兴趣
                    userinfo.Interests = postParameter.textMsg;
                    bool flag = await userRepository.SaveUserInfo(userinfo);
                    if(flag)
                        return WebApiHelper.HttpRMtoJson(flag, HttpStatusCode.OK, customStatus.Success);
                    else
                        return WebApiHelper.HttpRMtoJson("没有保存成功", HttpStatusCode.OK, customStatus.Fail);
                }
            }
        }
开发者ID:amwtke,项目名称:bkwecaht,代码行数:29,代码来源:ProfessorRecordsController.cs

示例9: PostChatInitialize

        public async Task<HttpResponseMessage> PostChatInitialize([FromBody]DualParameter postParameter)
        {
            string openid = postParameter.openID;
            Guid uuid = postParameter.uuid;
            int pageIndex = postParameter.pageIndex;
            if(string.IsNullOrEmpty(openid))
            {
                return WebApiHelper.HttpRMtoJson(null, HttpStatusCode.OK, customStatus.InvalidArguments);
            }

            using(UserRepository userRepository = new UserRepository())
            {
                var user = await userRepository.GetUserInfoByOpenid(openid);
                var touser = await userRepository.GetUserInfoByUuidAsync(uuid);
                if(user == null || touser == null)
                {
                    return WebApiHelper.HttpRMtoJson(null, HttpStatusCode.OK, customStatus.NotFound);
                }
                var chatList = await WeChatReceiveHelper.GetMessage(user.uuid.ToString().ToUpper(), touser.uuid.ToString().ToUpper(), pageIndex);

                return WebApiHelper.HttpRMtoJson(Tuple.Create(user, touser, chatList), HttpStatusCode.OK, customStatus.Success);
            }
        }
开发者ID:amwtke,项目名称:bkwecaht,代码行数:23,代码来源:ChatController.cs

示例10: LoginCallBack

        protected virtual async Task<ActionResult> LoginCallBack(string code, string state, string xueshengUrl,string jiaoshouUrl)
        {
            try
            {
                if (code == null)
                    return Content("code是空!");
                //LogHelper.LogInfoAsync(typeof(WeChatCallBackController), @"1\code=" + code);

                var config = BK.Configuration.BK_ConfigurationManager.GetConfig<WeixinConfig>();
                bool Isbinded = true;

                var openid = await WXAuthHelper.GetOpenIdWXCallBackAsync(config.WeixinAppId, config.WeixinAppSecret, code, async delegate (OAuthAccessTokenResult result)
                {
                    //是否需要绑定账号

                    using (UserRepository userRepository = new UserRepository())
                    {
                        //如果OPenid绑定了,就不需要再向微信请求userinfo的信息了.
                        //如果没有绑定,则需要刷新accesstoken,然后请求userinfo;并将userinfo存入redis。
                        Isbinded = await userRepository.IsUserOpenidExist(result.openid);
                    }

                    if (!Isbinded)
                        //如果没有绑定就要存储token信息
                        await WeChatCallBackControllerHelper.SaveOAuthUserTokenAsync(result);
                    return !Isbinded;//如果绑定了就不需要获取userinfo信息了
                }, async delegate (OAuthUserInfo user)
                {
                    //如果需要绑定用户信息则,此处存储用户信息
                    return await WeChatCallBackControllerHelper.SaveOAuthUserInfoToRedis(user);
                });
                //再次判断是否需要绑定

                //存入cookie供前端代码调用
                Response.Cookies["openid"].Value = openid;
                Response.Cookies["openid"].Expires = DateTime.Now.AddYears(1);


                //如果是tester则不管怎么样都要去注册。
                //可以通过wechat.51science.cn/weixinapi/addtester/?openid=xxx来添加
                //wechat.51science.cn/weixinapi/rmtester/?openid=xxx删除
                bool isToRegister = !Isbinded || await WXAuthHelper.IsTester(openid);
                //BKLogger.LogInfoAsync(typeof(MVCNeedWeixinCallBackBaseController), "isToRegister:"+isToRegister);
                //BKLogger.LogInfoAsync(typeof(MVCNeedWeixinCallBackBaseController), "Isbinded:" + Isbinded);
                if (!isToRegister)
                {
                    //记录用户行为
                    await UserLoginBehaviorOp.AddLoginCountAsync(openid);
                    await UserLoginBehaviorOp.AddUpdateLastLoginTimeAsync(openid);
                    //跳转到个人主页
                    UserInfo userinfo = null;
                    using (UserRepository userRepository = new UserRepository())
                    {
                        userinfo = await userRepository.GetUserInfoByOpenid(openid);
                    }

                    BKLogger.LogInfoAsync(typeof(MVCNeedWeixinCallBackBaseController), "userinfo:"+userinfo.uuid.ToString()+" type:"+userinfo.IsBusiness.Value.ToString());

                    BizMQ bizobj = new BizMQ("微信登陆", openid, userinfo.uuid,userinfo.Name+ " 登陆了!");
                    BKLogger.LogBizAsync(typeof(MVCNeedWeixinCallBackBaseController), bizobj);

                    //存cookie
                    var cookieResult = Response.Cookies["type"].Value = userinfo.IsBusiness.Value.ToString();
                    Response.Cookies["type"].Expires = DateTime.Now.AddYears(1);
                    Response.Cookies["uuid"].Value = userinfo.uuid.ToString();
                    Response.Cookies["uuid"].Expires = DateTime.Now.AddYears(1);

                    //LogHelper.LogInfoAsync(typeof(MVCNeedWeixinCallBackBaseController), cookieResult.ToString());
                    if (userinfo.IsBusiness.Value == 0)
                        return Redirect(jiaoshouUrl);
                    else
                        return Redirect(xueshengUrl);
                }
                else
                {
                    // login页面 
                    return Redirect(LOGIN_PAGE_URL);
                }

            }
            catch (Exception ex)
            {
                BKLogger.LogErrorAsync(typeof(MVCNeedWeixinCallBackBaseController), ex);
                return Content(ex.ToString());
            }
        }
开发者ID:amwtke,项目名称:bkwecaht,代码行数:86,代码来源:MVCNeedWeixinCallBackBaseController.cs

示例11: PostResetPassword

        public async Task<HttpResponseMessage> PostResetPassword([FromBody]PasswordParameter postParameter)
        {
            string openid = postParameter.openID;
            string old = postParameter.oldPassword;
            string newp = postParameter.newPassword;

            if (string.IsNullOrEmpty(openid)|| string.IsNullOrEmpty(old) || string.IsNullOrEmpty(newp))
            {
                return WebApiHelper.HttpRMtoJson(null, HttpStatusCode.OK, customStatus.InvalidArguments);
            }

            using (UserRepository userRepository = new UserRepository())
            {
                userinfo = await userRepository.GetUserInfoByOpenid(openid);
                if (userinfo == null)
                    return WebApiHelper.HttpRMtoJson(null, HttpStatusCode.OK, customStatus.NotFound);
                else
                {
                    if (userinfo.AccountEmail.Contains("@phone.51science.cn"))
                        return WebApiHelper.HttpRMtoJson(userinfo.AccountEmail.Replace("@phone.51science.cn", ""), HttpStatusCode.OK, customStatus.Success);
                    else
                        return WebApiHelper.HttpRMtoJson(userinfo.AccountEmail, HttpStatusCode.OK, customStatus.Success);
                }
            }
        }
开发者ID:amwtke,项目名称:bkwecaht,代码行数:25,代码来源:LoginController.cs

示例12: PostGetArticleById

 public async Task<HttpResponseMessage> PostGetArticleById([FromBody]EKCommentParameter postParameter)
 {
     string openid = postParameter.openID;
     long ekid = postParameter.Id;
     if (string.IsNullOrEmpty(openid) || ekid == 0)
     {
         return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, null, HttpStatusCode.OK, customStatus.InvalidArguments);
     }
     Guid user;
     using (UserRepository repo = new UserRepository())
     {
         var userinfo = await repo.GetUserInfoByOpenid(openid);
         user = userinfo.uuid;
     }
     var ret = await EKArticleManager.GetById(ekid);
     //将文章插图的地址转义
     ret.BodyText = WebApiHelper.GetEscapedBodyText(ret);
     await EKArticleManager.AddReadCountAsync(ekid);
     await EKArticleManager.SetReadPeopleAsync(ekid, user, DateTime.Now);
     return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, ret, HttpStatusCode.OK, customStatus.Success);
 }
开发者ID:amwtke,项目名称:bkwecaht,代码行数:21,代码来源:EKCommentController.cs

示例13: PostInitializeProfessorRecords

        public async Task<HttpResponseMessage> PostInitializeProfessorRecords([FromBody]BaseParameter postParameter)
        {
            string openid = postParameter.openID;
            if (string.IsNullOrEmpty(openid))
            {
                return WebApiHelper.HttpRMtoJson(null, HttpStatusCode.OK, customStatus.InvalidArguments);
            }
            using (UserRepository userRepository = new UserRepository())
            {
                var userUuid = await userRepository.GetUserUuidByOpenid(openid);
                if (userUuid == Guid.Empty)
                {
                    return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, null, HttpStatusCode.OK, customStatus.NotFound);
                }
                else
                {
                    Dictionary<string, object> tempResult = new Dictionary<string, object>();

                    UserInfo userinfo = await userRepository.GetUserInfoByOpenid(openid);
                    //研究兴趣
                    string researchField = userinfo.Interests;
                    tempResult.Add("yjly", researchField);


                    //学术地位
                    List<UserAcademic> userAcademicList = await userRepository.GetUserRecords(new UserAcademic { AccountEmail_uuid = userUuid });
                    List<string> acadmeicList =  RepositoryHelper.ConvertUserAcademicToString(userAcademicList);
                    tempResult.Add("xsdw", Tuple.Create("UserAcademic", acadmeicList));

                    //项目资助
                    List<UserAwards> userAwardList = await userRepository.GetUserRecords(new UserAwards() { AccountEmail_uuid = userUuid });

                    tempResult.Add("zzxm", Tuple.Create("UserAwards", userAwardList));

                    //教育经历
                    List<UserEducation> userEducationList = await userRepository.GetUserRecords(new UserEducation() { AccountEmail_uuid = userUuid });
                    tempResult.Add("jyjl", Tuple.Create("UserEducation", userEducationList));

                    //工作经历
                    List<UserExperience> userExperienceList = await userRepository.GetUserRecords(new UserExperience() { AccountEmail_uuid = userUuid });
                    tempResult.Add("gzjl", Tuple.Create("UserExperience", userExperienceList));

                    //论文数
                    int userArticleNumber = await userRepository.GetUserRecordsNumber(new UserArticle() { AccountEmail_uuid = userUuid });
                    tempResult.Add("lws", Tuple.Create("UserArticle", userArticleNumber));

                    //专利数
                    int userPatendNumber = await userRepository.GetUserRecordsNumber(new UserPatent() { AccountEmail_uuid = userUuid });
                    tempResult.Add("zls", Tuple.Create("UserPatent", userPatendNumber));

                    //访问过我的人还访问过谁
                    int visitorsBeenToNumber = await userRepository.GetVisitorBeenToNumber(userUuid);
                    List<UserInfo> visitorsBeenTo = await userRepository.GetVisitorBeenTo(userUuid, 6);

                    tempResult.Add("visitorsBeenToNumber", visitorsBeenToNumber);
                    tempResult.Add("visitorsBeenToTopSix", visitorsBeenTo);
                    return WebApiHelper.HttpRMtoJson(tempResult, HttpStatusCode.OK, customStatus.Success);
                }

            }
        }
开发者ID:amwtke,项目名称:bkwecaht,代码行数:61,代码来源:ProfessorRecordsController.cs

示例14: PostGetReadUsers

        public async Task<HttpResponseMessage> PostGetReadUsers([FromBody]EKCommentParameter postParameter)
        {
            string openid = postParameter.openID;
            long ekid = postParameter.Id;
            int pageIndex = postParameter.pageIndex;
            int pageSize = postParameter.pageSize;
            int fromNo = pageIndex * pageSize;
            int toNo = fromNo + pageSize;

            if (string.IsNullOrEmpty(openid) || ekid == 0)
            {
                return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, null, HttpStatusCode.OK, customStatus.InvalidArguments);
            }

            using (UserRepository userR = new UserRepository())
            {
                UserInfo user = await userR.GetUserInfoByOpenid(openid);
                var redis = new RedisManager2<WeChatRedisConfig>();

                var zans = await redis.GetRangeByRankAsync<EKTodayRedis, EKReadPepleZsetAttribute>(ekid.ToString(), from: fromNo, to: toNo);

                List<UserInfo> ret = new List<UserInfo>();
                if (zans != null && zans.Count() > 0)
                {
                    foreach (var v in zans)
                    {
                        UserInfo tmp = await userR.GetUserInfoByUuidAsync(Guid.Parse(v.Key));
                        ret.Add(tmp);
                    }
                }

                return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, ret, HttpStatusCode.OK, customStatus.Success);
            }
        }
开发者ID:amwtke,项目名称:bkwecaht,代码行数:34,代码来源:EKCommentController.cs

示例15: PostIsZaned

        public async Task<HttpResponseMessage> PostIsZaned([FromBody]EKCommentParameter postParameter)
        {
            string openid = postParameter.openID;
            long ekid = postParameter.Id;
            if (string.IsNullOrEmpty(openid) || ekid == 0)
            {
                return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, null, HttpStatusCode.OK, customStatus.InvalidArguments);
            }

            using (UserRepository userR = new UserRepository())
            {
                UserInfo user = await userR.GetUserInfoByOpenid(openid);
                var redis = new RedisManager2<WeChatRedisConfig>();
                double score = await redis.GetScoreEveryKeyAsync<EKTodayRedis, EKZanPepleZsetAttribute>(ekid.ToString(), user.uuid.ToString());
                if(score==0)
                    return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, false, HttpStatusCode.OK, customStatus.Success);
                return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, true, HttpStatusCode.OK, customStatus.Success);
            }
        }
开发者ID:amwtke,项目名称:bkwecaht,代码行数:19,代码来源:EKCommentController.cs


注:本文中的UserRepository.GetUserInfoByOpenid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。