示例#1
0
        public async Task <APIResult> AddExpressSingle([FromBody] AddExpressSingleModel input)
        {
            var order = db.ConglomerationOrder.Find(input.OrderId);

            if (!order.Type.Equals(ConsignmentType.快递))
            {
                return(Error("订单类型为自提"));
            }
            if (!order.Status.Equals(ShopOrderStatus.待配送))
            {
                return(Error("订单不是待配送状态"));
            }
            var express = db.ConglomerationExpress.FirstOrDefault(m => m.ShopConglomerationOrderId.Equals(input.OrderId));

            express.ExpressSingle = input.ExpressSingle;
            order.Status          = ShopOrderStatus.已完成;
            db.SaveChanges();

            #region 积分获取
            var sourceType = await ShopIntegralRechargeServer.GetOrderSourceType(db, input.OrderId, true, _logger);

            await ShopIntegralRechargeServer.GetOrderIntegral(db, input.OrderId, sourceType, _logger);

            #endregion
            return(Success());
        }
示例#2
0
        public async Task <APIResult> SetOrderStatus([FromBody] SetStatusArgsModel args)
        {
            var model = db.GetSingle <ShopOrder>(args.Id);

            if (model == null)
            {
                throw new Exception("数据库记录不存在");
            }

            //获取到订单后判断是否拥有指定的店铺的权限
            CheckShopActor(model.ShopId, ShopActorType.超级管理员);
            model.Status = args.Status;
            db.SaveChanges();
            #region 积分获取
            var sourceType = await ShopIntegralRechargeServer.GetOrderSourceType(db, args.Id, false, _logger);

            await ShopIntegralRechargeServer.GetOrderIntegral(db, args.Id, sourceType, _logger);

            #endregion
            return(Success());
        }
示例#3
0
        public async Task <APIResult> GetIntegral([FromBody] GetIntegralModel input)
        {
            if (input.SourceType != SourceType.拼团订单)
            {
                var order = await db.ShopOrders.FindAsync(input.OrderId);

                if (order.IsTakeOut)
                {
                    input.SourceType = SourceType.外卖订单;
                }
                if (order.ShopPartId.HasValue)
                {
                    input.SourceType = SourceType.扫码点餐订单;
                }
                if (order.ShopOrderSelfHelpId.HasValue)
                {
                    input.SourceType = SourceType.自助点餐订单;
                }
            }
            await ShopIntegralRechargeServer.GetOrderIntegral(db, input.OrderId, input.SourceType, _logger);

            return(await Task.FromResult(Success()));
        }