Commit de51c0aa authored by liudong1993's avatar liudong1993

基础配置

parent 6c9ce8e0
......@@ -10,6 +10,23 @@ namespace Mall.Model.Extend.GuideCar
/// </summary>
public class RB_GuideCar_Base_Extend : RB_GuideCar_Base
{
/// <summary>
/// 订单状态列表
/// </summary>
public List<GrudeCarStateModel> OrderStateList { get; set; }
}
/// <summary>
/// 司导订单状态
/// </summary>
public class GrudeCarStateModel {
/// <summary>
/// id
/// </summary>
public int Id { get; set; }
/// <summary>
/// 状态名称
/// </summary>
public string Name { get; set; }
}
}
......@@ -169,17 +169,49 @@ namespace Mall.Module.Product
TenantId = tenantId,
};
}
if (model.OrderStateJson == null || model.OrderStateJson == "") {
if (model.OrderStateJson == null || model.OrderStateJson == "" || model.OrderStateJson == "[]")
{
var list = EnumHelper.GetEnumList(typeof(Common.Enum.Goods.OrderStatusEnum));
//list.OrderBy(x => Convert.ToInt32(x.Value)).Select(x => new
//{
// Name = x.Key,
// Id = Convert.ToInt32(x.Value)
//}))
model.OrderStateList = list.OrderBy(x => Convert.ToInt32(x.Value)).Select(x => new GrudeCarStateModel
{
Name = x.Key,
Id = Convert.ToInt32(x.Value)
}).ToList();
}
else {
model.OrderStateList = JsonConvert.DeserializeObject<List<GrudeCarStateModel>>(model.OrderStateJson);
}
return model;
}
/// <summary>
/// 保存
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public bool SetGuideCarInfo(RB_GuideCar_Base_Extend demodel)
{
var model = guideCar_BaseRepository.GetList(new RB_GuideCar_Base_Extend() { TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId }).FirstOrDefault();
if (model == null)
{
return guideCar_BaseRepository.Insert(demodel);
}
else {
model.UpdateBy = demodel.UpdateBy;
model.AdvanceDay = demodel.AdvanceDay;
model.CancelHour = demodel.CancelHour;
model.CostPrice = demodel.CostPrice;
model.InsuranceDescription = demodel.InsuranceDescription;
model.InsuranceName = demodel.InsuranceName;
model.IsConfirm = demodel.IsConfirm;
model.OrderStateJson = demodel.OrderStateJson;
model.PagePath = demodel.PagePath;
model.SalePrice = demodel.SalePrice;
model.UpdateDate = demodel.UpdateDate;
return guideCar_BaseRepository.Update(model);
}
}
#endregion
......
......@@ -16,6 +16,7 @@ using Newtonsoft.Json.Linq;
using Mall.Common;
using Mall.Module.Product;
using Mall.AOP;
using Mall.Model.Extend.GuideCar;
namespace Mall.WebApi.Controllers.MallBase
{
......@@ -38,10 +39,41 @@ namespace Mall.WebApi.Controllers.MallBase
var req = RequestParm;
var model = guideCarModule.GetGuideCarInfo(req.TenantId, req.MallBaseId);
return ApiResult.Success("", model);
}
/// <summary>
/// 保存司导专区配置
/// </summary>
/// <returns></returns>
public ApiResult SetGuideCarInfo() {
var req = RequestParm;
RB_GuideCar_Base_Extend demodel = JsonConvert.DeserializeObject<RB_GuideCar_Base_Extend>(req.msg.ToString());
return ApiResult.Success();
if (string.IsNullOrEmpty(demodel.PagePath)) {
return ApiResult.ParamIsNull("请输入详情页面链接地址");
}
demodel.OrderStateJson = "";
if (demodel.OrderStateList != null && demodel.OrderStateList.Any()) {
demodel.OrderStateJson = JsonConvert.SerializeObject(demodel.OrderStateList);
}
demodel.TenantId = req.TenantId;
demodel.MallBaseId = req.MallBaseId;
demodel.UpdateBy = req.EmpId;
demodel.CreateDate = DateTime.Now;
demodel.UpdateDate = DateTime.Now;
bool flag = guideCarModule.SetGuideCarInfo(demodel);
if (flag)
{
return ApiResult.Success();
}
else {
return ApiResult.Failed();
}
}
#endregion
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment