コード例 #1
0
        /// <summary>
        /// 申请通过处理
        /// </summary>
        /// <param name="apply"></param>
        /// <param name="store"></param>
        /// <returns></returns>
        public bool ApplySuccess(PinRefundApply apply, PinStore store, ref string msg)
        {
            bool result = false;

            if (apply.type == 2 || apply.type == 3)
            {
                if (string.IsNullOrEmpty(store.setting.place) || string.IsNullOrEmpty(store.setting.phone) || string.IsNullOrEmpty(store.setting.name))
                {
                    msg = "请前往店铺配置设置您的退换货寄件信息";
                    return(result);
                }
            }
            PinGoodsOrderBLL orderBLL = new PinGoodsOrderBLL();

            PinGoodsOrder order = orderBLL.GetModel(apply.orderId);

            if (order == null)
            {
                msg = "订单不存在";
                return(result);
            }
            order.state        = apply.orderState;
            order.returnCount += apply.count;
            order.state        = order.returnCount == order.count ? order.state = (int)PinOrderState.交易取消 : order.state = apply.orderState;
            orderBLL.Update(order, "state,returncount,state");
            PinGroupBLL.SingleModel.RollbackEntrantCount(order, ref msg);
            result = Update(apply, "state,updatetime");
            return(result);
        }
コード例 #2
0
        /// <summary>
        /// 申请不通过处理
        /// </summary>
        /// <param name="apply"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public bool ApplyFail(PinRefundApply apply, ref string msg)
        {
            bool             result   = false;
            PinGoodsOrderBLL orderBLL = new PinGoodsOrderBLL();
            PinGoodsOrder    order    = orderBLL.GetModel(apply.orderId);

            if (order == null)
            {
                msg = "订单不存在";
                return(result);
            }
            order.state = apply.orderState;
            orderBLL.Update(order, "state");
            result = Update(apply, "state,updatetime");
            return(result);
        }
コード例 #3
0
ファイル: PinGroupBLL.cs プロジェクト: soon14/vzan
        /// <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);
        }
コード例 #4
0
ファイル: PinStoreBLL.cs プロジェクト: soon14/vzan
        /// <summary>
        /// 更新商家收入
        /// </summary>
        /// <param name="group"></param>
        /// <param name="tran"></param>
        public void UpdateIncome(PinGroup group, TransactionModel tran)
        {
            PinStore store = GetModel(group.storeId);

            if (store == null)
            {
                log4net.LogHelper.WriteError(GetType(), new Exception($"门店信息不存在storeId:{group.storeId}"));
                return;
            }
            PinGoodsOrderBLL     pinGoodsOrderBLL = new PinGoodsOrderBLL();
            List <PinGoodsOrder> orderList        = pinGoodsOrderBLL.GetListByGroupId(group.id);

            if (orderList != null && orderList.Count > 0)
            {
                orderList = orderList.Where(order => order.state == (int)PinEnums.PinOrderState.交易成功 || order.state == (int)PinEnums.PinOrderState.已评价).ToList();
                if (orderList != null && orderList.Count > 0)
                {
                    foreach (var order in orderList)
                    {
                        AddIncome(order, store, tran, 1);
                    }
                }
            }
        }