Browse Source

加收入数据

master
nili 9 months ago
parent
commit
113f9e917d
  1. 284
      dist/140.016265e7.async.js
  2. 284
      dist/140.1458bf51.async.js
  3. 3
      dist/169.c5babfbf.async.js
  4. 150
      dist/507.7e792448.async.js
  5. 8
      dist/559.683b9a7b.async.js
  6. 8
      dist/630.1e884d8b.async.js
  7. 18
      dist/635.4de81965.async.js
  8. 58
      dist/930.0d0532dc.async.js
  9. 58
      dist/930.8352590c.async.js
  10. 3
      dist/941.3ce529e6.async.js
  11. 259
      dist/983.53a1b6a8.async.js
  12. 2
      dist/index.html
  13. 1
      dist/p__AdvRecordList.39e7df79.async.js
  14. 1
      dist/p__AdvRecordList.41794fc1.async.js
  15. 2
      dist/p__User__Login__index.b793c4e2.async.js
  16. 2
      dist/p__Welcome.845d8956.async.js
  17. 212
      dist/umi.46a6b901.js
  18. 18
      package.json
  19. 207
      src/pages/AdvRecordList.tsx
  20. 165
      src/pages/Overview.tsx
  21. 27
      src/services/matrix/admin.ts
  22. 26
      src/services/matrix/matrixController.ts
  23. 56
      src/services/matrix/typings.d.ts

284
dist/140.016265e7.async.js

File diff suppressed because one or more lines are too long

284
dist/140.1458bf51.async.js

File diff suppressed because one or more lines are too long

3
dist/169.c5babfbf.async.js

File diff suppressed because one or more lines are too long

150
dist/507.7e792448.async.js

File diff suppressed because one or more lines are too long

8
dist/559.683b9a7b.async.js

File diff suppressed because one or more lines are too long

8
dist/630.1e884d8b.async.js

File diff suppressed because one or more lines are too long

18
dist/635.09454aea.async.js → dist/635.4de81965.async.js

File diff suppressed because one or more lines are too long

58
dist/930.0d0532dc.async.js

File diff suppressed because one or more lines are too long

58
dist/930.8352590c.async.js

File diff suppressed because one or more lines are too long

3
dist/941.3ce529e6.async.js

File diff suppressed because one or more lines are too long

259
dist/983.53a1b6a8.async.js

File diff suppressed because one or more lines are too long

2
dist/index.html

@ -8,6 +8,6 @@
</head> </head>
<body> <body>
<div id="root"></div> <div id="root"></div>
<script src="/umi.574c0b88.js"></script> <script src="/umi.46a6b901.js"></script>
</body></html> </body></html>

1
dist/p__AdvRecordList.39e7df79.async.js

@ -1 +0,0 @@
"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[857],{46701:function(U,d,e){e.r(d);var E=e(15009),u=e.n(E),p=e(97857),l=e.n(p),x=e(99289),f=e.n(x),I=e(48357),h=e(90930),D=e(1507),M=e(35312),i=e(67294),T=e(96974),o=e(85893),P=function(){var m=(0,i.useRef)(),O=(0,M.useIntl)(),j=[{title:"\u8BBE\u5907Id",dataIndex:"deviceId",valueType:"textarea",ellipsis:!0,copyable:!0},{title:"\u5E94\u7528\u540D\u79F0",hideInSearch:!0,dataIndex:"appName",valueType:"textarea"},{title:"\u5E73\u53F0",dataIndex:"platform",valueEnum:{1:{text:"\u7A7F\u5C71\u7532"},2:{text:"\u817E\u8BAF"},3:{text:"\u767E\u5EA6\u8054\u76DF"},4:{text:"Mintegral"},5:{text:"\u5FEB\u624B"},6:{text:"\u6E38\u53EF\u8D62"},7:{text:"Sigmob"},8:{text:"Admob"}}},{title:"\u5E7F\u544A\u7C7B\u578B",dataIndex:"advType",valueEnum:{1:{text:"\u6A2A\u5E45",status:"Default"},2:{text:"\u63D2\u9875",status:"Processing"},3:{text:"\u6FC0\u52B1\u89C6\u9891",status:"Success"}}},{title:"ecpm(\u5143)",dataIndex:"ecpm",hideInSearch:!0,renderText:function(_){return _/100}},{title:"\u8BBE\u5907\u54C1\u724C",dataIndex:"deviceBrand",hideInSearch:!0,valueType:"textarea"},{title:"\u8BBE\u5907\u540D",dataIndex:"deviceName",hideInSearch:!0,valueType:"textarea"},{title:"ip",dataIndex:"ip",hideInSearch:!0,valueType:"textarea"},{title:"\u65F6\u95F4",hideInSearch:!0,dataIndex:"createdAt",valueType:"dateTime"},{title:"\u65F6\u95F4",hideInTable:!0,dataIndex:"createdAt",valueType:"dateRange"}],b=(0,T.UO)(),c=b.code,R=function(){var t=f()(u()().mark(function _(v){var r,n,s;return u()().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,(0,I._5)(l()(l()({},v),{},{code:c}));case 2:return s=a.sent,a.abrupt("return",{data:(r=s.data)===null||r===void 0?void 0:r.data,total:(n=s.data)===null||n===void 0?void 0:n.total,success:!0});case 4:case"end":return a.stop()}},_)}));return function(v){return t.apply(this,arguments)}}();return(0,i.useEffect)(function(){var t;(t=m.current)===null||t===void 0||t.reload()},[c]),(0,o.jsx)(h._z,{children:(0,o.jsx)(D.Z,{headerTitle:O.formatMessage({id:"pages.searchTable.title",defaultMessage:"Enquiry form"}),actionRef:m,rowKey:"key",search:{labelWidth:120},request:R,columns:j})})};d.default=P}}]);

1
dist/p__AdvRecordList.41794fc1.async.js

@ -0,0 +1 @@
"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[857],{46701:function(ne,h,e){e.r(h);var b=e(5574),f=e.n(b),C=e(15009),d=e.n(C),U=e(97857),u=e.n(U),B=e(99289),p=e.n(B),D=e(48357),y=e(92296),o=e(31847),g=e(90930),K=e(57470),x=e(64317),L=e(34540),W=e(50624),S=e(35312),Z=e(13169),O=e(16250),F=e(27484),z=e.n(F),$=e(9220),m=e(67294),G=e(96974),_=e(85893),N=function(){var M=(0,m.useRef)(),H=(0,S.useIntl)(),J=[{title:"\u8BBE\u5907id",dataIndex:"deviceId",valueType:"textarea",ellipsis:!0,copyable:!0},{title:"\u5E94\u7528\u540D\u79F0",hideInSearch:!0,dataIndex:"appName",valueType:"textarea"},{title:"\u5E73\u53F0",dataIndex:"platform",valueEnum:{1:{text:"\u7A7F\u5C71\u7532"},2:{text:"\u817E\u8BAF"},3:{text:"\u767E\u5EA6\u8054\u76DF"},4:{text:"Mintegral"},5:{text:"\u5FEB\u624B"},6:{text:"\u6E38\u53EF\u8D62"},7:{text:"Sigmob"},8:{text:"Admob"}}},{title:"\u5E7F\u544A\u7C7B\u578B",dataIndex:"advType",valueEnum:{1:{text:"\u6A2A\u5E45",status:"Default"},2:{text:"\u63D2\u9875",status:"Processing"},3:{text:"\u6FC0\u52B1\u89C6\u9891",status:"Success"}}},{title:"ecpm(\u5143)",dataIndex:"ecpm",hideInSearch:!0,renderText:function(t){return t/100}},{title:"\u8BBE\u5907\u54C1\u724C",dataIndex:"deviceBrand",hideInSearch:!0,valueType:"textarea"},{title:"\u8BBE\u5907\u540D",dataIndex:"deviceName",hideInSearch:!0,valueType:"textarea"},{title:"ip",dataIndex:"ip",hideInSearch:!0,valueType:"textarea"},{title:"\u65F6\u95F4",hideInSearch:!0,dataIndex:"createdAt",valueType:"dateTime"},{title:"\u65F6\u95F4",hideInTable:!0,dataIndex:"createdAt",valueType:"dateRange"}],Q=(0,G.UO)(),c=Q.code,V=function(){var a=p()(d()().mark(function t(s){var n,v,r;return d()().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.next=2,(0,D._5)(u()(u()({},s),{},{code:c}));case 2:return r=l.sent,l.abrupt("return",{data:(n=r.data)===null||n===void 0?void 0:n.data,total:(v=r.data)===null||v===void 0?void 0:v.total,success:!0});case 4:case"end":return l.stop()}},t)}));return function(s){return a.apply(this,arguments)}}(),X=(0,m.useState)(),P=f()(X,2),i=P[0],Y=P[1],w=(0,m.useState)([]),I=f()(w,2),T=I[0],k=I[1],q=o.Z.Divider,ee=(0,m.useState)(!1),j=f()(ee,2),R=j[0],te=j[1],ae=function(){var a=p()(d()().mark(function t(s){var n;return d()().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,(0,D.d1)({appCode:s});case 2:n=r.sent,n.data&&Y(n.data);case 4:case"end":return r.stop()}},t)}));return function(s){return a.apply(this,arguments)}}(),A=function(){var a=p()(d()().mark(function t(s){var n;return d()().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,(0,D.Zb)(u()(u()({},s),{},{code:c}));case 2:n=r.sent,n.data&&k(n.data);case 4:case"end":return r.stop()}},t)}));return function(s){return a.apply(this,arguments)}}();(0,m.useEffect)(function(){var a;(a=M.current)===null||a===void 0||a.reload(),ae(c),A({code:c})},[c]);var E=function(t){return t?parseFloat((t/1e5).toFixed(2)):0},_e=T.map(function(a){return{date:a.date+"",income:E(a.income)}}),re={data:_e,xField:"date",yField:"income",axis:{date:{title:"\u65E5\u671F"},income:{title:"\u6536\u5165\uFF08\u5143\uFF09"}},title:"\u7D2F\u8BA1"+E(T.reduce(function(a,t){return a+(t.income?t.income:0)},0))+"\u5143",height:400,label:{text:function(t){return t.\u6536\u5165>0?t.\u6536\u5165:""},textBaseline:"bottom"}};return(0,_.jsx)(g._z,{children:(0,_.jsxs)(Z.Z,{defaultActiveKey:"1",centered:!0,style:{backgroundColor:"white",padding:"20px"},children:[(0,_.jsxs)(O.Z,{tab:"\u6570\u636E\u603B\u89C8",children:[(0,_.jsx)($.Z,{onResize:function(t){te(t.width<596)},children:(0,_.jsx)(o.Z,{children:(0,_.jsxs)(o.Z.Group,{direction:R?"column":"row",children:[(0,_.jsx)(o.Z,{statistic:{title:"\u7D2F\u8BA1\u6536\u5165\uFF08\u5143\uFF09",value:E(i==null?void 0:i.totalIncome)}}),(0,_.jsx)(q,{type:R?"horizontal":"vertical"}),(0,_.jsx)(o.Z,{statistic:{title:"\u4ECA\u65E5\u6536\u5165\uFF08\u5143\uFF09",value:E(i==null?void 0:i.todayIncome)}})]})})},"resize-observer"),(0,_.jsxs)(K.t,{defaultCollapsed:!0,split:!0,onFinish:A,children:[(0,_.jsx)(x.Z,{label:"\u5E73\u53F0",name:"platform",valueEnum:{1:"\u7A7F\u5C71\u7532",2:"\u817E\u8BAF",3:"\u767E\u5EA6\u8054\u76DF",4:"Mintegral",5:"\u5FEB\u624B",6:"\u6E38\u53EF\u8D62",7:"Sigmob",8:"Admob"}}),(0,_.jsx)(x.Z,{name:"advType",label:"\u5E7F\u544A\u7C7B\u578B",valueEnum:{1:"\u6A2A\u5E45",2:"\u63D2\u9875",3:"\u6FC0\u52B1\u89C6\u9891"}}),(0,_.jsx)(L.Z,{fieldProps:{disabledDate:function(t){return t&&t>=z()().startOf("day")}},name:"date",label:"\u65F6\u95F4"})]}),(0,_.jsx)(y.Z,u()({},re))]},"1"),(0,_.jsx)(O.Z,{tab:"\u5E7F\u544A\u8BE6\u60C5",children:(0,_.jsx)(W.Z,{headerTitle:H.formatMessage({id:"pages.searchTable.title",defaultMessage:"Enquiry form"}),actionRef:M,rowKey:"key",search:{labelWidth:120},request:V,columns:J})},"2")]})})};h.default=N}}]);

2
dist/p__User__Login__index.f3ef3531.async.js → dist/p__User__Login__index.b793c4e2.async.js

File diff suppressed because one or more lines are too long

2
dist/p__Welcome.a2bd332c.async.js → dist/p__Welcome.845d8956.async.js

@ -1,4 +1,4 @@
"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[185],{71759:function(Ke,G,d){d.r(G),d.d(G,{default:function(){return ye}});var K=d(90930),Z=d(35312),X=d(9361),o=d(67294),Q=d(93967),f=d.n(Q),V=d(98423),E=d(53124),J=d(98675),U=d(99559),Y=d(11941),q=function(e,r){var t={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&r.indexOf(a)<0&&(t[a]=e[a]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,a=Object.getOwnPropertySymbols(e);i<a.length;i++)r.indexOf(a[i])<0&&Object.prototype.propertyIsEnumerable.call(e,a[i])&&(t[a[i]]=e[a[i]]);return t},H=e=>{var{prefixCls:r,className:t,hoverable:a=!0}=e,i=q(e,["prefixCls","className","hoverable"]);const{getPrefixCls:s}=o.useContext(E.E_),b=s("card",r),h=f()(`${b}-grid`,t,{[`${b}-grid-hoverable`]:a});return o.createElement("div",Object.assign({},i,{className:h}))},n=d(54548),y=d(14747),_=d(91945),k=d(45503);const ee=e=>{const{antCls:r,componentCls:t,headerHeight:a,cardPaddingBase:i,tabsMarginBottom:s}=e;return Object.assign(Object.assign({display:"flex",justifyContent:"center",flexDirection:"column",minHeight:a,marginBottom:-1,padding:`0 ${(0,n.bf)(i)}`,color:e.colorTextHeading,fontWeight:e.fontWeightStrong,fontSize:e.headerFontSize,background:e.headerBg,borderBottom:`${(0,n.bf)(e.lineWidth)} ${e.lineType} ${e.colorBorderSecondary}`,borderRadius:`${(0,n.bf)(e.borderRadiusLG)} ${(0,n.bf)(e.borderRadiusLG)} 0 0`},(0,y.dF)()),{"&-wrapper":{width:"100%",display:"flex",alignItems:"center"},"&-title":Object.assign(Object.assign({display:"inline-block",flex:1},y.vS),{[` "use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[185],{71759:function(Ke,G,d){d.r(G),d.d(G,{default:function(){return ye}});var K=d(90930),Z=d(35312),X=d(9361),o=d(67294),Q=d(93967),f=d.n(Q),V=d(98423),E=d(53124),J=d(98675),U=d(99559),Y=d(13169),q=function(e,r){var t={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&r.indexOf(a)<0&&(t[a]=e[a]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,a=Object.getOwnPropertySymbols(e);i<a.length;i++)r.indexOf(a[i])<0&&Object.prototype.propertyIsEnumerable.call(e,a[i])&&(t[a[i]]=e[a[i]]);return t},H=e=>{var{prefixCls:r,className:t,hoverable:a=!0}=e,i=q(e,["prefixCls","className","hoverable"]);const{getPrefixCls:s}=o.useContext(E.E_),b=s("card",r),h=f()(`${b}-grid`,t,{[`${b}-grid-hoverable`]:a});return o.createElement("div",Object.assign({},i,{className:h}))},n=d(54548),y=d(14747),_=d(91945),k=d(45503);const ee=e=>{const{antCls:r,componentCls:t,headerHeight:a,cardPaddingBase:i,tabsMarginBottom:s}=e;return Object.assign(Object.assign({display:"flex",justifyContent:"center",flexDirection:"column",minHeight:a,marginBottom:-1,padding:`0 ${(0,n.bf)(i)}`,color:e.colorTextHeading,fontWeight:e.fontWeightStrong,fontSize:e.headerFontSize,background:e.headerBg,borderBottom:`${(0,n.bf)(e.lineWidth)} ${e.lineType} ${e.colorBorderSecondary}`,borderRadius:`${(0,n.bf)(e.borderRadiusLG)} ${(0,n.bf)(e.borderRadiusLG)} 0 0`},(0,y.dF)()),{"&-wrapper":{width:"100%",display:"flex",alignItems:"center"},"&-title":Object.assign(Object.assign({display:"inline-block",flex:1},y.vS),{[`
> ${t}-typography, > ${t}-typography,
> ${t}-typography-edit-content > ${t}-typography-edit-content
`]:{insetInlineStart:0,marginTop:0,marginBottom:0}}),[`${r}-tabs-top`]:{clear:"both",marginBottom:s,color:e.colorText,fontWeight:"normal",fontSize:e.fontSize,"&-bar":{borderBottom:`${(0,n.bf)(e.lineWidth)} ${e.lineType} ${e.colorBorderSecondary}`}}})},te=e=>{const{cardPaddingBase:r,colorBorderSecondary:t,cardShadow:a,lineWidth:i}=e;return{width:"33.33%",padding:r,border:0,borderRadius:0,boxShadow:` `]:{insetInlineStart:0,marginTop:0,marginBottom:0}}),[`${r}-tabs-top`]:{clear:"both",marginBottom:s,color:e.colorText,fontWeight:"normal",fontSize:e.fontSize,"&-bar":{borderBottom:`${(0,n.bf)(e.lineWidth)} ${e.lineType} ${e.colorBorderSecondary}`}}})},te=e=>{const{cardPaddingBase:r,colorBorderSecondary:t,cardShadow:a,lineWidth:i}=e;return{width:"33.33%",padding:r,border:0,borderRadius:0,boxShadow:`

212
dist/umi.574c0b88.js → dist/umi.46a6b901.js

File diff suppressed because one or more lines are too long

18
package.json

@ -4,7 +4,7 @@
"private": true, "private": true,
"description": "An out-of-box UI solution for enterprise applications", "description": "An out-of-box UI solution for enterprise applications",
"scripts": { "scripts": {
"openapi": "umi openapi", "openapi": "max openapi",
"analyze": "cross-env ANALYZE=1 max build", "analyze": "cross-env ANALYZE=1 max build",
"build": "max build", "build": "max build",
"deploy": "npm run build && npm run gh-pages", "deploy": "npm run build && npm run gh-pages",
@ -19,7 +19,6 @@
"lint:fix": "eslint --fix --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src ", "lint:fix": "eslint --fix --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src ",
"lint:js": "eslint --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src", "lint:js": "eslint --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src",
"lint:prettier": "prettier -c --write \"**/**.{js,jsx,tsx,ts,less,md,json}\" --end-of-line auto", "lint:prettier": "prettier -c --write \"**/**.{js,jsx,tsx,ts,less,md,json}\" --end-of-line auto",
"openapi": "max openapi",
"prepare": "husky install", "prepare": "husky install",
"prettier": "prettier -c --write \"**/**.{js,jsx,tsx,ts,less,md,json}\"", "prettier": "prettier -c --write \"**/**.{js,jsx,tsx,ts,less,md,json}\"",
"preview": "npm run build && max preview --port 8000", "preview": "npm run build && max preview --port 8000",
@ -37,10 +36,17 @@
}, },
"lint-staged": { "lint-staged": {
"**/*.{js,jsx,ts,tsx}": "npm run lint-staged:js", "**/*.{js,jsx,ts,tsx}": "npm run lint-staged:js",
"**/*.{js,jsx,tsx,ts,less,md,json}": ["prettier --write"] "**/*.{js,jsx,tsx,ts,less,md,json}": [
"prettier --write"
]
}, },
"browserslist": ["> 1%", "last 2 versions", "not ie <= 10"], "browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 10"
],
"dependencies": { "dependencies": {
"@ant-design/charts": "^2.0.3",
"@ant-design/icons": "^4.8.1", "@ant-design/icons": "^4.8.1",
"@ant-design/pro-components": "^2.6.48", "@ant-design/pro-components": "^2.6.48",
"@umijs/route-utils": "^2.2.2", "@umijs/route-utils": "^2.2.2",
@ -88,5 +94,7 @@
"umi-presets-pro": "^2.0.3", "umi-presets-pro": "^2.0.3",
"umi-serve": "^1.9.11" "umi-serve": "^1.9.11"
}, },
"engines": { "node": ">=12.0.0" } "engines": {
"node": ">=12.0.0"
}
} }

207
src/pages/AdvRecordList.tsx

@ -1,14 +1,28 @@
import { advList } from '@/services/matrix/admin'; import { advList, incomeOverview } from '@/services/matrix/admin';
import { PageContainer, ProColumns, ProTable } from '@ant-design/pro-components'; import { Column } from '@ant-design/charts';
import {
PageContainer,
ProColumns,
ProFormDateRangePicker,
ProFormSelect,
ProTable,
QueryFilter,
StatisticCard,
} from '@ant-design/pro-components';
import { useIntl } from '@umijs/max'; import { useIntl } from '@umijs/max';
import React, { useEffect, useRef } from 'react'; import { Tabs } from 'antd';
import TabPane from 'antd/es/tabs/TabPane';
import moment from 'moment';
import RcResizeObserver from 'rc-resize-observer';
import React, { useEffect, useRef, useState } from 'react';
import { useParams } from 'react-router-dom'; import { useParams } from 'react-router-dom';
import { incomeDaily } from '../services/matrix/admin';
// import { RequestOptionsType, ProFieldRequestData } from "@ant-design/pro-utils"; // import { RequestOptionsType, ProFieldRequestData } from "@ant-design/pro-utils";
import type { ActionType } from '@ant-design/pro-components'; import type { ActionType } from '@ant-design/pro-components';
const AdvRecordList: React.FC = () => { const AdvRecordList: React.FC = () => {
const actionRef = useRef<ActionType>(); const actionRef = useRef<ActionType>();
/** /**
@ -29,103 +43,103 @@ const AdvRecordList: React.FC = () => {
const columns: ProColumns<API.MatrixAdvRecordBo>[] = [ const columns: ProColumns<API.MatrixAdvRecordBo>[] = [
{ {
title: "设备Id", title: '设备id',
dataIndex: 'deviceId', dataIndex: 'deviceId',
valueType: 'textarea', valueType: 'textarea',
ellipsis: true, ellipsis: true,
copyable: true copyable: true,
}, },
{ {
title: "应用名称", title: '应用名称',
hideInSearch: true, hideInSearch: true,
dataIndex: 'appName', dataIndex: 'appName',
valueType: 'textarea', valueType: 'textarea',
}, },
{ {
title: "平台", title: '平台',
dataIndex: 'platform', dataIndex: 'platform',
valueEnum: { valueEnum: {
1: { 1: {
text:"穿山甲" , text: '穿山甲',
}, },
2: { 2: {
text: "腾讯", text: '腾讯',
}, },
3: { 3: {
text: "百度联盟", text: '百度联盟',
}, },
4: { 4: {
text:"Mintegral", text: 'Mintegral',
}, },
5: { 5: {
text:"快手", text: '快手',
}, },
6: { 6: {
text:"游可赢", text: '游可赢',
}, },
7: { 7: {
text:"Sigmob", text: 'Sigmob',
}, },
8: { 8: {
text:"Admob", text: 'Admob',
}, },
}, },
}, },
{ {
title: "广告类型", title: '广告类型',
dataIndex: 'advType', dataIndex: 'advType',
valueEnum: { valueEnum: {
1: { 1: {
text:"横幅" , text: '横幅',
status: 'Default', status: 'Default',
}, },
2: { 2: {
text: "插页", text: '插页',
status: 'Processing', status: 'Processing',
}, },
3: { 3: {
text: "激励视频", text: '激励视频',
status: 'Success', status: 'Success',
}, },
}, },
}, },
{ {
title: "ecpm(元)", title: 'ecpm(元)',
dataIndex: 'ecpm', dataIndex: 'ecpm',
hideInSearch: true, hideInSearch: true,
renderText: (x) => { renderText: (x) => {
return x / 100; return x / 100;
} },
}, },
{ {
title: "设备品牌", title: '设备品牌',
dataIndex: 'deviceBrand', dataIndex: 'deviceBrand',
hideInSearch: true, hideInSearch: true,
valueType: 'textarea', valueType: 'textarea',
}, },
{ {
title: "设备名", title: '设备名',
dataIndex: 'deviceName', dataIndex: 'deviceName',
hideInSearch: true, hideInSearch: true,
valueType: 'textarea', valueType: 'textarea',
}, },
{ {
title: "ip", title: 'ip',
dataIndex: 'ip', dataIndex: 'ip',
hideInSearch: true, hideInSearch: true,
valueType: 'textarea', valueType: 'textarea',
}, },
{ {
title: "时间", title: '时间',
hideInSearch: true, hideInSearch: true,
dataIndex: 'createdAt', dataIndex: 'createdAt',
valueType: 'dateTime' valueType: 'dateTime',
}, },
{ {
title: "时间", title: '时间',
hideInTable: true, hideInTable: true,
dataIndex: 'createdAt', dataIndex: 'createdAt',
valueType: 'dateRange' valueType: 'dateRange',
}, },
// { // {
// title: "应用名称", // title: "应用名称",
@ -136,22 +150,142 @@ const AdvRecordList: React.FC = () => {
// } // }
]; ];
const {code} = useParams(); const { code } = useParams();
const fetchData = async (params:any) => { const fetchData = async (params: any) => {
const res = await advList({...params, code:code}); const res = await advList({ ...params, code: code });
return { return {
data: res.data?.data, data: res.data?.data,
total: res.data?.total, total: res.data?.total,
success: true success: true,
};
};
const [overview, setOverview] = useState<API.OverviewBo>();
const [daily, setDaily] = useState<API.DateIncome[]>([]);
const { Divider } = StatisticCard;
const [responsive, setResponsive] = useState(false);
const fetchOverview = async (param: string | undefined) => {
const res = await incomeOverview({ appCode: param });
if (res.data) {
setOverview(res.data);
}
};
const fetchDaily = async (params: API.IncomeQuery) => {
const res = await incomeDaily({ ...params, code: code });
if (res.data) {
setDaily(res.data);
} }
}; };
useEffect(() => { useEffect(() => {
actionRef.current?.reload(); actionRef.current?.reload();
fetchOverview(code);
fetchDaily({ code: code });
}, [code]); }, [code]);
const formatIncome = (v: number | undefined) => {
if (!v) {
return 0;
}
return parseFloat((v / 1000_00).toFixed(2));
};
// 在渲染折线图组件时,对数据进行处理
const processedChartData: { date: string | number; income: number }[] = daily.map((item) => ({
date: item.date + '',
income: formatIncome(item.income),
}));
const config = {
data: processedChartData,
xField: 'date',
yField: 'income',
axis: {
date: {
title: '日期',
},
income: {
title: '收入(元)',
},
},
title:
'累计' +
formatIncome(daily.reduce((acc, data) => acc + (data.income ? data.income : 0), 0)) +
'元',
height: 400,
label: {
text: (d: any) => (d. > 0 ? d. : ''),
textBaseline: 'bottom',
},
};
return ( return (
<PageContainer> <PageContainer>
<Tabs defaultActiveKey="1" centered style={{ backgroundColor: 'white', padding: '20px' }}>
<TabPane tab="数据总览" key="1">
<RcResizeObserver
key="resize-observer"
onResize={(offset) => {
setResponsive(offset.width < 596);
}}
>
<StatisticCard>
<StatisticCard.Group direction={responsive ? 'column' : 'row'}>
<StatisticCard
statistic={{
title: '累计收入(元)',
value: formatIncome(overview?.totalIncome),
}}
/>
<Divider type={responsive ? 'horizontal' : 'vertical'} />
<StatisticCard
statistic={{
title: '今日收入(元)',
value: formatIncome(overview?.todayIncome),
}}
/>
</StatisticCard.Group>
</StatisticCard>
</RcResizeObserver>
<QueryFilter defaultCollapsed split onFinish={fetchDaily}>
<ProFormSelect
label="平台"
name="platform"
valueEnum={{
1: '穿山甲',
2: '腾讯',
3: '百度联盟',
4: 'Mintegral',
5: '快手',
6: '游可赢',
7: 'Sigmob',
8: 'Admob',
}}
/>
<ProFormSelect
name="advType"
label="广告类型"
valueEnum={{
1: '横幅',
2: '插页',
3: '激励视频',
}}
/>
<ProFormDateRangePicker
fieldProps={{
disabledDate: (current: any) => current && current >= moment().startOf('day'),
}}
name="date"
label="时间"
/>
</QueryFilter>
{/* <Line {...config} /> */}
<Column {...config} />
</TabPane>
<TabPane tab="广告详情" key="2">
<ProTable<API.MatrixAdvRecordBo, API.AdvRecordQuery> <ProTable<API.MatrixAdvRecordBo, API.AdvRecordQuery>
headerTitle={intl.formatMessage({ headerTitle={intl.formatMessage({
id: 'pages.searchTable.title', id: 'pages.searchTable.title',
@ -165,9 +299,10 @@ const AdvRecordList: React.FC = () => {
request={fetchData} request={fetchData}
columns={columns} columns={columns}
/> />
</TabPane>
</Tabs>
</PageContainer> </PageContainer>
); );
}; };
export default AdvRecordList;
export default AdvRecordList;

165
src/pages/Overview.tsx

@ -0,0 +1,165 @@
import { appList, incomeOverview } from '@/services/matrix/admin';
import { Column } from '@ant-design/charts';
import {
PageContainer,
ProFormDateRangePicker,
ProFormSelect,
QueryFilter,
StatisticCard,
} from '@ant-design/pro-components';
import moment from 'moment';
import RcResizeObserver from 'rc-resize-observer';
import { useEffect, useState } from 'react';
import { useParams } from 'react-router-dom';
import { incomeDaily } from '../services/matrix/admin';
const Overview: React.FC = () => {
const [overview, setOverview] = useState<API.OverviewBo>();
const [daily, setDaily] = useState<API.DateIncome[]>([]);
const [appArr, setAppArr] = useState<API.MatrixApp[]>([]);
const { Divider } = StatisticCard;
const [responsive, setResponsive] = useState(false);
const { code } = useParams();
const fetchData = async () => {
const res = await incomeOverview({ appCode: code });
if (res.data) {
setOverview(res.data);
}
};
const fetchApp = async () => {
const res = await appList();
if (res.data) {
setAppArr(res.data);
}
};
const fetchDaily = async (params: API.IncomeQuery) => {
console.log('fetchDaily');
console.log(params);
const res = await incomeDaily(params);
if (res.data) {
setDaily(res.data);
}
};
useEffect(() => {
fetchData();
fetchApp();
fetchDaily({ code: code });
}, []);
const formatIncome = (v: number | undefined) => {
if (!v) {
return 0;
}
return parseFloat((v / 1000_00).toFixed(2));
};
// 在渲染折线图组件时,对数据进行处理
const processedChartData: { date: string | number; income: number }[] = daily.map((item) => ({
date: item.date + '',
income: formatIncome(item.income),
}));
const config = {
data: processedChartData,
xField: 'date',
yField: 'income',
axis: {
date: {
title: '日期',
},
income: {
title: '收入(元)',
},
},
title:
'累计' +
formatIncome(daily.reduce((acc, data) => acc + (data.income ? data.income : 0), 0)) +
'元',
height: 400,
label: {
text: (d: any) => (d. > 0 ? d. : ''),
textBaseline: 'bottom',
},
};
return (
<PageContainer>
<RcResizeObserver
key="resize-observer"
onResize={(offset) => {
setResponsive(offset.width < 596);
}}
>
<StatisticCard>
<StatisticCard.Group direction={responsive ? 'column' : 'row'}>
<StatisticCard
statistic={{
title: '累计收入(元)',
value: formatIncome(overview?.totalIncome),
}}
/>
<Divider type={responsive ? 'horizontal' : 'vertical'} />
<StatisticCard
statistic={{
title: '今日收入(元)',
value: formatIncome(overview?.todayIncome),
}}
/>
</StatisticCard.Group>
</StatisticCard>
</RcResizeObserver>
<div style={{ backgroundColor: 'white', marginTop: '20px', padding: '40px' }}>
<QueryFilter defaultCollapsed split onFinish={fetchDaily}>
<ProFormSelect
name="code"
label="应用"
options={appArr.map((x) => ({
label: x.name,
value: x.code,
}))}
/>
<ProFormSelect
label="平台"
name="platform"
valueEnum={{
1: '穿山甲',
2: '腾讯',
3: '百度联盟',
4: 'Mintegral',
5: '快手',
6: '游可赢',
7: 'Sigmob',
8: 'Admob',
}}
/>
<ProFormSelect
name="advType"
label="广告类型"
valueEnum={{
1: '横幅',
2: '插页',
3: '激励视频',
}}
/>
<ProFormDateRangePicker
fieldProps={{
disabledDate: (current: any) => current && current >= moment().startOf('day'),
}}
name="date"
label="时间"
/>
</QueryFilter>
{/* <Line {...config} /> */}
<Column {...config} />
</div>
</PageContainer>
);
};
export default Overview;

27
src/services/matrix/admin.ts

@ -53,6 +53,33 @@ export async function grantApp(
}); });
} }
/** 此处后端没有提供注释 POST /api/admin/incomeDaily */
export async function incomeDaily(body: API.IncomeQuery, options?: { [key: string]: any }) {
return request<API.RListDateIncome>('/api/admin/incomeDaily', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
data: body,
...(options || {}),
});
}
/** 此处后端没有提供注释 GET /api/admin/incomeOverview */
export async function incomeOverview(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: API.incomeOverviewParams,
options?: { [key: string]: any },
) {
return request<API.ROverviewBo>('/api/admin/incomeOverview', {
method: 'GET',
params: {
...params,
},
...(options || {}),
});
}
/** 此处后端没有提供注释 POST /api/admin/login */ /** 此处后端没有提供注释 POST /api/admin/login */
export async function adminLogin( export async function adminLogin(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象) // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)

26
src/services/matrix/matrixController.ts

@ -2,6 +2,21 @@
/* eslint-disable */ /* eslint-disable */
import { request } from '@umijs/max'; import { request } from '@umijs/max';
/** 此处后端没有提供注释 POST /api/game/matrix/addWhiteList */
export async function addWhiteList(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: API.addWhiteListParams,
options?: { [key: string]: any },
) {
return request<API.RVoid>('/api/game/matrix/addWhiteList', {
method: 'POST',
params: {
...params,
},
...(options || {}),
});
}
/** 此处后端没有提供注释 POST /api/game/matrix/saveAdvRecord */ /** 此处后端没有提供注释 POST /api/game/matrix/saveAdvRecord */
export async function saveAdvRecord( export async function saveAdvRecord(
body: API.MatrixAdvRecordEditBo, body: API.MatrixAdvRecordEditBo,
@ -18,9 +33,16 @@ export async function saveAdvRecord(
} }
/** 此处后端没有提供注释 GET /api/game/matrix/whiteList */ /** 此处后端没有提供注释 GET /api/game/matrix/whiteList */
export async function whiteList(options?: { [key: string]: any }) { export async function whiteList(
return request<API.RListString>('/api/game/matrix/whiteList', { // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: API.whiteListParams,
options?: { [key: string]: any },
) {
return request<API.RBoolean>('/api/game/matrix/whiteList', {
method: 'GET', method: 'GET',
params: {
...params,
},
...(options || {}), ...(options || {}),
}); });
} }

56
src/services/matrix/typings.d.ts

@ -1,4 +1,9 @@
declare namespace API { declare namespace API {
type addWhiteListParams = {
deviceId: string;
appCode: string;
};
type adminLoginParams = { type adminLoginParams = {
name: string; name: string;
pwd: string; pwd: string;
@ -29,6 +34,11 @@ declare namespace API {
openId?: string; openId?: string;
}; };
type DateIncome = {
date?: number;
income?: number;
};
type getAppInfoParams = { type getAppInfoParams = {
appId?: string; appId?: string;
}; };
@ -38,6 +48,17 @@ declare namespace API {
adminId: number; adminId: number;
}; };
type incomeOverviewParams = {
appCode?: string;
};
type IncomeQuery = {
code?: string;
platform?: number;
advType?: number;
date?: string[];
};
type InviteInfo = { type InviteInfo = {
inviteCnt?: number; inviteCnt?: number;
list?: InviteUserInfo[]; list?: InviteUserInfo[];
@ -112,6 +133,12 @@ declare namespace API {
code?: string; code?: string;
url?: string; url?: string;
income?: number; income?: number;
channel?: string;
};
type OverviewBo = {
todayIncome?: number;
totalIncome?: number;
}; };
type PageResultMatrixAdvRecordBo = { type PageResultMatrixAdvRecordBo = {
@ -137,6 +164,12 @@ declare namespace API {
data?: AppInfo; data?: AppInfo;
}; };
type RBoolean = {
code?: number;
message?: string;
data?: boolean;
};
type RCurrentUser = { type RCurrentUser = {
code?: number; code?: number;
message?: string; message?: string;
@ -149,22 +182,22 @@ declare namespace API {
data?: InviteInfo; data?: InviteInfo;
}; };
type RListMatrixAdminBo = { type RListDateIncome = {
code?: number; code?: number;
message?: string; message?: string;
data?: MatrixAdminBo[]; data?: DateIncome[];
}; };
type RListMatrixApp = { type RListMatrixAdminBo = {
code?: number; code?: number;
message?: string; message?: string;
data?: MatrixApp[]; data?: MatrixAdminBo[];
}; };
type RListString = { type RListMatrixApp = {
code?: number; code?: number;
message?: string; message?: string;
data?: string[]; data?: MatrixApp[];
}; };
type RLoginBo = { type RLoginBo = {
@ -179,6 +212,12 @@ declare namespace API {
data?: MatrixAdmin; data?: MatrixAdmin;
}; };
type ROverviewBo = {
code?: number;
message?: string;
data?: OverviewBo;
};
type RPageResultMatrixAdvRecordBo = { type RPageResultMatrixAdvRecordBo = {
code?: number; code?: number;
message?: string; message?: string;
@ -218,6 +257,11 @@ declare namespace API {
score?: number; score?: number;
}; };
type whiteListParams = {
deviceId: string;
appCode: string;
};
type wxLoginParams = { type wxLoginParams = {
code: string; code: string;
appId: string; appId: string;

Loading…
Cancel
Save