Пример #1
0
        public IActionResult BuyTopics([FromServices] IMemberScoreService memberScoreService, string id)
        {
            if (CoreContextProvider.CurrentMember == null)
            {
                return(Error("用户未登录,请登录!", "/login"));
            }
            var topic = _ArticleTopicService.GetForm(id);

            if (topic == null)
            {
                return(Error("该专题不存在,购买失败!"));
            }

            if (topic.TopicStatus != (int)TopicStatus.Audited)
            {
                return(Error("该专题未审核成功,购买失败!"));
            }
            if (CoreContextProvider.CurrentMember.UserId == topic.CreatorUserId)
            {
                return(Error("无法 购买自己的专题,购买失败!"));
            }
            var buyResult = memberScoreService
                            .MarketBuy(CoreContextProvider.CurrentMember.UserId, ScoreType.buytopic, topic.Id, topic.PackageAmount, topic.CreatorUserId);

            return(JsonResult(buyResult));
        }
        public ActionResult GetFormJson(string keyValue)
        {
            var data   = _ArticleTopicService.GetForm(keyValue);
            var member = "管理员";

            if (!data.CreatorUserId.IsEmpty())
            {
                member = _IMemberService.GetMemName(data.CreatorUserId);
            }
            return(Content(new { member, data }.ToJson()));
        }