Ejemplo n.º 1
0
        // GET:
        public ActionResult Index()
        {
            int aid = Context.GetRequestInt("appId", 0);

            if (aid <= 0)
            {
                aid = Context.GetRequestInt("aid", 0);
            }
            PlatStore  store  = PlatStoreBLL.SingleModel.GetModelByAId(aid);
            PlatMyCard myCard = PlatMyCardBLL.SingleModel.GetModel(store.MyCardId);

            if (myCard == null)
            {
                return(Redirect("/base/PageError?type=2"));
            }
            PlatUserCash model = PlatUserCashBLL.SingleModel.GetModelByUserId(myCard.AId, myCard.UserId);

            if (model == null)
            {
                model            = new PlatUserCash();
                model.AddTime    = DateTime.Now;
                model.UpdateTime = DateTime.Now;
                model.UserId     = myCard.UserId;
                model.AId        = myCard.AId;
                model.Id         = Convert.ToInt32(PlatUserCashBLL.SingleModel.Add(model));
            }
            string nowTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

            RedisUtil.Set <string>(string.Format(PlatStatisticalFlowBLL._redis_PlatVisiteTimeKey, aid), nowTime);
            return(View());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 检测名片是否被禁用
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public ActionResult CheckCardState(int userId = 0)
        {
            returnObj = new Return_Msg_APP();
            if (userId <= 0)
            {
                returnObj.Msg = "无效的用户参数";
                return(Json(returnObj));
            }

            PlatMyCard model = PlatMyCardBLL.SingleModel.GetModelByUserId(userId);

            if (model == null)
            {
                returnObj.isok = true;
                returnObj.Msg  = "无效的名片";
                returnObj.isok = true;
                return(Json(returnObj));
            }
            if (model.State == -1)
            {
                returnObj.Msg     = "该名片信息违反平台规则,已被删除";
                returnObj.dataObj = false;
                return(Json(returnObj));
            }

            returnObj.isok    = true;
            returnObj.dataObj = true;
            return(Json(returnObj));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 保存虚拟人气
        /// </summary>
        /// <returns></returns>
        public ActionResult SaveFictitiousCount()
        {
            _returnData = new Return_Msg();
            int id = Context.GetRequestInt("id", 0);
            int fictitiousCount = Context.GetRequestInt("fictitiouscount", 0);

            if (id <= 0)
            {
                return(Redirect("/base/PageError?type=7"));
            }

            PlatMyCard model = PlatMyCardBLL.SingleModel.GetModel(id);

            if (model == null)
            {
                _returnData.Msg = "数据过期,请刷新重试";
                return(Json(_returnData));
            }

            model.UpdateTime      = DateTime.Now;
            model.FictitiousCount = fictitiousCount;
            _returnData.isok      = PlatMyCardBLL.SingleModel.Update(model, "FictitiousCount,UpdateTime");
            _returnData.Msg       = _returnData.isok ? "保存成功" : "保存失败";

            return(Json(_returnData));
        }
Ejemplo n.º 4
0
        public ActionResult Index()
        {
            int aid = Context.GetRequestInt("aid", 0);

            ViewBag.appId = aid;
            PlatStore  store  = PlatStoreBLL.SingleModel.GetModelByAId(aid);
            PlatMyCard myCard = PlatMyCardBLL.SingleModel.GetModel(store.MyCardId);

            if (myCard == null)
            {
                return(Redirect("/base/PageError?type=2"));
            }
            //用户提现账户
            PlatUserCash model = PlatUserCashBLL.SingleModel.GetModelByUserId(myCard.AId, myCard.UserId);

            if (model == null)
            {
                return(Redirect("/base/PageError?type=2"));
            }
            //平台提现设置
            PlatDrawConfig drawConfig = PlatDrawConfigBLL.SingleModel.GetModelByAId(myCard.AId);

            if (drawConfig == null)
            {
                drawConfig = new PlatDrawConfig();
            }
            model.Fee = drawConfig.Fee;
            if (string.IsNullOrEmpty(model.Name))
            {
                model.Name = "未绑定";
            }
            return(View(model));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 人脉圈
        /// </summary>
        /// <returns></returns>
        public ActionResult GetConnectionsList()
        {
            returnObj = new Return_Msg_APP();
            int    userId     = Context.GetRequestInt("userid", 0);
            int    aid        = Context.GetRequestInt("aid", 0);
            int    distance   = Context.GetRequestInt("distance", -1);//-1默认,-2:同城,大于0:附近人
            int    actionType = Context.GetRequestInt("actiontype", -1);
            int    areaCode   = Context.GetRequestInt("areacode", 0);
            int    industryId = Context.GetRequestInt("industryid", 0);
            int    pageIndex  = Context.GetRequestInt("pageindex", 1);
            int    pageSize   = Context.GetRequestInt("pagesize", 10);
            string lng        = Context.GetRequest("lng", "0");
            string lat        = Context.GetRequest("lat", "0");

            if (userId <= 0)
            {
                returnObj.Msg = "userid不能小于0";
                return(Json(returnObj));
            }
            if (aid <= 0)
            {
                returnObj.Msg = "aid不能小于0";
                return(Json(returnObj));
            }

            C_UserInfo userInfo = C_UserInfoBLL.SingleModel.GetModel(userId);

            if (userInfo == null)
            {
                returnObj.Msg = "用户信息无效";
                return(Json(returnObj));
            }

            int cityCode = 0;
            int count    = 0;

            PlatMyCard myCard = PlatMyCardBLL.SingleModel.GetModelByUserId(userId, aid);

            if (myCard != null)
            {
                lng      = myCard.Lng.ToString();
                lat      = myCard.Lat.ToString();
                cityCode = myCard.CityCode;
            }
            lat = lat == "undefined" ? "0" : lat;
            lng = lng == "undefined" ? "0" : lng;

            List <PlatMyCard> list = PlatMyCardBLL.SingleModel.GetCardApiList(userInfo.appId, industryId, areaCode, lng, lat, cityCode, distance, userId, aid, actionType, ref count, pageSize, pageIndex);

            returnObj.dataObj = new { list = list, count = count };
            returnObj.isok    = true;
            return(Json(returnObj));
        }
Ejemplo n.º 6
0
        public List <PlatMsgReport> GetListByaid(int aid, out int totalCount, int pageSize = 10, int pageIndex = 1, string orderWhere = "addTime desc")
        {
            string strWhere = $"aid={aid} and state=0";

            totalCount = base.GetCount(strWhere);

            List <PlatMsgReport> listCity_MsgReport = base.GetList(strWhere, pageSize, pageIndex, "*", orderWhere);

            if (listCity_MsgReport != null && listCity_MsgReport.Count > 0)
            {
                string         msgIds      = string.Join(",", listCity_MsgReport.Select(s => s.MsgId).Distinct());
                List <PlatMsg> platMsgList = PlatMsgBLL.SingleModel.GetListByIds(msgIds);

                string msgCardIds = string.Join(",", platMsgList?.Select(s => s.MyCardId).Distinct());
                string cardIds    = string.Join(",", listCity_MsgReport.Select(s => s.ReportcardId).Distinct());
                if (!string.IsNullOrEmpty(msgCardIds))
                {
                    if (!string.IsNullOrEmpty(cardIds))
                    {
                        cardIds = cardIds + "," + msgCardIds;
                    }
                    else
                    {
                        cardIds = msgCardIds;
                    }
                }
                List <PlatMyCard> platMyCardList = PlatMyCardBLL.SingleModel.GetListByIds(cardIds);

                listCity_MsgReport.ForEach(x => {
                    //获取举者用户昵称
                    PlatMyCard platMyCard = platMyCardList?.FirstOrDefault(f => f.Id == x.ReportcardId);
                    if (platMyCard != null)
                    {
                        x.ReportUserName = platMyCard.Name;
                    }

                    //获取被举报帖子的信息
                    PlatMsg platMsg = platMsgList?.FirstOrDefault(f => f.Id == x.MsgId);
                    if (platMsg != null)
                    {
                        x.BeReportMsgPhone = platMsg.Phone;
                        PlatMyCard model   = platMyCardList?.FirstOrDefault(f => f.Id == platMsg.MyCardId);

                        if (model != null)
                        {
                            x.BeReportUserName = model.Name;
                        }
                    }
                });
            }

            return(listCity_MsgReport);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 根据用户Id也就是myCardId 获取该用户发布的帖子列表
        /// </summary>
        /// <param name="aid"></param>
        /// <param name="myCardId"></param>
        /// <param name="totalCount"></param>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        /// <returns></returns>
        public List <PlatMsg> GetListByUserId(int aid, int myCardId, out int totalCount, int pageSize = 10, int pageIndex = 1)
        {
            string         strWhere          = $"aid={aid} and state<>-1 and PayState=1 and MyCardId={myCardId}";
            List <PlatMsg> listPlatMsg       = base.GetList(strWhere, pageSize, pageIndex, "*", " addTime desc");
            int            commentTotalCount = 0;

            if (listPlatMsg != null && listPlatMsg.Count > 0)
            {
                string            cardIds        = string.Join(",", listPlatMsg.Select(s => s.MyCardId).Distinct());
                List <PlatMyCard> platMyCardList = PlatMyCardBLL.SingleModel.GetListByIds(cardIds);

                string             msgTypeIds      = string.Join(",", listPlatMsg.Select(s => s.MsgTypeId).Distinct());
                List <PlatMsgType> platMsgTypeList = PlatMsgTypeBLL.SingleModel.GetListByIds(msgTypeIds);

                listPlatMsg.ForEach(x =>
                {
                    //获取用户头像
                    PlatMyCard platMyCard = platMyCardList?.FirstOrDefault(f => f.Id == x.MyCardId);
                    if (platMyCard != null)
                    {
                        x.UserName      = platMyCard.Name;
                        x.UserHeaderImg = platMyCard.ImgUrl;
                    }

                    //获取帖子类别
                    PlatMsgType platMsgType = platMsgTypeList?.FirstOrDefault(f => f.Id == x.MsgTypeId);
                    if (platMsgType != null)
                    {
                        x.MsgTypeName = platMsgType.Name;
                    }

                    //根据帖子ID获取其浏览量-收藏量-分享量数据
                    PlatMsgviewFavoriteShare _platMsgviewFavoriteShare = PlatMsgviewFavoriteShareBLL.SingleModel.GetModelByMsgId(x.Aid, x.Id, (int)PointsDataType.帖子);
                    if (_platMsgviewFavoriteShare != null)
                    {
                        x.ViewCount     = _platMsgviewFavoriteShare.ViewCount;
                        x.FavoriteCount = _platMsgviewFavoriteShare.FavoriteCount;
                        x.ShareCount    = _platMsgviewFavoriteShare.ShareCount;
                        x.DzCount       = _platMsgviewFavoriteShare.DzCount;
                    }
                    x.Comments    = PlatMsgCommentBLL.SingleModel.GetPlatMsgComment(x.Aid, out commentTotalCount, 0, string.Empty, 1000, 1, x.Id, 0);
                    x.ShowTimeStr = CommondHelper.GetTimeSpan(DateTime.Now - x.AddTime);
                    x.MsgDetail   = HttpUtility.HtmlDecode(x.MsgDetail);
                });
            }

            totalCount = base.GetCount(strWhere);

            return(listPlatMsg);
        }
Ejemplo n.º 8
0
        public ActionResult CardInfo()
        {
            int id  = Context.GetRequestInt("id", 0);
            int aid = Context.GetRequestInt("aid", 0);

            ViewBag.AppId = aid;
            if (id <= 0)
            {
                return(Redirect("/base/PageError?type=7"));
            }

            PlatMyCard model = PlatMyCardBLL.SingleModel.GetMyCardData(id, aid);

            return(View(model));
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 获取名片
        /// </summary>
        /// <returns></returns>
        public ActionResult GetMyCard()
        {
            returnObj = new Return_Msg_APP();
            int userId   = Context.GetRequestInt("userid", 0);
            int myuserId = Context.GetRequestInt("myuserid", 0);
            int aid      = Context.GetRequestInt("aid", 0);

            if (userId <= 0 || myuserId <= 0)
            {
                returnObj.Msg = "userid不能小于0";
                return(Json(returnObj));
            }
            if (aid <= 0)
            {
                returnObj.Msg = "aid不能小于0";
                return(Json(returnObj));
            }

            PlatMyCard platMyCardModel = PlatMyCardBLL.SingleModel.GetMyCardData(userId, myuserId, aid, (int)PointsDataType.片);

            if (platMyCardModel == null || platMyCardModel.Id <= 0)
            {
                returnObj.Msg     = "您还没有创建名片";
                returnObj.dataObj = platMyCardModel;
                return(Json(returnObj));
            }
            //判断是否已保存appid
            if (string.IsNullOrEmpty(platMyCardModel.AppId))
            {
                C_UserInfo userinfo = C_UserInfoBLL.SingleModel.GetModel(platMyCardModel.UserId);
                platMyCardModel.AppId = userinfo.appId;
                PlatMyCardBLL.SingleModel.Update(platMyCardModel, "appid");
            }

            bool isReload = false;

            //获取服务器商的图片路径
            platMyCardModel.ImgUrl = WxUploadHelper.GetMyServerImgUrl(platMyCardModel.ImgUrl, ref isReload);
            if (isReload)
            {
                PlatMyCardBLL.SingleModel.Update(platMyCardModel, "ImgUrl");
            }

            returnObj.dataObj = platMyCardModel;
            returnObj.isok    = platMyCardModel.Id > 0;
            returnObj.Msg     = returnObj.isok ? "成功" : "失败";
            return(Json(returnObj));
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 名片屏蔽或显示
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult EditeCardState(int id = 0, int state = 0)
        {
            _returnData = new Return_Msg();
            if (id <= 0)
            {
                _returnData.Msg = "无效参数";
                return(Json(_returnData));
            }
            PlatMyCard model = PlatMyCardBLL.SingleModel.GetModel(id);

            if (model == null)
            {
                _returnData.Msg = "无效数据,请刷新重试";
                return(Json(_returnData));
            }
            model.State      = state;
            model.UpdateTime = DateTime.Now;
            _returnData.isok = PlatMyCardBLL.SingleModel.Update(model, "state,updatetime");
            _returnData.Msg  = _returnData.isok ? "保存成功" : "保存失败";

            return(Json(_returnData));
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 申请独立小程序
        /// </summary>
        /// <returns></returns>
        public ActionResult ApplyStoreApp()
        {
            returnObj = new Return_Msg_APP();
            int userid = Context.GetRequestInt("userid", 0);

            if (userid <= 0)
            {
                returnObj.Msg = "userid不能为0";
            }
            PlatMyCard mycard = PlatMyCardBLL.SingleModel.GetModelByUserId(userid);

            if (mycard == null)
            {
                returnObj.Msg = "名片已过期";
                return(Json(returnObj));
            }
            PlatStore store = PlatStoreBLL.SingleModel.GetModelBycardid(mycard.AId, mycard.Id);

            if (store == null)
            {
                returnObj.Msg = "店铺已过期";
                return(Json(returnObj));
            }

            PlatApplyApp model = new PlatApplyApp();

            model.AddTime      = DateTime.Now;
            model.BindAId      = mycard.AId;
            model.CustomerName = mycard.Name;
            model.MycardId     = mycard.Id;
            model.OpenState    = 0;
            model.StoreId      = store.Id;
            model.UpdateTime   = DateTime.Now;
            model.Id           = Convert.ToInt32(PlatApplyAppBLL.SingleModel.Add(model));
            returnObj.isok     = model.Id > 0;
            returnObj.Msg      = returnObj.isok ? "提交成功,正在审核中" : "提交失败";

            return(Json(returnObj));
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 获取指定帖子详情 包含了 点赞数 分享数 收藏数 浏览量等...
        /// </summary>
        /// <param name="aid"></param>
        /// <param name="msgId"></param>
        /// <returns></returns>
        public PlatMsg GetMsg(int aid, int msgId)
        {
            PlatMsg x = base.GetModel($"aid={aid} and Id={msgId}");

            if (x != null)
            {
                //获取用户头像
                PlatMyCard platMyCard = PlatMyCardBLL.SingleModel.GetModel(x.MyCardId);
                if (platMyCard != null)
                {
                    x.UserName      = platMyCard.Name;
                    x.UserHeaderImg = platMyCard.ImgUrl;
                    x.UserId        = platMyCard.UserId;
                }

                //获取帖子类别
                PlatMsgType platMsgType = PlatMsgTypeBLL.SingleModel.GetModel(x.MsgTypeId);
                if (platMsgType != null)
                {
                    x.MsgTypeName = platMsgType.Name;
                }

                //根据帖子ID获取其浏览量-收藏量-分享量数据
                PlatMsgviewFavoriteShare _platMsgviewFavoriteShare = PlatMsgviewFavoriteShareBLL.SingleModel.GetModelByMsgId(x.Aid, x.Id, (int)PointsDataType.帖子);
                if (_platMsgviewFavoriteShare != null)
                {
                    x.ViewCount     = _platMsgviewFavoriteShare.ViewCount;
                    x.FavoriteCount = _platMsgviewFavoriteShare.FavoriteCount;
                    x.ShareCount    = _platMsgviewFavoriteShare.ShareCount;
                    x.DzCount       = _platMsgviewFavoriteShare.DzCount;
                }
                x.MsgDetail   = HttpUtility.HtmlDecode(x.MsgDetail);
                x.ShowTimeStr = CommondHelper.GetTimeSpan(DateTime.Now - x.AddTime);
            }


            return(x);
        }
Ejemplo n.º 13
0
        public ActionResult OpenDistribution(int aid = 0, int isOpen = 0)
        {
            Return_Msg            returnData  = new Return_Msg();
            XcxAppAccountRelation xcxrelation = XcxAppAccountRelationBLL.SingleModel.GetModel(aid);

            if (xcxrelation == null)
            {
                returnData.Msg = "无效模板";
                return(Json(returnData));
            }
            PlatStore store = PlatStoreBLL.SingleModel.GetModelByAId(aid);

            if (store == null)
            {
                returnData.Msg = "无效店铺";
                return(Json(returnData));
            }
            PlatMyCard myCard = PlatMyCardBLL.SingleModel.GetModel(store.MyCardId);

            if (myCard == null)
            {
                returnData.Msg = "无效用户数据";
                return(Json(returnData));
            }
            PlatUserCash userCash = PlatUserCashBLL.SingleModel.GetModelByUserId(store.BindPlatAid, myCard.UserId);

            if (userCash == null)
            {
                returnData.Msg = "无效账号";
                return(Json(returnData));
            }
            userCash.IsOpenDistribution = isOpen;
            userCash.UpdateTime         = DateTime.Now;
            returnData.isok             = PlatUserCashBLL.SingleModel.Update(userCash, "IsOpenDistribution,UpdateTime");
            returnData.Msg = returnData.isok ? "保存成功" : "保存失败";

            return(Json(returnData));
        }
Ejemplo n.º 14
0
        /// <summary>
        /// 申请提现
        /// </summary>
        /// <param name="aid"></param>
        /// <param name="id">提现账号id(PlatUserCash)</param>
        /// <param name="drawcashmoney">提现金额(分)</param>
        /// <returns></returns>
        public string ApplyDrawCash(int aid = 0, int id = 0, int drawcashmoney = 0)
        {
            TransactionModel tran = new TransactionModel();

            if (id <= 0)
            {
                return("id不能为0");
            }
            if (drawcashmoney <= 0)
            {
                return("提现金额不能为0");
            }

            PlatUserCash usercash = PlatUserCashBLL.SingleModel.GetModel(id);

            if (usercash == null)
            {
                return("提现账号");
            }
            if (usercash.DrawCashWay == (int)DrawCashWay.银行卡人工提现 && string.IsNullOrEmpty(usercash.AccountBank))
            {
                return("请完善提现账号");
            }
            if (usercash.UseCash < drawcashmoney)
            {
                return("可提现金额不足");
            }
            XcxAppAccountRelation xcxrelation = XcxAppAccountRelationBLL.SingleModel.GetModel(usercash.AId);

            if (xcxrelation == null)
            {
                return("提现平台已过期");
            }
            if (string.IsNullOrEmpty(xcxrelation.AppId))
            {
                return("提现平台还未上线");
            }
            PlatDrawConfig drawconfig = PlatDrawConfigBLL.SingleModel.GetModelByAId(usercash.AId);

            if (drawconfig == null)
            {
                return("平台还未开启提现");
            }
            if (string.IsNullOrEmpty(drawconfig.DrawCashWay))
            {
                return("平台未开通提现方式");
            }
            //判断是否支持该提现方式
            DrawCashWayItem tempway = drawconfig.DrawCashWayList.FirstOrDefault(f => f.IsOpen == 1 && f.DrawCashWay == usercash.DrawCashWay);

            if (tempway == null)
            {
                return("平台不支持该提现方式");
            }
            if (drawconfig.MinMoney > drawcashmoney)
            {
                return($"提现金额不能低于{drawconfig.MinMoneyStr}元");
            }
            PlatMyCard mycard = PlatMyCardBLL.SingleModel.GetModelByUserId(usercash.UserId, usercash.AId);

            if (mycard == null)
            {
                return("无效提现账号");
            }

            int           serviceFee       = Convert.ToInt32((drawconfig.Fee * 0.01 * 0.01) * drawcashmoney);
            string        partner_trade_no = WxPayApi.GenerateOutTradeNo();
            DrawCashApply apply            = new DrawCashApply()
            {
                Aid              = usercash.AId,
                appId            = xcxrelation.AppId,
                partner_trade_no = partner_trade_no,
                userId           = usercash.UserId,
                applyMoney       = drawcashmoney,
                serviceMoney     = serviceFee,
                cashMoney        = drawcashmoney - serviceFee,
                useCash          = (usercash.UseCash - drawcashmoney).ToString(),
                BeforeApplyMoney = usercash.UseCash,
                AddTime          = DateTime.Now,
                remark           = "平台字模板店铺申请提现",
                hostIP           = WebHelper.GetIP(),
                state            = 0,
                drawState        = (int)DrawCashState.未开始提现,
                applyType        = (int)DrawCashApplyType.平台店铺提现,
                account          = usercash.DrawCashWay == (int)DrawCashWay.微信提现 ? mycard.Phone : usercash.AccountBank,
                accountName      = usercash.DrawCashWay == (int)DrawCashWay.微信提现 ? mycard.Name : usercash.Name,
                drawCashWay      = usercash.DrawCashWay,
            };

            tran.Add(base.BuildAddSql(apply));

            usercash.UseCash    = usercash.UseCash - drawcashmoney;
            usercash.UpdateTime = DateTime.Now;
            tran.Add(PlatUserCashBLL.SingleModel.BuildUpdateSql(usercash, "UseCash,UpdateTime"));

            if (!base.ExecuteTransactionDataCorect(tran.sqlArray))
            {
                return("申请提现失败");
            }
            return("");
        }
Ejemplo n.º 15
0
        /// <summary>
        /// 开通独立小程序
        /// </summary>
        /// <param name="platApplyAppModel"></param>
        /// <param name="accountid"></param>
        /// <param name="uselength"></param>
        /// <param name="tid"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public bool OpenStore(PlatApplyApp platApplyAppModel, string accountid, int uselength, int tid, ref string msg)
        {
            DateTime         nowtime = DateTime.Now;
            TransactionModel tran    = new TransactionModel();


            bool success = false;

            if (platApplyAppModel == null)
            {
                msg = "申请记录为空";
                return(false);
            }

            //用户基础数据,获取普通预存款

            AccountRelation accountrelation = AccountRelationBLL.SingleModel.GetModelByAccountId(accountid);

            Agentinfo agentinfo = AgentinfoBLL.SingleModel.GetModelByAccoundId(accountid);

            #region 模板跟模板价格
            XcxTemplate tempinfo = XcxTemplateBLL.SingleModel.GetModelByType((int)TmpType.小未平台子模版);
            if (tempinfo != null && agentinfo != null)
            {
                List <XcxTemplate> xcxlist = XcxTemplateBLL.SingleModel.GetRealPriceTemplateList($" id in ({tempinfo.Id})", agentinfo.id);
                if (xcxlist != null && xcxlist.Count > 0)
                {
                    //代理过期检验
                    AgentinfoBLL.SingleModel.CheckOutTime(ref xcxlist, agentinfo, 0, ref msg);
                    tempinfo = xcxlist[0];
                }
            }
            if (tempinfo == null)
            {
                msg = "模板数据为空";
                return(false);
            }
            #endregion

            #region 扣费
            //扣除总费用
            int sum = tempinfo.Price * uselength;
            //变更前金额
            int deposit = 0;
            //变更后的金额
            int afterdeposit = 0;
            //扣除代理费用
            if (agentinfo != null)
            {
                //首次开通免费
                if (AgentdepositLogBLL.SingleModel.IsFirstOpen(agentinfo.id, 2, 0))
                {
                    sum       = 0;
                    uselength = 1;
                }
                //变更前金额
                deposit = agentinfo.deposit;
                //判断余额是否满足扣费
                if (deposit + accountrelation.Deposit < sum)
                {
                    msg = "余额不足";
                    return(false);
                }

                //变更后金额,先扣除普通用户账号预存款
                if (accountrelation.Deposit > 0)
                {
                    if (accountrelation.Deposit >= sum)
                    {
                        afterdeposit = accountrelation.Deposit - sum;
                        tran.Add($"UPDATE AccountRelation set deposit={afterdeposit} ,updatetime='{nowtime}' where id={accountrelation.Id}");
                    }
                    else
                    {
                        //先扣除普通用户预存,再扣除代理商预存
                        afterdeposit = agentinfo.deposit - (sum - accountrelation.Deposit);
                        tran.Add($"UPDATE Agentinfo set deposit={afterdeposit} ,updateitme='{nowtime}' where id={agentinfo.id}");
                        tran.Add($"UPDATE AccountRelation set deposit=0 ,updatetime='{nowtime}' where id={accountrelation.Id}");
                    }
                }
                else
                {
                    afterdeposit = deposit - sum;
                    tran.Add($"UPDATE Agentinfo set deposit={afterdeposit} ,updateitme='{nowtime}' where id={agentinfo.id}");
                }
            }
            //扣除普通账号预存款
            else
            {
                //首次开通免费
                if (AgentdepositLogBLL.SingleModel.IsFirstOpen(0, 13, accountrelation.Id))
                {
                    sum = 0;
                }
                else
                {
                    sum = 100 * uselength;
                }
                //变更前金额
                deposit = accountrelation.Deposit;
                //判断余额是否满足扣费
                if (deposit < sum)
                {
                    msg = "余额不足";
                    return(false);
                }
                //变更后金额
                afterdeposit = deposit - sum;
                tran.Add($"UPDATE AccountRelation set deposit={afterdeposit} ,updatetime='{nowtime}' where id={accountrelation.Id}");
            }
            #endregion

            //名片管理登陆账号

            PlatMyCard mycardmodel = PlatMyCardBLL.SingleModel.GetModel(platApplyAppModel.MycardId);
            if (mycardmodel == null)
            {
                msg = "名片过期";
                return(false);
            }
            //判断是否已开通
            if (!string.IsNullOrEmpty(mycardmodel.LoginId))
            {
                msg = "该用户已开通过,请刷新看看";
                return(false);
            }

            //开通后台账号
            Account account = AccountBLL.SingleModel.WeiXinRegister("", 0, "", true, "", "", "小未平台开通独立小程序");
            if (account == null)
            {
                msg = "注册后台账号失败";
                return(false);
            }

            mycardmodel.LoginId    = account.LoginId;
            mycardmodel.UpdateTime = nowtime;
            tran.Add(PlatMyCardBLL.SingleModel.BuildUpdateSql(mycardmodel, "LoginId,UpdateTime"));

            //申请开通记录
            platApplyAppModel.UserId     = mycardmodel.UserId;
            platApplyAppModel.OpenState  = 1;
            platApplyAppModel.OpenTime   = nowtime;
            platApplyAppModel.UpdateTime = nowtime;
            tran.Add(base.BuildUpdateSql(platApplyAppModel, "OpenState,OpenTime,UpdateTime,UserId"));

            //开通独立小程序模板
            tran.Add($@"insert into XcxAppAccountRelation(TId,AccountId,AddTime,Url,price,outtime,agentid) 
            values({tempinfo.Id}, '{account.Id}', '{nowtime}', '{tempinfo.Link}', {tempinfo.Price}, '{nowtime.AddYears(uselength)}',{(agentinfo != null ? agentinfo.id : 0)})");

            //绑定店铺

            PlatStore platstoremodel = PlatStoreBLL.SingleModel.GetModel(platApplyAppModel.StoreId);
            if (platstoremodel == null)
            {
                msg = "店铺已过期,请刷新重试";
                return(false);
            }
            tran.Add($"update PlatStore set aid=(select last_insert_id()),UpdateTime='{nowtime}' where id={platstoremodel.Id}");

            #region 开通流水
            AgentdepositLog agentLog = new AgentdepositLog();
            agentLog.agentid       = agentinfo != null ? agentinfo.id : 0;
            agentLog.addtime       = nowtime;
            agentLog.templateCount = 1;
            agentLog.customerid    = account.Id.ToString();
            agentLog.tid           = tempinfo.Id;
            agentLog.type          = agentinfo != null ? (int)AgentDepositLogType.开通客户模板 : (int)AgentDepositLogType.普通用户开通模板;
            agentLog.templateCount = 1;
            agentLog.beforeDeposit = deposit;
            agentLog.cost          = sum;
            agentLog.Rid           = platApplyAppModel.BindAId;
            agentLog.acid          = agentinfo != null ? 0 : accountrelation.Id;
            agentLog.afterDeposit  = afterdeposit;
            string desc = $"客户:{mycardmodel.Name}  开通模板:{tempinfo.TName} 开通数量:1";
            agentLog.costdetail = desc;
            tran.Add(AgentdepositLogBLL.SingleModel.BuildAddSql(agentLog));
            #endregion

            //执行事务
            success = base.ExecuteTransactionDataCorect(tran.sqlArray, tran.ParameterArray);

            return(success);
        }
Ejemplo n.º 16
0
        /// <summary>
        /// 获取名片码
        /// </summary>
        /// <returns></returns>
        public ActionResult GetMyCardCodeUrl()
        {
            returnObj = new Return_Msg_APP();
            int    userId  = Context.GetRequestInt("userid", 0);
            int    aid     = Context.GetRequestInt("aid", 0);
            string pageUrl = Context.GetRequest("pageurl", "");

            if (userId <= 0)
            {
                returnObj.Msg = "userid不能为空";
                return(Json(returnObj));
            }
            if (aid <= 0)
            {
                returnObj.Msg = "aid不能为空";
                return(Json(returnObj));
            }
            if (string.IsNullOrEmpty(pageUrl))
            {
                returnObj.Msg = "名片路径不能为空";
                return(Json(returnObj));
            }

            PlatMyCard myCard = PlatMyCardBLL.SingleModel.GetModelByUserId(userId);

            if (myCard == null)
            {
                returnObj.Msg = "名片过期";
                return(Json(returnObj));
            }
            //判断是否已有名片码
            if (!string.IsNullOrEmpty(myCard.QrCodeImgUrl))
            {
                returnObj.dataObj = myCard.QrCodeImgUrl;
                returnObj.isok    = true;
                return(Json(returnObj));
            }

            XcxAppAccountRelation xcxrelation = _xcxAppAccountRelationBLL.GetModel(aid);

            if (xcxrelation == null)
            {
                returnObj.Msg = "模板过期";
                return(Json(returnObj));
            }

            //XcxTemplate xcxTemplate = XcxTemplateBLL.SingleModel.GetModel(xcxrelation.TId);
            //if (xcxTemplate == null)
            //{
            //    returnObj.Msg = "无效模板";
            //    return Json(returnObj);
            //}

            string token = "";

            if (!XcxApiBLL.SingleModel.GetToken(xcxrelation, ref token))
            {
                returnObj.Msg = token;
                return(Json(returnObj));
            }

            string      scen        = $"{userId}";
            qrcodeclass qrCodeModel = CommondHelper.GetMiniAppQrcode(token, pageUrl, scen);

            if (qrCodeModel == null || string.IsNullOrEmpty(qrCodeModel.url))
            {
                returnObj.Msg = qrCodeModel == null?"生成名片码失败": qrCodeModel.msg + "失败";
                return(Json(returnObj));
            }

            myCard.QrCodeImgUrl = qrCodeModel.url;
            myCard.UpdateTime   = DateTime.Now;
            PlatMyCardBLL.SingleModel.Update(myCard, "QrCodeImgUrl,UpdateTime");
            returnObj.dataObj = myCard.QrCodeImgUrl;
            returnObj.isok    = true;
            return(Json(returnObj));
        }
Ejemplo n.º 17
0
        /// <summary>
        /// 数据雷达
        /// </summary>
        /// <returns></returns>
        public ActionResult GetRadarData()
        {
            PlatRadarReportModel radar = new PlatRadarReportModel();

            returnObj = new Return_Msg_APP();
            int userId = Context.GetRequestInt("userid", 0);
            int aid    = Context.GetRequestInt("aid", 0);
            int type   = Context.GetRequestInt("type", 0);//-1:统计,0:本月,1:上个月

            if (userId <= 0)
            {
                returnObj.Msg = "userid不能为0";
                return(Json(returnObj));
            }
            PlatMyCard myCard = PlatMyCardBLL.SingleModel.GetModelByUserId(userId);

            if (myCard == null)
            {
                returnObj.Msg = "名片已过期";
                return(Json(returnObj));
            }

            string startTime = "";
            string endTime   = "";

            switch (type)
            {
            case -1: break;

            case 0:
                startTime = DateTime.Now.ToString("yyyy-MM") + "-1";
                endTime   = DateTime.Now.AddMonths(1).ToString("yyyy-MM") + "-1";
                break;

            case 1:
                startTime = DateTime.Now.AddMonths(1).ToString("yyyy-MM") + "-1";
                endTime   = DateTime.Now.AddMonths(2).ToString("yyyy-MM") + "-1";
                break;
            }

            #region  片数据分析
            //浏览量
            //点赞量
            //关注量
            //与多少人私信
            //转发量
            PlatMsgviewFavoriteShare reportData = PlatMsgviewFavoriteShareBLL.SingleModel.GetModelByMsgId(aid, myCard.Id, (int)PointsDataType.片);
            radar.MyCardViewCount = myCard.FictitiousCount;
            if (reportData != null)
            {
                radar.MyCardDzCount     = reportData.DzCount;
                radar.MyCardViewCount  += reportData.ViewCount;
                radar.MyCardFollowCount = reportData.FollowCount;
                radar.MyCardShareCount  = reportData.ShareCount;
            }
            radar.MyCardSiXinCount = ImMessageBLL.SingleModel.GetCountByTuesrId(userId);

            //访客人数
            int visitorCount = PlatUserFavoriteMsgBLL.SingleModel.GetVisitorCount(myCard.Id, myCard.AId, (int)PointsDataType.片, startTime, endTime);
            radar.MyCardVisitorCount = visitorCount;
            #endregion

            #region 人脉关系统计
            //已关注人数
            int myFavoriteCount = PlatUserFavoriteMsgBLL.SingleModel.GetUserMsgCount(aid, 0, (int)PointsActionType.关注, (int)PointsDataType.片, userId);
            radar.FollowCount = myFavoriteCount;

            //粉丝人数
            int fanCount = PlatUserFavoriteMsgBLL.SingleModel.GetUserMsgCount(aid, myCard.Id, (int)PointsActionType.关注, (int)PointsDataType.片, 0);
            radar.FanCount = fanCount;

            //相互关注人数
            radar.MutualFollowCount = PlatUserFavoriteMsgBLL.SingleModel.GetMutualFollowCount(aid, userId);
            #endregion

            #region 平台入驻店铺数据统计
            PlatStore storeModel = PlatStoreBLL.SingleModel.GetPlatStore(myCard.Id, 1);
            if (storeModel != null)
            {
                //浏览量
                radar.StoreViewCount = storeModel.StorePV + storeModel.StoreVirtualPV;
                //收藏数
                List <PlatUserFavoriteMsg> storelist = PlatUserFavoriteMsgBLL.SingleModel.GetReportData(storeModel.Id, myCard.AId, (int)PointsDataType.店铺, startTime, endTime);
                if (storelist != null && storelist.Count > 0)
                {
                    PlatUserFavoriteMsg tempmodel = storelist.Where(w => w.ActionType == (int)PointsActionType.收藏).FirstOrDefault();
                    radar.StoreFavoriteCount = tempmodel == null ? 0 : tempmodel.Count;
                }

                //访客人数
                int storeVisitorCount = PlatUserFavoriteMsgBLL.SingleModel.GetVisitorCount(storeModel.Id, myCard.AId, (int)PointsDataType.店铺, startTime, endTime);
                radar.StoreVisitorCount = storeVisitorCount;
            }
            #endregion

            returnObj.isok    = true;
            returnObj.dataObj = radar;
            return(Json(returnObj));
        }
Ejemplo n.º 18
0
        /// <summary>
        /// 获取帖子列表 排列顺序为 置顶未失效>时间降序
        /// 然后再到前端进行排序 如果时间按照最近则不需要排序
        /// 如果是按距离则再排一次先是置顶的然后 距离有限 再按时间降序
        /// </summary>
        /// <param name="aid"></param>
        /// <param name="totalCount"></param>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        /// <returns></returns>

        public List <PlatMsg> GetListMsg(int aid, out int totalCount, string keyMsg = "", int msgTypeId = 0, int pageSize = 10, int pageIndex = 1, int orderType = 0, double ws_lat = 0, double ws_lng = 0)
        {
            string strWhere = $" aid={aid} and state=1 and PayState=1 ";

            if (msgTypeId > 0)
            {
                strWhere += $"  and MsgTypeId={msgTypeId} ";
            }

            List <MySqlParameter> parameters = new List <MySqlParameter>();

            if (!string.IsNullOrEmpty(keyMsg))
            {
                strWhere += $" and msgDetail like @keyMsg ";
                parameters.Add(new MySqlParameter("keyMsg", $"%{keyMsg}%"));
            }

            totalCount = base.GetCount(strWhere, parameters.ToArray());

            string sql = $@"SELECT * FROM( SELECT * FROM (SELECT *,(DATE_ADD(ReviewTime,INTERVAL topDay DAY)-now()) as tspan from platmsg where (DATE_ADD(ReviewTime,INTERVAL topDay DAY)-now())>0 and { strWhere} ORDER BY addtime desc LIMIT 100000)t1 
UNION
 SELECT* FROM(
SELECT*, (DATE_ADD(ReviewTime, INTERVAL topDay DAY)-now()) as tspan from platmsg where (DATE_ADD(ReviewTime, INTERVAL topDay DAY) - now()) <= 0 and { strWhere}  ORDER BY addtime desc LIMIT 100000) t2
) t3 limit {(pageIndex - 1) * pageSize},{pageSize}";

            if (orderType > 0)
            {//表示附近
                sql = $@"SELECT * FROM( SELECT * FROM (SELECT *,(DATE_ADD(ReviewTime,INTERVAL topDay DAY)-now()) as tspan,ROUND(6378.138*2*ASIN(SQRT(POW(SIN(({ws_lat}*PI()/180-lat*PI()/180)/2),2)+COS({ws_lat}*PI()/180)*COS(lat*PI()/180)*POW(SIN(({ws_lng}*PI()/180-lng*PI()/180)/2),2)))*1000) AS distance from platmsg where (DATE_ADD(ReviewTime,INTERVAL topDay DAY)-now())>0 and { strWhere} ORDER BY distance asc,addtime desc LIMIT 100000)t1 
UNION
 SELECT* FROM(
SELECT*, (DATE_ADD(ReviewTime, INTERVAL topDay DAY)-now()) as tspan,ROUND(6378.138*2*ASIN(SQRT(POW(SIN(({ws_lat}*PI()/180-lat*PI()/180)/2),2)+COS({ws_lat}*PI()/180)*COS(lat*PI()/180)*POW(SIN(({ws_lng}*PI()/180-lng*PI()/180)/2),2)))*1000) AS distance from platmsg where (DATE_ADD(ReviewTime, INTERVAL topDay DAY) - now()) <= 0 and { strWhere}  ORDER BY distance asc, addtime desc LIMIT 100000) t2
) t3 limit {(pageIndex - 1) * pageSize},{pageSize}";
            }

            //   log4net.LogHelper.WriteInfo(this.GetType(),sql);
            List <PlatMsg> listPlatMsg = base.GetListBySql(sql, parameters.ToArray());

            if (listPlatMsg != null && listPlatMsg.Count > 0)
            {
                string            cardIds        = string.Join(",", listPlatMsg.Select(s => s.MyCardId).Distinct());
                List <PlatMyCard> platMyCardList = PlatMyCardBLL.SingleModel.GetListByIds(cardIds);

                string             msgTypeIds      = string.Join(",", listPlatMsg.Select(s => s.MsgTypeId).Distinct());
                List <PlatMsgType> platMsgTypeList = PlatMsgTypeBLL.SingleModel.GetListByIds(msgTypeIds);

                listPlatMsg.ForEach(x =>
                {
                    //获取用户头像
                    PlatMyCard platMyCard = platMyCardList?.FirstOrDefault(f => f.Id == x.MyCardId);
                    if (platMyCard != null)
                    {
                        x.UserName      = platMyCard.Name;
                        x.UserHeaderImg = platMyCard.ImgUrl;
                        x.UserId        = platMyCard.UserId;
                    }

                    //获取帖子类别
                    PlatMsgType platMsgType = platMsgTypeList?.FirstOrDefault(f => f.Id == x.MsgTypeId);
                    if (platMsgType != null)
                    {
                        x.MsgTypeName = platMsgType.Name;
                    }

                    //根据帖子ID获取其浏览量-收藏量-分享量数据
                    PlatMsgviewFavoriteShare _platMsgviewFavoriteShare = PlatMsgviewFavoriteShareBLL.SingleModel.GetModelByMsgId(x.Aid, x.Id, (int)PointsDataType.帖子);
                    if (_platMsgviewFavoriteShare != null)
                    {
                        x.ViewCount     = _platMsgviewFavoriteShare.ViewCount;
                        x.FavoriteCount = _platMsgviewFavoriteShare.FavoriteCount;
                        x.ShareCount    = _platMsgviewFavoriteShare.ShareCount;
                        x.DzCount       = _platMsgviewFavoriteShare.DzCount;
                    }

                    x.ShowTimeStr = CommondHelper.GetTimeSpan(DateTime.Now - x.AddTime);
                    x.MsgDetail   = HttpUtility.HtmlDecode(x.MsgDetail);
                });
            }

            totalCount = base.GetCount(strWhere, parameters.ToArray());
            return(listPlatMsg);
        }
Ejemplo n.º 19
0
        public List <PlatActivityTrajectory> GetListByMyUserId(int myuserid, int pageIndex, int pageSize, ref int count, bool reflesh = false)
        {
            RedisModel <PlatActivityTrajectory> model = new RedisModel <PlatActivityTrajectory>();

            model = RedisUtil.Get <RedisModel <PlatActivityTrajectory> >(string.Format(_redis_PlatActivityTrajectoryKey, myuserid, pageSize, pageIndex));
            int dataversion = RedisUtil.GetVersion(string.Format(_redis_PlatActivityTrajectoryVersion, myuserid));

            if (reflesh || model == null || model.DataList == null || model.DataList.Count <= 0 || model.DataVersion != dataversion)
            {
                model = new RedisModel <PlatActivityTrajectory>();

                string sqlwhere = $"myuserid = {myuserid}";
                List <PlatActivityTrajectory> list = base.GetList(sqlwhere, pageSize, pageIndex, "", "addtime desc");
                if (list != null && list.Count > 0)
                {
                    //名片
                    string userid1 = string.Join(",", list.Select(s => s.MyUserId).Distinct());
                    string userid2 = string.Join(",", list.Select(s => s.OtherUserId).Distinct());
                    if (!string.IsNullOrEmpty(userid2))
                    {
                        if (!string.IsNullOrEmpty(userid1))
                        {
                            userid1 = userid1 + "," + userid2;
                        }
                        else
                        {
                            userid1 = userid2;
                        }
                    }

                    List <PlatMyCard> cardlist = PlatMyCardBLL.SingleModel.GetListByUserIds(userid1);

                    //评论
                    List <PlatMsgComment>         commentlist = new List <PlatMsgComment>();
                    List <PlatActivityTrajectory> templist    = list.Where(w => w.Datatype == (int)PointsDataType.评论).ToList();
                    if (templist != null && templist.Count > 0)
                    {
                        string commondids = string.Join(",", templist.Select(s => s.DataId).Distinct());
                        commentlist = PlatMsgCommentBLL.SingleModel.GetListByIds(commondids);
                    }
                    foreach (PlatActivityTrajectory item in list)
                    {
                        PlatMyCard tempcardmodel = cardlist?.FirstOrDefault(f => f.UserId == item.MyUserId);
                        item.MyCardId    = tempcardmodel != null ? tempcardmodel.Id : 0;
                        tempcardmodel    = cardlist?.Where(w => w.UserId == item.OtherUserId).FirstOrDefault();
                        item.OtherCardId = tempcardmodel != null ? tempcardmodel.Id : 0;

                        if (item.Datatype == (int)PointsDataType.帖子)
                        {
                            item.MsgId = item.DataId;
                        }
                        else if (item.Datatype == (int)PointsDataType.评论)
                        {
                            PlatMsgComment commentmodel = commentlist?.FirstOrDefault(f => f.Id == item.DataId);
                            item.MsgId = commentmodel != null ? commentmodel.MsgId : 0;
                        }
                    }
                }
                count             = base.GetCount(sqlwhere);
                model.DataList    = list;
                model.DataVersion = dataversion;
                model.Count       = count;
                if (!reflesh)
                {
                    RedisUtil.Set <RedisModel <PlatActivityTrajectory> >(string.Format(_redis_PlatActivityTrajectoryKey, myuserid, pageSize, pageIndex), model);
                }
            }
            else
            {
                count = model.Count;
            }

            return(model.DataList);
        }
Ejemplo n.º 20
0
        /// <summary>
        /// 点赞、关注、浏览、私信、收藏量
        /// </summary>
        /// <returns></returns>
        public ActionResult AddFavorite()
        {
            returnObj = new Return_Msg_APP();
            int actionType  = Context.GetRequestInt("actiontype", (int)PointsActionType.收藏);
            int userId      = Context.GetRequestInt("userid", 0);
            int otherCardId = Context.GetRequestInt("othercardid", 0);
            int aid         = Context.GetRequestInt("aid", 0);
            int dataType    = Context.GetRequestInt("datatype", (int)PointsDataType.片);

            if (userId <= 0)
            {
                returnObj.Msg = "userid不能小于0";
                return(Json(returnObj));
            }
            if (otherCardId <= 0)
            {
                returnObj.Msg = "名片ID不能小于0";
                return(Json(returnObj));
            }
            if (aid <= 0)
            {
                returnObj.Msg = "aid不能小于0";
                return(Json(returnObj));
            }
            int curState = 0;

            lock (_lockobj)
            {
                switch (dataType)
                {
                case (int)PointsDataType.片:
                    if (actionType == (int)PointsActionType.过)
                    {
                        PlatMyCard platMycard = PlatMyCardBLL.SingleModel.GetModel(otherCardId);
                        if (platMycard == null)
                        {
                            returnObj.Msg = "名片已失效";
                            return(Json(returnObj));
                        }
                        if (platMycard.UserId == userId)
                        {
                            returnObj.isok = true;
                            returnObj.Msg  = "屏蔽自己的浏览";
                            return(Json(returnObj));
                        }
                    }

                    break;
                }

                returnObj.Msg = PlatUserFavoriteMsgBLL.SingleModel.CommondFavoriteMsg(aid, otherCardId, userId, actionType, dataType, ref curState);
            }
            returnObj.isok = returnObj.Msg.ToString() == "";

            if ((int)PointsActionType.点赞 == actionType && dataType == 0)
            {
                //表示帖子的点赞需要返回该帖子的点赞列表
                int count = 0;
                returnObj.dataObj = new { curState = curState, dzList = PlatUserFavoriteMsgBLL.SingleModel.GetMsgUserFavoriteList(0, aid, otherCardId, (int)PointsActionType.点赞, (int)PointsDataType.帖子, 1, 1000, ref count) };
            }
            else
            {
                returnObj.dataObj = new { curState = curState };
            }
            return(Json(returnObj));
        }
Ejemplo n.º 21
0
        /// <summary>
        /// 获取平台指定店铺详情
        /// </summary>
        /// <returns></returns>
        public ActionResult GetStoreDetail()
        {
            returnObj      = new Return_Msg_APP();
            returnObj.code = "200";
            string appId   = Context.GetRequest("appId", string.Empty);
            int    userId  = Context.GetRequestInt("userId", 0);
            int    storeId = Context.GetRequestInt("storeId", 0);
            int    type    = Context.GetRequestInt("type", 0);

            if (string.IsNullOrEmpty(appId))
            {
                returnObj.Msg = "参数错误";
                return(Json(returnObj));
            }
            List <string>         listPlatMyCardIds = new List <string>();
            int                   myCardId          = Context.GetRequestInt("myCardId", 0);
            int                   isStoreID         = Context.GetRequestInt("isStoreID", 0);//如果是1 表示myCardId为店铺Id 这里是轮播图处理兼容旧数据
            XcxAppAccountRelation r = _xcxAppAccountRelationBLL.GetModelByAppid(appId);

            if (r == null)
            {
                returnObj.Msg = "小程序未授权";
                return(Json(returnObj, JsonRequestBehavior.AllowGet));
            }
            PlatStore platStore = new PlatStore();

            if (type == 1 && isStoreID == 0)
            {
                //表示从我的店铺名片进来
                if (myCardId <= 0)
                {
                    platStore = null;
                }
                else
                {
                    platStore = PlatStoreBLL.SingleModel.GetPlatStore(myCardId, type);
                }
            }
            else if (type == 2)
            {
                //表示独立小程序进来的
                platStore = PlatStoreBLL.SingleModel.GetPlatStore(r.Id, type);
                r         = _xcxAppAccountRelationBLL.GetModel(platStore.BindPlatAid);//查找所属平台
                if (r != null)
                {
                    listPlatMyCardIds = PlatMyCardBLL.SingleModel.GetCardIds(r.Id, r.AppId).Split(',').ToList();
                    if (!listPlatMyCardIds.Contains(platStore.MyCardId.ToString()))
                    {
                        returnObj.Msg = "店铺不存在(平台换绑了小程序,请重新入驻)";
                        return(Json(returnObj, JsonRequestBehavior.AllowGet));
                    }
                }
            }
            else
            {
                //平台轮播图 置顶商家 进入店铺会带上isStoreID

                if (isStoreID > 0)
                {
                    type      = 0;
                    platStore = PlatStoreBLL.SingleModel.GetPlatStore(myCardId, type);
                }
                else
                {
                    platStore = PlatStoreBLL.SingleModel.GetPlatStore(storeId, type);
                }
            }

            if (platStore == null)
            {
                returnObj.Msg = "店铺不存在";
                return(Json(returnObj, JsonRequestBehavior.AllowGet));
            }
            if (platStore.State == -1)
            {
                returnObj.Msg = "店铺无效(未支付)";
                return(Json(returnObj, JsonRequestBehavior.AllowGet));
            }



            if (type != 2)
            {
                //这里的appID是平台的
                listPlatMyCardIds = PlatMyCardBLL.SingleModel.GetCardIds(r.Id, appId).Split(',').ToList();
                if (!listPlatMyCardIds.Contains(platStore.MyCardId.ToString()))
                {
                    returnObj.Msg = "店铺不存在(平台换绑了小程序,请重新入驻绑定)";
                    return(Json(returnObj, JsonRequestBehavior.AllowGet));
                }
            }



            //店铺关联的权限表数据
            XcxAppAccountRelation storexcxrelation = _xcxAppAccountRelationBLL.GetModel(platStore.Aid);

            if (storexcxrelation != null)
            {
                platStore.AppId = storexcxrelation.AppId;
            }

            //TODO 后续流量大了再放入redis然后定时去更新
            platStore.StorePV++;
            //访客人数
            platStore.StoreUV       = PlatUserFavoriteMsgBLL.SingleModel.GetVisitorCount(platStore.MyCardId, platStore.BindPlatAid, (int)PointsDataType.店铺, "", "");
            platStore.FavoriteCount = PlatUserFavoriteMsgBLL.SingleModel.GetStoreFavoriteCount(r.Id, platStore.Id);

            PlatUserFavoriteMsg platUserFavoriteMsg = PlatUserFavoriteMsgBLL.SingleModel.GetUserFavoriteMsg(r.Id, platStore.Id, userId, (int)PointsActionType.收藏, (int)PointsDataType.店铺);

            platStore.Favorited = (platUserFavoriteMsg != null && platUserFavoriteMsg.State != -1 ? 1 : 0);

            platStore.CategoryName = PlatStoreCategoryBLL.SingleModel.GetModel(platStore.Category).Name;

            int tjCount = 0;

            List <PlatChildGoods> listTjGoods = listTjGoods = PlatChildGoodsBLL.SingleModel.GetListByRedis(platStore.Aid, ref tjCount, string.Empty, 0, 0, 1, 1, 4, "TopState desc,VirtualSalesCount+SalesCount desc,sort desc");

            //if (type == 0)
            //{

            //    listTjGoods = _platChildGoodsBLL.GetListByRedis(platStore.Aid, ref tjCount, string.Empty, 0, 0, 1, 1, 4, "TopState desc,VirtualSalesCount+SalesCount desc,sort desc");
            //}
            //else
            //{
            //    listTjGoods = _platChildGoodsBLL.GetListByRedis(r.Id, ref tjCount, string.Empty, 0, 0, 1, 1, 4, "TopState desc,VirtualSalesCount+SalesCount desc,sort desc");
            //}
            if (listTjGoods != null && listTjGoods.Count > 0)
            {
                listTjGoods.ForEach(x =>
                {
                    platStore.TjGoods.Add(new TjGoods()
                    {
                        Aid       = x.AId,
                        Id        = x.Id,
                        Name      = x.Name,
                        Img       = x.Img,
                        PriceStr  = (x.PriceFen * 0.01).ToString("0.00"),
                        SaleCount = (x.SalesCount + x.VirtualSalesCount),
                        TopState  = x.TopState
                    });
                });
            }

            PlatApplyApp platApplyApp = PlatApplyAppBLL.SingleModel.GetPlatApplyAppByStoreId(platStore.Id);

            if (platApplyApp != null)
            {
                platStore.AppState = platApplyApp.OpenState;
            }

            if (!PlatStoreBLL.SingleModel.Update(platStore, "StorePV"))
            {
                returnObj.Msg = "更新店铺浏览量异常";
                return(Json(returnObj, JsonRequestBehavior.AllowGet));
            }
            //PlatMsgviewFavoriteShare msgview = _platMsgviewFavoriteShareBLL.GetModelByMsgId(platStore.BindPlatAid, platStore.Id,(int)PointsDataType.店铺);
            //if(msgview!=null)
            //{
            //    platStore.StorePV = msgview.ViewCount;
            //}

            PlatMyCard platMyCard = PlatMyCardBLL.SingleModel.GetModel(platStore.MyCardId);

            if (platMyCard != null)
            {
                platStore.storeOwner = new StoreOwner()
                {
                    UserId = platMyCard.UserId,
                    Name   = platMyCard.Name,
                    Avatar = platMyCard.ImgUrl,
                    State  = platMyCard.State,
                };
            }

            if (!string.IsNullOrEmpty(platStore.StoreService))
            {
                platStore.StoreServiceModelList = Newtonsoft.Json.JsonConvert.DeserializeObject <List <StoreServiceModel> >(platStore.StoreService);
            }
            else
            {
                List <StoreServiceModel> list = new List <StoreServiceModel>();
                list.Add(new StoreServiceModel()
                {
                    ServiceState = true, ServiceName = "WIFI"
                });
                list.Add(new StoreServiceModel()
                {
                    ServiceState = true, ServiceName = "停车位"
                });
                list.Add(new StoreServiceModel()
                {
                    ServiceState = true, ServiceName = "支付宝支付"
                });
                list.Add(new StoreServiceModel()
                {
                    ServiceState = true, ServiceName = "微信支付"
                });
                list.Add(new StoreServiceModel()
                {
                    ServiceState = true, ServiceName = "刷卡支付"
                });
                list.Add(new StoreServiceModel()
                {
                    ServiceState = true, ServiceName = "空调雅座"
                });
                list.Add(new StoreServiceModel()
                {
                    ServiceState = true, ServiceName = "付费停车"
                });
                list.Add(new StoreServiceModel()
                {
                    ServiceState = true, ServiceName = "接送服务"
                });
                platStore.StoreServiceModelList = list;
            }

            if (!string.IsNullOrEmpty(platStore.SwitchConfig))
            {
                platStore.SwitchModel = Newtonsoft.Json.JsonConvert.DeserializeObject <PlatStoreSwitchModel>(platStore.SwitchConfig);
            }
            else
            {
                platStore.SwitchModel = new PlatStoreSwitchModel();
            }

            platStore.StorePV += platStore.StoreVirtualPV;
            returnObj.dataObj  = new
            {
                platStore = platStore
            };
            returnObj.isok = true;
            returnObj.Msg  = "获取成功";
            return(Json(returnObj, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 22
0
        /// <summary>
        /// 获取帖子列表 后台数据用
        /// </summary>
        /// <param name="aid"></param>
        /// <param name="totalCount"></param>
        /// <param name="isTop"></param>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        /// <param name="msgTypeName"></param>
        /// <param name="userName"></param>
        /// <param name="userPhone"></param>
        /// <param name="orderWhere"></param>
        /// <param name="Review">-2表示全部</param>
        /// <returns></returns>
        public List <PlatMsg> GetListByaid(int aid, out int totalCount, int isTop = 0, int pageSize = 10, int pageIndex = 1, string msgTypeName = "", string userName = "", string userPhone = "", string orderWhere = "addTime desc", int Review = -2, int isFromStore = -1)
        {
            string strWhere = $"aid={aid} and state<>-1 and PayState=1";

            if (isTop == 0)
            {
                //表示普通信息 非置顶信息
                strWhere += " and topDay=0 and isTop=0";
            }
            if (isTop == 1)
            {
                strWhere += $" and (topDay>0 or isTop=1) ";//置顶信息
            }


            if (Review != -2)
            {
                strWhere += $" and Review={Review} ";
            }



            #region 根据类别名称查询类别
            List <PlatMsgType> listMsgType = new List <PlatMsgType>();

            if (!string.IsNullOrEmpty(msgTypeName))
            {
                //类别
                int        count   = 0;
                string     typeIds = string.Empty;
                List <int> listIds = new List <int>();
                listMsgType = PlatMsgTypeBLL.SingleModel.getListByaid(aid, out count, 1000, 1, msgTypeName);
                if (listMsgType != null && listMsgType.Count > 0)
                {
                    listIds.AddRange(listMsgType.Select(x => x.Id));
                }
                else
                {
                    listIds.Add(0);
                }
                typeIds = string.Join(",", listIds);
                if (!string.IsNullOrEmpty(typeIds))
                {
                    strWhere += $" and msgTypeId in ({typeIds})";
                }
            }
            #endregion

            #region 根据用户昵称模糊匹配用户列表
            List <PlatMyCard> listPlatMyCard = new List <PlatMyCard>();
            if (!string.IsNullOrEmpty(userName))
            {
                string     platMyCardIds   = string.Empty;
                List <int> listIds         = new List <int>();
                int        platMyCardCount = 0;
                listPlatMyCard = PlatMyCardBLL.SingleModel.GetDataList(aid, ref platMyCardCount, userName);
                if (listPlatMyCard != null && listPlatMyCard.Count > 0)
                {
                    //  log4net.LogHelper.WriteInfo(this.GetType(), $"listUserInfo={listUserInfo.Count}");
                    listIds.AddRange(listPlatMyCard.Select(x => x.Id));
                }
                else
                {
                    listIds.Add(0);
                }

                platMyCardIds = string.Join(",", listIds);
                if (!string.IsNullOrEmpty(platMyCardIds))
                {
                    strWhere += $" and mycardid in ({platMyCardIds})";
                }
            }
            #endregion

            List <MySqlParameter> parameters = new List <MySqlParameter>();

            if (!string.IsNullOrEmpty(userPhone))
            {
                parameters.Add(new MySqlParameter("@userPhone", $"%{userPhone}%"));
                strWhere += " and phone like @userPhone";
            }

            totalCount = base.GetCount(strWhere, parameters.ToArray());
            // log4net.LogHelper.WriteInfo(this.GetType(), strWhere);
            List <PlatMsg> listPlatMsg = base.GetListByParam(strWhere, parameters.ToArray(), pageSize, pageIndex, "*", orderWhere);
            if (listPlatMsg != null && listPlatMsg.Count > 0)
            {
                listPlatMsg.ForEach(x =>
                {
                    if (listPlatMyCard != null && listPlatMyCard.Count > 0)
                    {
                        x.UserName      = listPlatMyCard.FirstOrDefault(u => u.Id == x.MyCardId).Name;
                        x.UserHeaderImg = listPlatMyCard.FirstOrDefault(u => u.Id == x.MyCardId).ImgUrl;
                    }
                    else
                    {
                        PlatMyCard platMyCard = PlatMyCardBLL.SingleModel.GetModel(x.MyCardId);
                        if (platMyCard != null)
                        {
                            x.UserName      = platMyCard.Name;
                            x.UserHeaderImg = platMyCard.ImgUrl;
                        }
                    }

                    if (listMsgType != null && listMsgType.Count > 0)
                    {
                        x.MsgTypeName = listMsgType.FirstOrDefault(t => t.Id == x.MsgTypeId).Name;
                    }
                    else
                    {
                        PlatMsgType platMsgType = PlatMsgTypeBLL.SingleModel.GetModel(x.MsgTypeId);
                        if (platMsgType != null)
                        {
                            x.MsgTypeName = platMsgType.Name;
                        }
                    }
                    x.MsgDetail = HttpUtility.HtmlDecode(x.MsgDetail);

                    if (isFromStore != -1)
                    {
                        x.MsgDetail = x.MsgDetail.Length > 10 ? x.MsgDetail.Substring(0, 10) + "..." : x.MsgDetail;
                    }
                });
            }

            return(listPlatMsg);
        }
Ejemplo n.º 23
0
        /// <summary>
        /// 获取平台提现申请记录列表
        /// </summary>
        /// <param name="appId"></param>
        /// <param name="state"></param>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <param name="telephone"></param>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        /// <returns></returns>
        public List <DrawCashApply> GetPlatDrawCashApplys(ref int count, int aid, int state, int drawway, int drawstate, string startTime = "", string endTime = "", string storename = "", int pageSize = 10, int pageIndex = 1, int userid = 0)
        {
            List <DrawCashApply> list = new List <DrawCashApply>();
            string sqlwhere           = $"aid={aid} and applyType={(int)DrawCashApplyType.平台店铺提现}";

            if (!string.IsNullOrEmpty(startTime))
            {
                sqlwhere += $" and AddTime>='{startTime}'";
            }
            if (!string.IsNullOrEmpty(endTime))
            {
                sqlwhere += $" and AddTime<='{endTime}'";
            }
            //店铺或电话搜索
            if (!string.IsNullOrEmpty(storename))
            {
                List <PlatStore> storelist = PlatStoreBLL.SingleModel.GetListByNameOrPhone(storename, aid);
                if (storelist == null || storelist.Count <= 0)
                {
                    return(list);
                }

                string userids = string.Join(",", storelist.Select(s => s.UserId).Distinct());
                sqlwhere += $" and userid in ({userids})";
            }
            if (userid > 0)
            {
                sqlwhere += $" and userid ={userid}";
            }

            if (state != -999)
            {
                sqlwhere += $" and state={state}";
            }
            if (drawway != -999)
            {
                sqlwhere += $" and drawCashWay={drawway}";
            }
            if (drawstate != -999)
            {
                sqlwhere += $" and drawState={drawstate}";
            }
            string salesManRecordIds = string.Empty;

            list  = base.GetList(sqlwhere, pageSize, pageIndex, "*", "addTime desc");
            count = base.GetCount(sqlwhere);
            if (count > 0)
            {
                string userids = string.Join(",", list.Select(s => s.userId).Distinct());
                //List<C_UserInfo> userinfolist = C_UserInfoBLL.SingleModel.GetListByIds(userids);
                List <PlatMyCard> mycardlist = PlatMyCardBLL.SingleModel.GetListByUserIds(userids);
                if (mycardlist == null || mycardlist.Count <= 0)
                {
                    return(new List <DrawCashApply>());
                }
                string           mycardids = string.Join(",", mycardlist.Select(s => s.Id));
                List <PlatStore> storelist = PlatStoreBLL.SingleModel.GetListByCardId(mycardids);
                list.ForEach(x =>
                {
                    PlatMyCard card = mycardlist.FirstOrDefault(f => f.UserId == x.userId);
                    if (card != null)
                    {
                        PlatStore store = storelist.FirstOrDefault(f => f.MyCardId == card.Id);
                        if (store != null)
                        {
                            x.nickName = store.Name;
                            x.phone    = card.Phone;
                        }
                    }
                });
            }

            return(list);
        }
Ejemplo n.º 24
0
        /// <summary>
        /// 谁看过我,谁关注我,谁收藏我,谁点赞我列表数据
        /// </summary>
        /// <returns></returns>
        public ActionResult GetOtherFavoriteList()
        {
            returnObj = new Return_Msg_APP();
            int    actionType = Context.GetRequestInt("actiontype", (int)PointsActionType.收藏);
            int    myCardId   = Context.GetRequestInt("mycardid", 0);
            int    userId     = Context.GetRequestInt("userid", 0);
            int    aid        = Context.GetRequestInt("aid", 0);
            int    dataType   = Context.GetRequestInt("datatype", (int)PointsDataType.片);
            int    pageIndex  = Context.GetRequestInt("pageindex", 1);
            int    pageSize   = Context.GetRequestInt("pagesize", 10);
            int    type       = Context.GetRequestInt("type", 0);
            string lng        = Context.GetRequest("lng", "0");
            string lat        = Context.GetRequest("lat", "0");
            int    ver        = Context.GetRequestInt("ver", 0);

            if (myCardId <= 0)
            {
                returnObj.Msg = "我的名片ID不能小于0";
                return(Json(returnObj));
            }
            if (userId <= 0)
            {
                returnObj.Msg = "userid不能小于0";
                return(Json(returnObj));
            }
            if (aid <= 0)
            {
                returnObj.Msg = "aid不能小于0";
                return(Json(returnObj));
            }
            PlatMyCard myCard = PlatMyCardBLL.SingleModel.GetModelByUserId(userId, aid);

            if (myCard != null)
            {
                lng = myCard.Lng.ToString();
                lat = myCard.Lat.ToString();
            }

            int count = 0;

            switch (dataType)
            {
            case (int)PointsDataType.片:
                if (actionType == (int)PointsActionType.私信)
                {
                    List <PlatUserFavoriteMsg> myCardList = PlatUserFavoriteMsgBLL.SingleModel.GetMyCardUserFavoriteList(ver, myCard.Id, userId, aid, pageIndex, pageSize, ref count);
                    returnObj.dataObj = new { list = myCardList, count = count };
                }
                else
                {
                    List <PlatUserFavoriteMsg> mycardlist = PlatUserFavoriteMsgBLL.SingleModel.GetMyCardUserFavoriteList(myCard.AppId, lng, lat, userId, type, aid, myCardId, actionType, dataType, pageIndex, pageSize, ref count);
                    returnObj.dataObj = new { list = mycardlist, count = count };
                }

                break;

            case (int)PointsDataType.帖子:
                List <PlatUserFavoriteMsg> msgList = PlatUserFavoriteMsgBLL.SingleModel.GetMsgUserFavoriteList(type, aid, myCardId, actionType, dataType, pageIndex, pageSize, ref count);
                returnObj.dataObj = new { list = msgList, count = count };
                break;

            case (int)PointsDataType.店铺:
                List <PlatStore> storeList = PlatUserFavoriteMsgBLL.SingleModel.GetListMyFavoriteStore(aid, userId, out count, pageSize, pageIndex);


                //表示没有传坐标 通过客户端IP获取经纬度
                IPToPoint iPToPoint = new IPToPoint();
                if (lng == "0" || lat == "0")
                {
                    string IP = WebHelper.GetIP();

                    iPToPoint = CommondHelper.GetLoctionByIP(IP);
                    if (iPToPoint != null && iPToPoint.result != null)
                    {
                        lat = iPToPoint.result.location.lat.ToString();
                        lng = iPToPoint.result.location.lng.ToString();
                    }
                }
                double distance = 0.00;
                storeList.ForEach(x =>
                {
                    distance = CommondHelper.GetDistance(x.Lat, x.Lng, Convert.ToDouble(lat), Convert.ToDouble(lng));
                    if (distance < 1)
                    {
                        x.Distance = (distance * 1000).ToString() + "m";
                    }
                    else
                    {
                        x.Distance = distance.ToString() + "km";
                    }
                });

                returnObj.dataObj = new { list = storeList, count = count };
                break;
            }
            returnObj.isok = true;
            return(Json(returnObj));
        }
Ejemplo n.º 25
0
        public ActionResult GetGoodInfo()
        {
            int pid    = Context.GetRequestInt("pid", 0);
            int userId = Context.GetRequestInt("userId", 0);

            returnObj      = new Return_Msg_APP();
            returnObj.code = "200";

            if (pid == 0)
            {
                returnObj.Msg = "请选择产品";
                return(Json(returnObj, JsonRequestBehavior.AllowGet));
            }

            PlatChildGoods goodModel = PlatChildGoodsBLL.SingleModel.GetModel(pid);

            if (goodModel == null || goodModel.State == 0)
            {
                returnObj.Msg = "产品不存在或已删除";
                return(Json(returnObj, JsonRequestBehavior.AllowGet));
            }

            PlatStore platStore = PlatStoreBLL.SingleModel.GetModelByAId(goodModel.AId);

            if (platStore == null)
            {
                returnObj.Msg = "店铺不存在";
                return(Json(returnObj, JsonRequestBehavior.AllowGet));
            }

            if (!string.IsNullOrEmpty(goodModel.Plabels))
            {
                //goodModel.plabelstr = DAL.Base.SqlMySql.ExecuteScalar(Utility.dbEnum.MINIAPP.ToString(), CommandType.Text, $"SELECT group_concat(name order by sort desc) from entgoodlabel where id in ({goodModel.plabels})").ToString();
                goodModel.PlabelStr      = PlatChildGoodsLabelBLL.SingleModel.GetEntGoodsLabelStr(goodModel.Plabels);
                goodModel.PlabelStr_Arry = goodModel.PlabelStr.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList();
            }

            #region 会员折扣显示
            //获取会员信息
            VipRelation vipInfo   = VipRelationBLL.SingleModel.GetModelByUserid(userId);
            VipLevel    levelinfo = vipInfo != null?VipLevelBLL.SingleModel.GetModel(vipInfo.levelid) : null;

            List <PlatChildGoods> list = new List <PlatChildGoods>();
            list.Add(goodModel);
            //  _miniappVipLevelBll.GetVipDiscount(ref list, vipInfo, levelinfo, userId, "Discount", "Price");
            goodModel = list.FirstOrDefault();

            #endregion 会员折扣显示

            //#region 会员打折
            List <PlatChildGoodsCart> carlist = new List <PlatChildGoodsCart>()
            {
                new PlatChildGoodsCart()
                {
                    GoodsId = goodModel.Id
                }
            };
            carlist.ForEach(g => g.OriginalPrice = g.Price);
            VipLevelBLL.SingleModel.GetVipDiscount(ref carlist, vipInfo, levelinfo, userId, "Discount", "Price");
            goodModel.Discount = carlist[0].Discount;
            //#endregion 会员打折

            if (!string.IsNullOrEmpty(goodModel.Img))
            {
                goodModel.Img = goodModel.Img.Replace("http://vzan-img.oss-cn-hangzhou.aliyuncs.com", "https://i.vzan.cc/");
            }

            List <GoodsSpecDetail> listGoodsSpecDetail = Newtonsoft.Json.JsonConvert.DeserializeObject <List <GoodsSpecDetail> >(goodModel.SpecDetail);
            listGoodsSpecDetail.ForEach(x =>
            {
                if (x.Discount == 100)
                {
                    x.DiscountPrice = x.Price;
                }
            });

            goodModel.SpecDetail = JsonConvert.SerializeObject(listGoodsSpecDetail);
            goodModel.storeModel = new StoreModel()
            {
                StoreId = platStore.Id,
                Name    = platStore.Name,
                Img     = platStore.StoreHeaderImg,
                Loction = platStore.Location,
                Lng     = platStore.Lng,
                Lat     = platStore.Lat
            };

            PlatMyCard platMyCard = PlatMyCardBLL.SingleModel.GetModel(platStore.MyCardId);
            if (platMyCard != null)
            {
                goodModel.storeOwner = new StoreOwner()
                {
                    UserId = platMyCard.UserId,
                    Name   = platMyCard.Name,
                    Avatar = platMyCard.ImgUrl
                };

                PlatUserCash userCash = PlatUserCashBLL.SingleModel.GetModelByUserId(platMyCard.AId, platMyCard.UserId);
                if (userCash != null)
                {
                    goodModel.storeOwner.IsOpenDistribution = userCash.IsOpenDistribution;
                }
            }

            returnObj.isok    = true;
            returnObj.dataObj = goodModel;
            returnObj.Msg     = "获取成功";
            return(Json(returnObj, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 26
0
        /// <summary>
        /// 续期
        /// </summary>
        /// <param name="platApplyAppModel"></param>
        /// <param name="accountid"></param>
        /// <param name="uselength"></param>
        /// <param name="tid"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public bool AddTimeLength(PlatApplyApp platApplyAppModel, string accountid, int uselength, int tid, ref string msg)
        {
            DateTime         nowtime = DateTime.Now;
            TransactionModel tran    = new TransactionModel();

            #region 基础验证
            bool success = false;
            if (platApplyAppModel == null)
            {
                msg = "申请记录为空";
                return(false);
            }
            //名片管理登陆账号

            PlatMyCard mycardmodel = PlatMyCardBLL.SingleModel.GetModel(platApplyAppModel.MycardId);
            if (mycardmodel == null)
            {
                msg = "名片过期";
                return(false);
            }
            //判断是否已开通
            if (string.IsNullOrEmpty(mycardmodel.LoginId))
            {
                msg = "该用户还没开通小程序";
                return(false);
            }

            //店铺数据

            PlatStore platStore = PlatStoreBLL.SingleModel.GetModel(platApplyAppModel.StoreId);
            if (platStore == null)
            {
                msg = "店铺过期,请刷新重试";
                return(false);
            }
            #endregion

            #region 使用中的模板数据
            XcxAppAccountRelation xcxrelation = XcxAppAccountRelationBLL.SingleModel.GetModel(platStore.Aid);
            if (xcxrelation == null)
            {
                msg = "模板数据过期";
                return(false);
            }
            if (xcxrelation.outtime < nowtime)
            {
                xcxrelation.outtime = nowtime.AddYears(uselength);
            }
            else
            {
                xcxrelation.outtime = xcxrelation.outtime.AddYears(uselength);
            }
            tran.Add($"update XcxAppAccountRelation set outtime='{xcxrelation.outtime}',state=1 where id={xcxrelation.Id}");
            #endregion

            //用户基础数据,获取普通预存款

            AccountRelation accountrelation = AccountRelationBLL.SingleModel.GetModelByAccountId(accountid);

            //代理数据
            Agentinfo agentinfo = AgentinfoBLL.SingleModel.GetModelByAccoundId(accountid);

            #region 模板跟模板价格
            XcxTemplate tempinfo = XcxTemplateBLL.SingleModel.GetModelByType((int)TmpType.小未平台子模版);
            if (tempinfo != null && agentinfo != null)
            {
                List <XcxTemplate> xcxlist = XcxTemplateBLL.SingleModel.GetRealPriceTemplateList($" id in ({tempinfo.Id})", agentinfo.id);
                if (xcxlist != null && xcxlist.Count > 0)
                {
                    //代理过期检验
                    AgentinfoBLL.SingleModel.CheckOutTime(ref xcxlist, agentinfo, 0, ref msg);
                    tempinfo = xcxlist[0];
                }
            }
            if (tempinfo == null)
            {
                msg = "模板数据为空";
                return(false);
            }
            #endregion

            #region 扣费
            //扣除总费用
            int sum = tempinfo.Price * uselength;
            //变更前金额
            int deposit = 0;
            //变更后的金额
            int afterdeposit = 0;
            //扣除代理费用
            if (agentinfo != null)
            {
                //变更前金额
                deposit = agentinfo.deposit;
                //判断余额是否满足扣费
                if (deposit + accountrelation.Deposit < sum)
                {
                    msg = "余额不足";
                    return(false);
                }
                //变更后金额
                if (deposit >= sum)
                {
                    afterdeposit = deposit - sum;
                    tran.Add($"UPDATE Agentinfo set deposit={afterdeposit} ,updateitme='{nowtime}' where id={agentinfo.id}");
                }
                else if (accountrelation.Deposit >= sum)
                {
                    afterdeposit = accountrelation.Deposit - sum;
                    tran.Add($"UPDATE AccountRelation set deposit={afterdeposit} ,updatetime='{nowtime}' where id={accountrelation.Id}");
                }
                else
                {
                    //先扣除普通用户预存,再扣除代理商预存
                    afterdeposit = agentinfo.deposit - (sum - accountrelation.Deposit);
                    tran.Add($"UPDATE Agentinfo set deposit={afterdeposit} ,updateitme='{nowtime}' where id={agentinfo.id}");
                    tran.Add($"UPDATE AccountRelation set deposit=0 ,updatetime='{nowtime}' where id={accountrelation.Id}");
                }
            }
            //扣除普通账号预存款
            else
            {
                sum = 100 * uselength;
                //变更前金额
                deposit = accountrelation.Deposit;
                //判断余额是否满足扣费
                if (deposit < sum)
                {
                    msg = "余额不足";
                    return(false);
                }
                //变更后金额
                afterdeposit = deposit - sum;
                tran.Add($"UPDATE AccountRelation set deposit={afterdeposit} ,updatetime='{nowtime}' where id={accountrelation.Id}");
            }
            #endregion

            #region 开通流水

            AgentdepositLog agentLog = new AgentdepositLog();
            agentLog.agentid       = agentinfo != null ? agentinfo.id : 0;
            agentLog.addtime       = nowtime;
            agentLog.templateCount = 1;
            agentLog.customerid    = xcxrelation.AccountId.ToString();
            agentLog.tid           = tempinfo.Id;
            agentLog.type          = agentinfo != null ? (int)AgentDepositLogType.代理商续费 : (int)AgentDepositLogType.普通用户续费模板;
            agentLog.templateCount = 1;
            agentLog.beforeDeposit = deposit;
            agentLog.cost          = sum;
            agentLog.acid          = agentinfo != null ? 0 : accountrelation.Id;
            agentLog.Rid           = platApplyAppModel.BindAId;
            agentLog.afterDeposit  = afterdeposit;
            string desc = $"客户:{mycardmodel.Name}  续期模板:{tempinfo.TName} 续期年限:{uselength}年";
            agentLog.costdetail = desc;
            tran.Add(AgentdepositLogBLL.SingleModel.BuildAddSql(agentLog));
            #endregion

            success = base.ExecuteTransactionDataCorect(tran.sqlArray, tran.ParameterArray);

            //清除缓存
            XcxAppAccountRelationBLL.SingleModel.RemoveRedis(xcxrelation.Id);
            return(success);
        }
Ejemplo n.º 27
0
        public void AddData(int aid, int myuserid, int othercardid, int actiontype, int datatype, int dataid = 0, string dataimgurl = "", string datacomment = "")
        {
            if (myuserid <= 0 || othercardid <= 0 || aid <= 0)
            {
                return;
            }

            XcxAppAccountRelation xcxrelation = XcxAppAccountRelationBLL.SingleModel.GetModel(aid);

            if (xcxrelation == null)
            {
                return;
            }


            PlatMyCard mycard = PlatMyCardBLL.SingleModel.GetModelByUserId(myuserid, aid);

            if (mycard == null)
            {
                return;
            }

            long   otheruserid = 0;
            string othername   = "";
            string otherimgurl = "";
            string datacontent = "";

            switch (datatype)
            {
            case (int)PointsDataType.片:
                PlatMyCard othercard = PlatMyCardBLL.SingleModel.GetModel(othercardid);
                if (othercard == null)
                {
                    return;
                }
                otheruserid = othercard.UserId;
                othername   = othercard.Name;
                otherimgurl = othercard.ImgUrl;
                break;

            case (int)PointsDataType.帖子:
                PlatMsg platmsg = PlatMsgBLL.SingleModel.GetModel(othercardid);
                if (platmsg == null)
                {
                    return;
                }
                PlatMyCard msgothercard = PlatMyCardBLL.SingleModel.GetModel(platmsg.MyCardId);
                if (msgothercard == null)
                {
                    return;
                }
                datacontent = platmsg.MsgDetail;
                otheruserid = msgothercard.UserId;
                othername   = msgothercard.Name;
                otherimgurl = msgothercard.ImgUrl;
                dataid      = platmsg.Id;
                dataimgurl  = platmsg.ImgList != null && platmsg.ImgList.Count > 0 ? platmsg.ImgList[0] : "";
                break;
            }


            PlatActivityTrajectory model = new PlatActivityTrajectory();

            model.MyUserId    = mycard.UserId;
            model.MyName      = mycard.Name;
            model.MyImgUrl    = mycard.ImgUrl;
            model.OtherUserId = otheruserid;
            model.OtherImgUrl = otherimgurl;
            model.OtherName   = othername;
            model.ActionType  = actiontype;
            model.Datatype    = datatype;
            model.DataId      = dataid;
            model.DataImgUrl  = dataimgurl;
            model.DataContent = datacontent;
            model.AId         = aid;
            model.AppId       = xcxrelation.AppId;
            model.AddTime     = DateTime.Now;
            model.DataComment = datacomment;
            RemoveCache(myuserid);
            base.Add(model);
        }
Ejemplo n.º 28
0
        /// <summary>
        /// 发帖
        /// </summary>
        /// <param name="jsondata"></param>
        /// <param name="ordertype"></param>
        /// <param name="paytype"></param>
        /// <param name="aid"></param>
        /// <param name="order"></param>
        /// <param name="MyCardId"></param>
        /// <returns></returns>
        public string saveMsg(string jsondata, int ordertype, int paytype, int aid, ref CityMorders order, int userId)
        {
            if (string.IsNullOrEmpty(jsondata))
            {
                return("json参数错误");
            }

            SavePlatMsgModel savePlatMsgModelJson = JsonConvert.DeserializeObject <SavePlatMsgModel>(jsondata);

            if (savePlatMsgModelJson == null)
            {
                return("null参数错误");
            }

            double lng = 0.00;
            double lat = 0.00;

            //校验手机号码
            if (!Regex.IsMatch(savePlatMsgModelJson.Phone, @"\d") || savePlatMsgModelJson.Phone.Length > 11)
            {
                return("联系号码不符合");
            }

            if (string.IsNullOrEmpty(savePlatMsgModelJson.Location))
            {
                return("请填写地址");
            }

            if (string.IsNullOrEmpty(savePlatMsgModelJson.MsgDetail))
            {
                return("发布信息不能为空");
            }

            if (!double.TryParse(savePlatMsgModelJson.Lng, out lng) || !double.TryParse(savePlatMsgModelJson.Lat, out lat))
            {
                return("地址坐标错误");
            }

            if (savePlatMsgModelJson.MsgType <= 0)
            {
                return("请选择信息类别");
            }

            PlatMyCard platMyCard = PlatMyCardBLL.SingleModel.GetModelByUserId(userId, aid);

            if (platMyCard == null)
            {
                return("请先注册");
            }



            PlatMsg platMsg = new PlatMsg();

            platMsg.AddTime   = DateTime.Now;
            platMsg.Aid       = aid;
            platMsg.Lat       = savePlatMsgModelJson.Lat;
            platMsg.Lng       = savePlatMsgModelJson.Lng;
            platMsg.Location  = savePlatMsgModelJson.Location;
            platMsg.MsgDetail = HttpUtility.HtmlEncode(savePlatMsgModelJson.MsgDetail);
            platMsg.MsgTypeId = savePlatMsgModelJson.MsgType;
            platMsg.Phone     = savePlatMsgModelJson.Phone;
            platMsg.MyCardId  = platMyCard.Id;
            platMsg.Imgs      = savePlatMsgModelJson.Imgs;

            PlatMsgConf platMsgConf = PlatMsgConfBLL.SingleModel.GetMsgConf(aid);

            if (platMsgConf == null)
            {
                return("商家配置异常");
            }

            switch (platMsgConf.ReviewSetting)
            {
            case 0:    //不需要审核
                if (savePlatMsgModelJson.IsTop == 0)
                {
                    //不置顶消息
                    platMsg.State      = 1;
                    platMsg.Review     = 0;
                    platMsg.PayState   = 1;
                    platMsg.ReviewTime = DateTime.Now;
                }
                else
                {
                    platMsg.State      = 0; //支付回成功调后再变更1
                    platMsg.PayState   = 0; //支付回成功调后再变更1
                    platMsg.ReviewTime = DateTime.Now;
                    platMsg.Review     = 0;
                }
                break;

            case 1:                 //先审核后发布
                platMsg.State  = 0; //审核通过后变为1
                platMsg.Review = 1; //审核通过后变为2  审核不通过变为-1
                if (savePlatMsgModelJson.IsTop == 0)
                {
                    //不置顶消息
                    platMsg.PayState = 1;
                }
                else
                {
                    platMsg.PayState = 0;    //支付回成功调后再变更为1
                }

                break;

            case 2:    //先发布后审核
                platMsg.ReviewTime = DateTime.Now;
                if (savePlatMsgModelJson.IsTop == 0)
                {
                    //不置顶消息
                    platMsg.State    = 1;
                    platMsg.PayState = 1;
                    platMsg.Review   = 1;  //审核通过后变为2  审核不通过变为-1
                }
                else
                {
                    platMsg.State    = 0; //支付回成功调后再变更为1
                    platMsg.PayState = 0; //支付回成功调后再变更为1
                    platMsg.Review   = 1; //审核通过后变为2  审核不通过变为-1
                }
                break;
            }

            if (savePlatMsgModelJson.IsTop == 0)
            {
                //表示不置顶的消息
                platMsg.TopDay       = 0;
                platMsg.IsTop        = 0;
                platMsg.TopCostPrice = 0;

                int msgId = Convert.ToInt32(base.Add(platMsg));
                if (msgId <= 0)
                {
                    return("发布信息异常");
                }
                else
                {
                    return(string.Empty);
                }
            }
            else
            {
                //表示置顶消息 需要 生成微信订单,然后微信支付,支付成功后回调将状态变为1可用
                if (savePlatMsgModelJson.RuleId <= 0)
                {
                    return("请选择置顶时间");
                }

                PlatMsgRule platMsgRule = PlatMsgRuleBLL.SingleModel.GetMsgRules(aid, savePlatMsgModelJson.RuleId);
                if (platMsgRule == null)
                {
                    return("非法操作(置顶时间有误)");
                }

                platMsg.TopDay       = platMsgRule.ExptimeDay;
                platMsg.TopCostPrice = platMsgRule.Price;
                platMsg.IsTop        = 1;
                int msgId = Convert.ToInt32(base.Add(platMsg));
                if (msgId <= 0)
                {
                    return("发布信息异常");
                }
                else
                {
                    order.Articleid    = platMsgRule.Id;
                    order.CommentId    = msgId;
                    order.MinisnsId    = aid;
                    order.payment_free = platMsg.TopCostPrice;
                    order.ShowNote     = $"平台版小程序分类信息发置顶帖付款{order.payment_free * 0.01}元";
                    return(string.Empty);
                }
            }
        }
Ejemplo n.º 29
0
        public ActionResult GetData()
        {
            Return_Msg returnData = new Return_Msg();
            int        aid        = Context.GetRequestInt("aid", 0);

            if (aid <= 0)
            {
                returnData.Msg = "参数错误";
                return(Json(returnData));
            }
            XcxAppAccountRelation xcxrelation = XcxAppAccountRelationBLL.SingleModel.GetModel(aid);

            if (xcxrelation == null)
            {
                returnData.Msg = "无效模板";
                return(Json(returnData));
            }
            PlatStore store = PlatStoreBLL.SingleModel.GetModelByAId(aid);

            if (store == null)
            {
                returnData.Msg = "无效店铺";
                return(Json(returnData));
            }
            PlatMyCard myCard = PlatMyCardBLL.SingleModel.GetModel(store.MyCardId);

            if (myCard == null)
            {
                returnData.Msg = "无效用户数据";
                return(Json(returnData));
            }
            PlatUserCash userCash = PlatUserCashBLL.SingleModel.GetModelByUserId(store.BindPlatAid, myCard.UserId);

            if (userCash == null)
            {
                return(Redirect("/base/PageError?type=2"));
            }
            PlatDrawConfig platDrawConfig = PlatDrawConfigBLL.SingleModel.GetModelByAId(store.BindPlatAid);

            if (platDrawConfig == null)
            {
                platDrawConfig = new PlatDrawConfig();
            }

            //总访问量
            int sumPV = PlatStatisticalFlowBLL.SingleModel.GetPVCount(aid);
            //店铺概况
            //当天订单
            int newOrderCount = PlatChildGoodsOrderBLL.SingleModel.GetTodayOrderCount(aid);
            //总订单
            int orderCount = PlatChildGoodsOrderBLL.SingleModel.GetOrderSum(aid);
            //会员人数
            int userCount = C_UserInfoBLL.SingleModel.GetCountByAppid(xcxrelation.AppId);
            //领券人数
            int couponCount = CouponLogBLL.SingleModel.GetUserCount(aid);
            //上次访问时间
            string visiteTime = RedisUtil.Get <string>(string.Format(PlatStatisticalFlowBLL._redis_PlatVisiteTimeKey, aid));
            //平台订单数
            int platOrderNum = PlatChildGoodsOrderBLL.SingleModel.GetPlatOrderNum(store.BindPlatAid, store.Id);
            //平台交易总额
            int platSumPrice = PlatChildGoodsOrderBLL.SingleModel.GetPlatOrderSumPrice(store.BindPlatAid, store.Id);
            //已提现金额
            int drawedCashPrice = userCash.UseCashTotal;
            //可提现金额
            int canDrawCashPrice = userCash.UseCash;
            //提现手续费
            int drawCashServer = platDrawConfig.Fee;

            DateTime nowTime = DateTime.Now;
            //访问量(PV)
            //当天,昨天,近七天,近30天,总累计
            int todayPV     = 0;
            int yeastodayPV = PlatStatisticalFlowBLL.SingleModel.GetPVCount(aid, "", nowTime.AddDays(-1).ToString("yyyy-MM-dd"), nowTime.ToString("yyyy-MM-dd"));
            int sevenDayPV  = PlatStatisticalFlowBLL.SingleModel.GetPVCount(aid, "", nowTime.AddDays(-7).ToString("yyyy-MM-dd"), nowTime.ToString("yyyy-MM-dd"));
            int thirthDayPV = PlatStatisticalFlowBLL.SingleModel.GetPVCount(aid, "", nowTime.AddDays(-30).ToString("yyyy-MM-dd"), nowTime.ToString("yyyy-MM-dd"));
            //近30天访问趋势统计
            List <PlatStatisticalFlow> list = PlatStatisticalFlowBLL.SingleModel.GetListByAid(aid, nowTime.AddDays(-30).ToString("yyyy-MM-dd"), nowTime.ToString("yyyy-MM-dd"));
            List <string> labels            = new List <string>();
            List <int>    datas             = new List <int>();

            if (list != null && list.Count > 0)
            {
                foreach (PlatStatisticalFlow item in list)
                {
                    labels.Add(item.RefDate);
                    datas.Add(item.VisitPV);
                }
            }

            returnData.dataObj = new
            {
                sumpv         = sumPV,
                newordercount = newOrderCount,
                usercount     = userCount,
                ordercount    = orderCount,
                couponcount   = couponCount,
                todaypv       = todayPV,
                yeastodaypv   = yeastodayPV,
                sevendaypv    = sevenDayPV,
                thirthdaypv   = thirthDayPV,
                labels        = labels,
                datas         = datas,
                visitetime    = visiteTime,

                platordernum       = platOrderNum,
                platsumprice       = (platSumPrice * 0.01).ToString("0.00"),
                drawedcashprice    = (drawedCashPrice * 0.01).ToString("0.00"),
                candrawcashprice   = (canDrawCashPrice * 0.01).ToString("0.00"),
                isopendistribution = userCash.IsOpenDistribution,
                drawcashserver     = (drawCashServer * 0.01) + "%",
            };

            return(Json(returnData));
        }
Ejemplo n.º 30
0
        /// <summary>
        /// 创建名片
        /// </summary>
        /// <returns></returns>
        public ActionResult AddMyCard()
        {
            returnObj = new Return_Msg_APP();
            string imgUrl      = Context.GetRequest("imgurl", "");
            string companyName = Context.GetRequest("companyname", "");
            int    userId      = Context.GetRequestInt("userid", 0);
            int    jobType     = Context.GetRequestInt("jobtype", 0);
            string lat         = Context.GetRequest("lat", "0");
            string lng         = Context.GetRequest("lng", "0");
            string name        = Context.GetRequest("name", "");
            string address     = Context.GetRequest("address", "");
            string job         = Context.GetRequest("job", "");
            string department  = Context.GetRequest("department", "");
            string desc        = Context.GetRequest("desc", "");
            int    industryIid = Context.GetRequestInt("industryid", 0);
            int    hiddenPhone = Context.GetRequestInt("hiddenphone", 0);
            int    type        = Context.GetRequestInt("type", 0);

            if (userId <= 0)
            {
                returnObj.Msg = "userid不能小于0";
                return(Json(returnObj));
            }
            if (type == 1)
            {
                if (string.IsNullOrEmpty(lat))
                {
                    returnObj.Msg = "lat不能小于0";
                    return(Json(returnObj));
                }
                if (string.IsNullOrEmpty(lng))
                {
                    returnObj.Msg = "lng不能为空";
                    return(Json(returnObj));
                }
                if (string.IsNullOrEmpty(address))
                {
                    returnObj.Msg = "地址不能为空";
                    return(Json(returnObj));
                }
                if (string.IsNullOrEmpty(name))
                {
                    returnObj.Msg = "姓名不能为空";
                    return(Json(returnObj));
                }
                if (industryIid <= 0)
                {
                    returnObj.Msg = "请选择行业";
                    return(Json(returnObj));
                }
            }

            C_UserInfo userinfo = C_UserInfoBLL.SingleModel.GetModel(userId);

            if (userinfo == null)
            {
                returnObj.Msg = "用户已失效";
                return(Json(returnObj));
            }
            XcxAppAccountRelation xcxrelatiion = _xcxAppAccountRelationBLL.GetModelByAppid(userinfo.appId);

            if (xcxrelatiion == null)
            {
                returnObj.Msg = "模板已失效";
                return(Json(returnObj));
            }
            int aid = xcxrelatiion.Id;

            PlatMyCard platMyCardModel = PlatMyCardBLL.SingleModel.GetModelByUserId(userId, aid);

            //地址
            if (!string.IsNullOrEmpty(lng) && lng != "0" && !string.IsNullOrEmpty(lat) && lat != "0")
            {
                AddressApi addressinfo = AddressHelper.GetAddressByApi(lng, lat);
                if (addressinfo != null && addressinfo.result != null && addressinfo.result.address_component != null)
                {
                    string provinceName          = addressinfo.result.address_component.province;
                    string cityName              = addressinfo.result.address_component.city;
                    string countryName           = addressinfo.result.address_component.district;
                    Dictionary <string, int> dic = C_AreaBLL.SingleModel.GetAddressCode(provinceName, cityName, countryName);
                    if (platMyCardModel == null)
                    {
                        platMyCardModel = new PlatMyCard();
                    }
                    platMyCardModel.ProvinceCode = dic["provincename"];
                    platMyCardModel.ProvinceCode = dic["cityname"];
                    platMyCardModel.ProvinceCode = dic["countryName"];
                }
            }
            imgUrl = string.IsNullOrEmpty(imgUrl) ? userinfo.HeadImgUrl : imgUrl;
            //获取服务器商的图片路径
            bool isreload = false;

            imgUrl = WxUploadHelper.GetMyServerImgUrl(imgUrl, ref isreload);

            if (platMyCardModel == null || platMyCardModel.Id <= 0)
            {
                platMyCardModel             = new PlatMyCard();
                platMyCardModel.AddTime     = DateTime.Now;
                platMyCardModel.Address     = address;
                platMyCardModel.AId         = aid;
                platMyCardModel.CompanyName = companyName;
                platMyCardModel.Desc        = desc;
                platMyCardModel.ImgUrl      = imgUrl;
                platMyCardModel.JobType     = jobType;
                platMyCardModel.Lat         = Convert.ToDouble(lat);
                platMyCardModel.Lng         = Convert.ToDouble(lng);
                platMyCardModel.Name        = name;
                platMyCardModel.NickName    = userinfo.NickName;
                platMyCardModel.Phone       = userinfo.TelePhone;
                platMyCardModel.UpdateTime  = DateTime.Now;
                platMyCardModel.UserId      = userId;
                platMyCardModel.Job         = job;
                platMyCardModel.Department  = department;
                platMyCardModel.IndustryId  = industryIid;
                platMyCardModel.HiddenPhone = hiddenPhone;
                platMyCardModel.AppId       = userinfo.appId;
                platMyCardModel.Id          = Convert.ToInt32(PlatMyCardBLL.SingleModel.Add(platMyCardModel));
                returnObj.isok = platMyCardModel.Id > 0;
            }
            else
            {
                platMyCardModel.AddTime     = DateTime.Now;
                platMyCardModel.Address     = address;
                platMyCardModel.AId         = aid;
                platMyCardModel.CompanyName = companyName;
                platMyCardModel.Desc        = "";
                platMyCardModel.ImgUrl      = imgUrl;
                platMyCardModel.JobType     = jobType;
                platMyCardModel.Lat         = Convert.ToDouble(lat);
                platMyCardModel.Lng         = Convert.ToDouble(lng);
                platMyCardModel.Name        = name;
                platMyCardModel.NickName    = userinfo.NickName;
                platMyCardModel.Phone       = userinfo.TelePhone;
                platMyCardModel.UpdateTime  = DateTime.Now;
                platMyCardModel.UserId      = userId;
                platMyCardModel.IndustryId  = industryIid;
                platMyCardModel.HiddenPhone = hiddenPhone;
                if (!string.IsNullOrEmpty(job))
                {
                    platMyCardModel.Job = job;
                }
                if (!string.IsNullOrEmpty(department))
                {
                    platMyCardModel.Department = department;
                }
                if (!string.IsNullOrEmpty(companyName))
                {
                    platMyCardModel.CompanyName = companyName;
                }
                if (!string.IsNullOrEmpty(desc))
                {
                    platMyCardModel.Desc = desc;
                }
                returnObj.isok = PlatMyCardBLL.SingleModel.Update(platMyCardModel);
            }
            returnObj.Msg     = returnObj.isok ? "保存成功" : "保存失败";
            returnObj.dataObj = platMyCardModel;
            return(Json(returnObj));
        }