using CoreCms.Net.Configuration;
|
using CoreCms.Net.IServices.baifenbingfa;
|
using CoreCms.Net.Model.ViewModels.UI;
|
using CoreCms.Net.Web.Admin.Infrastructure;
|
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Mvc;
|
using System.ComponentModel;
|
using System.Linq;
|
using System.Threading.Tasks;
|
|
namespace CoreCms.Net.Web.Admin.Controllers.Api
|
{
|
[Description("通用API")]
|
[Route("api/[controller]/[action]")]
|
[ApiController]
|
[RequiredErrorForAdmin]
|
[Authorize(Permissions.Name)]
|
public class CommonAPIController : ControllerBase
|
{
|
private readonly IBfbfComAPIService _comapiservice;
|
public CommonAPIController(IBfbfComAPIService comapiservice)
|
{
|
_comapiservice = comapiservice;
|
}
|
/// <summary>
|
/// 获取用户搜索列表
|
/// </summary>
|
/// <param name="s"></param>
|
[HttpPost]
|
[Description("获取列表")]
|
[AllowAnonymous]
|
public async Task<AdminUiCallBack> GetUserList()
|
{
|
var ret= new AdminUiCallBack();
|
var s = Request.Form["sKey"].FirstOrDefault();
|
var data= await _comapiservice.SearchUserData(s);
|
if(data!=null)
|
{
|
ret.code = 0;
|
ret.data = data;
|
}
|
else
|
{
|
ret.msg = "读取用户数据失败";
|
}
|
|
return ret;
|
}
|
|
|
/// <summary>
|
/// 获取商品分类列表 已上架的
|
/// </summary>
|
[HttpPost]
|
[Description("获取商品分类列表")]
|
[AllowAnonymous]
|
public async Task<AdminUiCallBack> GetGoodsCategory()
|
{
|
var ret = new AdminUiCallBack();
|
var data = await _comapiservice.GetGoodsCategory();
|
if (data != null)
|
{
|
ret.code = 0;
|
ret.data = data;
|
}
|
else
|
{
|
ret.msg = "读取用户数据失败";
|
}
|
|
return ret;
|
}
|
|
}
|
}
|