import {UPDATE_CHANNEL_DATA} from '../../constants/channel/actionTypes';

// 应用系统的初始化数据
const initialState = {
    error: false,
    errorDesc: null,
    result: {
        data: {
            "accountData": {
                "10-10": {"number": 1359},
                "10-11": {"number": 1352},
                "10-12": {"number": 1622},
                "10-13": {"number": 1583},
                "10-16": {"number": 1523},
                "10-17": {"number": 1610},
                "10-18": {"number": 1486},
                "10-19": {"number": 1474},
                "10-20": {"number": 1574},
                "10-23": {"number": 2498},
                "10-24": {"number": 1011}
            },
            "appDownData": {
                "2016-09": {"number": 210.55},
                "2016-10": {"number": 221.85},
                "2016-11": {"number": 264.59},
                "2016-12": {"number": 190.59},
                "2017-01": {"number": 165.19},
                "2017-02": {"number": 194.73},
                "2017-03": {"number": 162.88},
                "2017-04": {"number": 58.9},
                "2017-05": {"number": 44.6},
                "2017-06": {"number": 50.48},
                "2017-07": {"number": 48.84},
                "2017-08": {"number": 55.13},
                "2017-09": {"number": 94.16}
            },
            "tradeData": {
                "09-28": {"phone": 2087722, "pc": 587416},
                "09-29": {"phone": 1926462, "pc": 563969},
                "10-09": {"phone": 634945, "pc": 302505},
                "10-10": {"phone": 2129943, "pc": 616558},
                "10-11": {"phone": 2125259, "pc": 624765},
                "10-12": {"phone": 1953872, "pc": 591867},
                "10-13": {"phone": 2099652, "pc": 598911},
                "10-16": {"phone": 655741, "pc": 305295},
                "10-17": {"phone": 544398, "pc": 256542},
                "10-18": {"phone": 2087875, "pc": 573111},
                "10-19": {"phone": 1929080, "pc": 555647},
                "10-20": {"phone": 1897532, "pc": 546488},
                "10-23": {"phone": 1281379, "pc": 421532},
                "10-24": {"phone": 907799, "pc": 298429}
            },
            "entrustData": {
                "10-10": {"phone": 57, "pc": 42},
                "10-11": {"phone": 61, "pc": 38},
                "10-12": {"phone": 63, "pc": 36},
                "10-13": {"phone": 58, "pc": 41},
                "10-16": {"phone": 62, "pc": 37},
                "10-17": {"phone": 55, "pc": 44},
                "10-18": {"phone": 67, "pc": 31},
                "10-19": {"phone": 68, "pc": 31},
                "10-20": {"phone": 66, "pc": 32},
                "10-23": {"phone": 63, "pc": 36},
                "10-24": {"phone": 64, "pc": 35}
            },
            "accountNum": 1011,
            "entrustNum": 2477270,
            "curEntrustNum": 164,
            "tradeNum": 1206228,
            "activeNum": 0,
            "tradingVolume": 364.42,
            "channelTradeData": {
                "barData": {
                    "201705": {
                        "2": 636.28,
                        "3": 690.75,
                        "4": 765.12,
                        "23": 658.92,
                        "24": 563.71,
                        "25": 683.52,
                        "26": 636.1,
                        "31": 624.94
                    },
                    "201706": {
                        "1": 581.98,
                        "2": 577.49,
                        "5": 517.78,
                        "6": 492.92,
                        "7": 699.18,
                        "8": 652.01,
                        "9": 618.46,
                        "12": 588.48,
                        "13": 582.43,
                        "14": 603.2,
                        "15": 655.59,
                        "16": 583.36,
                        "19": 566.52,
                        "20": 637.35,
                        "21": 617.19,
                        "22": 756.94,
                        "23": 643.27,
                        "26": 686.01,
                        "27": 603.96,
                        "28": 588.52,
                        "29": 542.98,
                        "30": 533.75
                    },
                    "201707": {
                        "3": 567.59,
                        "4": 587.19,
                        "5": 656.54,
                        "6": 757.37,
                        "7": 725.81,
                        "10": 797.12,
                        "11": 693.44,
                        "12": 693.18,
                        "13": 667.01,
                        "14": 601.14,
                        "17": 818.93,
                        "18": 609.26,
                        "19": 802.44,
                        "20": 777.56,
                        "21": 664.16,
                        "24": 731.69,
                        "25": 656.4,
                        "26": 689.48,
                        "27": 870.84,
                        "28": 710.0,
                        "31": 833.78
                    },
                    "201708": {
                        "1": 840.02,
                        "2": 930.94,
                        "3": 820.87,
                        "4": 884.34,
                        "7": 707.97,
                        "8": 828.56,
                        "9": 771.74,
                        "10": 787.67,
                        "11": 788.57,
                        "14": 762.38,
                        "15": 707.86,
                        "16": 772.9,
                        "17": 833.21,
                        "18": 748.15,
                        "21": 712.41,
                        "22": 722.39,
                        "23": 656.69,
                        "24": 629.19,
                        "25": 718.79,
                        "28": 956.61,
                        "29": 857.65,
                        "30": 847.56,
                        "31": 845.71
                    },
                    "201709": {
                        "1": 979.75,
                        "4": 962.61,
                        "5": 841.3,
                        "6": 896.9,
                        "7": 939.86,
                        "8": 830.52,
                        "11": 877.43,
                        "12": 1101.69,
                        "13": 810.32,
                        "14": 886.75,
                        "15": 847.58,
                        "18": 777.36,
                        "19": 793.41,
                        "20": 820.25,
                        "21": 867.06,
                        "22": 762.78,
                        "25": 698.44,
                        "26": 633.49,
                        "27": 652.31,
                        "28": 709.23,
                        "29": 677.91
                    },
                    "201710": {
                        "9": 803.87,
                        "10": 807.75,
                        "11": 866.4,
                        "12": 759.65,
                        "13": 719.35,
                        "16": 861.98,
                        "17": 647.75,
                        "18": 722.96,
                        "19": 677.37,
                        "20": 610.48,
                        "23": 668.09,
                        "24": 364.42
                    }
                },
                "barDataTotal": {
                    "201705": 13244.51,
                    "201706": 13329.37,
                    "201707": 14910.93,
                    "201708": 18132.18,
                    "201709": 17366.95,
                    "201710": 8510.07
                },
                "lineData": {
                    "201705": {
                        "02": 34.0,
                        "03": 35.0,
                        "04": 33.0,
                        "05": 33.0,
                        "08": 35.0,
                        "26": 33.0,
                        "31": 33.0
                    },
                    "201706": {
                        "01": 36.0,
                        "02": 33.0,
                        "05": 34.0,
                        "06": 34.0,
                        "07": 35.0,
                        "08": 36.0,
                        "09": 35.0,
                        "12": 36.0,
                        "13": 34.0,
                        "14": 36.0,
                        "15": 37.0,
                        "16": 36.0,
                        "19": 35.0,
                        "20": 36.0,
                        "21": 36.0,
                        "22": 35.0,
                        "23": 35.0,
                        "26": 33.0,
                        "27": 35.0,
                        "28": 36.0,
                        "29": 36.0,
                        "30": 36.0
                    },
                    "201707": {
                        "03": 36.0,
                        "04": 36.0,
                        "05": 34.0,
                        "06": 35.0,
                        "07": 37.0,
                        "10": 36.0,
                        "11": 38.0,
                        "12": 37.0,
                        "13": 36.0,
                        "14": 36.0,
                        "17": 40.0,
                        "18": 38.0,
                        "19": 35.0,
                        "20": 39.0,
                        "21": 38.0,
                        "24": 36.0,
                        "25": 37.0,
                        "26": 37.0,
                        "27": 36.0,
                        "28": 37.0,
                        "31": 35.0
                    },
                    "201708": {
                        "01": 36.0,
                        "02": 36.0,
                        "03": 36.0,
                        "04": 37.0,
                        "07": 36.0,
                        "08": 36.0,
                        "09": 37.0,
                        "10": 38.0,
                        "11": 39.0,
                        "14": 34.0,
                        "15": 37.0,
                        "16": 37.0,
                        "17": 36.0,
                        "18": 38.0,
                        "21": 36.0,
                        "22": 39.0,
                        "23": 39.0,
                        "24": 19.0,
                        "25": 18.0,
                        "28": 18.0,
                        "29": 19.0,
                        "30": 18.0,
                        "31": 18.0
                    },
                    "201709": {
                        "01": 18.0,
                        "04": 18.0,
                        "05": 19.0,
                        "06": 19.0,
                        "07": 19.0,
                        "08": 19.0,
                        "11": 18.0,
                        "12": 19.0,
                        "13": 19.0,
                        "14": 19.0,
                        "15": 19.0,
                        "18": 19.0,
                        "19": 19.0,
                        "20": 19.0,
                        "21": 19.0,
                        "22": 19.0,
                        "25": 19.0,
                        "26": 18.0,
                        "27": 18.0,
                        "28": 18.0,
                        "29": 19.0
                    },
                    "201710": {
                        "09": 37.0,
                        "10": 38.0,
                        "11": 38.0,
                        "12": 38.0,
                        "13": 37.0,
                        "16": 38.0,
                        "17": 36.0,
                        "18": 38.0,
                        "19": 40.0,
                        "20": 36.0,
                        "23": 34.0,
                        "24": 35.0
                    }
                }
            },
            "activeData": {
                "barData": {
                    "201703": {
                        "1": 2114468.0,
                        "2": 2086871.0,
                        "3": 2063687.0,
                        "4": 752138.0,
                        "5": 726608.0,
                        "6": 2098337.0,
                        "7": 2087269.0,
                        "8": 2057822.0,
                        "9": 2071780.0,
                        "10": 2031063.0,
                        "11": 742288.0,
                        "12": 696815.0,
                        "13": 2079827.0,
                        "14": 2066048.0,
                        "15": 2046728.0,
                        "16": 2078989.0,
                        "17": 2070371.0,
                        "18": 789879.0,
                        "19": 726511.0,
                        "20": 2087736.0,
                        "21": 2061451.0,
                        "22": 2068781.0,
                        "23": 2083703.0,
                        "24": 2066115.0,
                        "25": 784389.0,
                        "26": 689795.0,
                        "27": 2092377.0,
                        "28": 2051601.0,
                        "29": 2086196.0,
                        "30": 2062325.0,
                        "31": 2059654.0
                    },
                    "201704": {
                        "1": 1011167.0,
                        "2": 577436.0,
                        "3": 651759.0,
                        "4": 698355.0,
                        "5": 2136335.0,
                        "6": 2117199.0,
                        "7": 2088391.0,
                        "8": 767611.0,
                        "9": 685420.0,
                        "10": 2098966.0,
                        "11": 2113588.0,
                        "12": 2076658.0,
                        "13": 2097015.0,
                        "14": 2067958.0,
                        "15": 698795.0,
                        "16": 642719.0,
                        "17": 2090394.0,
                        "18": 2069772.0,
                        "19": 2067905.0,
                        "20": 2069924.0,
                        "21": 2025790.0,
                        "22": 660195.0,
                        "23": 598942.0,
                        "24": 2085311.0,
                        "25": 2013503.0,
                        "26": 2035711.0,
                        "27": 2049006.0,
                        "28": 1993260.0,
                        "29": 655587.0,
                        "30": 525075.0
                    },
                    "201705": {
                        "1": 597320.0,
                        "2": 2015325.0,
                        "3": 1999243.0,
                        "4": 2002107.0,
                        "5": 1985759.0,
                        "6": 648184.0,
                        "7": 585794.0,
                        "8": 2009741.0,
                        "9": 1965701.0,
                        "10": 1966735.0,
                        "11": 1969146.0,
                        "12": 1926737.0,
                        "13": 637122.0,
                        "14": 579414.0,
                        "15": 1954917.0,
                        "16": 1980319.0,
                        "17": 1969979.0,
                        "18": 1965671.0,
                        "19": 1947086.0,
                        "20": 665426.0,
                        "21": 591296.0,
                        "22": 1943672.0,
                        "23": 1945402.0,
                        "24": 1930139.0,
                        "25": 1958316.0,
                        "26": 1848061.0,
                        "27": 916655.0,
                        "28": 494422.0,
                        "29": 527843.0,
                        "30": 531550.0,
                        "31": 1890135.0
                    },
                    "201706": {
                        "1": 1913976.0,
                        "2": 1912315.0,
                        "3": 623582.0,
                        "4": 557567.0,
                        "5": 1900730.0,
                        "6": 1916635.0,
                        "7": 1984562.0,
                        "8": 1946785.0,
                        "9": 1937373.0,
                        "10": 643986.0,
                        "11": 590925.0,
                        "12": 1964304.0,
                        "13": 1963544.0,
                        "14": 1923345.0,
                        "15": 1957347.0,
                        "16": 1903847.0,
                        "17": 636451.0,
                        "18": 573712.0,
                        "19": 1967484.0,
                        "20": 1954851.0,
                        "21": 1957084.0,
                        "22": 1958062.0,
                        "23": 1944787.0,
                        "24": 643906.0,
                        "25": 574775.0,
                        "26": 1984106.0,
                        "27": 1936769.0,
                        "28": 1940882.0,
                        "29": 1942160.0,
                        "30": 1913892.0
                    },
                    "201707": {
                        "1": 653364.0,
                        "2": 612757.0,
                        "3": 1933369.0,
                        "4": 1890321.0,
                        "5": 1953171.0,
                        "6": 1941262.0,
                        "7": 1920781.0,
                        "8": 675373.0,
                        "9": 591287.0,
                        "10": 1929955.0,
                        "11": 1899719.0,
                        "12": 1959428.0,
                        "13": 1952524.0,
                        "14": 1922826.0,
                        "15": 644761.0,
                        "16": 569787.0,
                        "17": 2001899.0,
                        "18": 1979412.0,
                        "19": 2009976.0,
                        "20": 2011998.0,
                        "21": 1954540.0,
                        "22": 652329.0,
                        "23": 611540.0,
                        "24": 2000411.0,
                        "25": 1954886.0,
                        "26": 1973876.0,
                        "27": 2008119.0,
                        "28": 1955429.0,
                        "29": 653312.0,
                        "30": 582527.0,
                        "31": 1990768.0
                    },
                    "201708": {
                        "1": 1973257.0,
                        "2": 1975344.0,
                        "3": 1938510.0,
                        "4": 1947318.0,
                        "5": 661146.0,
                        "6": 581705.0,
                        "7": 1974344.0,
                        "8": 1986354.0,
                        "9": 1984833.0,
                        "10": 1987625.0,
                        "11": 1974107.0,
                        "12": 634230.0,
                        "13": 575232.0,
                        "14": 2030563.0,
                        "15": 1976549.0,
                        "16": 2008702.0,
                        "17": 2008047.0,
                        "18": 1987935.0,
                        "19": 672967.0,
                        "20": 600961.0,
                        "21": 2000047.0,
                        "22": 2016170.0,
                        "23": 1990432.0,
                        "24": 1986141.0,
                        "25": 2012565.0,
                        "26": 696922.0,
                        "27": 629504.0,
                        "28": 2046894.0,
                        "29": 1986158.0,
                        "30": 1984838.0,
                        "31": 2006806.0
                    }
                },
                "barDataTotal": {
                    "201708": 5560000,
                    "201707": 5660000,
                    "201706": 6100000,
                    "201705": 6260000,
                    "201704": 6090000,
                    "201703": 6870000
                }
            }
        }
    }
};

let switchMap = {};

switchMap[UPDATE_CHANNEL_DATA] = (state, action) => {
    return Object.assign({}, state, action.payload);
};

export default function channel(state = initialState, action) {
    if (switchMap[action.type]) {
        return switchMap[action.type](state, action);
    } else {
        return state;
    }
}
