Exemple #1
0
        /// <summary>
        /// 团购订单:15天后订单商品自动评论
        /// </summary>
        public void StartBargainGoodsCommentServer(int timelength)
        {
            List <BargainUser> bargainuserlist = BargainUserBLL.SingleModel.GetSuccessDataList(0, timelength);

            if (bargainuserlist != null && bargainuserlist.Count > 0)
            {
                string            userids      = string.Join(",", bargainuserlist.Select(s => s.UserId).Distinct());
                List <C_UserInfo> userinfolist = C_UserInfoBLL.SingleModel.GetListByIds(userids);
                userinfolist = userinfolist == null ? new List <C_UserInfo>() : userinfolist;

                string aids = string.Join(",", bargainuserlist.Select(s => s.aid).Distinct());
                List <XcxAppAccountRelation> xcxrelationlist = XcxAppAccountRelationBLL.SingleModel.GetListByIds(aids);
                xcxrelationlist = xcxrelationlist == null ? new List <XcxAppAccountRelation>() : xcxrelationlist;

                foreach (BargainUser itembargain in bargainuserlist)
                {
                    C_UserInfo            userinfo    = userinfolist?.FirstOrDefault(f => f.Id == itembargain.UserId);
                    XcxAppAccountRelation xcxrelation = xcxrelationlist?.FirstOrDefault(f => f.Id == itembargain.aid);
                    string imgurl = itembargain.ImgUrl;

                    itembargain.IsCommentting = true;
                    BargainUserBLL.SingleModel.Update(itembargain, "IsCommentting");
                    SingleModel.AddComment(xcxrelation.Id, userinfo, (int)EntGoodsType.价产品, itembargain.BId, itembargain.BName, itembargain.CurrentPrice, imgurl, itembargain.Id, "");
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// 团购订单:15天后订单商品自动评论
        /// </summary>
        public void StartGroupGoodsCommentServer(int timelength)
        {
            List <GroupUser> groupuserlist = GroupUserBLL.SingleModel.GetSuccessDataList(0, timelength);

            if (groupuserlist != null && groupuserlist.Count > 0)
            {
                string            userids      = string.Join(",", groupuserlist.Select(s => s.ObtainUserId).Distinct());
                List <C_UserInfo> userinfolist = C_UserInfoBLL.SingleModel.GetListByIds(userids);
                userinfolist = userinfolist == null ? new List <C_UserInfo>() : userinfolist;

                string aids = string.Join(",", groupuserlist.Select(s => s.AId).Distinct());
                List <XcxAppAccountRelation> xcxrelationlist = XcxAppAccountRelationBLL.SingleModel.GetListByIds(aids);
                xcxrelationlist = xcxrelationlist == null ? new List <XcxAppAccountRelation>() : xcxrelationlist;

                foreach (GroupUser itemgroup in groupuserlist)
                {
                    C_UserInfo            userinfo    = userinfolist?.FirstOrDefault(f => f.Id == itemgroup.ObtainUserId);
                    XcxAppAccountRelation xcxrelation = xcxrelationlist?.FirstOrDefault(f => f.Id == itemgroup.AId);
                    string imgurl = itemgroup.GroupImgUrl;

                    itemgroup.IsCommentting = true;
                    GroupUserBLL.SingleModel.Update(itemgroup, "IsCommentting");
                    SingleModel.AddComment(xcxrelation.Id, userinfo, (int)EntGoodsType.团购商品, itemgroup.GroupId, itemgroup.GroupName, itemgroup.BuyPrice, imgurl, itemgroup.Id, "");
                }
            }
        }
Exemple #3
0
        /// <summary>
        /// 订单取消发送订单取消通知模板消息
        /// </summary>
        /// <param name="pinOrder"></param>
        public void SendTemplateMsg_PayCancel(PinGoodsOrder pinOrder)
        {
            PinStore store = PinStoreBLL.SingleModel.GetModelByAid_Id(pinOrder.aid, pinOrder.storeId);

            if (store == null && pinOrder.orderType == 0)
            {
                log4net.LogHelper.WriteError(GetType(), new Exception($"拼享惠发送订单取消模板消息失败,找不到店铺信息 aid:{pinOrder.aid}, storeid:{pinOrder.storeId}"));
                return;
            }

            //如果未支付,获取预支付码的formid是无效的,要取消
            if (pinOrder.payState == (int)PayState.未付款)
            {
                C_UserInfo userInfo = C_UserInfoBLL.SingleModel.GetModel(pinOrder.userId);
                if (userInfo == null)
                {
                    log4net.LogHelper.WriteError(GetType(), new Exception($"拼享惠发送订单取消模板消息失败,找不到用户信息 userid:{pinOrder.userId}"));
                    return;
                }
                TemplateMsg_UserParam userParam = TemplateMsg_UserParamBLL.SingleModel.GetModel($" Form_Id is not null and appId = '{userInfo.appId}'  and  Open_Id = '{userInfo.OpenId}' and State = 1 and LoseDateTime > now() and orderId={pinOrder.id} ");
                if (userParam != null)
                {
                    userParam.State = -1;
                    TemplateMsg_UserParamBLL.SingleModel.Update(userParam, "state");
                }
            }
            //发给用户通知
            object orderData = TemplateMsg_Miniapp.PinGetTemplateMessageData(SendTemplateMessageTypeEnum.拼享惠订单取消通知, order: pinOrder, store: store);

            TemplateMsg_Miniapp.SendTemplateMessage(pinOrder.userId, SendTemplateMessageTypeEnum.拼享惠订单取消通知, TmpType.拼享惠, orderData, $"pages/shopping/orderInfo/orderInfo?orderid={pinOrder.id}&storeid={pinOrder.storeId}");
        }
Exemple #4
0
        /// <summary>
        /// 专业版普通订单:15天后订单商品自动评论
        /// </summary>
        public void StartEntGoodsCommentServer(int timelength)
        {
            List <EntGoodsCart> entgoodscartlist = EntGoodsCartBLL.SingleModel.GetSuccessDataList(0, timelength);

            if (entgoodscartlist != null && entgoodscartlist.Count > 0)
            {
                string            userids      = string.Join(",", entgoodscartlist.Select(s => s.UserId).Distinct());
                List <C_UserInfo> userinfolist = C_UserInfoBLL.SingleModel.GetListByIds(userids);
                userinfolist = userinfolist == null ? new List <C_UserInfo>() : userinfolist;

                string aids = string.Join(",", entgoodscartlist.Select(s => s.aId).Distinct());
                List <XcxAppAccountRelation> xcxrelationlist = XcxAppAccountRelationBLL.SingleModel.GetListByIds(aids);
                xcxrelationlist = xcxrelationlist == null ? new List <XcxAppAccountRelation>() : xcxrelationlist;

                string          goodsids     = string.Join(",", entgoodscartlist.Select(s => s.FoodGoodsId).Distinct());
                List <EntGoods> entgoodslist = EntGoodsBLL.SingleModel.GetListByIds(goodsids);
                entgoodslist = entgoodslist == null ? new List <EntGoods>() : entgoodslist;

                foreach (EntGoodsCart itemcart in entgoodscartlist)
                {
                    C_UserInfo            userinfo    = userinfolist?.FirstOrDefault(f => f.Id == itemcart.UserId);
                    XcxAppAccountRelation xcxrelation = xcxrelationlist?.FirstOrDefault(f => f.Id == itemcart.aId);
                    EntGoods entgood = entgoodslist?.FirstOrDefault(f => f.id == itemcart.FoodGoodsId);
                    string   imgurl  = string.IsNullOrEmpty(itemcart.SpecImg) ? entgood.img : itemcart.SpecImg;

                    itemcart.IsCommentting = true;
                    EntGoodsCartBLL.SingleModel.Update(itemcart, "IsCommentting");
                    SingleModel.AddComment(xcxrelation.Id, userinfo, entgood.goodtype, itemcart.FoodGoodsId, itemcart.GoodName, itemcart.Price, imgurl, itemcart.GoodsOrderId, itemcart.SpecInfo);
                }
            }
        }
Exemple #5
0
        public ActionResult MyIncomeList(string phone = "", string testpxhappid = "", int type = 0, int extractType = 0, string utoken = "")
        {
            if (string.IsNullOrEmpty(testpxhappid))
            {
                testpxhappid = _pxhAppId;
            }
            C_UserInfo userinfo = C_UserInfoBLL.SingleModel.GetModelByTelephone_appid(phone, testpxhappid);

            if (userinfo == null)
            {
                return(Content("无效用户"));
            }

            XcxAppAccountRelation xcxrelation = XcxAppAccountRelationBLL.SingleModel.GetModelByAppid(userinfo.appId);

            if (xcxrelation == null)
            {
                return(Content("无效模板"));
            }

            if (string.IsNullOrEmpty(utoken))
            {
                return(Content("utoken无效,请重新登录"));
            }
            //获取登陆秘钥

            ViewBag.utoken = utoken;


            PinAgent agent = PinAgentBLL.SingleModel.GetModelByUserId(userinfo.Id);

            agent.userInfo = userinfo;
            return(View(agent));
        }
Exemple #6
0
        public List <CityUserMsg> getListByUserId(int aid, int userId, out int totalCount, int pageSize = 10, int pageIndex = 1, string appId = "")
        {
            string strWhere = $"aid={aid} and toUserId={userId}";

            base.ExecuteNonQuery($"update CityUserMsg set state=1 where aid={aid} and toUserId={userId}");//将该用户未读消息全部标记为已读

            totalCount = base.GetCount(strWhere);
            OpenAuthorizerConfig openAuthorizerConfig = OpenAuthorizerConfigBLL.SingleModel.GetModelByAppids(appId);

            List <CityUserMsg> list = base.GetList(strWhere, pageSize, pageIndex, "*", "addTime desc");

            string            userIds      = string.Join(",", list?.Select(s => s.fromUserId).Distinct());
            List <C_UserInfo> userInfoList = C_UserInfoBLL.SingleModel.GetListByIds(userIds);

            list.ForEach(x =>
            {
                //获取用户头像 昵称
                C_UserInfo c_UserInfo = userInfoList?.FirstOrDefault(f => f.Id == x.fromUserId);
                if (c_UserInfo != null)
                {
                    x.fromUserName = c_UserInfo.NickName;
                    x.fromUseImg   = c_UserInfo.HeadImgUrl;
                }
                else
                {
                    x.fromUserName = "******";
                    x.fromUseImg   = openAuthorizerConfig.head_img;
                }
                x.addTimeStr = CommondHelper.GetTimeSpan(DateTime.Now - x.addTime);
            });

            return(list);
        }
Exemple #7
0
        /// <summary>
        /// 提现申请
        /// </summary>
        /// <returns></returns>
        public ActionResult ApplyList(int aid = 0, int pageIndex = 1, int pageSize = 15)
        {
            if (aid <= 0)
            {
                return(Content("参数错误"));
            }

            ViewModel <DrawCashApply> vm = new ViewModel <DrawCashApply>();
            int recordCount = 0;

            vm.DataList = DrawCashApplyBLL.SingleModel.GetListByAid(aid, pageIndex, pageSize, out recordCount);
            if (vm.DataList != null && vm.DataList.Count > 0)
            {
                string            userIds      = string.Join(",", vm.DataList.Select(s => s.userId).Distinct());
                List <C_UserInfo> userInfoList = C_UserInfoBLL.SingleModel.GetListByIds(userIds);
                vm.DataList.ForEach(apply =>
                {
                    apply.userId        = apply.appId == WebSiteConfig.GongZhongAppId ? apply.OrderId : apply.userId;
                    apply.pinStore      = PinStoreBLL.SingleModel.GetModelByAid_UserId(apply.Aid, apply.userId);
                    C_UserInfo userInfo = userInfoList?.FirstOrDefault(f => f.Id == apply.userId);

                    apply.nickName = userInfo != null ? $"{userInfo.NickName} {userInfo.TelePhone}" : "用户信息错误";
                });
            }
            vm.PageSize   = pageSize;
            vm.PageIndex  = pageIndex;
            vm.TotalCount = recordCount;
            vm.aId        = aid;
            return(View(vm));
        }
Exemple #8
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> GetDistributionDrawCashApplys(out int TotalCount, int appId, int state = -2, string startTime = "", string endTime = "", string telephone = "", int pageSize = 10, int pageIndex = 1)
        {
            #region 查找出当前小程序所属分销员的userId 然后再去查询提现申请
            string salesManWhere = $"appId={appId}";
            List <MySqlParameter> mysqlParams = new List <MySqlParameter>();
            if (!string.IsNullOrEmpty(telephone))
            {
                salesManWhere += $" and TelePhone like @telephone";
                mysqlParams.Add(new MySqlParameter("@telephone", "%" + telephone + "%"));
            }

            List <SalesMan> listSalesMan = SalesManBLL.SingleModel.GetListByParam(salesManWhere, mysqlParams.ToArray());

            List <int> listSalesManUserId = new List <int>();
            foreach (SalesMan item in listSalesMan)
            {
                listSalesManUserId.Add(item.UserId);
            }
            #endregion
            List <DrawCashApply> listDrawCashApply = new List <DrawCashApply>();
            string userIds = string.Join(",", listSalesManUserId);
            TotalCount = 0;
            if (listSalesManUserId != null && listSalesManUserId.Count > 0)
            {
                string strWhere = $"aid={appId} and applyType=0 and userId in({userIds}) ";
                if (!string.IsNullOrEmpty(startTime) && !string.IsNullOrEmpty(endTime))
                {
                    strWhere += $" and AddTime>='{startTime}' and AddTime<='{endTime}'";
                }

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



                string salesManRecordIds = string.Empty;
                listDrawCashApply = base.GetList(strWhere, pageSize, pageIndex, "*", "addTime desc");
                listDrawCashApply.ForEach(x =>
                {
                    C_UserInfo c_UserInfo = C_UserInfoBLL.SingleModel.GetModel(x.userId);
                    if (c_UserInfo != null)
                    {
                        x.nickName = c_UserInfo.NickName;
                    }

                    SalesMan salesMan = listSalesMan.Find(y => y.UserId == x.userId);
                    if (salesMan != null)
                    {
                        x.phone = salesMan.TelePhone;
                    }
                });



                TotalCount = base.GetList(strWhere) == null ? 0 : base.GetList(strWhere).Count;
            }
            return(listDrawCashApply);
        }
Exemple #9
0
        // GET api/<controller>/5
        /// <summary>
        /// 根据帐号获取用户信息
        /// </summary>
        /// <param name="account">帐号</param>
        /// <returns></returns>
        public C_UserInfo Get(string id)
        {
            C_UserInfo userinfo = null;

            using (var db = new fz_basicEntities())
            {
                sy_user m   = db.sy_user.Where(w => w.Account == id.Trim()).FirstOrDefault();
                int     tid = db.sy_teacher.Where(w => w.UserId == m.Id).Select(s => s.Id).FirstOrDefault();
                if (m != null)
                {
                    userinfo           = new C_UserInfo();
                    userinfo.Id        = m.Id;
                    userinfo.Type      = m.Type;
                    userinfo.Account   = m.Account;
                    userinfo.Name      = m.Name;
                    userinfo.Subject   = 3;
                    userinfo.userClass = db.sy_class.Where(w => db.sy_teacher_and_class_and_subject.Any(a => a.TeacherId == tid && a.ClassId == w.Id)).Select(s => new C_UserClass
                    {
                        ClassId   = s.Id,
                        ClassName = s.Name,
                        GradeId   = s.sy_grade.Id,
                        GradeName = s.sy_grade.Name
                    }).ToArray();
                }
            }

            return(userinfo);
        }
Exemple #10
0
        public JsonResult MasterLogin(string username, string password, string wxToken = null)
        {
            bool wxLogin  = !string.IsNullOrWhiteSpace(wxToken);
            bool hasInput = !string.IsNullOrWhiteSpace(username) && !string.IsNullOrWhiteSpace(password);

            if (!wxLogin && !hasInput)
            {
                return(ApiModel(message: "用户名和密码不能为空"));
            }

            Account    account  = null;
            C_UserInfo userInfo = null;

            if (wxLogin)
            {
                //微信授权登陆
                wxToken = HttpUtility.UrlDecode(wxToken);
                int userId;
                int.TryParse(DESEncryptTools.DESDecrypt(wxToken), out userId);
                userInfo = C_UserInfoBLL.SingleModel.GetModel(userId);
                account  = AccountBLL.SingleModel.GetAccountByUnionId(userInfo.UnionId);
            }

            string loginToken = string.Empty;
            string authToken  = string.Empty;

            if (account != null)
            {
                //登陆已绑定微信的账号
                authToken  = DESEncryptTools.DESEncrypt(account.Id.ToString());
                loginToken = Utils.BuildCookie(account.Id, account.UpdateTime);
            }
            else if (hasInput)
            {
                bool success = false;
                //用账号密码登录账号
                account = AccountBLL.SingleModel.LoginUserWhole(username, password);
                if (account == null)
                {
                    return(ApiModel(message: "用户名或密码错误"));
                }
                if (userInfo != null)
                {
                    account.UnionId = userInfo.UnionId;
                    success         = AccountBLL.SingleModel.Update(account, "UnionId");
                }
                if (userInfo != null && account != null && !success)
                {
                    return(ApiModel(message: "账号绑定微信失败"));
                }
                authToken  = DESEncryptTools.DESEncrypt(account.Id.ToString());
                loginToken = Utils.BuildCookie(account.Id, account.UpdateTime);
            }
            else
            {
                return(ApiModel(isok: true, message: "微信账号未绑定账号,请输入账号密码", data: "NewUser"));
            }

            return(ApiModel(isok: true, message: "登陆成功", data: new { loginToken, authToken }));
        }
Exemple #11
0
        /// <summary>
        /// 提现申请界面
        /// </summary>
        /// <param name="aId"></param>
        /// <param name="storeId"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        // GET: PinAdmin/Cash
        public ActionResult Index(int aId = 0, int storeId = 0)
        {
            if (aId <= 0 || storeId <= 0)
            {
                return(Content("参数错误"));
            }

            PinPlatform platform = PinPlatformBLL.SingleModel.GetModelByAid(aId);

            if (platform == null)
            {
                return(Content("平台信息错误"));
            }
            PinStore   store    = (PinStore)Request.RequestContext.RouteData.Values["pinStore"];
            C_UserInfo userInfo = C_UserInfoBLL.SingleModel.GetModel(store.userId);

            if (userInfo == null)
            {
                return(Content($"用户信息错误"));
            }

            PinAgent agent = PinAgentBLL.SingleModel.GetModelByUserId(userInfo.Id);

            int sumCash = DrawCashApplyBLL.SingleModel.GetSumCash(aId, store.userId);

            ViewBag.DrawCashSum  = (sumCash * 0.01).ToString("0.00");
            ViewData["platform"] = platform;
            ViewData["userInfo"] = userInfo;
            ViewData["agent"]    = agent;
            return(View(store));
        }
Exemple #12
0
        /// <summary>
        /// 获取当前可以参加的团
        /// </summary>
        /// <param name="groupid">拼团商品ID</param>
        /// <param name="length">获取数据数量</param>
        /// <returns></returns>
        private List <GroupSponsor> GetHaveSuccessGroup(int groupid, int length)
        {
            List <GroupSponsor> gsList = GroupSponsorBLL.SingleModel.GetListJoiningGroup(groupid, length);

            if (gsList.Count > 0)
            {
                string            userIds      = string.Join(",", gsList.Select(s => s.SponsorUserId).Distinct());
                List <C_UserInfo> userInfoList = C_UserInfoBLL.SingleModel.GetListByIds(userIds);
                foreach (GroupSponsor gsInfo in gsList)
                {
                    //获取头像和昵称
                    C_UserInfo user = userInfoList?.FirstOrDefault(f => f.Id == gsInfo.SponsorUserId);
                    if (user != null)
                    {
                        gsInfo.UserName = user.NickName;
                        gsInfo.UserLogo = "//j.vzan.cc/content/city/images/voucher/10.jpg";
                        if (!string.IsNullOrEmpty(user.HeadImgUrl))
                        {
                            gsInfo.UserLogo = user.HeadImgUrl;
                        }
                    }

                    //开始以及结束时间
                    gsInfo.ShowStartTime = gsInfo.StartDate.ToString("yyyy/MM/dd HH:mm:ss");
                    gsInfo.ShowEndTime   = gsInfo.EndDate.ToString("yyyy/MM/dd HH:mm:ss");
                }
            }

            return(gsList);
        }
Exemple #13
0
        /// <summary>
        /// 提交验证短信验证码
        /// </summary>
        /// <param name="utoken"></param>
        /// <param name="postData">
        /// {
        ///     tel:"",
        ///     code:"",
        ///     appid:""
        /// }
        /// </param>
        /// <returns></returns>
        public ReturnMsg ValidateSMS(PinStore store, string code = "")
        {
            C_UserInfo userInfo = C_UserInfoBLL.SingleModel.GetModel(store.userId);

            if (userInfo == null)
            {
                result.msg = "用户信息错误!";
                return(result);
            }
            XcxAppAccountRelation xcx = XcxAppAccountRelationBLL.SingleModel.GetModel(store.aId);

            if (xcx == null)
            {
                result.msg = "小程序信息错误!";
                return(result);
            }
            if (string.IsNullOrEmpty(code))
            {
                result.msg = "验证码不能为空!";
                return(result);
            }

            string serverAuthCode = RedisUtil.Get <string>(userInfo.TelePhone);

            if (serverAuthCode != code)
            {
                result.msg = "验证码错误!";
                return(result);
            }
            RedisUtil.Remove(userInfo.TelePhone);
            result.code = 1;
            result.msg  = "验证成功";
            return(result);
        }
Exemple #14
0
        public bool AddByFlashItem(FlashDealItem flashItem, C_UserInfo user, TmpType pageType = TmpType.小程序电商模板)
        {
            FlashDeal flashDeal = FlashDealBLL.SingleModel.GetModel(flashItem.DealId);

            object sendContent = new
            {
                keyword1 = new { value = "限时秒杀开始啦!", color = "#000000" },               //交易类型
                keyword2 = new { value = flashDeal.Title, color = "#000000" },          //活动信息
                keyword3 = new { value = flashItem.Title, color = "#000000" },          //商品信息
                keyword4 = new { value = flashDeal.End.ToString(), color = "#000000" }, //到期日
            };

            SubscribeMessage newMsg = new SubscribeMessage
            {
                State       = (int)SubscribeMsgState.等待发送,
                Template    = (int)SendTemplateMessageTypeEnum.秒杀开始通知,
                ContentType = (int)SubscribeMsgType.小程序模板消息,
                UserId      = user.Id,
                SourceId    = flashDeal.Id,
                OpenId      = user.OpenId,
                PageType    = (int)pageType,
                SendTime    = flashDeal.Begin,
                SendContent = JsonConvert.SerializeObject(sendContent)
            };

            int newId = 0;

            return(int.TryParse(Add(newMsg).ToString(), out newId) && newId > 0);
        }
        public ActionResult GetUserPublicData(string appid, string openid, int pageindex = 1, int pagesize = 10)
        {
            if (string.IsNullOrEmpty(appid))
            {
                return(Json(new { isok = -1, msg = "appid不能为空", data = "" }, JsonRequestBehavior.AllowGet));
            }
            if (string.IsNullOrEmpty(openid))
            {
                return(Json(new { isok = -1, msg = "openid不能为空", data = "" }, JsonRequestBehavior.AllowGet));
            }
            XcxAppAccountRelation umodel = _xcxAppAccountRelationBLL.GetModelByAppid(appid);

            if (umodel == null)
            {
                return(Json(new { isok = -1, msg = "请先授权", data = "" }, JsonRequestBehavior.AllowGet));
            }
            C_UserInfo userinfo = C_UserInfoBLL.SingleModel.GetModelFromCache(openid);

            if (userinfo == null)
            {
                return(Json(new { isok = -1, msg = "请先登陆", data = "" }, JsonRequestBehavior.AllowGet));
            }

            List <SinglePage> data = SinglePageBLL.SingleModel.GetListByUserIdandRid(userinfo.Id, umodel.Id, pageindex, pagesize);

            if (data == null)
            {
                return(Json(new { isok = -1, msg = "没有数据", data = "" }, JsonRequestBehavior.AllowGet));
            }

            return(Json(new { isok = 1, msg = "成功", data = data }, JsonRequestBehavior.AllowGet));
        }
Exemple #16
0
        public void HaveSixin(int tuserId, int fuserId, bool havedata = false)
        {
            C_UserInfo userinfo = C_UserInfoBLL.SingleModel.GetModel(tuserId);

            if (userinfo == null)
            {
                return;
            }

            XcxAppAccountRelation xcxrelation = XcxAppAccountRelationBLL.SingleModel.GetModelByAppid(userinfo.appId);

            if (xcxrelation == null)
            {
                return;
            }

            //int tmptype = XcxAppAccountRelationBLL.SingleModel.GetXcxTemplateType(xcxrelation.Id);

            switch (xcxrelation.Type)
            {
            case (int)TmpType.小未平台:
                PlatMyCard card = new PlatMyCardBLL().GetModelByUserId(tuserId);
                if (card == null)
                {
                    return;
                }
                RefleshCach(card.Id, (int)PointsActionType.私信, true);
                break;

            case (int)TmpType.企业智推版:
                RedisUtil.Set <bool>(string.Format(_redis_havenewdatakey, tuserId, fuserId), true);
                break;
            }
        }
Exemple #17
0
        public int AddComment(int aid, C_UserInfo userinfo, int goodtype, int goodsid, string goodname, int price, string imgurl, int orderid, string specinfo, bool isdefalut = true, int haveImg = 0)
        {
            GoodsComment commentmodel = new GoodsComment();

            commentmodel.AddTime            = DateTime.Now;
            commentmodel.AId                = aid;
            commentmodel.Anonymous          = true;
            commentmodel.Comment            = "";
            commentmodel.Hidden             = false;
            commentmodel.NickName           = userinfo.NickName;
            commentmodel.UserId             = userinfo.Id;
            commentmodel.Praise             = 2;
            commentmodel.LogisticsScore     = 5;
            commentmodel.ServiceScore       = 5;
            commentmodel.DescriptiveScore   = 5;
            commentmodel.State              = 1;
            commentmodel.Type               = goodtype;
            commentmodel.Points             = 1;
            commentmodel.UpdateTime         = DateTime.Now;
            commentmodel.GoodsId            = goodsid;
            commentmodel.GoodsName          = goodname;
            commentmodel.GoodsPrice         = price;
            commentmodel.GoodsImg           = imgurl;
            commentmodel.OrderId            = orderid;
            commentmodel.GoodsSpecification = specinfo;
            commentmodel.HaveImg            = haveImg;
            commentmodel.IsDefault          = isdefalut;
            commentmodel.Id = Convert.ToInt32(SingleModel.Add(commentmodel));

            return(commentmodel.Id);
        }
Exemple #18
0
        public ActionResult SetAgent(int aid = 0, int userId = 0, int state = -1)
        {
            int agentMoney = Utility.IO.Context.GetRequestInt("agentMoney", 0);//代理费用

            if (aid <= 0 || userId <= 0)
            {
                result.code = 0;
                result.msg  = "参数错误";
                return(Json(result));
            }

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

            if (userInfo == null)
            {
                result.code = 0;
                result.msg  = "用户不存在";
                return(Json(result));
            }

            string msg = "";

            result.code = PinAgentBLL.SingleModel.SetAgent(aid, userInfo.Id, state, out msg, agentMoney);
            result.msg  = msg;
            return(Json(result));
        }
Exemple #19
0
        /// <summary>
        /// 平台上获取订单信息列表
        /// </summary>
        /// <returns></returns>
        public ActionResult GetPlatOrderList()
        {
            returnObj = new Return_Msg_APP();
            int userId    = Context.GetRequestInt("userid", 0);
            int state     = Context.GetRequestInt("state", 0);
            int pageIndex = Context.GetRequestInt("pageindex", 1);
            int pageSize  = Context.GetRequestInt("pagesize", 10);

            if (userId <= 0)
            {
                returnObj.Msg = "用户ID不能为0";
                return(Json(returnObj));
            }
            C_UserInfo userInfo = C_UserInfoBLL.SingleModel.GetModel(userId);

            if (userInfo == null)
            {
                returnObj.Msg = "找不到用户";
                return(Json(returnObj));
            }

            XcxAppAccountRelation xcxrelation = _xcxAppAccountRelationBLL.GetModelByAppid(userInfo.appId);

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

            string           userIds   = userId.ToString();
            List <PlatStore> storeList = PlatStoreBLL.SingleModel.GetXcxRelationAppids(xcxrelation.Id);

            if (storeList != null && storeList.Count > 0)
            {
                string            appids       = "'" + string.Join("','", storeList.Select(s => s.AppId)) + "'";
                List <C_UserInfo> userInfoList = C_UserInfoBLL.SingleModel.GetListByAppIds(userInfo.TelePhone, appids);
                if (userInfoList != null && userInfoList.Count > 0)
                {
                    userIds += "," + string.Join(",", userInfoList.Select(s => s.Id));
                }
            }

            int count = 0;
            List <PlatChildGoodsOrder> list = PlatChildGoodsOrderBLL.SingleModel.GetList_Api(state, 0, 0, pageSize, pageIndex, ref count, 0, 0, 0, userIds);

            if (count > 0)
            {
                string           storeIds  = string.Join(",", list.Select(s => s.StoreId).Distinct());
                List <PlatStore> allStores = PlatStoreBLL.SingleModel.GetListByIds(storeIds);
                foreach (PlatChildGoodsOrder item in list)
                {
                    PlatStore storeModel = allStores?.FirstOrDefault(f => f.Id == item.StoreId);
                    item.StoreName = storeModel?.Name;
                }
            }

            returnObj.isok    = true;
            returnObj.dataObj = new { count = count, list = list };
            return(Json(returnObj));
        }
Exemple #20
0
        public ActionResult SearchUserInfo(int aid = 0, string nickName = "", int storeId = 0)
        {
            if (aid <= 0 || string.IsNullOrEmpty(nickName) || storeId <= 0)
            {
                result.code = 0;
                result.msg  = "参数错误";
                return(Json(result));
            }
            XcxAppAccountRelation xcxRelation = XcxAppAccountRelationBLL.SingleModel.GetModel(aid);

            if (xcxRelation == null)
            {
                result.code = 0;
                result.msg  = "小程序不存在";
                return(Json(result));
            }
            PinStore store = PinStoreBLL.SingleModel.GetModelByAid_Id(aid, storeId);

            if (store == null)
            {
                result.code = 0;
                result.msg  = "门店不存在";
                return(Json(result));
            }
            C_UserInfo userInfo = C_UserInfoBLL.SingleModel.GetModelByNickName(xcxRelation.AppId, nickName);

            result.code = 1;
            result.obj  = userInfo;
            return(Json(result));
        }
Exemple #21
0
        public ActionResult ApplyDrawCase(string orderIds = "", string openId = "")
        {
            Return_Msg returnData = new Return_Msg();
            C_UserInfo userInfo   = C_UserInfoBLL.SingleModel.GetModelByAppId_OpenId(_appid, openId);

            if (userInfo == null)
            {
                returnData.Msg = "无效用户";
                return(Json(returnData));
            }
            List <PinGoodsOrder> orderList = _pinGoodsOrderBLL.GetListByIds(orderIds);

            if (orderList != null && orderList.Count > 0)
            {
                foreach (PinGoodsOrder item in orderList)
                {
                    returnData.Msg = DrawCashApplyBLL.SingleModel.PxhUserApplyDrawCash(item, userInfo.Id, _appid);
                    if (returnData.Msg.Length > 0)
                    {
                        return(Json(returnData));
                    }
                }
            }

            returnData.isok = true;
            returnData.Msg  = "申请成功";
            return(Json(returnData));
        }
Exemple #22
0
        public ActionResult GetAgentList(int aid = 0, int pageIndex = 1, int pageSize = 10, int state = -999, string phone = "", string nickName = "", string fnickName = "", string fphone = "")
        {
            if (aid <= 0 || pageIndex <= 0 || pageSize <= 0)
            {
                result.code = 0;
                result.msg  = "参数错误";
                return(Json(result));
            }
            XcxAppAccountRelation xcxAppAccountRelation = XcxAppAccountRelationBLL.SingleModel.GetModel(aid);

            if (xcxAppAccountRelation == null)
            {
                result.code = 0;
                result.msg  = "小程序不存在";
                return(Json(result));
            }
            int recordCount = 0;


            List <PinStore> storeList = new List <PinStore>();

            List <PinAgent> agentList = PinAgentBLL.SingleModel.GetListByAid_State(xcxAppAccountRelation.AppId, aid, pageSize, pageIndex, out recordCount, phone: phone, nickName: nickName, fnickName: fnickName, fphone: fphone, state: -999);

            if (agentList != null && agentList.Count > 0)
            {
                foreach (var agent in agentList)
                {
                    PinStore store = PinStoreBLL.SingleModel.GetModelByAid_UserId(agent.aId, agent.userId);
                    if (store != null && store.state != -1)
                    {
                        store.goodsCount = PinGoodsBLL.SingleModel.GetCountByStoreId(store.id);
                        store.agentInfo  = agent;
                        store.userId     = agent.userId;
                    }
                    else
                    {
                        store = new PinStore()
                        {
                            storeName = "未开通店铺", userId = agent.userId
                        };
                        store.agentInfo = agent;
                    }
                    store.agentFee = PinAgentBLL.SingleModel.GetAgentFee(store.agentInfo.id);
                    C_UserInfo userInfo = C_UserInfoBLL.SingleModel.GetModel(agent.userId);
                    store.nickName = userInfo != null ? userInfo.NickName : string.Empty;
                    if (agent.fuserId > 0)
                    {
                        store.fuserInfo = C_UserInfoBLL.SingleModel.GetModel(agent.fuserId);
                    }
                    storeList.Add(store);
                }
            }


            result.code = 1;
            result.obj  = new { list = storeList, recordCount };
            return(Json(result));
        }
Exemple #23
0
        /// <summary>
        /// 获取订单信息列表
        /// </summary>
        /// <returns></returns>
        public ActionResult GetOrderList()
        {
            returnObj = new Return_Msg_APP();
            int userId    = Context.GetRequestInt("userid", 0);
            int state     = Context.GetRequestInt("state", 0);
            int pageIndex = Context.GetRequestInt("pageindex", 1);
            int pageSize  = Context.GetRequestInt("pagesize", 10);

            if (userId <= 0)
            {
                returnObj.Msg = "用户ID不能为0";
                return(Json(returnObj));
            }
            C_UserInfo userInfo = C_UserInfoBLL.SingleModel.GetModel(userId);

            if (userInfo == null)
            {
                returnObj.Msg = "找不到用户";
                return(Json(returnObj));
            }

            XcxAppAccountRelation xcxrelation = _xcxAppAccountRelationBLL.GetModelByAppid(userInfo.appId);

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

            PlatStore store = PlatStoreBLL.SingleModel.GetModelByAId(xcxrelation.Id);

            if (store == null)
            {
                returnObj.Msg = "无效店铺";
                return(Json(returnObj));
            }

            int platUserId = 0;
            XcxAppAccountRelation platXcxRelation = _xcxAppAccountRelationBLL.GetModel(store.BindPlatAid);

            if (platXcxRelation != null)
            {
                //平台上的用户ID
                List <C_UserInfo> userInfoList = C_UserInfoBLL.SingleModel.GetListByAppIds(userInfo.TelePhone, $"'{platXcxRelation.AppId}'");
                if (userInfoList != null && userInfoList.Count > 0)
                {
                    platUserId = userInfoList[0].Id;
                }
            }

            int count = 0;
            List <PlatChildGoodsOrder> list = PlatChildGoodsOrderBLL.SingleModel.GetList_Api(state, xcxrelation.Id, userId, pageSize, pageIndex, ref count, store.Id, store.BindPlatAid, platUserId);

            returnObj.isok    = true;
            returnObj.dataObj = new { count = count, list = list };
            return(Json(returnObj));
        }
Exemple #24
0
        public ReturnMsg commitFormId(string utoken, dynamic postData)
        {
            string appid = postData.appid;

            //string openid, string formid
            if (string.IsNullOrEmpty(appid))
            {
                result.msg = "appid不能为空";
                return(result);
            }

            XcxAppAccountRelation umodel = XcxAppAccountRelationBLL.SingleModel.GetModelByAppid(appid);

            if (umodel == null)
            {
                result.msg = "小程序不存在";
                return(result);
            }
            C_UserInfo user = GetUserInfo(utoken);

            if (user == null)
            {
                result.msg = "非法请求";
                return(result);
            }
            string formid = postData.formid;

            if (string.IsNullOrEmpty(formid))
            {
                result.msg = "formid为空";
                return(result);
            }

            if (formid.Equals("the formId is a mock one"))
            {
                result.msg = "formId错误";
                return(result);
            }

            //增加发送模板消息参数
            TemplateMsg_UserParam userParam = new TemplateMsg_UserParam();

            userParam.AppId        = umodel.AppId;
            userParam.Form_IdType  = 0;//form_id
            userParam.Open_Id      = user.OpenId;
            userParam.AddDate      = DateTime.Now;
            userParam.Form_Id      = formid;
            userParam.State        = 1;
            userParam.SendCount    = 0;
            userParam.AddDate      = DateTime.Now;
            userParam.LoseDateTime = DateTime.Now.AddDays(7);//form_id 有效期7天

            userParam.Id = Convert.ToInt32(TemplateMsg_UserParamBLL.SingleModel.Add(userParam));
            result.code  = 1;
            result.obj   = new { FormId = formid };
            return(result);
        }
Exemple #25
0
        /// <summary>
        /// 获取用户信息
        /// </summary>
        /// <returns></returns>
        public ActionResult GetUserInfo()
        {
            returnObj = new Return_Msg_APP();
            string appId    = Context.GetRequest("appid", string.Empty);
            int    userId   = Context.GetRequestInt("userId", 0);
            int    userType = Context.GetRequestInt("userType", 0);//0 普通用户 1足浴技师  2商家

            if (string.IsNullOrEmpty(appId) || userId <= 0)
            {
                returnObj.Msg = "参数错误";
                return(Json(returnObj));
            }
            XcxAppAccountRelation xcxRelatrion = _xcxAppAccountRelationBLL.GetModelByAppid(appId);

            if (xcxRelatrion == null)
            {
                returnObj.Msg = "小程序不存在";
                return(Json(returnObj));
            }
            //Store storeInfo = _storeBll.GetModelByRid(xcxRelatrion.Id);
            //if (storeInfo == null)
            //{
            //    result.Msg = "门店信息错误";
            //    return Json(result);
            //}
            //try
            //{

            //    storeInfo.funJoinModel = JsonConvert.DeserializeObject<StoreConfigModel>(storeInfo.configJson) ?? new StoreConfigModel();//若为 null 则new一个新的配置
            //}
            //catch
            //{
            //    storeInfo.funJoinModel = new StoreConfigModel();
            //}
            if (userType == 0)//普通用户
            {
                C_UserInfo userInfo = C_UserInfoBLL.SingleModel.GetModelByAppId_UserId(appId, userId);
                if (userInfo != null)
                {
                    returnObj.isok    = true;
                    returnObj.dataObj = userInfo;
                    // result.Msg = storeInfo.funJoinModel.helloWords;
                }
                else
                {
                    returnObj.Msg = "用户不存在";
                }
            }
            else if (userType == 2)//商家
            {
                C_UserInfo userInfo = C_UserInfoBLL.SingleModel.GetKfInfo(xcxRelatrion.AppId);
                returnObj.isok    = true;
                returnObj.dataObj = userInfo;
            }
            return(Json(returnObj));
        }
Exemple #26
0
        public ActionResult GetPayLogList()
        {
            returnObj = new Return_Msg_APP();
            string appid     = Context.GetRequest("appid", string.Empty);
            string openid    = Context.GetRequest("openid", string.Empty);
            int    pageIndex = Context.GetRequestInt("pageIndex", 1);
            int    pageSize  = Context.GetRequestInt("pageSize", 10);

            if (string.IsNullOrEmpty(appid))
            {
                returnObj.Msg = "获取失败(appid不能为空)";
                return(Json(returnObj));
            }

            XcxAppAccountRelation r = _xcxAppAccountRelationBLL.GetModelByAppid(appid);

            if (r == null)
            {
                returnObj.Msg = "获取失败(还未进行授权)";
                return(Json(returnObj));
            }
            C_UserInfo userInfo = C_UserInfoBLL.SingleModel.GetModelByAppId_OpenId(appid, openid);

            if (userInfo == null)
            {
                returnObj.Msg = "用户不存在";
                return(Json(returnObj));
            }

            List <SaveMoneySetUserLog> list = SaveMoneySetUserLogBLL.SingleModel.GetListByUserId(userInfo.Id, r.AppId, pageSize, pageIndex);

            list.ForEach(x =>
            {
                if (x.Type == 0)
                {
                    x.ChangeNote = "【充值】" + x.ChangeNote;
                }
                else if (x.Type == -1)
                {
                    x.ChangeNote = "【储值支付】" + x.ChangeNote;
                }
                else if (x.Type == -2)
                {
                    x.ChangeNote = "【微信支付】" + x.ChangeNote;
                }
                else if (x.Type == 1)
                {
                    x.ChangeNote = "【退款】" + x.ChangeNote;
                }
            });

            returnObj.Msg     = "获取预存款记录成功";
            returnObj.dataObj = list;
            returnObj.isok    = true;
            return(Json(returnObj));
        }
Exemple #27
0
        public ActionResult SendSMS(int aid = 0, int storeId = 0)
        {
            try
            {
                PinStore store = PinStoreBLL.SingleModel.GetModelByAid_Id(aid, storeId);
                if (store == null)
                {
                    result.msg = "店铺不存在!";
                    return(Json(result));
                }
                C_UserInfo userInfo = C_UserInfoBLL.SingleModel.GetModel(store.userId);
                if (userInfo == null)
                {
                    result.msg = "用户信息错误!";
                    return(Json(result));
                }
                if (string.IsNullOrEmpty(userInfo.TelePhone) || !Regex.IsMatch(userInfo.TelePhone, @"^1[3-9]+\d{9}$"))
                {
                    result.msg = "手机号码格式不正确!";
                    return(Json(result));
                }
                XcxAppAccountRelation xcx = XcxAppAccountRelationBLL.SingleModel.GetModel(aid);
                if (xcx == null)
                {
                    result.msg = "小程序信息错误!";
                    return(Json(result));
                }

                SendMsgHelper sendMsgHelper = new SendMsgHelper();
                string        authCode      = RedisUtil.Get <string>(userInfo.TelePhone);
                if (string.IsNullOrEmpty(authCode))
                {
                    authCode = Utility.EncodeHelper.CreateRandomCode(4);
                }
                bool sendResult = sendMsgHelper.AliSend(userInfo.TelePhone, "{\"code\":\"" + authCode + "\",\"product\":\" " + Enum.GetName(typeof(SendTypeEnum), 11) + "\"}", "小未科技", 401);
                if (sendResult)
                {
                    RedisUtil.Set <string>(userInfo.TelePhone, authCode, TimeSpan.FromMinutes(5));
                    result.code = 1;
                    result.msg  = "验证码发送成功!";
                }
                else
                {
                    result.msg = "验证码发送失败,请稍后再试!";
                }

                result.obj = authCode;
                return(Json(result));
            }
            catch (Exception ex)
            {
                result.msg = "系统异常!" + ex.Message;
                return(Json(result));;
            }
        }
Exemple #28
0
 /// <summary>
 /// 会员卡资料编辑
 /// </summary>
 /// <returns></returns>
 public ActionResult CardEdit(int id = 0, int aId = 6901757, int storeId = 8, string act = "")
 {
     if (act != "save")
     {
         if (id <= 0)
         {
             _result.code = 500;
             _result.msg  = "参数错误 id_error";
             return(View("PageError", _result));
         }
         EditModel <DishVipCard> model = new EditModel <DishVipCard>();
         model.DataModel = DishVipCardBLL.SingleModel.GetVipCardById_StoreId(id, storeId);
         model.aId       = aId;
         model.storeId   = storeId;
         return(View(model));
     }
     else
     {
         if (id <= 0)
         {
             _result.msg = "参数错误 id_error";
             return(Json(_result));
         }
         string      u_name  = Context.GetRequest("u_name", string.Empty);
         string      u_phone = Context.GetRequest("u_phone", string.Empty);
         DishVipCard card    = DishVipCardBLL.SingleModel.GetVipCardById_StoreId(id, storeId);
         if (card == null)
         {
             _result.msg = "不存在此会员卡";
             return(Json(_result));
         }
         C_UserInfo userInfo = C_UserInfoBLL.SingleModel.GetModel(card.uid);
         if (userInfo == null)
         {
             _result.msg = "不存在此用户";
             return(Json(_result));
         }
         card.u_name = u_name;
         if (!DishVipCardBLL.SingleModel.Update(card, "u_name"))
         {
             _result.msg = "保存失败";
             return(Json(_result));
         }
         userInfo.TelePhone = u_phone;
         if (!C_UserInfoBLL.SingleModel.Update(userInfo, "telephone"))
         {
             _result.msg = "手机号保存失败";
             return(Json(_result));
         }
         _result.code = 1;
         _result.msg  = "保存成功";
         return(Json(_result));
     }
 }
Exemple #29
0
        public ActionResult GetOpenId(string code = "", int type = 0)
        {
            string     grant_type = "authorization_code";
            Return_Msg data       = new Return_Msg();
            string     url        = "https://api.weixin.qq.com/sns/oauth2/access_token?appid={0}&secret={1}&code={2}&grant_type={3}";

            url = string.Format(url, _appid, _secret, code, grant_type);
            try
            {
                string resultJson = HttpHelper.GetData(url);
                if (!string.IsNullOrEmpty(resultJson))
                {
                    WxAuthorize result = JsonConvert.DeserializeObject <WxAuthorize>(resultJson);
                    if (result != null && !string.IsNullOrEmpty(result.openid))
                    {
                        data.dataObj = result.openid;
                        C_UserInfo userInfo = C_UserInfoBLL.SingleModel.GetModelByAppId_OpenId(_appid, result.openid);

                        if (userInfo == null)
                        {
                            userInfo         = new C_UserInfo();
                            userInfo.StoreId = 0;
                            userInfo.OpenId  = result.openid;
                            userInfo.appId   = _appid;
                            userInfo.Id      = Convert.ToInt32(C_UserInfoBLL.SingleModel.Add(userInfo));
                        }

                        if (!string.IsNullOrEmpty(userInfo.TelePhone))
                        {
                            if (type == 0)
                            {
                                return(Redirect($"/pxhfang/TiXianRecord?phone={userInfo.TelePhone}&openId={data.dataObj}&type={type}&appid={_appid}"));
                            }
                            else if (type == 99)
                            {
                                return(Redirect($"/pxhfang/MyAgentInfo?phone={userInfo.TelePhone}&openId={data.dataObj}&type={type}&appid={_appid}&id={userInfo.Id}"));
                            }
                            else
                            {
                                return(Redirect($"/pxhfang/TiXian?phone={userInfo.TelePhone}&openId={data.dataObj}&type={type}&appid={_appid}&id={userInfo.Id}"));
                            }
                        }
                        return(Redirect($"/pxhfang/CheckPhone?openId={data.dataObj}&type={type}"));
                    }
                }
            }
            catch (Exception ex)
            {
                log4net.LogHelper.WriteError(this.GetType(), ex);
            }

            return(Content("授权失败"));
            //return Json(data, JsonRequestBehavior.AllowGet);
        }
Exemple #30
0
        private string GetPxhUserOpenId(string phone)
        {
            C_UserInfo userinfo = C_UserInfoBLL.SingleModel.GetModelByTelephone_appid(phone, _pxhAppId);

            if (userinfo != null)
            {
                return(userinfo.OpenId);
            }

            return("");
        }