-
Notifications
You must be signed in to change notification settings - Fork 0
/
src__pages__Log__SwapDFS.async.js
1 lines (1 loc) · 7.16 KB
/
src__pages__Log__SwapDFS.async.js
1
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[3295,9515],{80652:function(e,t,r){var n=r(62435),a=r(20701),s=r(11924),o=r(79360),u=r(24770),l=r(79642),i=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r},c=(0,n.forwardRef)((function(e,t){var r=e.chartRef,c=e.style,f=void 0===c?{height:"inherit"}:c,m=e.className,p=e.loading,d=e.loadingTemplate,g=e.errorTemplate,h=i(e,["chartRef","style","className","loading","loadingTemplate","errorTemplate"]),y=(0,s.Z)(a.x1,h),x=y.chart,b=y.container;return(0,n.useEffect)((function(){(0,o.J)(r,x.current)}),[x.current]),(0,n.useImperativeHandle)(t,(function(){return{getChart:function(){return x.current}}})),n.createElement(u.Z,{errorTemplate:g},p&&n.createElement(l.Z,{loadingTemplate:d,theme:e.theme}),n.createElement("div",{className:m,style:f,ref:b}))}));t.Z=c},68078:function(e,t,r){r.r(t);var n=r(15009),a=r.n(n),s=r(97857),o=r.n(s),u=r(9783),l=r.n(u),i=r(99289),c=r.n(i),f=r(5574),m=r.n(f),p=r(52272),d=r(64119),g=r(87603),h=r(80652),y=r(11774),x=r(38345),b=r(92340),k=r(59530),w=r(80507),S=r(45360),v=r(71230),N=r(15746),j=r(69677),M=r(57953),D=r(32983),E=r(27484),F=r.n(E),O=r(70178),Z=r.n(O),_=r(62435),I=(r(15933),r(86074));F().extend(Z());t.default=function(){var e=S.ZP.useMessage(),t=m()(e,2),r=t[0],n=t[1],s=(0,_.useState)(!1),u=m()(s,2),i=u[0],f=u[1],E=(0,k.useDispatch)(),O=(0,k.useSelector)((function(e){return e.global.session})),Z=(0,k.useSelector)((function(e){return e.swaplog.dataSource})),C=(0,k.useSelector)((function(e){return e.swaplog.dailyDataSource})),T=(0,_.useState)({}),Y=m()(T,2),P=Y[0],z=Y[1],R=(0,_.useState)(""),A=m()(R,2),L=A[0],U=A[1],B=(0,k.useSelector)((function(e){return e.swaplog.inFilters})),G=(0,k.useSelector)((function(e){return e.swaplog.outFilters})),J=(0,k.useSelector)((function(e){return e.swaplog.userFilters})),H=(0,k.useSelector)((function(e){return e.swaplog.days})),V=["DFS","JIU","USDT","BTC"],q=(0,k.useIntl)(),K=q.formatMessage({id:"swaplog.intlLoad"}),Q=q.formatMessage({id:"swaplog.intlUser"}),W=q.formatMessage({id:"swaplog.intlFrom"}),X=q.formatMessage({id:"swaplog.intlTo"}),$=q.formatMessage({id:"swaplog.intlTime"}),ee=q.formatMessage({id:"swaplog.intlInputLoadNumber"}),te=q.formatMessage({id:"swaplog.intlDailyVolume"}),re=(0,_.useCallback)(function(){var e=c()(a()().mark((function e(t){var n,s,u,i,c,g,h,y,x,b,k,S,v,N,j,M,D,O,Z,_,I,C,T,Y,P;return a()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.prev=0,n=[],s=[],u=[],i=[],c=F()().format("YYYY-MM-DD"),g=F()(c).subtract(H+1,"day").format("YYYY-MM-DD"),h=!1,y=w.zM.from(w.zM.max),x=[],b=[],k={};case 12:return e.next=14,t.client.v1.chain.get_table_rows({code:"loglogloglog",table:"logs",scope:"loglogloglog",upper_bound:y,limit:500,reverse:!0});case 14:S=e.sent,v=0;case 16:if(!(v<S.rows.length)){e.next=32;break}if(N=S.rows[v],j=F().utc(N.create_time).local().format("YYYY-MM-DD"),M=j.localeCompare(g),U(j),!(M<=0)){e.next=24;break}return h=!0,e.abrupt("break",32);case 24:D=N.in.split(" "),O=m()(D,2),Z=O[0],_=O[1],I=N.out.split(" "),C=m()(I,2),T=C[0],Y=C[1],k.hasOwnProperty(_)?k[_].hasOwnProperty(j)?k[_][j]+=Number(Z):k[_][j]=Number(Z):k[_]=l()({},j,Number(Z)),k.hasOwnProperty(Y)?k[Y].hasOwnProperty(j)?k[Y][j]+=Number(T):k[Y][j]=Number(T):k[Y]=l()({},j,Number(T)),n.push(o()(o()({},N),{},{key:N.id,create_time:F().utc(N.create_time).local().format(),inSym:_,outSym:Y}));case 29:v++,e.next=16;break;case 32:if(!h){e.next=34;break}return e.abrupt("break",40);case 34:if(!S.more){e.next=38;break}y=w.zM.from(Number(S.next_key)),e.next=39;break;case 38:return e.abrupt("break",40);case 39:e.next=12;break;case 40:P={},Object.keys(k).forEach((function(e){P[e]=!1,Object.keys(k[e]).forEach((function(t){x.push({day:t,value:Number(k[e][t].toFixed(2)),category:e})}))})),V.forEach((function(e){x.forEach((function(t){t.category===e&&b.push(t)}))})),n.forEach((function(e){s.includes(e.inSym)||s.push(e.inSym),u.includes(e.outSym)||u.push(e.outSym),i.includes(e.user)||i.push(e.user)})),z(P),E(p.N.setInFilters(s.sort())),E(p.N.setOutFilters(u.sort())),E(p.N.setUserFilters(i.sort())),E(p.N.setDataSource(n)),E(p.N.setDailyDataSource(b)),f(!1),e.next=57;break;case 53:e.prev=53,e.t0=e.catch(0),f(!1),(0,d.Tv)(e.t0,r,"handleGetSwapLog");case 57:case"end":return e.stop()}}),e,null,[[0,53]])})));return function(t){return e.apply(this,arguments)}}(),[H,r,V]),ne=(0,_.useCallback)(c()(a()().mark((function e(){return a()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:f(!0),re(O);case 2:case"end":return e.stop()}}),e)}))),[re,O]);(0,_.useEffect)((function(){O?(Z.length?f(!1):f(!0),re(O)):f(!0)}),[O]);var ae=(0,_.useMemo)((function(){return[{title:"#",dataIndex:"key",key:"key",render:function(e,t){return(0,I.jsx)("span",{children:t.key+1})}},{title:"".concat(Q),dataIndex:"user",key:"user",sorter:function(e,t){return e.user.localeCompare(t.user)},filters:J.map((function(e){return{text:e,value:e}})),onFilter:function(e,t){return e===t.user},render:function(e,t){return(0,I.jsx)("span",{children:t.user})}},{title:"".concat(W),dataIndex:"in",key:"in",filters:B.map((function(e){return{text:e,value:e}})),onFilter:function(e,t){return e===t.inSym},render:function(e,t){return(0,I.jsx)("span",{children:t.in})}},{title:"",dataIndex:"key",key:"key",render:function(){return(0,I.jsx)("span",{children:(0,I.jsx)(g.Z,{})})}},{title:"".concat(X),dataIndex:"to",key:"to",filters:G.map((function(e){return{text:e,value:e}})),onFilter:function(e,t){return e===t.outSym},render:function(e,t){return(0,I.jsx)("span",{children:t.out})}},{title:"".concat($),dataIndex:"create_time",key:"create_time",sorter:function(e,t){return F().utc(e.create_time).unix()-F().utc(t.create_time).unix()},render:function(e,t){return(0,I.jsx)("span",{children:t.create_time})}}]}),[B,G,J]),se={data:C,xField:"day",xAxis:{type:"time",mask:"MM-DD"},yField:"value",yAxis:{label:{formatter:function(e){var t=Number(e.replace(/,/g,""));return t<1?t.toFixed(2):(0,d.CE)(t)}}},meta:{value:{formatter:function(e){return(0,d.CE)(e)}}},legend:{selected:o()(o()({},P),{},{DFS:!0})},seriesField:"category",slider:{start:0,end:1},smooth:!0,label:{}};return(0,I.jsxs)(y._z,{className:"swaplog",ghost:!0,children:[(0,I.jsx)(v.Z,{gutter:10,children:(0,I.jsx)(N.Z,{lg:{span:"12"},md:{span:"12"},sm:{span:"24"},xs:{span:"24"},children:(0,I.jsx)(j.Z.Search,{style:{width:"100%",marginBottom:"10px"},placeholder:ee,value:H,onChange:function(e){return E(p.N.setDays(Number(e.target.value)))},allowClear:!0,enterButton:K,size:"large",type:"number",min:"0",loading:i,onSearch:ne})})}),(0,I.jsx)(M.Z,{size:"large",spinning:i,tip:L,children:(0,I.jsx)(x.Z,{className:"mb-3",title:(0,I.jsx)("span",{className:" font-semibold",children:te}),children:C.length?(0,I.jsx)(h.Z,o()(o()({},se),{},{loading:i})):(0,I.jsx)(D.Z,{image:D.Z.PRESENTED_IMAGE_SIMPLE})})}),(0,I.jsx)(b.Z,{className:"mb-3",scroll:{x:!0},size:"small",columns:ae,dataSource:Z,defaultData:[],search:!1,options:!1,pagination:{pageSize:100},tableAlertRender:!1,tableAlertOptionRender:!1,loading:{spinning:i,size:"large"}}),n]})}},15933:function(){}}]);