| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638 |
- using System;
- using System.Collections.Generic;
- using System.Common;
- using System.IRepositories;
- using System.Linq;
- using System.Model;
- using System.Security.Claims;
- using System.Threading.Tasks;
- using Microsoft.AspNetCore.Authorization;
- using Microsoft.AspNetCore.Mvc;
- using TVShoppingCallCenter_ZLJ.Models.Inputs;
- using SqlSugar;
- using System.Common.Helpers;
- using Microsoft.Extensions.Configuration;
- using System.Data;
- using System.Reflection;
- namespace TVShoppingCallCenter_ZLJ.Controllers.Customer
- {
- //[Authorize]
- [Produces("application/json")]
- [Route("api/[controller]")]
- public class VipInfoController : BaseController
- {
- private readonly ICus_VipInfoRepository _cus_vip_infoRepository;
- private readonly ISys_UserAccountRepository _sys_user_accountRepository;
- private readonly ICus_MsgRepository _cus_msgRepository;
- private readonly IConfiguration _configuration;
- public VipInfoController(ICus_VipInfoRepository cus_vip_infoRepository, ISys_UserAccountRepository sys_user_accountRepository, ICus_MsgRepository cus_msgRepository,IConfiguration configuration)
- {
- _cus_vip_infoRepository = cus_vip_infoRepository;
- _sys_user_accountRepository = sys_user_accountRepository;
- _cus_msgRepository = cus_msgRepository;
- _configuration = configuration;
- }
- [HttpGet]
- public IActionResult Index()
- {
- return Success("成功");
- }
- /// <summary>
- /// 获取会员列表分页
- /// </summary>
- /// <param name="keyword"></param>
- /// <param name="pageindex"></param>
- /// <param name="pagesize"></param>
- /// <returns></returns>
- [HttpGet("getlistbypage")]
- public async Task<IActionResult> GetListsByPageAsync(string keyword,string name,string phone,string type, string province,string city,string area,string town,string address,string birthday,string recommender,string saleperson,int pageindex = 1, int pagesize = 20)
- {
- List<IConditionalModel> conModels = new List<IConditionalModel>();
- #region 条件筛选
- conModels.Add(new ConditionalModel() { FieldName = "F_State", ConditionalType = ConditionalType.Equal, FieldValue = ((int)EnumDelState.Enabled).ToString() });
- if (!string.IsNullOrEmpty(phone))
- conModels.Add(new ConditionalCollections()
- {
- ConditionalList = new List<KeyValuePair<WhereType, ConditionalModel>>()
- {
- new KeyValuePair<WhereType, ConditionalModel>(WhereType.And, new ConditionalModel() { FieldName = "F_Phone", ConditionalType = ConditionalType.Like, FieldValue = phone }),
- new KeyValuePair<WhereType, ConditionalModel>( WhereType.Or , new ConditionalModel() { FieldName = "F_Mobile", ConditionalType = ConditionalType.Like, FieldValue = phone }),
- new KeyValuePair<WhereType, ConditionalModel>( WhereType.Or, new ConditionalModel() { FieldName = "F_Mobile1", ConditionalType = ConditionalType.Like, FieldValue = phone })
-
- }
- });
- if (!string.IsNullOrEmpty(name))
- {
- conModels.Add(new ConditionalModel() { FieldName = "F_Name", ConditionalType = ConditionalType.Like, FieldValue = name });
- }
- if (!string.IsNullOrEmpty(type))
- {
- conModels.Add(new ConditionalModel() { FieldName = "F_Type", ConditionalType = ConditionalType.Like, FieldValue = type });
- }
- if (!string.IsNullOrEmpty(province))
- {
- conModels.Add(new ConditionalModel() { FieldName = "F_Province", ConditionalType = ConditionalType.Like, FieldValue = province });
- }
- if (!string.IsNullOrEmpty(city))
- {
- conModels.Add(new ConditionalModel() { FieldName = "F_City", ConditionalType = ConditionalType.Like, FieldValue = city });
- }
- if (!string.IsNullOrEmpty(area))
- {
- conModels.Add(new ConditionalModel() { FieldName = "F_Area", ConditionalType = ConditionalType.Like, FieldValue = area });
- }
- if (!string.IsNullOrEmpty(town))
- {
- conModels.Add(new ConditionalModel() { FieldName = "F_Town", ConditionalType = ConditionalType.Like, FieldValue = town });
- }
- if (!string.IsNullOrEmpty(address))
- {
- conModels.Add(new ConditionalModel() { FieldName = "F_Address", ConditionalType = ConditionalType.Like, FieldValue = address });
- new KeyValuePair<WhereType, ConditionalModel>(WhereType.Or, new ConditionalModel() { FieldName = "F_Address1", ConditionalType = ConditionalType.Like, FieldValue = address });
- }
- if (!string.IsNullOrEmpty(birthday))
- {
- conModels.Add(new ConditionalModel() { FieldName = "F_Birthday", ConditionalType = ConditionalType.Equal, FieldValue = birthday });
- }
- if (!string.IsNullOrEmpty(recommender))
- {
- conModels.Add(new ConditionalModel() { FieldName = "F_Recommender", ConditionalType = ConditionalType.Like, FieldValue = recommender });
- }
- if (!string.IsNullOrEmpty(saleperson))
- {
- conModels.Add(new ConditionalModel() { FieldName = "F_Saleperson", ConditionalType = ConditionalType.Like, FieldValue = saleperson });
- }
- //if (!string.IsNullOrEmpty(contact))
- //{
- // conModels.Add(new ConditionalModel() { FieldName = "F_Contact", ConditionalType = ConditionalType.Like, FieldValue = contact });
- //}
- #endregion
- int recordCount = 0;
- var list = await _cus_vip_infoRepository.GetListViewByPage(conModels, new MyPageModel() { PageIndex = pageindex, PageSize = pagesize, PageCount = recordCount }, "F_CreateOn desc");
- var obj = new
- {
- state = "success",
- message = "成功",
- rows = list,
- total = recordCount,
- };
- return Content(obj.ToJson());
- }
- /// <summary>
- /// 获取会员信息详情
- /// </summary>
- /// <param name="id">id</param>
- /// <returns></returns>
- [HttpGet("getdetails")]
- public async Task<IActionResult> GetDetailsAsync(int id)
- {
- if (id <= 0)
- return Error("参数错误");
- var model = await _cus_vip_infoRepository.GetSingleV(x => x.F_ID == id && x.F_State == (int)EnumDelState.Enabled);
- var newmodel = new V_Cus_VipInfo();
- if (model == null)
- {
- return Error("获取失败");
- }
- return Success("获取成功!", model);
- }
- /// <summary>
- /// 添加会员
- /// </summary>
- /// <param name="input"></param>
- /// <returns></returns>
- [HttpPost("add")]
- public async Task<IActionResult> AddAsync(VipInfoInput input)
- {
- if (string.IsNullOrEmpty(input.name))
- return Error("请输入名字");
- if (string.IsNullOrEmpty(input.phone))
- return Error("请输入联系方式");
- var model = new T_Cus_VipInfo();
- //model.F_VIPCode = input.vipcode;//会员卡号
- model.F_Name = input.name;
- model.F_Birthday = input.birthday;
- model.F_Phone = input.phone;
- model.F_Recommender = input.recommender;
- model.F_Sex = input.sex;
- model.F_Label = input.label;
- model.F_Note = input.note;
- model.F_City = input.city;
- model.F_Nickname = input.nickname;
- model.F_Address = input.address;
- model.F_Address1 = input.address1;
- model.F_Age = input.age;
- model.F_Mobile = input.mobile;
- model.F_Mobile1 = input.mobile1;
- model.F_Province = input.province;
- model.F_Area = input.area;
- model.F_Town = input.town;
- model.F_Postcode = input.postcode;
- model.F_Province1 = input.province1;
- model.F_Area1 = input.area1;
- model.F_Town1 = input.town1;
- model.F_Postcode1 = input.postcode1;
- model.F_City1 = input.city1;
- model.F_ShoeSize = input.shoesize;
- model.F_Score = input.score;
- model.F_Money = input.money;
- model.F_TotalScore = input.totalscore;
- model.F_Saleperson = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value; //"8000";input.saleperson;
- model.F_Type = input.type;
- model.F_CreateBy = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value; //"8000";
- model.F_CreateOn = DateTime.Now;
- model.F_State = (int)EnumDelState.Enabled;
- if (await _cus_vip_infoRepository.GetCount(x => x.F_Mobile == model.F_Mobile && x.F_Name == input.name) > 0)
- {
- return Error("添加失败,存在相同会员信息");
- }
- var res = await _cus_vip_infoRepository.Add(model);
- if (res > 0)
- {
- return Success("添加成功");
- }
- else
- {
- return Error("添加失败");
- }
- }
- /// <summary>
- /// 修改会员信息
- /// </summary>
- [HttpPost("update")]
- public async Task<IActionResult> UpdateAsync(VipInfoInput input)
- {
- if (string.IsNullOrEmpty(input.name))
- return Error("请输入名字");
- if (string.IsNullOrEmpty(input.phone))
- return Error("请输入联系方式");
- var model = await _cus_vip_infoRepository.GetSingle(x => x.F_ID == input.id && x.F_State == (int)EnumDelState.Enabled);
- if (model == null)
- return Error("操作失败");
- //model.F_VIPCode = input.vipcode;//会员卡号
- model.F_Name = input.name;
- model.F_Birthday = input.birthday;
- model.F_Phone = input.phone;
- model.F_Recommender = input.recommender;
- model.F_Sex = input.sex;
- model.F_Label = input.label;
- model.F_State = input.state;
- model.F_Note = input.note;
- model.F_City = input.city;
- model.F_Nickname = input.nickname;
- model.F_Address = input.address;
- model.F_Address1 = input.address1;
- model.F_LastModifyOn = DateTime.Now.ToLocalTime();
- model.F_LastModifyBy = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value;
- model.F_Age = input.age;
- model.F_Mobile = input.mobile;
- model.F_Mobile1 = input.mobile1;
- model.F_Province = input.province;
- model.F_Area = input.area;
- model.F_Town = input.town;
- model.F_Postcode = input.postcode;
- model.F_Province1 = input.province1;
- model.F_Area1 = input.area1;
- model.F_Town1 = input.town1;
- model.F_Postcode1 = input.postcode1;
- model.F_City1 = input.city1;
- model.F_ShoeSize = input.shoesize;
- model.F_Score = input.score;
- model.F_Money = input.money;
- model.F_TotalScore = input.totalscore;
- //model.F_Saleperson = input.saleperson;
- //model.F_Contact = input.contact;
- model.F_Type = input.type;
- bool b = await _cus_vip_infoRepository.Update(model);
- if (b)
- return Success("修改成功");
- return Error("修改失败");
- }
- /// <summary>
- /// 删除会员信息 by ids
- /// </summary>
- /// <param name="ids"></param>
- /// <returns></returns>
- [HttpPost("delete")]
- public async Task<IActionResult> Remove(int[] ids)
- {
- var res = 0;
- if (ids != null && ids.Length > 0)
- {
- foreach (var item in ids)
- {
- var ml = await _cus_vip_infoRepository.GetSingle(x => x.F_ID == item);
- ml.F_State = (int)EnumDelState.Delete;
- ml.F_DeleteOn = DateTime.Now.ToLocalTime();
- ml.F_DeleteBy = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value;
- if (_cus_vip_infoRepository.Update(ml).Result)
- res += 1;
- }
- if (res == ids.Length)
- return Success("删除成功");
- else if (res > 0 && res < ids.Length)
- return Error("部分删除失败,请查看后重新操作");
- else
- return Error("删除失败,请查看后重新操作");
- }
- else
- return Error("请选择要删除的记录");
- }
- /// <summary>
- /// 转移会员信息
- /// </summary>
- /// <param name="ids"></param>
- /// <returns></returns>
- [HttpPost("transfer")]
- public async Task<IActionResult> Transfer(int[] ids,string toperson)
- {
- var res = 0;
- if (ids != null && ids.Length > 0)
- {
- foreach (var item in ids)
- {
- var ml = await _cus_vip_infoRepository.GetSingle(x => x.F_ID == item);
- if (ml != null)
- {
- #region 创建消息提醒
- string cname = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value;
- var model = new T_Cus_Msg();
- model.F_Type = 1;
- model.F_VipInfoID = item;
- model.F_ToPerson = toperson;
- model.F_State = 0;
- model.F_Notice = cname+"将"+ids .Length +"条会员档案从"+ ml.F_Saleperson+"转移给"+toperson ;
- model.F_NotifyPerson = ml.F_Saleperson;
- model.F_CreateBy = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value;
- model.F_CreateOn = DateTime.Now;
- var su = await _cus_msgRepository.Add(model);
- if (su > 0)
- {
- res += 1;
- }
- #endregion
- }
- //ml.F_Saleperson = toperson;
- //ml.F_LastModifyOn = DateTime.Now.ToLocalTime();
- //ml.F_LastModifyBy = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value;
- //if (_cus_vip_infoRepository.Update(ml).Result)
- // res += 1;
- }
- if (res == ids.Length)
- return Success("转移消息创建成功");
- else if (res > 0 && res < ids.Length)
- return Error("部分转移消息创建失败,请查看后重新操作");
- else
- return Error("转移消息创建失败,请查看后重新操作");
- }
- else
- return Error("请选择要转移的记录");
- }
- /// <summary>
- /// 转移消息处理
- /// </summary>
- /// <param name="ids"></param>
- /// <returns></returns>
- [HttpPost("deal")]
- public async Task<IActionResult> Deal(int[] ids, int notagree)//同意传0,不同意传1
- {
- var res = 0;
- if (ids != null && ids.Length > 0)
- {
- foreach (var item in ids)
- {
- var ml = await _cus_msgRepository.GetSingle(x => x.F_ID == item);
-
- if (ml != null)
- {
- #region 创建消息提醒
- //var model = new T_Cus_Msg();
- ml.F_Type = 1;
- ml.F_State = notagree +2;
- ml.F_LastModifyBy = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value;
- ml.F_LastModifyOn = DateTime.Now;
- if (_cus_msgRepository.Update(ml).Result)
- {
- if (notagree == 0)//同意转移时更新会员信息
- {
- var m = await _cus_vip_infoRepository.GetSingle(x => x.F_ID == ml.F_VipInfoID );
- m.F_Saleperson = ml.F_ToPerson ;
- m.F_LastModifyOn = DateTime.Now.ToLocalTime();
- m.F_LastModifyBy = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value;
- if (_cus_vip_infoRepository.Update(m).Result)
- { }
- }
- res += 1;
- }
- #endregion
- }
-
- }
- if (res == ids.Length)
- return Success("处理成功");
- else if (res > 0 && res < ids.Length)
- return Error("部分消息处理失败,请查看后重新操作");
- else
- return Error("处理消息失败,请查看后重新操作");
- }
- else
- return Error("请选择要处理的记录");
- }
- #region 导入、导出
- //导出
- [Authorize]
- [HttpGet("exportexcel")]
- [AllowAnonymous]
- public async Task<IActionResult> ExportExcelAsync(string keyword, string name, string phone, string type, string province, string city, string area, string town, string address, string birthday, string recommender, string saleperson)
- {
- try
- {
- List<IConditionalModel> conModels = new List<IConditionalModel>();
- #region 条件筛选
- conModels.Add(new ConditionalModel() { FieldName = "F_State", ConditionalType = ConditionalType.Equal, FieldValue = ((int)EnumDelState.Enabled).ToString() });
- if (!string.IsNullOrEmpty(phone))
- conModels.Add(new ConditionalCollections()
- {
- ConditionalList = new List<KeyValuePair<WhereType, ConditionalModel>>()
- {
- new KeyValuePair<WhereType, ConditionalModel>(WhereType.And, new ConditionalModel() { FieldName = "F_Phone", ConditionalType = ConditionalType.Like, FieldValue = phone }),
- new KeyValuePair<WhereType, ConditionalModel>( WhereType.Or , new ConditionalModel() { FieldName = "F_Mobile", ConditionalType = ConditionalType.Like, FieldValue = phone }),
- new KeyValuePair<WhereType, ConditionalModel>( WhereType.Or, new ConditionalModel() { FieldName = "F_Mobile1", ConditionalType = ConditionalType.Like, FieldValue = phone })
- }
- });
- if (!string.IsNullOrEmpty(name))
- {
- conModels.Add(new ConditionalModel() { FieldName = "F_Name", ConditionalType = ConditionalType.Like, FieldValue = name });
- }
- if (!string.IsNullOrEmpty(type))
- {
- conModels.Add(new ConditionalModel() { FieldName = "F_Type", ConditionalType = ConditionalType.Like, FieldValue = type });
- }
- if (!string.IsNullOrEmpty(province))
- {
- conModels.Add(new ConditionalModel() { FieldName = "F_Province", ConditionalType = ConditionalType.Like, FieldValue = province });
- }
- if (!string.IsNullOrEmpty(city))
- {
- conModels.Add(new ConditionalModel() { FieldName = "F_City", ConditionalType = ConditionalType.Like, FieldValue = city });
- }
- if (!string.IsNullOrEmpty(area))
- {
- conModels.Add(new ConditionalModel() { FieldName = "F_Area", ConditionalType = ConditionalType.Like, FieldValue = area });
- }
- if (!string.IsNullOrEmpty(town))
- {
- conModels.Add(new ConditionalModel() { FieldName = "F_Town", ConditionalType = ConditionalType.Like, FieldValue = town });
- }
- if (!string.IsNullOrEmpty(address))
- {
- conModels.Add(new ConditionalModel() { FieldName = "F_Address", ConditionalType = ConditionalType.Like, FieldValue = address });
- new KeyValuePair<WhereType, ConditionalModel>(WhereType.Or, new ConditionalModel() { FieldName = "F_Address1", ConditionalType = ConditionalType.Like, FieldValue = address });
- }
- if (!string.IsNullOrEmpty(birthday))
- {
- conModels.Add(new ConditionalModel() { FieldName = "F_Birthday", ConditionalType = ConditionalType.Like, FieldValue = birthday });
- }
- if (!string.IsNullOrEmpty(recommender))
- {
- conModels.Add(new ConditionalModel() { FieldName = "F_Recommender", ConditionalType = ConditionalType.Like, FieldValue = recommender });
- }
- if (!string.IsNullOrEmpty(saleperson))
- {
- conModels.Add(new ConditionalModel() { FieldName = "F_Saleperson", ConditionalType = ConditionalType.Like, FieldValue = saleperson });
- }
- #endregion
- int recordCount = 0;
- var list = await _cus_vip_infoRepository.GetListALL(conModels, "F_CreateOn desc");
- var dtNew = list.ToList();
- if (dtNew != null)
- {
- var tb = ModelConvertHelper<T_Cus_VipInfo>.ConvertListToDataTable(dtNew);
- //导出dtnew
- NPOIHelper npoi = new NPOIHelper();
- string dbkeys = _configuration["Import:vipkey"].ToString();
- string title = _configuration["Import:vipvalue"].ToString();
- string[] cols = dbkeys.Split(",");
- string[] colname = title.Split(",");
- byte[] sm = npoi.ExportToExcel1(tb, cols, colname);
- if (sm != null)
- {
- return File(sm, "application/vnd.ms-excel", "会员信息.xlsx");
- }
- else
- {
- return Error("导出失败3");
- }
- }
- return Error("导出失败2");
- //return Success("根据条件获取数据成功", tasklist);
- }
- catch (Exception ex)
- {
- //_logger.LogError(ex, "导出异常");
- return Error("导出失败1");
- }
- //return Success("导出成功");
- }
- /// <summary>
- /// 上传文件并导入数据库
- /// </summary>
- /// <returns></returns>
- [HttpPost("importexcel")]
- public async Task<IActionResult> ImportExcel( int headrow = 0)
- {
-
- //string usercode = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value;
- Microsoft.AspNetCore.Http.IFormFile _upfile = Request.Form.Files[0];
- if (!_upfile.ContentType.Equals("application/vnd.ms-excel") && !_upfile.ContentType.Equals("application/x-xls") && !_upfile.ContentType.Equals("application/x-xlsx") && !_upfile.ContentType.Equals("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") && !_upfile.ContentType.Equals("application/octet-stream"))
- return Error($"请正确上传Excel文件:file.ContentType={_upfile.ContentType}");
- NPOIHelper npoi = new NPOIHelper();
- var dtExcel = npoi.ExcelToTable1(_upfile, headrow);
- int num = dtExcel.Rows.Count;
- var cols = dtExcel.Columns;
- int colnum = cols.Count;
- string dbkeys = _configuration["Import:vipkey"].ToString();
- string title = _configuration["Import:vipvalue"].ToString();
- string[] dbcols = dbkeys.Split(",");
- string[] titlecols = title.Split(",");
- string errmsg = string.Empty;
- if (num > 0)
- {
- int index = 1;
- foreach (DataRow dr in dtExcel.Rows)
- {
- var model = new T_Cus_VipInfo();
-
- model.F_State = 1;
- //model.F_CreateBy = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value;
- model.F_CreateOn = DateTime.Now;
- var dbcolslist = dbcols.ToList();
- var titlelist = titlecols.ToList();
- Type t = model.GetType();
- PropertyInfo[] PropertyList = t.GetProperties();
- foreach (PropertyInfo item in PropertyList)
- {
- if (dbcolslist.Contains(item.Name))
- {
- Type tType = null;
- object o = dr[titlelist[dbcolslist.IndexOf(item.Name)]];
- if (item.PropertyType.FullName.Contains(typeof(DateTime).FullName))
- {
- tType= typeof(DateTime);
- }
- else if (item.PropertyType.FullName.Contains(typeof(Int64).FullName))
- {
- tType = typeof(Int64);
- }
- else if (item.PropertyType.FullName.Contains(typeof(Int32).FullName))
- {
- tType = typeof(Int32);
- }
- else if (item.PropertyType.FullName.Contains(typeof(Decimal).FullName))
- {
- tType = typeof(Decimal);
- }
- else { tType = item.PropertyType; }
- object v = null;
- if (o!=null&&o!=DBNull.Value)
- v = Convert.ChangeType(dr[titlelist[dbcolslist.IndexOf(item.Name)]].ToString(), tType);
- item.SetValue(model, v, null);
- }
- }
- int b = await _cus_vip_infoRepository.Add(model);
-
- if (b<=0)
- {
- if (!string.IsNullOrEmpty(errmsg))
- {
- errmsg = errmsg + "\r\n第" + index + "行导入失败!";
- }
- else
- {
- errmsg = "第" + index + "行导入失败!";
- }
- }
- index++;
-
- }
- }
- else
- {
- return Error("文件中无数据");
- }
- if (!string.IsNullOrEmpty(errmsg))
- {
- //删除已导入的部分
- return Error(errmsg);
- }
- return Success("导入成功");
- }
- #endregion
- /// <summary>
- /// 更新会员积分
- /// </summary>
- /// <param name="ids"></param>
- /// <returns></returns>
- [HttpPost("updatescore")]
- public async Task<IActionResult> UpdateScore(string mobile,string money)
- {
-
- if (string.IsNullOrEmpty (mobile ))
- {
-
- var ml = await _cus_vip_infoRepository.GetSingle(x => x.F_Mobile == mobile||x.F_Mobile1 ==mobile );
- ml.F_State = (int)EnumDelState.Delete;
- ml.F_DeleteOn = DateTime.Now.ToLocalTime();
- ml.F_DeleteBy = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value;
- if (_cus_vip_infoRepository.Update(ml).Result)
- {
- return Success("更新成功");
- }
- else
- return Error("更新失败");
- }
- else
- return Error("手机号不能为空");
- }
- }
- }
|