Ejemplo n.º 1
0
        //添加团信息
        public bool AddGroupGoods(GroupGoodsDetail request)
        {
            var param    = Mapper.Map <GroupGoodsDetail, AddGroupGoodsRequest>(request);
            var response = MKMSClient.Send <AddGroupGoodsResponse>(param);

            return(response.DoFlag);
        }
Ejemplo n.º 2
0
        //更新商品信息
        public bool UpdateGroupGoods(GroupGoodsDetail request)
        {
            var upd = new UpdateGroupInfo();

            upd.SysNo    = request.SysNo;
            upd.UpdateTo = request;
            var param    = Mapper.Map <UpdateGroupInfo, UpdateGroupGoodsRequest>(upd);
            var response = MKMSClient.Send <UpdateGroupGoodsResponse>(param);

            return(response.DoFlag);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public JsonResult BargainGroupUpdate(GroupGoodsDetail model)
        {
            var result = new BaseResponse()
            {
                DoFlag   = false,
                DoResult = "更新失败 ,请稍后重试……"
            };

            #region 参数验证
            if (string.IsNullOrEmpty(model.GoodsDes))
            {
                result.DoResult = "请正确填写商品描述";
                return(Json(result));
            }
            if (string.IsNullOrEmpty(model.PicUrl))
            {
                result.DoResult = "请正确填写图片地址";
                return(Json(result));
            }
            if (!model.GroupPrice.HasValue)
            {
                result.DoResult = "请正确填写商品价格";
                return(Json(result));
            }
            if (!model.SetJianGroupCount.HasValue)
            {
                result.DoResult = "请正确填写建团数";
                return(Json(result));
            }

            if ((model.GroupPrice ?? 0) <= 0)
            {
                result.DoResult = "商品价格必须大于0";
                return(Json(result));
            }
            if ((model.SetCanGroupCount ?? 0) <= 0)
            {
                result.DoResult = "设置成团人数必须大于0";
                return(Json(result));
            }
            if ((model.SetJianGroupCount ?? 0) <= 0)
            {
                result.DoResult = "设置建团总数必须大于0";
                return(Json(result));
            }


            //if (model.SetJianGroupCount > 1000)
            //{
            //    result.DoResult = "建团数不能超过1000";
            //    return Json(result);
            //}

            if (!model.StartTime.HasValue)
            {
                result.DoResult = "请正确填写开始时间";
                return(Json(result));
            }

            if (!model.EndTime.HasValue)
            {
                result.DoResult = "请正确填写结束时间";
                return(Json(result));
            }

            var actRef = BargainGroupConfigClient.Instance.QueryGroupActivity(new GroupActivityRefer()
            {
                SearchDetail = new GroupActivityDetail()
                {
                    SysNo = model.GroupActivitySysNo
                }
            });

            var actModel = actRef.List2.First();
            if (model.StartTime < actModel.StartTime)
            {
                result.DoResult = "商品开始时间必须大于活动开始时间" + actModel.StartTime;
                return(Json(result));
            }
            if (model.EndTime > actModel.EndTime)
            {
                result.DoResult = "商品结束时间必须小于活动结束时间" + actModel.EndTime;
                return(Json(result));
            }


            if (!model.Sort.HasValue)
            {
                result.DoResult = "请正确填写排序值";
                return(Json(result));
            }

            if (string.IsNullOrEmpty(model.PromSysNos))
            {
                result.DoResult = "请正确填写促销ID";
                return(Json(result));
            }

            if (!model.GroupActivitySysNo.HasValue)
            {
                result.DoResult = "请正确填活动SysNo";
                return(Json(result));
            }
            if (string.IsNullOrEmpty(model.PingPlayDesc))
            {
                result.DoResult = "拼团玩法图片地址必填";
                return(Json(result));
            }
            if (string.IsNullOrEmpty(model.ZeroPayDesc) && !string.IsNullOrEmpty(model.ZeroPayUserLabel))
            {
                result.DoResult = "当商品支持一元购时,一元购规则图片地址必填";
                return(Json(result));
            }
            if (string.IsNullOrEmpty(model.ZeroPayDesc))
            {
                model.ZeroPayDesc = "";
            }
            if (model.NoJoinUserLabel == "null")
            {
                model.NoJoinUserLabel = "";
            }
            if (model.ZeroPayUserLabel == "null")
            {
                model.ZeroPayUserLabel = "";
            }

            #endregion
            try
            {
                var refer = new GroupActivityRefer();
                refer.SearchDetail.SysNo = model.GroupActivitySysNo;
                var activity = BargainGroupConfigClient.Instance.QueryGroupActivity(refer);
                if (activity.List2 == null || !activity.List2.Any())
                {
                    result.DoResult = "活动SysNo 不存在";
                    return(Json(result));
                }
                var flag = BargainGroupConfigClient.Instance.UpdateGroupGoods(model);
                if (flag)
                {
                    result.DoFlag   = true;
                    result.DoResult = "更新成功";
                }
            }
            catch (Exception ex)
            {
                result.DoResult = "更新异常";
            }
            return(Json(result));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public JsonResult BargainGroupAdd(GroupGoodsDetail model)
        {
            var result = new BaseResponse()
            {
                DoFlag = false, DoResult = "添加失败,请稍后重试... ..."
            };

            #region 参数验证

            if (string.IsNullOrEmpty(model.PicUrl))
            {
                result.DoResult = "请正确填写图片地址";
                return(Json(result));
            }
            if (!model.GoodsId.HasValue)
            {
                result.DoResult = "请正确填写商品ID";
                return(Json(result));
            }

            if (string.IsNullOrEmpty(model.GoodsName))
            {
                result.DoResult = "没有商品名称";
                return(Json(result));
            }

            if (!model.VipPrice.HasValue)
            {
                result.DoResult = "没有商品原价";
                return(Json(result));
            }

            if (string.IsNullOrEmpty(model.GoodsDes))
            {
                result.DoResult = "请正确填写商品描述";
                return(Json(result));
            }

            if (!model.GroupPrice.HasValue)
            {
                result.DoResult = "请正确填写商品价格";
                return(Json(result));
            }

            if (!model.SetCanGroupCount.HasValue)
            {
                result.DoResult = "请正确填写参团人数";
                return(Json(result));
            }

            if (!model.SetJianGroupCount.HasValue)
            {
                result.DoResult = "请正确填写建团数";
                return(Json(result));
            }

            if ((model.GroupPrice ?? 0) <= 0)
            {
                result.DoResult = "商品价格必须大于0";
                return(Json(result));
            }
            if ((model.SetCanGroupCount ?? 0) <= 0)
            {
                result.DoResult = "设置成团人数必须大于0";
                return(Json(result));
            }
            if ((model.SetJianGroupCount ?? 0) <= 0)
            {
                result.DoResult = "设置建团总数必须大于0";
                return(Json(result));
            }
            //if (model.SetJianGroupCount > 1000)
            //{
            //    result.DoResult = "建团数不能超过1000";
            //    return Json(result);
            //}

            if (!model.StartTime.HasValue)
            {
                result.DoResult = "请正确填写开始时间";
                return(Json(result));
            }

            if (!model.EndTime.HasValue)
            {
                result.DoResult = "请正确填写结束时间";
                return(Json(result));
            }

            var actRef = BargainGroupConfigClient.Instance.QueryGroupActivity(new GroupActivityRefer()
            {
                SearchDetail = new GroupActivityDetail()
                {
                    SysNo = model.GroupActivitySysNo
                }
            });
            var actModel = actRef.List2.First();
            if (model.StartTime < actModel.StartTime)
            {
                result.DoResult = "商品开始时间必须大于活动开始时间" + actModel.StartTime;
                return(Json(result));
            }
            if (model.EndTime > actModel.EndTime)
            {
                result.DoResult = "商品结束时间必须小于活动结束时间" + actModel.EndTime;
                return(Json(result));
            }

            if (!model.Sort.HasValue)
            {
                result.DoResult = "请正确填写排序值";
                return(Json(result));
            }

            if (string.IsNullOrEmpty(model.PromSysNos))
            {
                result.DoResult = "请正确填写促销ID";
                return(Json(result));
            }
            if (!model.GroupActivitySysNo.HasValue)
            {
                result.DoResult = "请正确填活动SysNo";
                return(Json(result));
            }
            if (string.IsNullOrEmpty(model.PingPlayDesc))
            {
                result.DoResult = "拼团玩法图片地址必填";
                return(Json(result));
            }
            if (string.IsNullOrEmpty(model.ZeroPayDesc) && !string.IsNullOrEmpty(model.ZeroPayUserLabel))
            {
                result.DoResult = "当商品支持一元购时,一元购规则图片地址必填";
                return(Json(result));
            }


            if (!model.IsDelete.HasValue)
            {
                model.IsDelete = false;
            }
            if (!model.IsEnable.HasValue)
            {
                model.IsEnable = true;
            }

            model.CreatePeople = UserInfo.UserSysNo;
            model.CreateTime   = DateTime.Now;

            model.JianGroupCount = 0;
            #endregion

            //新增
            try
            {
                var refer = new GroupGoodsRefer();
                refer.SearchDetail.GoodsId            = model.GoodsId;
                refer.SearchDetail.GroupActivitySysNo = model.GroupActivitySysNo;
                var item = BargainGroupConfigClient.Instance.QueryGroupGoodsPageList(refer);
                if (item.List2 != null && item.List2.Any())
                {
                    result.DoResult = "添加的商品ID 已存在";
                    return(Json(result));
                }
                var gr = new GroupActivityRefer();
                gr.SearchDetail.SysNo = model.GroupActivitySysNo;
                var activity = BargainGroupConfigClient.Instance.QueryGroupActivity(gr);
                if (activity.List2 == null || !activity.List2.Any())
                {
                    result.DoResult = "活动SysNo 不存在";
                    return(Json(result));
                }

                result.DoFlag = BargainGroupConfigClient.Instance.AddGroupGoods(model);
            }
            catch (Exception ex)
            {
                result.DoResult = "添加异常,请稍后重试... ...";
            }

            return(Json(result));
        }