|
@@ -11,10 +11,10 @@ using MySystem.MainModels;
|
|
|
using LitJson;
|
|
|
using Library;
|
|
|
|
|
|
-namespace MySystem.Areas.Api.Controllers.v1.pos
|
|
|
+namespace MySystem.Areas.Api.Controllers.v1
|
|
|
{
|
|
|
[Area("Api")]
|
|
|
- [Route("Api/v1/pos/[controller]/[action]")]
|
|
|
+ [Route("Api/v1/[controller]/[action]")]
|
|
|
public class ProfitRewardRecordController : BaseController
|
|
|
{
|
|
|
public ProfitRewardRecordController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
|
|
@@ -37,11 +37,10 @@ namespace MySystem.Areas.Api.Controllers.v1.pos
|
|
|
{
|
|
|
JsonData data = JsonMapper.ToObject(value);
|
|
|
int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
|
|
|
- int ProductType = int.Parse(function.CheckInt(data["ProductType"].ToString()));//产品类型
|
|
|
int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
|
|
|
int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
|
|
|
List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
|
|
|
- IQueryable<ProfitRecord> query = maindb.ProfitRecord.Where(m => m.UserId == UserId && m.BrandId == ProductType).OrderByDescending(m => m.Id);
|
|
|
+ IQueryable<ProfitRecord> query = maindb.ProfitRecord.Where(m => m.UserId == UserId).OrderByDescending(m => m.Id);
|
|
|
if (PageNum == 1)
|
|
|
{
|
|
|
query = query.Take(PageSize);
|
|
@@ -51,29 +50,12 @@ namespace MySystem.Areas.Api.Controllers.v1.pos
|
|
|
int skipNum = PageSize * (PageNum - 1);
|
|
|
query = query.Skip(skipNum).Take(PageSize);
|
|
|
}
|
|
|
- Dictionary<string, string> items = new Dictionary<string, string>();
|
|
|
foreach (var subdata in query.ToList())
|
|
|
- {
|
|
|
- if(!items.ContainsKey(subdata.SeoTitle))
|
|
|
- {
|
|
|
- string CreateDate = subdata.CreateDate == null ? "" : subdata.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
- items.Add(subdata.SeoTitle, subdata.ProfitAmount + "|" + CreateDate);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- string[] datalist = items[subdata.SeoTitle].Split('|');
|
|
|
- decimal ProfitAmount = decimal.Parse(datalist[0]) + subdata.ProfitAmount;
|
|
|
- items[subdata.SeoTitle] = ProfitAmount + "|" + datalist[1];
|
|
|
- }
|
|
|
- }
|
|
|
- foreach (string MonthString in items.Keys)
|
|
|
{
|
|
|
Dictionary<string, object> curData = new Dictionary<string, object>();
|
|
|
- string[] datalist = items[MonthString].Split('|');
|
|
|
- curData.Add("TradeProfit", datalist[0]); //交易分润
|
|
|
- string Month = MonthString.Substring(0, 4) + "-" + MonthString.Substring(4);
|
|
|
- curData.Add("TradeMonth", Month); //交易月
|
|
|
- curData.Add("CreateDate", datalist[1]); //CreateDate
|
|
|
+ curData.Add("ProfitAmount", subdata.ProfitAmount); //交易分润
|
|
|
+ curData.Add("ProfitMonth", subdata.CreateDate.Value.ToString("yyyy年MM月"));
|
|
|
+ curData.Add("ProfitDate", subdata.CreateDate.Value.ToString("yyyy-MM-dd"));
|
|
|
dataList.Add(curData);
|
|
|
}
|
|
|
return dataList;
|