Commit ba5aa3de authored by 黄奎's avatar 黄奎

页面修改

parent deb4ee2c
......@@ -18,9 +18,6 @@ namespace Mall.Model.Entity.MarketingCenter
/// </summary>
public int ID { get; set; }
/// <summary>
/// 会员id
/// </summary>
......@@ -32,23 +29,14 @@ namespace Mall.Model.Entity.MarketingCenter
public int ActivitySurveyId { get; set; }
/// <summary>
///
/// 小程序编号
/// </summary>
public int MallBaseId
{
get;
set;
}
public int MallBaseId { get; set; }
/// <summary>
///
/// 商户编号
/// </summary>
public int TenantId
{
get;
set;
}
public int TenantId { get; set; }
/// <summary>
/// 创建时间
......@@ -60,8 +48,9 @@ namespace Mall.Model.Entity.MarketingCenter
/// </summary>
public DateStateEnum State { get; set; }
/// <summary>
/// 用户类型(1-小程序用户,2-教育学员)
/// </summary>
public int UserType { get; set; }
}
}
......@@ -424,7 +424,7 @@ namespace Mall.Module.MarketingCenter
public int SetGuestSurvey(Rb_GuestSurvey_Extend model)
{
var trans = guestSurveyRepository.DbTransaction;
int surveyId = 0;
int surveyId;
try
{
......@@ -460,7 +460,7 @@ namespace Mall.Module.MarketingCenter
public bool SetBbatchGuestSurvey(List<Rb_GuestSurvey_Extend> list)
{
var trans = guestSurveyRepository.DbTransaction;
int surveyId = 0;
int surveyId;
try
{
foreach (var itemModel in list)
......@@ -496,9 +496,9 @@ namespace Mall.Module.MarketingCenter
/// </summary>
/// <param name="where"></param>
/// <returns></returns>
public List<Rb_GuestSurvey_Extend> GetGuestSurveyList(Rb_GuestSurvey_Extend where)
public List<Rb_GuestSurvey_Extend> GetGuestSurveyListModule(Rb_GuestSurvey_Extend where)
{
return guestSurveyRepository.GetList(where);
return guestSurveyRepository.GetGuestSurveyListRepository(where);
}
......
......@@ -20,7 +20,7 @@ namespace Mall.Repository.MarketingCenter
/// </summary>
/// <param name="where"></param>
/// <returns></returns>
public List<Rb_GuestSurvey_Extend> GetList(Rb_GuestSurvey_Extend where)
public List<Rb_GuestSurvey_Extend> GetGuestSurveyListRepository(Rb_GuestSurvey_Extend where)
{
StringBuilder sb = new StringBuilder();
sb.Append($@"SELECT * from Rb_GuestSurvey where state=0");
......@@ -42,6 +42,10 @@ namespace Mall.Repository.MarketingCenter
{
sb.AppendFormat(" and ActivitySurveyId={0}", where.ActivitySurveyId);
}
if (where.UserType > 0)
{
sb.AppendFormat(" and UserType={0}", where.UserType);
}
}
return Get<Rb_GuestSurvey_Extend>(sb.ToString()).ToList();
}
......
......@@ -1140,15 +1140,18 @@ namespace Mall.WebApi.Controllers.Education
[HttpPost]
public ApiResult SetGuestSurvey()
{
var req = RequestParm;
JObject jObj = JObject.Parse(RequestParm.msg.ToString());
var userInfo = AppletUserInfo;
List<Rb_Survey_Extend> modelSurvey = JsonConvert.DeserializeObject<List<Rb_Survey_Extend>>(req.msg.ToString());
List<Rb_Survey_Extend> modelSurvey = JsonConvert.DeserializeObject<List<Rb_Survey_Extend>>(RequestParm.msg.ToString());
if (modelSurvey == null || !modelSurvey.Any())
{
return ApiResult.Failed("选项信息不能空");
}
Rb_GuestSurvey_Extend model = new Rb_GuestSurvey_Extend();
Rb_GuestSurvey_Extend model = new Rb_GuestSurvey_Extend()
{
UserType= jObj.GetInt("UserType"),
};
if ((modelSurvey.FirstOrDefault()?.ActivitySurveyId ?? 0) == 0)
{
return ApiResult.Failed("请选择活动对应的问卷信息");
......@@ -1161,7 +1164,13 @@ namespace Mall.WebApi.Controllers.Education
}
//先判断是否已添加
var GuestSurvey = surveyModule.GetGuestSurveyList(new Rb_GuestSurvey_Extend { ActivitySurveyId = modelSurvey.FirstOrDefault()?.ActivitySurveyId ?? 0, TenantId = userInfo.TenantId, MallBaseId = userInfo.MallBaseId });
var GuestSurvey = surveyModule.GetGuestSurveyListModule(new Rb_GuestSurvey_Extend
{
ActivitySurveyId = modelSurvey.FirstOrDefault()?.ActivitySurveyId ?? 0,
TenantId = userInfo.TenantId,
MallBaseId = userInfo.MallBaseId,
UserType= model.UserType,
});
if (activeSurueyModel.StartDate.HasValue && activeSurueyModel.EndDate.HasValue)
{
......@@ -1174,10 +1183,7 @@ namespace Mall.WebApi.Controllers.Education
return ApiResult.Failed("问卷调查活动已结束");
}
}
//if (activeSurueyModel.SurveyNum != -1 && activeSurueyModel.SurveyNum <= GuestSurvey.Count())
//{
// return ApiResult.Failed(activeSurueyModel.SurveyNum + "份问卷调查已填写完");
//}
if (GuestSurvey.Where(x => x.UserId == userInfo.UserId).Count() > 0)
{
return ApiResult.Failed("请勿重复参与问卷调查");
......@@ -1250,19 +1256,10 @@ namespace Mall.WebApi.Controllers.Education
}
model.SurveyOptionsList.Add(modelSurveyOptions);
}
int flag = surveyModule.SetGuestSurvey(model);
if (flag > 0)
{
return ApiResult.Success();
}
else
return ApiResult.Failed("问卷调查提交失败");
return flag > 0 ? ApiResult.Success() : ApiResult.Failed("问卷调查提交失败");
}
/// <summary>
/// 获取会员调查问题列表
/// </summary>
......@@ -1280,7 +1277,7 @@ namespace Mall.WebApi.Controllers.Education
return ApiResult.Failed("问卷调查活动不存在");
}
//先判断是否已添加
var GuestSurvey = surveyModule.GetGuestSurveyList(new Rb_GuestSurvey_Extend { ActivitySurveyId = model.ActivitySurveyId, TenantId = userInfo.TenantId, MallBaseId = userInfo.MallBaseId });
var GuestSurvey = surveyModule.GetGuestSurveyListModule(new Rb_GuestSurvey_Extend { ActivitySurveyId = model.ActivitySurveyId, TenantId = userInfo.TenantId, MallBaseId = userInfo.MallBaseId });
int isEnd = 0;
if (activeSurueyModel.StartDate.HasValue && activeSurueyModel.EndDate.HasValue)
......@@ -1974,15 +1971,13 @@ namespace Mall.WebApi.Controllers.Education
}
}
/// <summary>
/// 取消报名
/// </summary>
/// <returns></returns>
public ApiResult CancelCommerceConsult()
{
bool flag = false;
bool flag;
JObject jObj = JObject.Parse(RequestParm.msg.ToString());
var ActivityId = jObj.GetInt("ActivityId");
var Id = jObj.GetInt("Id");
......@@ -2381,7 +2376,8 @@ namespace Mall.WebApi.Controllers.Education
{
return ApiResult.Failed("未查询到您正在学习的课程,无法绑定信息");
}
if (courseId == 1) {
if (courseId == 1)
{
StuIsEmp = 1;//内部人员
}
}
......@@ -2764,7 +2760,7 @@ namespace Mall.WebApi.Controllers.Education
[RateValve(Policy = Policy.Ip, Limit = 10, Duration = 60)]
public ApiResult CancelCommerceConsultJXH()
{
bool flag = false;
bool flag;
JObject jObj = JObject.Parse(RequestParm.msg.ToString());
var ActivityId = jObj.GetInt("ActivityId");
var Id = jObj.GetInt("Id");
......
......@@ -28,11 +28,12 @@ namespace Mall.WebApi.Controllers.MarketingCenter
/// <summary>
/// 处理类对象
/// </summary>
private SurveyModule module = new SurveyModule();
private readonly SurveyModule module = new SurveyModule();
/// <summary>
/// 处理类对象
/// </summary>
private Module.User.UserModule userModule = new Module.User.UserModule();
private readonly Module.User.UserModule userModule = new Module.User.UserModule();
#region 问卷活动调查
......@@ -229,7 +230,7 @@ namespace Mall.WebApi.Controllers.MarketingCenter
model.SurveyOptionsList = module.GetSurveyOptionsList(new Rb_SurveyOptions_Extend { SurveyID = model.ID });
bool result = module.DelSurvey(model);
return ApiResult.Success("删除成功");
return result ? ApiResult.Success("删除成功!") : ApiResult.Failed("删除失败!");
}
return ApiResult.Failed("未找到此调查信息");
}
......
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