【新增】接口端增加批量删除购物车信息功能

This commit is contained in:
大灰灰
2024-09-05 16:42:54 +08:00
parent 93f1bfb045
commit 2bcd31e924

View File

@@ -8,6 +8,7 @@
* Description: 暂无 * Description: 暂无
***********************************************************************/ ***********************************************************************/
using System.Linq;
using CoreCms.Net.Auth.HttpContextUser; using CoreCms.Net.Auth.HttpContextUser;
using CoreCms.Net.IServices; using CoreCms.Net.IServices;
using CoreCms.Net.Model.FromBody; using CoreCms.Net.Model.FromBody;
@@ -106,6 +107,32 @@ namespace CoreCms.Net.Web.WebApi.Controllers
#endregion #endregion
#region
/// <summary>
/// 批量删除购物车信息
/// </summary>
/// <returns></returns>
[HttpPost]
[Authorize]
public async Task<WebApiCallBack> DoDeleteByIds([FromBody] FMArrayIntIds entity)
{
var jm = new WebApiCallBack();
if (entity.id.Length <= 0)
{
jm.msg = "请提交要删除的货品";
return jm;
}
var bl = await _cartServices.DeleteAsync(p => entity.id.Contains(p.id) && p.userId == _user.ID);
jm.status = bl;
jm.msg = jm.status ? "删除成功" : "删除失败";
jm.code = bl ? 0 : 1;
return jm;
}
#endregion
#region #region
/// <summary> /// <summary>