示例#1
0
        /// <summary>
        /// 购买表情检查
        /// </summary>
        /// <param name="req"></param>
        /// <returns></returns>
        private ValueTuple <bool, TpxinEmoticonMaterial> Check_BuyEmoticon(DownloadEmoticonReq req)
        {
            var emoticon = db.TpxinEmoticonMaterialSet.Where(c => c.Id == req.ID).FirstOrDefault();

            if (emoticon == null)
            {
                Alert("表情包不存在");
                return(false, null);
            }
            //if (emoticon.Configid != 11)
            //{
            //    if (!CheckPwd(req.Nodeid, req.Pwd))
            //    {
            //        return (false,null);
            //    }
            //}
            var path = System.Web.Hosting.HostingEnvironment.MapPath(emoticon.Filedir);

            if (!File.Exists(path))
            {
                Alert("表情包不存在");
                return(false, null);
            }
            var order = db.TpxinEmoticonOrderSet.Where(c => c.Nodeid == req.Nodeid && c.Materialid == req.ID).FirstOrDefault();

            if (order != null)
            {
                //重复下载直接通过
                Alert("再次下载", 2);
                return(false, null);
            }

            return(true, emoticon);
        }
示例#2
0
        /// <summary>
        /// 购买表情
        /// </summary>
        /// <param name="req"></param>
        /// <returns></returns>
        public ValueTuple <bool, OpenInfUeoDto> BuyEmoticon(DownloadEmoticonReq req)
        {
            var result = Check_BuyEmoticon(req);

            if (!result.Item1)
            {
                return(false, null);
            }

            var emoticon = result.Item2;

            if (emoticon.Configid == 11)
            {
                var uesign = GetUESignInfo(req.Nodeid, emoticon.Price, emoticon.Id);
                Alert("调起ueapp", 99);
                return(true, uesign);
            }

            db.BeginTransaction();
            BeginTransfer();

            if (emoticon.Price > 0)
            {
                if (emoticon.Configid < 0)
                {
                    if (!Transfer_EmoticonPayPV(req.Nodeid, emoticon.Price, emoticon.Configid))
                    {
                        db.Rollback();
                        EndTransfer(false);
                        return(false, null);
                    }
                }
                else
                {
                    if (!Transfer_EmoticonPay(req.Nodeid, emoticon.Price, emoticon.Configid))
                    {
                        db.Rollback();
                        EndTransfer(false);
                        return(false, null);
                    }
                }
            }

            if (!DownloadEmoticon_Pro(req.Nodeid, emoticon.Price, emoticon))
            {
                db.Rollback();
                EndTransfer(false);
                return(false, null);
            }

            db.Commit();
            Alert("支付成功", 1);
            return(true, null);
        }
        public Respbase <OpenInfUeoDto> BuyEmoticon(DownloadEmoticonReq req)
        {
            EmoticonFacade facade = new EmoticonFacade();
            var            result = facade.BuyEmoticon(req);

            if (result.Item1)
            {
                return(new Respbase <OpenInfUeoDto> {
                    Result = facade.PromptInfo.Result, Message = facade.PromptInfo.Message, Data = result.Item2
                });
            }
            return(new Respbase <OpenInfUeoDto> {
                Result = facade.PromptInfo.Result, Message = facade.PromptInfo.Message
            });
        }