|
|
@@ -0,0 +1,77 @@
|
|
|
+using molilian.core;
|
|
|
+using dodohold.core;
|
|
|
+using Microsoft.AspNetCore.Mvc;
|
|
|
+using System.Text.Json;
|
|
|
+namespace molilian.api.Controllers
|
|
|
+{
|
|
|
+ [ApiController]
|
|
|
+ [MyAuthorize("admin")]
|
|
|
+ [Route("api/[controller]/[action]")]
|
|
|
+ public class TaobaoOrderController : ControllerBase
|
|
|
+ {
|
|
|
+ readonly IAuthorizationProvider provider = new AdminProvider();
|
|
|
+ protected IHttpContextAccessor _accessor;
|
|
|
+ public TaobaoOrderController(IHttpContextAccessor accessor)
|
|
|
+ {
|
|
|
+ _accessor = accessor;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ [HttpPost]
|
|
|
+ public ActionResult list([FromBody] JsonElement form)
|
|
|
+ {
|
|
|
+ int page = form.Read("current", 1);
|
|
|
+ int size = form.Read("pageSize", 10);
|
|
|
+ bool getTotal = form.Read("getTotal", true);
|
|
|
+ string sort = form.Read<string>("sort");
|
|
|
+ string order = form.Read<string>("order");
|
|
|
+ string name = form.Read<string>("keyword");
|
|
|
+
|
|
|
+ var time = form.PathReadArray<string>("query_date[]");
|
|
|
+
|
|
|
+ string filter = string.Empty;
|
|
|
+ if (!string.IsNullOrEmpty(name))
|
|
|
+ {
|
|
|
+ filter += $" AND accountId IN (SELECT ID FROM tk_pool WHERE company=@name)";
|
|
|
+ }
|
|
|
+ DateTime stime = DateTime.MinValue, etime = DateTime.MinValue;
|
|
|
+ if (time.Count == 2)
|
|
|
+ {
|
|
|
+ if (DateTime.TryParse(time[0], out stime) && DateTime.TryParse(time[1], out etime))
|
|
|
+ {
|
|
|
+ etime = etime.AddDays(1).AddSeconds(-1);
|
|
|
+ filter += $" AND tkPaidTime BETWEEN @stime AND @etime";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ filter = filter.StringTrimStart(" AND ");
|
|
|
+
|
|
|
+ //排序
|
|
|
+ string orderBy = "tkPaidTime DESC";
|
|
|
+ if (!string.IsNullOrEmpty(order))
|
|
|
+ {
|
|
|
+ order = "descending".Equals(order) ? "DESC" : "ASC";
|
|
|
+ orderBy = sort switch
|
|
|
+ {
|
|
|
+ _ => $"{sort} {order}",
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ var result = new DBContext.Table("tk_order_details")
|
|
|
+ .Where(filter, new { name, stime, etime })
|
|
|
+ .Page(size, page)
|
|
|
+ .Order(orderBy)
|
|
|
+ .PageList<TkOrderDetailDTO>(getTotal);
|
|
|
+
|
|
|
+
|
|
|
+ //foreach (var item in result.List)
|
|
|
+ //{
|
|
|
+ // if (string.IsNullOrEmpty(name))
|
|
|
+ // {
|
|
|
+ // item.accountName = "-";
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ return new APIResult(new { data = result });
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+}
|