import request from '@/utils/request';
import type { ApiResult, PageResult } from '@/api';
import type { Profit, ProfitParam } from './model';

/**
 * 分页查询收益明细
 */
export async function profitPage(params: ProfitParam) {
  const res = await request.get<ApiResult<PageResult<Profit>>>(
    '/shop/profit-log/page',
    {
      params
    }
  );
  if (res.data.code === 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}
