/// <summary>
        /// 开单
        /// </summary>
        /// <returns></returns>
        public ActionResult createOrder()
        {
            #region 数据验证
            int appId = Context.GetRequestInt("appId", 0);
            if (appId <= 0)
            {
                return(Json(new { isok = false, msg = "系统繁忙appid_null" }, JsonRequestBehavior.AllowGet));
            }
            if (dzaccount == null)
            {
                return(Json(new { isok = false, msg = "系统繁忙auth_null" }));
            }
            XcxAppAccountRelation appAcountRelation = XcxAppAccountRelationBLL.SingleModel.GetModelByaccountidAndAppid(appId, dzaccount.Id.ToString());
            if (appAcountRelation == null)
            {
                return(Json(new { isok = false, msg = "系统繁忙relation_null" }));
            }
            FootBath storeModel = FootBathBLL.SingleModel.GetModelByAppId(appId);
            if (storeModel == null)
            {
                return(Json(new { isok = false, msg = "系统繁忙model_null" }));
            }
            int orderId = Context.GetRequestInt("orderId", 0);
            if (orderId <= 0)
            {
                return(Json(new { isok = false, msg = "系统繁忙orderId_null" }));
            }
            EntGoodsOrder orderInfo = EntGoodsOrderBLL.SingleModel.GetModelByOrderIdAndAid(orderId, appId, 1);
            if (orderInfo == null)
            {
                return(Json(new { isok = false, msg = "系统繁忙order_null" }));
            }
            #endregion

            if (orderInfo.State == (int)MiniAppEntOrderState.已超时)
            {
                orderInfo.State = (int)MiniAppEntOrderState.务中;
            }
            orderInfo.OrderType = 0;
            orderInfo.ConfDate  = DateTime.Now;
            bool isok = EntGoodsOrderBLL.SingleModel.Update(orderInfo, "State,ordertype,ConfDate") && VipRelationBLL.SingleModel.updatelevel(orderInfo.UserId, "footbath");
            #region 预约成功通知 模板消息
            if (isok)
            {
                object objData = TemplateMsg_Miniapp.FootbathGetTemplateMessageData(orderInfo, SendTemplateMessageTypeEnum.足浴预约成功通知);
                TemplateMsg_Miniapp.SendTemplateMessage(orderInfo.UserId, SendTemplateMessageTypeEnum.足浴预约成功通知, TmpType.小程序足浴模板, objData);
            }
            #endregion
            string msg = isok ? "操作成功" : "操作失败";
            return(Json(new { isok = isok, msg = msg }));
        }
Exemple #2
0
        public ActionResult AddOrEditNews(int appId = 0, int Id = 0, int Type = 0)
        {
            if (dzaccount == null)
            {
                return(Redirect("/dzhome/login"));
            }

            if (appId <= 0)
            {
                return(View("PageError", new Return_Msg()
                {
                    Msg = "参数错误!", code = "500"
                }));
            }
            XcxAppAccountRelation umodel = XcxAppAccountRelationBLL.SingleModel.GetModel(appId);

            if (umodel == null)
            {
                return(View("PageError", new Return_Msg()
                {
                    Msg = "权限表里没有该数据!", code = "403"
                }));
            }

            if (umodel.AccountId != dzaccount.Id)
            {
                return(View("PageError", new Return_Msg()
                {
                    Msg = "不能随便跨账号越权!", code = "403"
                }));
            }

            NewsGw model = new NewsGw();

            //默认新增
            ViewBag.Id = appId;
            model.Type = Type;
            if (Id > 0)
            {
                //表示修改
                model = NewsGwBLL.SingleModel.GetModel(Id);
                if (model == null)
                {
                    return(View("PageError", new Return_Msg()
                    {
                        Msg = "要修改的数据不存在!", code = "500"
                    }));
                }
            }
            return(View(model));
        }
        public ActionResult GetDadaFreight()
        {
            #region 达达下单参数
            string cityname      = Context.GetRequest("cityname", string.Empty);
            string appid         = Context.GetRequest("appid", string.Empty);
            string openid        = Context.GetRequest("openid", string.Empty);
            string lat           = Context.GetRequest("lat", string.Empty);
            string lnt           = Context.GetRequest("lnt", string.Empty);
            string acceptername  = Context.GetRequest("acceptername", string.Empty);
            string accepterphone = Context.GetRequest("accepterphone", string.Empty);
            string address       = Context.GetRequest("address", string.Empty);
            #endregion
            string msg = "";
            returnObj = new Return_Msg_APP()
            {
                isok = false
            };
            int getway = (int)miniAppOrderGetWay.达达配送;

            XcxAppAccountRelation xcxrelation = _xcxAppAccountRelationBLL.GetModelByAppid(appid);
            if (xcxrelation == null)
            {
                returnObj.Msg = "请先授权 umodel_null";
                return(Json(returnObj));
            }

            int storeId = 0;
            int tmpType = _xcxAppAccountRelationBLL.GetXcxTemplateType(xcxrelation.Id);
            switch (tmpType)
            {
            case (int)TmpType.小程序专业模板: break;

            case (int)TmpType.小程序餐饮模板:
                Food food = FoodBLL.SingleModel.GetModelByAppId(xcxrelation.Id);
                if (food == null)
                {
                    returnObj.Msg = "找不到餐饮店铺";
                    return(Json(returnObj));
                }
                getway = food.DistributionWay;
                break;
            }

            ResultReponseModel result = new ResultReponseModel();
            result.deliverFeeInt = DistributionApiConfigBLL.SingleModel.Getpeisongfei(cityname, appid, openid, lat, lnt, acceptername, accepterphone, address, ref msg, getway, storeId, xcxrelation.Id, 0);
            result.deliverFee    = result.deliverFeeInt * 0.01;
            returnObj.isok       = !(msg.Length > 0);
            returnObj.Msg        = msg;
            returnObj.dataObj    = result;
            return(Json(returnObj));
        }
Exemple #4
0
        public ActionResult SetPageIndex(PageIndexControl m)
        {
            if (dzaccount == null)
            {
                return(Json(new { isok = false, msg = "1系统繁忙account_null!" }, JsonRequestBehavior.AllowGet));
            }
            if (m.RelationId <= 0)
            {
                return(Json(new { isok = false, msg = "权限Id不能为空!" }, JsonRequestBehavior.AllowGet));
            }

            XcxAppAccountRelation umodel = XcxAppAccountRelationBLL.SingleModel.GetModel(m.RelationId);

            if (umodel == null)
            {
                return(Json(new { isok = false, msg = "2系统繁忙umodel_null!" }, JsonRequestBehavior.AllowGet));
            }

            if (umodel.AccountId != dzaccount.Id)
            {
                return(Json(new { isok = false, msg = "3系统繁忙umodel_null!" }, JsonRequestBehavior.AllowGet));
            }

            PageIndexControl model = PageIndexControlBLL.SingleModel.GetModel($"RelationId={umodel.Id}");

            if (model != null)
            {
                //表示更新
                if (PageIndexControlBLL.SingleModel.Update(m))
                {
                    return(Json(new { isok = true, msg = "更新成功", obj = m.Id }));
                }
                else
                {
                    return(Json(new { isok = false, msg = "更新异常", obj = m.Id }));
                }
            }
            else
            {
                //表示新增
                int id = Convert.ToInt32(PageIndexControlBLL.SingleModel.Add(m));
                if (id > 0)
                {
                    return(Json(new { isok = true, msg = "新增成功", obj = id }));
                }
                else
                {
                    return(Json(new { isok = false, msg = "新增异常" }));
                }
            }
        }
Exemple #5
0
        /// <summary>
        /// 新闻资讯列表
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public ActionResult NewsList(int appId = 0, int Type = 0, int pageIndex = 1, int pageSize = 20)
        {
            if (dzaccount == null)
            {
                return(Redirect("/dzhome/login"));
            }

            if (appId <= 0)
            {
                return(View("PageError", new Return_Msg()
                {
                    Msg = "参数错误!", code = "500"
                }));
            }
            XcxAppAccountRelation umodel = XcxAppAccountRelationBLL.SingleModel.GetModel(appId);

            if (umodel == null)
            {
                return(View("PageError", new Return_Msg()
                {
                    Msg = "没有权限!", code = "403"
                }));
            }

            if (umodel.AccountId != dzaccount.Id)
            {
                return(View("PageError", new Return_Msg()
                {
                    Msg = "不能随便跨账号越权!", code = "403"
                }));
            }

            string strWhere  = string.Empty;
            string NewsTitle = Utility.IO.Context.GetRequest("keys", string.Empty);

            strWhere = $"State>0 and Type={Type}";
            if (!string.IsNullOrEmpty(NewsTitle))
            {
                strWhere += $" and Title like '%{NewsTitle}%'";
            }

            ViewBag.Keys     = NewsTitle;
            ViewBag.Id       = appId;
            ViewBag.Type     = Type;
            ViewBag.pageSize = pageSize;
            List <NewsGw> list       = NewsGwBLL.SingleModel.GetList(strWhere, pageSize, pageIndex);
            int           TotalCount = NewsGwBLL.SingleModel.GetCount(strWhere);

            ViewBag.TotalCount = TotalCount;
            return(View(list));
        }
Exemple #6
0
        // GET: footbath_technician:足浴版小程序-技师管理

        #region 技师管理
        /// <summary>
        /// 技师管理视图
        /// </summary>
        /// <returns></returns>
        public ActionResult TechnicianList()
        {
            int appId = Context.GetRequestInt("appId", 0);

            if (appId <= 0)
            {
                return(View("PageError", new Return_Msg()
                {
                    Msg = "参数错误!", code = "500"
                }));
            }
            ViewBag.appId = appId;
            if (dzaccount == null)
            {
                return(Redirect("/dzhome/login"));
            }
            XcxAppAccountRelation appAcountRelation = XcxAppAccountRelationBLL.SingleModel.GetModelByaccountidAndAppid(appId, dzaccount.Id.ToString());

            if (appAcountRelation == null)
            {
                return(View("PageError", new Return_Msg()
                {
                    Msg = "没有权限!", code = "403"
                }));
            }
            FootBath storeModel = FootBathBLL.SingleModel.GetModel($"appId={appId}");

            if (storeModel == null)
            {
                return(View("PageError", new Return_Msg()
                {
                    Msg = "数据不存在!", code = "500"
                }));
            }
            List <EntGoods> serviceList = EntGoodsBLL.SingleModel.GetServicList(appId);


            //扫码绑定代码
            string sessonid = new Random().Next(1, 3) + DateTime.Now.ToString("mmssfffff");

            Session["qrcodekey"] = sessonid;
            if (null == RedisUtil.Get <LoginQrCode>("SessionID:" + sessonid))
            {
                LoginQrCode wxkey = new LoginQrCode();
                wxkey.SessionId = sessonid;
                wxkey.IsLogin   = false;
                RedisUtil.Set <LoginQrCode>("SessionID:" + sessonid, wxkey);
            }
            return(View(serviceList));
        }
Exemple #7
0
        public ActionResult DelOrDownExchangeActivity(int appId, int Id)
        {
            int actionType = Context.GetRequestInt("actionType", 0);

            if (appId <= 0)
            {
                return(Json(new { isok = false, msg = "appId非法" }, JsonRequestBehavior.AllowGet));
            }
            if (dzaccount == null)
            {
                return(Json(new { isok = false, msg = "登录信息超时" }, JsonRequestBehavior.AllowGet));
            }
            XcxAppAccountRelation xcx = XcxAppAccountRelationBLL.SingleModel.GetModelByaccountidAndAppid(appId, dzaccount.Id.ToString());

            if (xcx == null)
            {
                return(Json(new { isok = false, msg = "小程序未授权" }, JsonRequestBehavior.AllowGet));
            }

            ExchangeActivity model = ExchangeActivityBLL.SingleModel.GetModel(Id);

            if (model == null)
            {
                return(Json(new { isok = false, msg = "数据不存在!" }, JsonRequestBehavior.AllowGet));
            }
            if (model.appId != appId)
            {
                return(Json(new { isok = false, msg = "没有权限!" }, JsonRequestBehavior.AllowGet));
            }

            string field = "UpdateDate,";

            if (actionType == 0)
            {
                //表示 上架或者下架
                model.state      = model.state == 0 ? 1 : 0;
                model.UpdateDate = DateTime.Now;
                field           += "state";
            }
            else
            {
                //表示删除
                model.isdel      = 1;
                model.UpdateDate = DateTime.Now;
                field           += "isdel";
            }


            return(Json(new { isok = true, msg = ExchangeActivityBLL.SingleModel.Update(model, field) ? "操作成功" : "操作失败" }, JsonRequestBehavior.AllowGet));
        }
Exemple #8
0
        public ActionResult GetMyGroupList()
        {
            string appId     = Context.GetRequest("appId", string.Empty);
            int    userId    = Context.GetRequestInt("userId", 0);
            int    state     = Context.GetRequestInt("state", 0);
            int    storeId   = Context.GetRequestInt("storeId", 0);//多门店分店ID,其他的都为0
            int    pageIndex = Context.GetRequestInt("pageIndex", 1);
            int    pageSize  = 10;

            if (string.IsNullOrEmpty(appId))
            {
                return(Json(new { isok = -1, msg = "appid不能为空" }, JsonRequestBehavior.AllowGet));
            }
            if (userId <= 0)
            {
                return(Json(new { isok = -1, msg = "用户ID不能小于0" }, JsonRequestBehavior.AllowGet));
            }
            XcxAppAccountRelation umodel = _xcxAppAccountRelationBLL.GetModelByAppid(appId);

            if (umodel == null)
            {
                return(Json(new { isok = -1, msg = "请先授权" }, JsonRequestBehavior.AllowGet));
            }
            int xtype = _xcxAppAccountRelationBLL.GetXcxTemplateType(umodel.Id);

            if (xtype == 0)
            {
                return(Json(new { isok = -1, msg = "小程序没授权" }, JsonRequestBehavior.AllowGet));
            }

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

            if (userInfo == null)
            {
                return(Json(new { isok = -1, msg = "用户不存在" }, JsonRequestBehavior.AllowGet));
            }
            object postdata = new object();

            switch (xtype)
            {
            case (int)TmpType.小程序专业模板:
                postdata = EntGoodsOrderBLL.SingleModel.GetMyGroupPostData(state, umodel.Id, userId, pageIndex, pageSize, storeId);
                break;

            case (int)TmpType.小程序餐饮模板:
                postdata = FoodGoodsOrderBLL.SingleModel.GetMyGroupPostData(state, umodel.Id, userId, pageIndex, pageSize);
                break;
            }
            return(Json(new { isok = 1, msg = "成功", postdata = postdata }, JsonRequestBehavior.AllowGet));
        }
Exemple #9
0
        public ActionResult SaveCityStoreUser()
        {
            returnObj      = new Return_Msg_APP();
            returnObj.code = "200";
            string appId  = Context.GetRequest("appId", string.Empty);
            int    userId = Context.GetRequestInt("userId", 0);

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

            XcxAppAccountRelation r = _xcxAppAccountRelationBLL.GetModelByAppid(appId);

            if (r == null)
            {
                returnObj.Msg = "小程序未授权";
                return(Json(returnObj));
            }
            CityStoreUser model            = CityStoreUserBLL.SingleModel.getCity_StoreUser(r.Id, userId);
            int           city_storeUserId = 0;

            if (model == null)
            {
                //新增一条记录
                city_storeUserId = Convert.ToInt32(CityStoreUserBLL.SingleModel.Add(new CityStoreUser()
                {
                    aid        = r.Id,
                    userId     = userId,
                    addTime    = DateTime.Now,
                    updateTime = DateTime.Now,
                    state      = 0
                }));
                if (city_storeUserId <= 0)
                {
                    returnObj.Msg = "操作异常";
                    return(Json(returnObj));
                }
            }
            else
            {
                city_storeUserId = model.Id;
            }

            returnObj.isok    = true;
            returnObj.Msg     = "操作成功";
            returnObj.dataObj = new { id = city_storeUserId };
            return(Json(returnObj));
        }
Exemple #10
0
        public JsonResult GetItem(XcxAppAccountRelation authData, int flashDealId = 0)
        {
            if (flashDealId <= 0)
            {
                return(ReturnJson(message: "无效秒杀活动ID"));
            }
            List <FlashDealItem> flashItems = FlashDealItemBLL.SingleModel.GetByDealId(flashDealId);

            if (flashItems.Exists(item => item.Aid != authData.Id))
            {
                return(ReturnJson(message: "非法操作(秒杀商品)"));
            }
            return(ReturnJson(isOk: true, data: flashItems, message: "获取成功"));
        }
Exemple #11
0
        public ActionResult RangeList(int appId = 0, int pageIndex = 1, int pageSize = 100)
        {
            if (dzaccount == null)
            {
                return(Redirect("/dzhome/login"));
            }

            if (appId <= 0)
            {
                return(View("PageError", new Return_Msg()
                {
                    Msg = "参数错误!", code = "500"
                }));
            }

            XcxAppAccountRelation umodel = XcxAppAccountRelationBLL.SingleModel.GetModel(appId);

            if (umodel == null)
            {
                return(View("PageError", new Return_Msg()
                {
                    Msg = "权限表里没有该数据!", code = "500"
                }));
            }

            if (umodel.AccountId != dzaccount.Id)
            {
                return(View("PageError", new Return_Msg()
                {
                    Msg = "不能随便跨账号越权!", code = "403"
                }));
            }

            string strWhere = string.Empty;
            string AppTitle = Utility.IO.Context.GetRequest("keys", string.Empty);

            if (!string.IsNullOrEmpty(AppTitle))
            {
                strWhere = $"Title like '%{AppTitle}%'";
            }

            ViewBag.Keys     = AppTitle;
            ViewBag.Id       = appId;
            ViewBag.pageSize = pageSize;
            List <RangeGw> list       = RangeGwBLL.SingleModel.GetList(strWhere, pageSize, pageIndex, "*", " RangeId");
            int            TotalCount = RangeGwBLL.SingleModel.GetCount(strWhere);

            ViewBag.TotalCount = TotalCount;
            return(View(list));
        }
Exemple #12
0
        public ActionResult DelFormData(int relationId = 0, int Id = 0)
        {
            if (dzaccount == null)
            {
                return(Json(new { isok = false, msg = "系统繁忙umodel_null!" }, JsonRequestBehavior.AllowGet));
            }

            if (relationId <= 0)
            {
                return(Json(new { isok = false, msg = "relationId不能为空!" }, JsonRequestBehavior.AllowGet));
            }
            XcxAppAccountRelation umodel = XcxAppAccountRelationBLL.SingleModel.GetModel(relationId);

            if (umodel == null)
            {
                return(Json(new { isok = false, msg = "没有权限对象!" }, JsonRequestBehavior.AllowGet));
            }

            if (umodel.AccountId != dzaccount.Id)
            {
                return(Json(new { isok = false, msg = "非法操作没有权限删除!" }, JsonRequestBehavior.AllowGet));
            }


            PageIndexControl model = PageIndexControlBLL.SingleModel.GetModel($"RelationId={relationId}");

            if (model == null)
            {
                return(Json(new { isok = false, msg = "首页未进行配置没有表单数据" }));
            }

            PageFormMsg form = PageFormMsgBLL.SingleModel.GetModel(Id);

            if (form == null)
            {
                return(Json(new { isok = false, msg = "没有该表单数据" }));
            }

            form.State = -1;
            if (PageFormMsgBLL.SingleModel.Update(form))
            {
                return(Json(new { isok = true, msg = "删除成功!" }));
            }
            else
            {
                return(Json(new { isok = false, msg = "删除失败!" }));
            }
        }
Exemple #13
0
        /// <summary>
        /// 获取平台独立小程序用户消费记录
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public int GetPlatChildGoodsVipPriceSum(int userId)
        {
            int        sum      = 0;
            C_UserInfo userinfo = C_UserInfoBLL.SingleModel.GetModel(userId);

            if (userinfo == null)
            {
                return(sum);
            }
            XcxAppAccountRelation xcxrelation = XcxAppAccountRelationBLL.SingleModel.GetModelByAppid(userinfo.appId);

            if (xcxrelation == null)
            {
                return(sum);
            }
            PlatStore store = PlatStoreBLL.SingleModel.GetModelByAId(xcxrelation.Id);

            if (store == null)
            {
                return(sum);
            }
            xcxrelation = XcxAppAccountRelationBLL.SingleModel.GetModel(store.BindPlatAid);

            if (xcxrelation == null)
            {
                return(sum);
            }
            userinfo = C_UserInfoBLL.SingleModel.GetModelByTelephone_appid(userinfo.TelePhone, xcxrelation.AppId);
            int puserId = 0;

            if (userinfo != null)
            {
                puserId = userinfo.Id;
            }

            string sql    = $"select sum(buyprice) as count from PlatChildGoodsOrder where ((USERID = {userId} and templatetype ={(int)TmpType.小未平台子模版}) or (userid={puserId} and storeid={store.Id} and templatetype={(int)TmpType.小未平台})) and State = {(int)PlatChildOrderState.已完成}";//购物消费总额  已收货才确定计算为消费
            var    result = SqlMySql.ExecuteScalar(Utility.dbEnum.MINIAPP.ToString(), CommandType.Text, sql);

            if (DBNull.Value != result)
            {
                sum += Convert.ToInt32(result);
            }

            //sum += GetBargainAndGroupPriceSum(userid);
            sum += GetStoredvaluePaySum(userId);
            sum += GetEditSaveMoney(userId);
            return(sum);
        }
Exemple #14
0
        /// <summary>
        /// 拼团成功,返利提现到零钱
        /// </summary>
        /// <returns></returns>
        public string ReturnMoney(PinGroup groupInfo)
        {
            string               msg = string.Empty;
            PinGoodsOrderBLL     pinGoodsOrderBLL = new PinGoodsOrderBLL();
            TransactionModel     tran             = new TransactionModel();
            string               sqlwhere         = $"state={(int)PinEnums.PinOrderState.交易成功} and paystate={(int)PinEnums.PayState.已付款} and groupid ={groupInfo.id} and isReturnMoney=0";
            List <PinGoodsOrder> orderList        = pinGoodsOrderBLL.GetList(sqlwhere);

            if (orderList == null || orderList.Count <= 0)
            {
                msg = $"拼团成功,找不到交易成功且已付款的订单 groupids:{groupInfo.id}";
                log4net.LogHelper.WriteError(GetType(), new Exception(msg));
                groupInfo.state = (int)PinEnums.GroupState.返利失败;
                tran.Add(BuildUpdateSql(groupInfo, "state"));
            }
            else
            {
                string aids = string.Join(",", orderList.Select(s => s.aid).Distinct());
                List <XcxAppAccountRelation> xcxAppAccountRelationList = XcxAppAccountRelationBLL.SingleModel.GetValuableListByIds(aids);

                foreach (var order in orderList)
                {
                    XcxAppAccountRelation xcxAppAccountRelation = xcxAppAccountRelationList?.FirstOrDefault(f => f.Id == order.aid);
                    if (xcxAppAccountRelation == null)
                    {
                        msg += $"拼享惠返利,找不到平台小程序信息 aid:{order.id}||";
                        log4net.LogHelper.WriteError(GetType(), new Exception($"拼享惠返利,找不到平台小程序信息 aid:{order.id}"));
                        continue;
                    }
                    string str = DrawCashApplyBLL.SingleModel.PxhUserApplyDrawCash(order, order.userId, xcxAppAccountRelation.AppId);
                    if (!string.IsNullOrEmpty(str))
                    {
                        msg += $"拼享惠提现错误,orderId:{order.id},{str}";
                        log4net.LogHelper.WriteError(GetType(), new Exception($"拼享惠提现错误,orderId:{order.id},{str}"));
                    }
                }
                groupInfo.state = (int)PinEnums.GroupState.已返利;
                Update(groupInfo, "state");
                // tran.Add(BuildUpdateSql(groupInfo, "state"));
            }
            //if (!ExecuteTransactionDataCorect(tran.sqlArray, tran.ParameterArray))
            //{
            //    msg = $"拼团成功返利处理失败 groupids:{groupInfo.id},sql:{JsonConvert.SerializeObject(tran.sqlArray)}";
            //    log4net.LogHelper.WriteError(GetType(), new Exception($"拼团成功返利处理失败 groupids:{groupInfo.id},sql:{JsonConvert.SerializeObject(tran.sqlArray)}"));
            //}
            return(msg);
        }
Exemple #15
0
        /// <summary>
        /// 获取平台店铺二维码
        /// </summary>
        /// <param name="aid"></param>
        /// <param name="pageurl"></param>
        /// <param name="scene"></param>
        /// <returns></returns>
        public string GetStoreCode(int storeid, string pageurl, ref string msg)
        {
            PlatStore store = base.GetModel(storeid);

            if (store == null)
            {
                msg = "店铺二维码:找不到店铺数据";
                return("");
            }

            XcxAppAccountRelation xcxrelation = XcxAppAccountRelationBLL.SingleModel.GetModel(store.BindPlatAid);

            if (xcxrelation == null)
            {
                msg = "平台店铺二维码:模板过期";
                return("");
            }

            XcxTemplate xcxTemplate = XcxTemplateBLL.SingleModel.GetModel(xcxrelation.TId);

            if (xcxTemplate == null)
            {
                msg = "无效模板";
                return("");
            }

            string token = "";

            if (!XcxApiBLL.SingleModel.GetToken(xcxrelation, ref token))
            {
                msg = token;
                return("");
            }

            //店铺没有开通小程序
            //平台小程序二维码
            string      scen        = $"{storeid}";
            qrcodeclass qrcodemodel = CommondHelper.GetMiniAppQrcode(token, pageurl, scen);

            if (qrcodemodel == null || string.IsNullOrEmpty(qrcodemodel.url))
            {
                msg = qrcodemodel != null ? qrcodemodel.msg : "生成名片码失败";
                return("");
            }

            return(qrcodemodel.url);
        }
Exemple #16
0
        public ActionResult GetDataList()
        {
            _returnData = new Return_Msg();

            int    pageSize     = Context.GetRequestInt("pageSize", 10);
            int    pageIndex    = Context.GetRequestInt("pageIndex", 1);
            int    aid          = Context.GetRequestInt("aid", 0);
            int    openState    = Context.GetRequestInt("openstate", -1);
            int    xcxappState  = Context.GetRequestInt("xcxappstate", -2);
            int    dayLength    = Context.GetRequestInt("daylength", 0);
            string customerName = Context.GetRequest("customername", string.Empty);
            string storeName    = Context.GetRequest("storename", string.Empty);
            string loginId      = Context.GetRequest("loginid", string.Empty);

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

            if (xcxrelation == null)
            {
                _returnData.Msg = "还未开通小未平台模板";
                return(Json(_returnData));
            }

            Agentinfo agentinfoModel = AgentinfoBLL.SingleModel.GetModelByAccoundId(xcxrelation.AccountId.ToString());

            int count = 0;
            List <PlatApplyApp> list = PlatApplyAppBLL.SingleModel.GetDataList(xcxrelation.AppId, dayLength, customerName, loginId, storeName, openState, xcxappState, aid, pageSize, pageIndex, ref count);

            XcxTemplate tempInfo = XcxTemplateBLL.SingleModel.GetModelByType((int)TmpType.小未平台子模版);

            if (tempInfo != null && agentinfoModel != null)
            {
                List <XcxTemplate> xcxList = XcxTemplateBLL.SingleModel.GetRealPriceTemplateList($" id in ({tempInfo.Id})", agentinfoModel.id);
                if (xcxList != null && xcxList.Count > 0)
                {
                    tempInfo = xcxList[0];
                }
            }
            _returnData.isok    = true;
            _returnData.dataObj = new { data = list, count = count, tempinfo = tempInfo };

            return(Json(_returnData));
        }
Exemple #17
0
        public ActionResult DelRule()
        {
            result = new PlatReturnMsg();
            int appId  = Utility.IO.Context.GetRequestInt("appId", 0);
            int ruleId = Utility.IO.Context.GetRequestInt("ruleId", 0);

            if (appId <= 0 || ruleId <= 0)
            {
                result.Msg = "参数错误";
                return(Json(result));
            }

            if (dzaccount == null)
            {
                result.Msg = "登录信息超时";
                return(Json(result));
            }

            XcxAppAccountRelation xcx = XcxAppAccountRelationBLL.SingleModel.GetModelByaccountidAndAppid(appId, dzaccount.Id.ToString());

            if (xcx == null)
            {
                result.Msg = "小程序未授权";
                return(Json(result));
            }

            PlatStoreAddRules model = PlatStoreAddRulesBLL.SingleModel.getRule(appId, ruleId);

            if (model == null)
            {
                result.Msg = "数据不存在";
                return(Json(result));
            }


            model.State      = -1;
            model.UpdateTime = DateTime.Now;
            if (!PlatStoreAddRulesBLL.SingleModel.Update(model, "State,UpdateTime"))
            {
                result.Msg = "删除异常";
                return(Json(result));
            }

            result.isok = true;
            result.Msg  = "删除成功";
            return(Json(result));
        }
Exemple #18
0
        /// <summary>
        /// 删除我收藏的记录或者发布的帖子
        /// </summary>
        /// <returns></returns>
        public ActionResult DelMyFavoriteOrMyMsg()
        {
            returnObj      = new Return_Msg_APP();
            returnObj.code = "200";
            string appId   = Context.GetRequest("appId", string.Empty);
            int    userId  = Context.GetRequestInt("myCardId", 0);
            int    Id      = Context.GetRequestInt("Id", 0);
            int    delType = Context.GetRequestInt("delType", 0);//默认为0 表示删除我发布的帖子 1表示删除我收藏的帖子

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

            XcxAppAccountRelation r = _xcxAppAccountRelationBLL.GetModelByAppid(appId);

            if (r == null)
            {
                returnObj.Msg = "小程序未授权";
                return(Json(returnObj));
            }

            bool delresult = false;

            // log4net.LogHelper.WriteInfo(this.GetType(), "删除" + $"delType={delType} , userId={userId} , aid={appId},Id={Id}");
            if (delType == 0)
            {
                //删除我发布的帖子
                delresult = PlatMsgBLL.SingleModel.DelMsg(Id, userId, r.Id);
            }
            else
            {
                //  log4net.LogHelper.WriteInfo(this.GetType(), "删除收藏");
                delresult = PlatUserFavoriteMsgBLL.SingleModel.DelMolde(Id, userId, r.Id);
            }

            if (!delresult)
            {
                returnObj.Msg = "操作异常";
                return(Json(returnObj));
            }

            returnObj.isok = true;
            returnObj.Msg  = "删除成功";
            return(Json(returnObj));
        }
Exemple #19
0
        public ActionResult SaveAddSetting()
        {
            result = new PlatReturnMsg();
            int appId  = Utility.IO.Context.GetRequestInt("appId", 0);
            int addWay = Utility.IO.Context.GetRequestInt("addWay", 0);

            if (appId <= 0 || addWay < 0)
            {
                result.Msg = "参数错误";
                return(Json(result));
            }

            if (dzaccount == null)
            {
                result.Msg = "登录信息超时";
                return(Json(result));
            }

            XcxAppAccountRelation xcx = XcxAppAccountRelationBLL.SingleModel.GetModelByaccountidAndAppid(appId, dzaccount.Id.ToString());

            if (xcx == null)
            {
                result.Msg = "小程序未授权";
                return(Json(result));
            }

            PlatStoreAddSetting platStoreAddSetting = PlatStoreAddSettingBLL.SingleModel.GetPlatStoreAddSetting(appId);

            if (platStoreAddSetting == null)
            {
                result.Msg = "数据不存在";
                return(Json(result));
            }


            platStoreAddSetting.AddWay     = addWay;
            platStoreAddSetting.UpdateTime = DateTime.Now;
            if (!PlatStoreAddSettingBLL.SingleModel.Update(platStoreAddSetting, "AddWay,UpdateTime"))
            {
                result.Msg = "设置异常";
                return(Json(result));
            }

            result.isok = true;
            result.Msg  = "设置成功";
            return(Json(result));
        }
        public ActionResult QueryDelivery()
        {
            string lat   = Context.GetRequest("lat", string.Empty);
            string appid = Context.GetRequest("appid", string.Empty);
            string lnt   = Context.GetRequest("lnt", string.Empty);

            XcxAppAccountRelation umodel = _xcxAppAccountRelationBLL.GetModelByAppid(appid);

            if (umodel == null)
            {
                returnObj.Msg = "请先授权 umodel_null";
                return(Json(returnObj));
            }

            FNStoreRelation fstorer = FNStoreRelationBLL.SingleModel.GetModelByRid(umodel.Id);

            if (fstorer == null)
            {
                returnObj.Msg = "请先绑定蜂鸟门店";
                return(Json(returnObj));
            }

            FNStore fstore = FNStoreBLL.SingleModel.GetModel(fstorer.fnstoreid);

            if (fstore == null)
            {
                returnObj.Msg = "找不到蜂鸟门店数据";
                return(Json(returnObj));
            }

            object data = new
            {
                chain_store_code   = fstore.chain_store_code, //门店编号(支持数字、字母的组合)
                position_source    = 1,                       //收货点坐标属性(0:未知, 1:腾讯地图, 2:百度地图, 3:高德地图)
                receiver_longitude = lnt,
                receiver_latitude  = lat
            };

            string url    = FNApi._querydeliveryapi;
            string result = FNApi.SingleModel.UseFNApi(data, url);

            returnObj.isok = true;
            returnObj.Msg  = "在配送范围内";

            return(Json(returnObj, JsonRequestBehavior.AllowGet));
        }
Exemple #21
0
        public override void OnAuthorization(AuthorizationContext filterContext)
        {
            if (filterContext.ActionDescriptor.IsDefined(typeof(AllowAnonymousAttribute), true))
            {
                return;
            }
            int aid      = Context.GetRequestInt("appId", 0);
            int fromPlat = Context.GetRequestInt("fromPlat", 0);

            if (aid <= 0)
            {
                aid = Context.GetRequestInt("aid", 0);
                if (aid <= 0)
                {
                    filterContext.Result = new RedirectResult("/base/PageError?type=5");
                    return;
                }
            }

            string AccountId  = Core.MiniApp.Utils.GetBuildCookieId("dz_UserCookieNew").ToString();
            Guid   _accountid = Guid.Empty;

            Guid.TryParse(AccountId, out _accountid);
            if (aid == 0 || _accountid == Guid.Empty)
            {
                filterContext.Result = new RedirectResult("/base/PageError?type=1");
                return;
            }

            XcxAppAccountRelation xcxrelation = XcxAppAccountRelationBLL.SingleModel.GetModelByaccountidAndAppid(aid, _accountid.ToString());

            if (xcxrelation == null)
            {
                filterContext.Result = new RedirectResult("/base/PageError?type=2");
                return;
            }
            if (fromPlat == 0)//表示直接从平台店铺列表添加店铺 没有主人的店铺
            {
                PlatStore store = PlatStoreBLL.SingleModel.GetModelByAId(aid);
                if (store == null)
                {
                    filterContext.Result = new RedirectResult("/base/PageError?type=2");
                    return;
                }
            }
        }
Exemple #22
0
        public static bool GetToken(string appId, ref string token)
        {
            XcxAppAccountRelation xcxrelation = XcxAppAccountRelationBLL.SingleModel.GetModelByAppid(appId);

            if (xcxrelation == null)
            {
                token = "模板过期";
                return(false);
            }

            if (!XcxApiBLL.SingleModel.GetToken(xcxrelation, ref token))
            {
                return(false);
            }

            return(true);
        }
Exemple #23
0
        /// <summary>
        /// 获取积分活动列表数据
        /// </summary>
        /// <param name="appId"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public ActionResult GetExchangeActivityList(int appId, int pageIndex = 1, int pageSize = 10)
        {
            if (appId <= 0)
            {
                return(Json(new { isok = false, msg = "appId非法" }, JsonRequestBehavior.AllowGet));
            }
            if (dzaccount == null)
            {
                return(Json(new { isok = false, msg = "登录信息超时" }, JsonRequestBehavior.AllowGet));
            }
            XcxAppAccountRelation xcx = XcxAppAccountRelationBLL.SingleModel.GetModelByaccountidAndAppid(appId, dzaccount.Id.ToString());

            if (xcx == null)
            {
                return(Json(new { isok = false, msg = "小程序未授权" }, JsonRequestBehavior.AllowGet));
            }

            string activityname = Context.GetRequest("activityname", string.Empty);
            string strWhere     = $"appId={appId} and isdel=0";
            int    state        = Context.GetRequestInt("state", -1);

            activityname = StringHelper.ReplaceSqlKeyword(activityname);
            if (state > -1)
            {
                strWhere += $" and state={state}";
            }
            if (!string.IsNullOrEmpty(activityname))
            {
                strWhere += $" and activityname like '%{activityname}%'";
            }

            List <ExchangeActivity> list = ExchangeActivityBLL.SingleModel.GetList(strWhere, pageSize, pageIndex, "*", "SortNumber desc,Id desc");
            int TotalCount = ExchangeActivityBLL.SingleModel.GetCount(strWhere);

            list.ForEach(x =>
            {
                List <C_Attachment> activityimgList = C_AttachmentBLL.SingleModel.GetListByCache(x.id, (int)AttachmentItemType.小程序积分活动图片);
                if (activityimgList != null && activityimgList.Count > 0)
                {
                    x.activityimg = Utility.ImgHelper.ResizeImg(activityimgList[0].filepath, 50, 50);
                }
            });

            return(Json(new { isok = true, msg = "成功", model = new { RecordCount = TotalCount, ExchangeActivityList = list } }, JsonRequestBehavior.AllowGet));
        }
Exemple #24
0
        public ActionResult getSaveMoneySetList(string appid)
        {
            if (string.IsNullOrEmpty(appid))
            {
                return(Json(new { isok = false, msg = "获取失败(appid不能为空)" }, JsonRequestBehavior.AllowGet));
            }

            XcxAppAccountRelation r = _xcxAppAccountRelationBLL.GetModel($"AppId='{appid}'");

            if (r == null)
            {
                return(Json(new { isok = false, msg = "获取失败(还未进行授权)" }, JsonRequestBehavior.AllowGet));
            }

            var list = SaveMoneySetBLL.SingleModel.getListByAppId(r.AppId, 1);

            return(Json(new { isok = true, msg = "获取成功!", saveMoneySetList = list }, JsonRequestBehavior.AllowGet));
        }
Exemple #25
0
        public ActionResult Index()
        {
            int aid = Context.GetRequestInt("appId", 0);

            if (aid <= 0)
            {
                aid = Context.GetRequestInt("aid", 0);
            }

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

            AccountRelation accountRelation = AccountRelationBLL.SingleModel.GetModelByAccountId(xcxrelation.AccountId.ToString());

            string nowTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

            RedisUtil.Set <string>(string.Format(PlatStatisticalFlowBLL._redis_PlatVisiteTimeKey, aid), nowTime);
            return(View());
        }
Exemple #26
0
        public ActionResult GetMiniAppSaveMoneySetCanAdd(int appId)
        {
            XcxAppAccountRelation app = XcxAppAccountRelationBLL.SingleModel.GetModelByaccountidAndAppid(appId, dzaccount.Id.ToString());

            if (app == null)
            {
                return(Json(new { isok = false, msg = "系统繁忙null!" }, JsonRequestBehavior.AllowGet));
            }
            //int resultInt = 0;//
            int count = SaveMoneySetBLL.SingleModel.getCountByAppId(app.AppId);

            if (count >= 20)
            {
                return(Json(new { isok = false, msg = "无法新增储值项目!您已添加了20个储值项目,已达到上限,请编辑已有的储值项目或删除部分储值项目后再进行新增。" }));
            }

            return(Json(new { isok = true, msg = "可以添加!" }));
        }
Exemple #27
0
        public ActionResult JoinExchangeActivityList(int appId = 0)
        {
            if (appId <= 0)
            {
                return(View("PageError", new Return_Msg()
                {
                    Msg = "参数错误!", code = "500"
                }));
            }
            if (dzaccount == null)
            {
                return(Redirect("/dzhome/login"));
            }
            XcxAppAccountRelation xcx = XcxAppAccountRelationBLL.SingleModel.GetModelByaccountidAndAppid(appId, dzaccount.Id.ToString());

            if (xcx == null)
            {
                return(View("PageError", new Return_Msg()
                {
                    Msg = "小程序未授权!", code = "403"
                }));
            }
            XcxTemplate xcxTemplate = XcxTemplateBLL.SingleModel.GetModel($"id={xcx.TId}");

            if (xcxTemplate == null)
            {
                return(View("PageError", new Return_Msg()
                {
                    Msg = "小程序模板不存在!", code = "500"
                }));
            }

            int versionId = 0;

            if (xcxTemplate.Type == (int)TmpType.小程序专业模板)
            {
                versionId = xcx.VersionId;
            }
            ViewBag.versionId = versionId;

            ViewBag.PageType = xcxTemplate.Type;
            ViewBag.appId    = appId;
            return(View());
        }
Exemple #28
0
        public ActionResult giveGoods(int appId, int orderId)
        {
            if (appId <= 0)
            {
                return(Json(new { isok = false, msg = "appId非法" }, JsonRequestBehavior.AllowGet));
            }
            if (dzaccount == null)
            {
                return(Json(new { isok = false, msg = "登录信息超时" }, JsonRequestBehavior.AllowGet));
            }
            XcxAppAccountRelation xcx = XcxAppAccountRelationBLL.SingleModel.GetModelByaccountidAndAppid(appId, dzaccount.Id.ToString());

            if (xcx == null)
            {
                return(Json(new { isok = false, msg = "小程序未授权" }, JsonRequestBehavior.AllowGet));
            }

            ExchangeActivityOrder model = ExchangeActivityOrderBLL.SingleModel.GetModel($"Id={orderId} and appId={appId}");

            if (model == null)
            {
                return(Json(new { isok = false, msg = "数据不存在" }, JsonRequestBehavior.AllowGet));
            }
            if (model.state != 2)
            {
                return(Json(new { isok = false, msg = "状态错误" }, JsonRequestBehavior.AllowGet));
            }

            if (model.Way != 0)
            {
                model.state = 4;
            }
            else
            {
                model.state = 3;
            }


            if (ExchangeActivityOrderBLL.SingleModel.Update(model, "state"))
            {
                return(Json(new { isok = true, msg = "发货成功!" }, JsonRequestBehavior.AllowGet));
            }
            return(Json(new { isok = false, msg = "发货异常" }, JsonRequestBehavior.AllowGet));
        }
Exemple #29
0
        /// <summary>
        /// 保存值班信息
        /// </summary>
        /// <param name="rotaInfo"></param>
        /// <returns></returns>
        public ActionResult SaveRotaInfo(Rota rotaInfo)
        {
            if (rotaInfo.aid <= 0)
            {
                return(Json(new { isok = false, msg = "系统繁忙appid_null" }, JsonRequestBehavior.AllowGet));
            }
            if (dzaccount == null)
            {
                return(Json(new { isok = false, msg = "系统繁忙auth_null" }));
            }
            XcxAppAccountRelation appAcountRelation = XcxAppAccountRelationBLL.SingleModel.GetModelByaccountidAndAppid(rotaInfo.aid, dzaccount.Id.ToString());

            if (appAcountRelation == null)
            {
                return(Json(new { isok = false, msg = "系统繁忙relation_null" }));
            }
            FootBath storeModel = FootBathBLL.SingleModel.GetModel($"appId={rotaInfo.aid}");

            if (storeModel == null)
            {
                return(Json(new { isok = false, msg = "系统繁忙model_null" }));
            }
            if (rotaInfo.Id <= 0)
            {
                return(Json(new { isok = false, msg = "系统繁忙rotaId_null" }));
            }
            Rota model = RotaBLL.SingleModel.GetModelById(rotaInfo.aid, rotaInfo.Id);

            if (model == null)
            {
                return(Json(new { isok = false, msg = "系统繁忙rota_null" }));
            }
            model.monday   = RotaBLL.SingleModel.GetDayStr(rotaInfo.mondayState);
            model.tuesday  = RotaBLL.SingleModel.GetDayStr(rotaInfo.tuesdayState);
            model.wensday  = RotaBLL.SingleModel.GetDayStr(rotaInfo.wensdayState);
            model.thursday = RotaBLL.SingleModel.GetDayStr(rotaInfo.thursdayState);
            model.friday   = RotaBLL.SingleModel.GetDayStr(rotaInfo.fridayState);
            model.saturday = RotaBLL.SingleModel.GetDayStr(rotaInfo.saturdayState);
            model.sunday   = RotaBLL.SingleModel.GetDayStr(rotaInfo.sundayState);
            bool   isok = RotaBLL.SingleModel.Update(model, "monday,tuesday,wensday,thursday,friday,saturday,sunday");
            string msg  = isok ? "保存成功" : "保存失败";

            return(Json(new { isok = isok, msg = msg }));
        }
Exemple #30
0
        public ActionResult DelMiniAppNews(int appId, int Id)
        {
            if (dzaccount == null)
            {
                return(Json(new { isok = false, msg = "请先登录" }));
            }

            if (appId <= 0)
            {
                return(Json(new { isok = false, msg = "系统繁忙appid_null" }));
            }
            XcxAppAccountRelation umodel = XcxAppAccountRelationBLL.SingleModel.GetModel(appId);

            if (umodel == null)
            {
                return(Json(new { isok = false, msg = "权限表里没有该数据" }));
            }

            if (umodel.AccountId != dzaccount.Id)
            {
                return(Json(new { isok = false, msg = "不能随便跨账号越权" }));
            }

            if (umodel.Id != 281)
            {
                return(Json(new { isok = false, msg = "你不是管理员不能删除" }));
            }

            NewsGw model = NewsGwBLL.SingleModel.GetModel(Id);

            if (model == null)
            {
                return(Json(new { isok = false, msg = "数据不存在!" }));
            }
            model.State = 0;
            if (NewsGwBLL.SingleModel.Update(model))
            {
                return(Json(new { isok = true, msg = "删除成功!" }));
            }
            else
            {
                return(Json(new { isok = false, msg = "删除异常!" }));
            }
        }