Example #1
0
        public object JumpShopBranch(long branchId)
        {
            var branch = ShopBranchApplication.GetShopBranchById(branchId);

            if (branch.ShopId != CurrentUser.ShopId)
            {
                return(ErrorResult("非法操作,非所属门店。"));//越权至非当前商家的门店
            }
            if (!branch.EnableSellerManager)
            {
                return(ErrorResult("门店未开启商家管理"));
            }
            var manager = ShopBranchApplication.GetShopBranchManagerByShopBranchId(branch.Id);
            var userkey = UserCookieEncryptHelper.Encrypt(manager.Id, CookieKeysCollection.USERROLE_USER);

            return(new { success = true, userKey = userkey });
        }
Example #2
0
        /// <summary>
        /// 订单核销
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public string Consume(HttpContext context)
        {
            string  bizcontent = context.Request["bizcontent"];
            JObject jo         = (JObject)JsonConvert.DeserializeObject(bizcontent);
            string  orderId    = GetJObjectValue <string>(jo, "PlatOrderNo");
            string  pickcode   = GetJObjectValue <string>(jo, "VerifyCode");
            string  brachId    = GetJObjectValue <string>(jo, "StoreId");
            string  branchName = GetJObjectValue <string>(jo, "HXVerifyWay");
            string  userName   = "";

            if (string.IsNullOrWhiteSpace(pickcode))
            {
                throw new HimallApiException("该核销码无效");
            }
            var order = Application.OrderApplication.GetOrderByPickCode(pickcode);

            if (order == null)
            {
                throw new HimallApiException("该核销码无效");
            }
            var manager = ShopBranchApplication.GetShopBranchManagerByShopBranchId(order.ShopBranchId);

            if (manager != null)
            {
                userName = manager.UserName;
            }
            if (order.OrderStatus == Entities.OrderInfo.OrderOperateStatus.Finish && order.DeliveryType == CommonModel.DeliveryType.SelfTake)
            {
                throw new HimallApiException("该提货码于" + order.FinishDate.ToString() + "已核销");
            }
            if (order.OrderStatus != Entities.OrderInfo.OrderOperateStatus.WaitSelfPickUp)
            {
                throw new HimallApiException("只有待自提的订单才能进行核销");
            }
            Application.OrderApplication.ShopBranchConfirmOrder(order.Id, order.ShopBranchId, userName + "【网店管家】");
            StringBuilder sb = new StringBuilder();

            sb.Append("{");
            sb.Append("\"code\":" + "\"10000\"");
            sb.Append(",\"message\":" + "\"SUCCESS\"");
            sb.Append("}");
            return(sb.ToString());
        }
        protected override bool CheckContact(string contact, out string errorMessage)
        {
            errorMessage = string.Empty;
            var shopBranch = ShopBranchApplication.GetShopBranchByContact(contact);

            if (shopBranch == null)
            {
                return(false);
            }

            var manager = ShopBranchApplication.GetShopBranchManagerByShopBranchId(shopBranch.Id);

            if (manager == null)
            {
                return(false);
            }
            ;
            Cache.Insert(_encryptKey + contact, string.Format("{0}:{1:yyyyMMddHHmmss}", manager.Id, manager.CreateDate), DateTime.Now.AddHours(1));
            return(true);
        }
        protected override bool CheckContact(string contact, out string errorMessage)
        {
            errorMessage = string.Empty;
            var shopBranch = ShopBranchApplication.GetShopBranchByContact(contact);

            if (shopBranch == null)
            {
                return(false);
            }

            var managers = ShopBranchApplication.GetShopBranchManagerByShopBranchId(shopBranch.Id);

            if (managers.Count > 0)
            {
                //TODO 固定取第一个管理员,因为一个门店只有一个管理员,如果有多个管理员,应在管理员表添加联系方式字段
                var manager = managers[0];
                Cache.Insert(_encryptKey + contact, string.Format("{0}:{1:yyyyMMddHHmmss}", manager.Id, manager.CreateDate), DateTime.Now.AddHours(1));
            }

            return(managers.Count > 0);
        }