Commit 0cf4b358 by chenjinjing

no message

parent a190c046
{
"1730359573927": {},
"1729153582461": {},
"1730359559228": {
"isSubmit": false,
"R": [],
"I": [
{
"xsid": "C030",
"xsnr": "工人辛 - 产量1650",
"isChoice": false
},
{
"xsid": "C033",
"xsnr": "画师3 - 产量1900",
"isChoice": false
},
{
"xsid": "C035",
"xsnr": "掌柜B - 产量1100",
"isChoice": false
}
]
}
}
\ No newline at end of file
{
{
{
"1727399696222": {
"SWOT": {
"1730359573927": {},
"1729153582461": {},
"1730359559228": {
"isSubmit": false,
"S": [
{
"xsid": "C028",
"xsnr": "测试线索1",
"xsid": "C014",
"xsnr": "熟悉整套生产运输流程",
"isChoice": false
},
{
"xsid": "C029",
"xsnr": "测试线索2",
"xsid": "C015",
"xsnr": "还有熟识的好友可以提供协助",
"isChoice": false
},
{
"xsid": "C016",
"xsnr": "流行的瓷器粗制滥造,市场难觅好的瓷器",
"isChoice": false
},
{
"xsid": "C017",
"xsnr": "资金匮乏",
"isChoice": false
},
{
"xsid": "C018",
"xsnr": "商人可选择带回国做贸易的商品众多",
"isChoice": false
}
],
"W": [],
"O": [
{
"xsid": "C030",
"xsnr": "测试线索3",
"isChoice": false
},
{
"xsid": "C031",
"xsnr": "测试线索4",
"xsid": "C019",
"xsnr": "虽然流行的瓷器品质一般,但数量众多",
"isChoice": false
}
],
"T": []
},
"ROI": {
"isSubmit": false,
"R": [],
"I": []
},
"竞合": {
"isSubmit": false,
"供应商": [],
"行业竞争": [],
"跨界竞争": [],
"潜在替代": [],
"消费者": []
}
}
}
\ No newline at end of file
{
{
{
"1727399696222": [
"1727399696222": {
"普通线索": [
{
"xsid": "C001",
"xsnr": "马可波罗希望一个月内拿到100只瓷器",
"isChoice": false
"xsnr": "马可波罗希望一个月内拿到1000只瓷器",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C002",
"xsnr": "如果生产的瓷器非常精美有创意,从马可波罗那儿可以拿到定金。",
"isChoice": false
"isChoice": false,
"sfbx": "否"
}
],
"竞合": [
{
"xsid": "C003",
"xsnr": "瓷器胚",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C004",
"xsnr": "颜料商",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C005",
"xsnr": "通用瓷器销售",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C006",
"xsnr": "丝绸",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C007",
"xsnr": "茶叶",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C008",
"xsnr": "银制器具",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C009",
"xsnr": "玉器",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C010",
"xsnr": "瓷器新势力",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C011",
"xsnr": "西洋商人",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C012",
"xsnr": "竞合测试线索1",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C013",
"xsnr": "竞合测试线索2",
"isChoice": false,
"sfbx": "否"
}
],
"SWOT": [
{
"xsid": "C014",
"xsnr": "熟悉整套生产运输流程",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C015",
"xsnr": "还有熟识的好友可以提供协助",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C016",
"xsnr": "流行的瓷器粗制滥造,市场难觅好的瓷器",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C017",
"xsnr": "资金匮乏",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C018",
"xsnr": "商人可选择带回国做贸易的商品众多",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C019",
"xsnr": "虽然流行的瓷器品质一般,但数量众多",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C020",
"xsnr": "西洋有大量的瓷器进口需求",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C021",
"xsnr": "广州天气适宜",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C022",
"xsnr": "广州非常商业气氛很好",
"isChoice": false,
"sfbx": "否"
}
],
"ROI": [
{
"xsid": "C023",
"xsnr": "工人甲 - 产量360",
"isChoice": false,
"sfbx": "工人"
},
{
"xsid": "C024",
"xsnr": "工人乙 - 产量450",
"isChoice": false,
"sfbx": "工人"
},
{
"xsid": "C025",
"xsnr": "工人丙 - 产量510",
"isChoice": false,
"sfbx": "工人"
},
{
"xsid": "C026",
"xsnr": "工人丁 - 产量840",
"isChoice": false,
"sfbx": "工人"
},
{
"xsid": "C027",
"xsnr": "工人戊 - 产量960",
"isChoice": false,
"sfbx": "工人"
},
{
"xsid": "C028",
"xsnr": "工人己 - 产量1050",
"isChoice": false,
"sfbx": "工人"
},
{
"xsid": "C029",
"xsnr": "工人庚 - 产量1350",
"isChoice": false,
"sfbx": "工人"
},
{
"xsid": "C030",
"xsnr": "工人辛 - 产量1650",
"isChoice": false,
"sfbx": "工人"
},
{
"xsid": "C031",
"xsnr": "画师1 - 产量500",
"isChoice": false,
"sfbx": "画师"
},
{
"xsid": "C032",
"xsnr": "画师2 - 产量1320",
"isChoice": false,
"sfbx": "画师"
},
{
"xsid": "C033",
"xsnr": "画师3 - 产量1900",
"isChoice": false,
"sfbx": "画师"
},
{
"xsid": "C034",
"xsnr": "掌柜A - 产量1000",
"isChoice": false,
"sfbx": "掌柜"
},
{
"xsid": "C035",
"xsnr": "掌柜B - 产量1100",
"isChoice": false,
"sfbx": "掌柜"
},
{
"xsid": "C036",
"xsnr": "车路 - 运输量900",
"isChoice": false,
"sfbx": "运输"
},
{
"xsid": "C037",
"xsnr": "水路 - 运输量600",
"isChoice": false,
"sfbx": "运输"
},
{
"xsid": "C038",
"xsnr": "优质颜料",
"isChoice": false,
"sfbx": "颜料"
},
{
"xsid": "C039",
"xsnr": "普通颜料",
"isChoice": false,
"sfbx": "颜料"
},
{
"xsid": "C040",
"xsnr": "定制瓷器",
"isChoice": false,
"sfbx": "瓷器"
},
{
"xsid": "C041",
"xsnr": "通用瓷器",
"isChoice": false,
"sfbx": "瓷器"
},
{
"xsid": "C042",
"xsnr": "定制精美瓷器",
"isChoice": false,
"sfbx": "瓷器"
},
{
"xsid": "C043",
"xsnr": "定制普通瓷器",
"isChoice": false,
"sfbx": "瓷器"
},
{
"xsid": "C044",
"xsnr": "通用精美瓷器",
"isChoice": false,
"sfbx": "瓷器"
},
{
"xsid": "C045",
"xsnr": "通用普通瓷器",
"isChoice": false,
"sfbx": "瓷器"
},
{
"xsid": "C046",
"xsnr": "广州天气适宜",
"isChoice": false,
"sfbx": "否"
}
]
},
"1729153582461": {
"普通线索": [
{
"xsid": "C001",
"xsnr": "马可波罗希望一个月内拿到1000只瓷器",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C002",
"xsnr": "如果生产的瓷器非常精美有创意,从马可波罗那儿可以拿到定金。",
"isChoice": false,
"sfbx": "否"
}
],
"竞合": [
{
"xsid": "C003",
"xsnr": "瓷器胚",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C004",
"xsnr": "颜料商",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C005",
"xsnr": "通用瓷器销售",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C006",
"xsnr": "丝绸",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C007",
"xsnr": "茶叶",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C008",
"xsnr": "银制器具",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C009",
"xsnr": "玉器",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C010",
"xsnr": "瓷器新势力",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C011",
"xsnr": "西洋商人",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C012",
"xsnr": "竞合测试线索1",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C013",
"xsnr": "竞合测试线索2",
"isChoice": false,
"sfbx": "否"
}
],
"SWOT": [
{
"xsid": "C014",
"xsnr": "熟悉整套生产运输流程",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C015",
"xsnr": "还有熟识的好友可以提供协助",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C016",
"xsnr": "流行的瓷器粗制滥造,市场难觅好的瓷器",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C017",
"xsnr": "资金匮乏",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C018",
"xsnr": "商人可选择带回国做贸易的商品众多",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C019",
"xsnr": "虽然流行的瓷器品质一般,但数量众多",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C020",
"xsnr": "西洋有大量的瓷器进口需求",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C021",
"xsnr": "广州天气适宜",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C022",
"xsnr": "广州非常商业气氛很好",
"isChoice": false,
"sfbx": "否"
}
],
"ROI": [
{
"xsid": "C023",
"xsnr": "工人甲 - 产量360",
"isChoice": false,
"sfbx": "工人"
},
{
"xsid": "C024",
"xsnr": "工人乙 - 产量450",
"isChoice": false,
"sfbx": "工人"
},
{
"xsid": "C025",
"xsnr": "工人丙 - 产量510",
"isChoice": false,
"sfbx": "工人"
},
{
"xsid": "C026",
"xsnr": "工人丁 - 产量840",
"isChoice": false,
"sfbx": "工人"
},
{
"xsid": "C027",
"xsnr": "工人戊 - 产量960",
"isChoice": false,
"sfbx": "工人"
},
{
"xsid": "C028",
"xsnr": "工人己 - 产量1050",
"isChoice": false,
"sfbx": "工人"
},
{
"xsid": "C029",
"xsnr": "工人庚 - 产量1350",
"isChoice": false,
"sfbx": "工人"
},
{
"xsid": "C030",
"xsnr": "工人辛 - 产量1650",
"isChoice": false,
"sfbx": "工人"
},
{
"xsid": "C031",
"xsnr": "画师1 - 产量500",
"isChoice": false,
"sfbx": "画师"
},
{
"xsid": "C032",
"xsnr": "画师2 - 产量1320",
"isChoice": false,
"sfbx": "画师"
},
{
"xsid": "C033",
"xsnr": "画师3 - 产量1900",
"isChoice": false,
"sfbx": "画师"
},
{
"xsid": "C034",
"xsnr": "掌柜A - 产量1000",
"isChoice": false,
"sfbx": "掌柜"
},
{
"xsid": "C035",
"xsnr": "掌柜B - 产量1100",
"isChoice": false,
"sfbx": "掌柜"
},
{
"xsid": "C036",
"xsnr": "车路 - 运输量900",
"isChoice": false,
"sfbx": "运输"
},
{
"xsid": "C037",
"xsnr": "水路 - 运输量600",
"isChoice": false,
"sfbx": "运输"
},
{
"xsid": "C038",
"xsnr": "优质颜料",
"isChoice": false,
"sfbx": "颜料"
},
{
"xsid": "C039",
"xsnr": "普通颜料",
"isChoice": false,
"sfbx": "颜料"
},
{
"xsid": "C040",
"xsnr": "定制瓷器",
"isChoice": false,
"sfbx": "瓷器"
},
{
"xsid": "C041",
"xsnr": "通用瓷器",
"isChoice": false,
"sfbx": "瓷器"
},
{
"xsid": "C042",
"xsnr": "定制精美瓷器",
"isChoice": false,
"sfbx": "瓷器"
},
{
"xsid": "C043",
"xsnr": "定制普通瓷器",
"isChoice": false,
"sfbx": "瓷器"
},
{
"xsid": "C044",
"xsnr": "通用精美瓷器",
"isChoice": false,
"sfbx": "瓷器"
},
{
"xsid": "C045",
"xsnr": "通用普通瓷器",
"isChoice": false,
"sfbx": "瓷器"
},
{
"xsid": "C046",
"xsnr": "广州天气适宜",
"isChoice": false,
"sfbx": "否"
}
]
},
"1730359559228": {
"普通线索": [
{
"xsid": "C001",
"xsnr": "马可波罗希望一个月内拿到1000只瓷器",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C002",
"xsnr": "如果生产的瓷器非常精美有创意,从马可波罗那儿可以拿到定金。",
"isChoice": false,
"sfbx": "否"
}
],
"竞合": [
{
"xsid": "C003",
"xsnr": "瓷器胚",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C004",
"xsnr": "颜料商",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C005",
"xsnr": "通用瓷器销售",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C006",
"xsnr": "丝绸",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C007",
"xsnr": "茶叶",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C008",
"xsnr": "银制器具",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C009",
"xsnr": "玉器",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C010",
"xsnr": "瓷器新势力",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C011",
"xsnr": "西洋商人",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C012",
"xsnr": "竞合测试线索1",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C013",
"xsnr": "竞合测试线索2",
"isChoice": false,
"sfbx": "否"
}
],
"SWOT": [
{
"xsid": "C014",
"xsnr": "熟悉整套生产运输流程",
"isChoice": true,
"sfbx": "否"
},
{
"xsid": "C015",
"xsnr": "还有熟识的好友可以提供协助",
"isChoice": true,
"sfbx": "否"
},
{
"xsid": "C016",
"xsnr": "流行的瓷器粗制滥造,市场难觅好的瓷器",
"isChoice": true,
"sfbx": "否"
},
{
"xsid": "C017",
"xsnr": "资金匮乏",
"isChoice": true,
"sfbx": "否"
},
{
"xsid": "C018",
"xsnr": "商人可选择带回国做贸易的商品众多",
"isChoice": true,
"sfbx": "否"
},
{
"xsid": "C019",
"xsnr": "虽然流行的瓷器品质一般,但数量众多",
"isChoice": true,
"sfbx": "否"
},
{
"xsid": "C020",
"xsnr": "西洋有大量的瓷器进口需求",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C021",
"xsnr": "广州天气适宜",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C022",
"xsnr": "广州非常商业气氛很好",
"isChoice": false,
"sfbx": "否"
}
],
"ROI": [
{
"xsid": "C023",
"xsnr": "工人甲 - 产量360",
"isChoice": false,
"sfbx": "工人"
},
{
"xsid": "C024",
"xsnr": "工人乙 - 产量450",
"isChoice": false,
"sfbx": "工人"
},
{
"xsid": "C025",
"xsnr": "工人丙 - 产量510",
"isChoice": false,
"sfbx": "工人"
},
{
"xsid": "C026",
"xsnr": "工人丁 - 产量840",
"isChoice": false,
"sfbx": "工人"
},
{
"xsid": "C027",
"xsnr": "工人戊 - 产量960",
"isChoice": false,
"sfbx": "工人"
},
{
"xsid": "C028",
"xsnr": "工人己 - 产量1050",
"isChoice": false,
"sfbx": "工人"
},
{
"xsid": "C029",
"xsnr": "工人庚 - 产量1350",
"isChoice": false,
"sfbx": "工人"
},
{
"xsid": "C030",
"xsnr": "工人辛 - 产量1650",
"isChoice": true,
"sfbx": "工人"
},
{
"xsid": "C031",
"xsnr": "画师1 - 产量500",
"isChoice": false,
"sfbx": "画师"
},
{
"xsid": "C032",
"xsnr": "画师2 - 产量1320",
"isChoice": false,
"sfbx": "画师"
},
{
"xsid": "C033",
"xsnr": "画师3 - 产量1900",
"isChoice": true,
"sfbx": "画师"
},
{
"xsid": "C034",
"xsnr": "掌柜A - 产量1000",
"isChoice": false,
"sfbx": "掌柜"
},
{
"xsid": "C035",
"xsnr": "掌柜B - 产量1100",
"isChoice": true,
"sfbx": "掌柜"
},
{
"xsid": "C036",
"xsnr": "车路 - 运输量900",
"isChoice": false,
"sfbx": "运输"
},
{
"xsid": "C037",
"xsnr": "水路 - 运输量600",
"isChoice": false,
"sfbx": "运输"
},
{
"xsid": "C038",
"xsnr": "优质颜料",
"isChoice": false,
"sfbx": "颜料"
},
{
"xsid": "C039",
"xsnr": "普通颜料",
"isChoice": false,
"sfbx": "颜料"
},
{
"xsid": "C040",
"xsnr": "定制瓷器",
"isChoice": false,
"sfbx": "瓷器"
},
{
"xsid": "C041",
"xsnr": "通用瓷器",
"isChoice": false,
"sfbx": "瓷器"
},
{
"xsid": "C042",
"xsnr": "定制精美瓷器",
"isChoice": false,
"sfbx": "瓷器"
},
{
"xsid": "C043",
"xsnr": "定制普通瓷器",
"isChoice": false,
"sfbx": "瓷器"
},
{
"xsid": "C044",
"xsnr": "通用精美瓷器",
"isChoice": false,
"sfbx": "瓷器"
},
{
"xsid": "C045",
"xsnr": "通用普通瓷器",
"isChoice": false,
"sfbx": "瓷器"
},
{
"xsid": "C046",
"xsnr": "广州天气适宜",
"isChoice": false,
"sfbx": "否"
}
]
},
"1730359573927": {},
"1730970187744": {
"普通线索": [
{
"xsid": "C001",
"xsnr": "马可波罗希望一个月内拿到1000只瓷器",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C002",
"xsnr": "如果生产的瓷器非常精美有创意,从马可波罗那儿可以拿到定金。",
"isChoice": false,
"sfbx": "否"
}
],
"竞合": [
{
"xsid": "C003",
"xsnr": "西洋有大量的瓷器进口需求",
"isChoice": false
"xsnr": "瓷器胚",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C004",
"xsnr": "西洋商人所付瓷器定金",
"isChoice": false
"xsnr": "颜料商",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C005",
"xsnr": "西洋商人所付瓷器全部款项",
"isChoice": false
"xsnr": "通用瓷器销售",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C006",
"xsnr": "工人A月产量30",
"isChoice": false
"xsnr": "丝绸",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C007",
"xsnr": "工人B月产量50",
"isChoice": false
"xsnr": "茶叶",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C008",
"xsnr": "工人C月产量80",
"isChoice": false
"xsnr": "银制器具",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C009",
"xsnr": "画师A月产量30",
"isChoice": false
"xsnr": "玉器",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C010",
"xsnr": "画师B月产量50",
"isChoice": false
"xsnr": "瓷器新势力",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C011",
"xsnr": "画师C月产量80",
"isChoice": false
"xsnr": "西洋商人",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C012",
"xsnr": "瓷器定制100个",
"isChoice": false
"xsnr": "竞合测试线索1",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C013",
"xsnr": "瓷器通用100个",
"isChoice": false
},
"xsnr": "竞合测试线索2",
"isChoice": false,
"sfbx": "否"
}
],
"SWOT": [
{
"xsid": "C014",
"xsnr": "掌柜A 100%*R",
"isChoice": false
"xsnr": "熟悉整套生产运输流程",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C015",
"xsnr": "掌柜B 110%*R",
"isChoice": false
"xsnr": "还有熟识的好友可以提供协助",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C016",
"xsnr": "车路",
"isChoice": false
"xsnr": "流行的瓷器粗制滥造,市场难觅好的瓷器",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C017",
"xsnr": "水路",
"isChoice": false
"xsnr": "资金匮乏",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C018",
"xsnr": "瓷器胚",
"isChoice": false
"xsnr": "商人可选择带回国做贸易的商品众多",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C019",
"xsnr": "颜料",
"isChoice": false
"xsnr": "虽然流行的瓷器品质一般,但数量众多",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C020",
"xsnr": "瓷器胚",
"isChoice": false
"xsnr": "西洋有大量的瓷器进口需求",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C021",
"xsnr": "颜料商",
"isChoice": false
"xsnr": "广州天气适宜",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C022",
"xsnr": "广州非常商业气氛很好",
"isChoice": false,
"sfbx": "否"
}
],
"ROI": [
{
"xsid": "C023",
"xsnr": "工人甲 - 产量360",
"isChoice": false,
"sfbx": "工人"
},
{
"xsid": "C024",
"xsnr": "工人乙 - 产量450",
"isChoice": false,
"sfbx": "工人"
},
{
"xsid": "C025",
"xsnr": "工人丙 - 产量510",
"isChoice": false,
"sfbx": "工人"
},
{
"xsid": "C026",
"xsnr": "工人丁 - 产量840",
"isChoice": false,
"sfbx": "工人"
},
{
"xsid": "C027",
"xsnr": "工人戊 - 产量960",
"isChoice": false,
"sfbx": "工人"
},
{
"xsid": "C028",
"xsnr": "工人己 - 产量1050",
"isChoice": false,
"sfbx": "工人"
},
{
"xsid": "C029",
"xsnr": "工人庚 - 产量1350",
"isChoice": false,
"sfbx": "工人"
},
{
"xsid": "C030",
"xsnr": "工人辛 - 产量1650",
"isChoice": false,
"sfbx": "工人"
},
{
"xsid": "C031",
"xsnr": "画师1 - 产量500",
"isChoice": false,
"sfbx": "画师"
},
{
"xsid": "C032",
"xsnr": "画师2 - 产量1320",
"isChoice": false,
"sfbx": "画师"
},
{
"xsid": "C033",
"xsnr": "画师3 - 产量1900",
"isChoice": false,
"sfbx": "画师"
},
{
"xsid": "C034",
"xsnr": "掌柜A - 产量1000",
"isChoice": false,
"sfbx": "掌柜"
},
{
"xsid": "C035",
"xsnr": "掌柜B - 产量1100",
"isChoice": false,
"sfbx": "掌柜"
},
{
"xsid": "C036",
"xsnr": "车路 - 运输量900",
"isChoice": false,
"sfbx": "运输"
},
{
"xsid": "C037",
"xsnr": "水路 - 运输量600",
"isChoice": false,
"sfbx": "运输"
},
{
"xsid": "C038",
"xsnr": "优质颜料",
"isChoice": false,
"sfbx": "颜料"
},
{
"xsid": "C039",
"xsnr": "普通颜料",
"isChoice": false,
"sfbx": "颜料"
},
{
"xsid": "C040",
"xsnr": "定制瓷器",
"isChoice": false,
"sfbx": "瓷器"
},
{
"xsid": "C041",
"xsnr": "通用瓷器",
"isChoice": false,
"sfbx": "瓷器"
},
{
"xsid": "C042",
"xsnr": "定制精美瓷器",
"isChoice": false,
"sfbx": "瓷器"
},
{
"xsid": "C043",
"xsnr": "定制普通瓷器",
"isChoice": false,
"sfbx": "瓷器"
},
{
"xsid": "C044",
"xsnr": "通用精美瓷器",
"isChoice": false,
"sfbx": "瓷器"
},
{
"xsid": "C045",
"xsnr": "通用普通瓷器",
"isChoice": false,
"sfbx": "瓷器"
},
{
"xsid": "C046",
"xsnr": "广州天气适宜",
"isChoice": false,
"sfbx": "否"
}
]
},
"1730970810891": {
"普通线索": [
{
"xsid": "C001",
"xsnr": "马可波罗希望一个月内拿到1000只瓷器",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C002",
"xsnr": "如果生产的瓷器非常精美有创意,从马可波罗那儿可以拿到定金。",
"isChoice": false,
"sfbx": "否"
}
],
"竞合": [
{
"xsid": "C003",
"xsnr": "瓷器胚",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C004",
"xsnr": "颜料商",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C005",
"xsnr": "通用瓷器销售",
"isChoice": false
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C023",
"xsid": "C006",
"xsnr": "丝绸",
"isChoice": false
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C024",
"xsid": "C007",
"xsnr": "茶叶",
"isChoice": false
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C025",
"xsid": "C008",
"xsnr": "银制器具",
"isChoice": false
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C026",
"xsid": "C009",
"xsnr": "玉器",
"isChoice": false
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C027",
"xsid": "C010",
"xsnr": "瓷器新势力",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C011",
"xsnr": "西洋商人",
"isChoice": false
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C012",
"xsnr": "竞合测试线索1",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C013",
"xsnr": "竞合测试线索2",
"isChoice": false,
"sfbx": "否"
}
],
"SWOT": [
{
"xsid": "C014",
"xsnr": "熟悉整套生产运输流程",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C015",
"xsnr": "还有熟识的好友可以提供协助",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C016",
"xsnr": "流行的瓷器粗制滥造,市场难觅好的瓷器",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C017",
"xsnr": "资金匮乏",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C018",
"xsnr": "商人可选择带回国做贸易的商品众多",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C019",
"xsnr": "虽然流行的瓷器品质一般,但数量众多",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C020",
"xsnr": "西洋有大量的瓷器进口需求",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C021",
"xsnr": "广州天气适宜",
"isChoice": false,
"sfbx": "否"
},
{
"xsid": "C022",
"xsnr": "广州非常商业气氛很好",
"isChoice": false,
"sfbx": "否"
}
],
"ROI": [
{
"xsid": "C023",
"xsnr": "工人甲 - 产量360",
"isChoice": false,
"sfbx": "工人"
},
{
"xsid": "C024",
"xsnr": "工人乙 - 产量450",
"isChoice": false,
"sfbx": "工人"
},
{
"xsid": "C025",
"xsnr": "工人丙 - 产量510",
"isChoice": false,
"sfbx": "工人"
},
{
"xsid": "C026",
"xsnr": "工人丁 - 产量840",
"isChoice": false,
"sfbx": "工人"
},
{
"xsid": "C027",
"xsnr": "工人戊 - 产量960",
"isChoice": false,
"sfbx": "工人"
},
{
"xsid": "C028",
"xsnr": "测试线索1",
"isChoice": true
"xsnr": "工人己 - 产量1050",
"isChoice": false,
"sfbx": "工人"
},
{
"xsid": "C029",
"xsnr": "测试线索2",
"isChoice": true
"xsnr": "工人庚 - 产量1350",
"isChoice": false,
"sfbx": "工人"
},
{
"xsid": "C030",
"xsnr": "测试线索3",
"isChoice": true
"xsnr": "工人辛 - 产量1650",
"isChoice": false,
"sfbx": "工人"
},
{
"xsid": "C031",
"xsnr": "测试线索4",
"isChoice": true
"xsnr": "画师1 - 产量500",
"isChoice": false,
"sfbx": "画师"
},
{
"xsid": "C032",
"xsnr": "测试线索5",
"isChoice": false
"xsnr": "画师2 - 产量1320",
"isChoice": false,
"sfbx": "画师"
},
{
"xsid": "C033",
"xsnr": "测试线索6",
"isChoice": false
"xsnr": "画师3 - 产量1900",
"isChoice": false,
"sfbx": "画师"
},
{
"xsid": "C034",
"xsnr": "测试线索7",
"isChoice": false
"xsnr": "掌柜A - 产量1000",
"isChoice": false,
"sfbx": "掌柜"
},
{
"xsid": "C035",
"xsnr": "测试线索8",
"isChoice": false
"xsnr": "掌柜B - 产量1100",
"isChoice": false,
"sfbx": "掌柜"
},
{
"xsid": "C036",
"xsnr": "车路 - 运输量900",
"isChoice": false,
"sfbx": "运输"
},
{
"xsid": "C037",
"xsnr": "水路 - 运输量600",
"isChoice": false,
"sfbx": "运输"
},
{
"xsid": "C038",
"xsnr": "优质颜料",
"isChoice": false,
"sfbx": "颜料"
},
{
"xsid": "C039",
"xsnr": "普通颜料",
"isChoice": false,
"sfbx": "颜料"
},
{
"xsid": "C040",
"xsnr": "定制瓷器",
"isChoice": false,
"sfbx": "瓷器"
},
{
"xsid": "C041",
"xsnr": "通用瓷器",
"isChoice": false,
"sfbx": "瓷器"
},
{
"xsid": "C042",
"xsnr": "定制精美瓷器",
"isChoice": false,
"sfbx": "瓷器"
},
{
"xsid": "C043",
"xsnr": "定制普通瓷器",
"isChoice": false,
"sfbx": "瓷器"
},
{
"xsid": "C044",
"xsnr": "通用精美瓷器",
"isChoice": false,
"sfbx": "瓷器"
},
{
"xsid": "C045",
"xsnr": "通用普通瓷器",
"isChoice": false,
"sfbx": "瓷器"
},
{
"xsid": "C046",
"xsnr": "广州天气适宜",
"isChoice": false,
"sfbx": "否"
}
]
}
}
\ No newline at end of file
{
{
......@@ -2,6 +2,90 @@
"1727399696222": {
"初始资金": 500,
"天数": 1,
"结算": 500
"结算": 500,
"广州府介绍": true,
"酒馆剧情": 0,
"当前线索确认": 0,
"商行选择": false,
"SWOT": false,
"ROI": false,
"竞合": false
},
"1730359559228": {
"初始资金": 500,
"天数": 4,
"结算": -214000,
"广州府介绍": false,
"酒馆剧情": 1,
"当前线索确认": 1,
"商行选择": true,
"SWOT": true,
"ROI": true,
"竞合": true,
"码头": {
"SO11": {
"当前对话id": "15",
"已获得的线索": [
"C001",
"C002",
"C003",
"C012"
]
}
},
"酒馆": {
"SO12_1": {
"当前对话id": "15",
"已获得的线索": []
}
}
},
"1729153582461": {
"初始资金": 500,
"天数": 3,
"结算": 500,
"广州府介绍": false,
"酒馆剧情": 0,
"当前线索确认": 0,
"商行选择": false,
"SWOT": false,
"ROI": false,
"竞合": false
},
"1730359573927": {
"初始资金": 500,
"天数": 2,
"结算": 500,
"广州府介绍": false,
"酒馆剧情": 0,
"当前线索确认": 0,
"商行选择": false,
"SWOT": false,
"ROI": false,
"竞合": false
},
"1730970187744": {
"初始资金": 500,
"天数": 1,
"结算": 500,
"广州府介绍": false,
"酒馆剧情": 0,
"当前线索确认": 0,
"商行选择": false,
"SWOT": false,
"ROI": false,
"竞合": false
},
"1730970810891": {
"初始资金": 500,
"天数": 0,
"结算": 500,
"广州府介绍": true,
"酒馆剧情": 0,
"当前线索确认": 0,
"商行选择": false,
"SWOT": false,
"ROI": false,
"竞合": false
}
}
\ No newline at end of file
{
++ /dev/null
{
"1727399696222": {
"SWOT": {
"isSubmit": false,
"S": [],
"W": [],
"O": [],
"T": []
},
"ROI": {
"isSubmit": true,
"R": [],
"I": []
},
"竞合": {
"isSubmit": false,
"供应商": [],
"行业竞争": [],
"跨界竞争": [],
"潜在替代": [],
"消费者": []
}
}
}
\ No newline at end of file
{
{
"js":"十三行[Shísānháng]历史地名。位于广州市荔湾区沙面与文化公园的北面。清康熙二十五(1686),广州城西南江边开设洋货行,又称十三行。据谭元亨《十三行史稿》考证,“广州十三行与早先月港的,职能’一脉相承”。作者认为“十三行”一词缘起明代的月港:涵盖经营珠宝、棉布瓷器、丝绸、箍(豆饼)、铸鼎、糖、丝线、鱼、纸、茶、造船等13种行业。“十三行”是专称一个行业、一种职能,即明清对外贸易特有的机制与行当,其意义超越地域名、商馆数之名、资本集团之名以及制度名,而是历史之名,是传统的延续。 [13]十三只为特指数,不确实是十区。清乾隆二十二年(1757)-清道光二十二方允许的。"
}
\ No newline at end of file
{
++ /dev/null
{
"掌柜":{},
"工人":{},
"画师":{}
}
\ No newline at end of file
{
{
"1727399696222": {
"SWOT": 0,
"ROI": 0,
"竞合": 0
},
"1729153582461": {
"SWOT": 0,
"ROI": 0,
"竞合": 0
},
"1730359559228": {
"SWOT": 14.285714285714285,
"ROI": 30,
"竞合": 17.77777777777778
},
"1730359573927": {},
"1730970187744": {
"SWOT": 0,
"ROI": 0,
"竞合": 0
},
"1730970810891": {
"SWOT": 0,
"ROI": 0,
"竞合": 0
}
}
\ No newline at end of file
{
{
"瓷器": {
"定制精美瓷器": {
"瓷器": "C040",
"颜料": "C038",
"单价": 300,
"固定成本": 200
},
"定制普通瓷器": {
"瓷器": "C040",
"颜料": "C039",
"单价": 270,
"固定成本": 190
},
"通用精美瓷器": {
"瓷器": "C041",
"颜料": "C038",
"单价": 170,
"固定成本": 120
},
"通用普通瓷器": {
"瓷器": "C041",
"颜料": "C039",
"单价": 150,
"固定成本": 110
}
},
"人员成本": {
"C023": {
"ycl": 360,
"gz": 150,
"fjcb": 0.42
},
"C024": {
"ycl": 450,
"gz": 150,
"fjcb": 0.33
},
"C025": {
"ycl": 510,
"gz": 150,
"fjcb": 0.29
},
"C026": {
"ycl": 840,
"gz": 300,
"fjcb": 0.36
},
"C027": {
"ycl": 960,
"gz": 300,
"fjcb": 0.31
},
"C028": {
"ycl": 1050,
"gz": 300,
"fjcb": 0.29
},
"C029": {
"ycl": 1350,
"gz": 450,
"fjcb": 0.33
},
"C030": {
"ycl": 1650,
"gz": 450,
"fjcb": 0.27
},
"C031": {
"ycl": 500,
"gz": 1000,
"fjcb": 2
},
"C032": {
"ycl": 1320,
"gz": 2000,
"fjcb": 1.52
},
"C033": {
"ycl": 1900,
"gz": 3000,
"fjcb": 1.58
},
"C034": {
"ycl": 1000,
"gz": 1000,
"fjcb": 1
},
"C035": {
"ycl": 1100,
"gz": 1050,
"fjcb": 0.95
}
},
"运输成本": {
"C036": {
"sjmc": "车路",
"xjb": 1.33
},
"C037": {
"sjmc": "水路",
"xjb": 1
}
}
}
\ No newline at end of file
[
[
{
"userId": "1727399696222",
"loginId": "玩家1",
"pwd": "123456"
},
{
"userId": "1729153582461",
"loginId": "玩家2",
"pwd": "123456"
},
{
"userId": "1730359559228",
"loginId": "admin",
"pwd": "123456"
},
{
"userId": "1730359573927",
"loginId": "123",
"pwd": "123"
},
{
"userId": "1730970187744",
"loginId": "111",
"pwd": "111"
},
{
"userId": 1730970810891,
"loginId": "333",
"pwd": "333"
}
]
\ No newline at end of file
{
{
{
"1729153582461": {},
"1730359573927": {},
"1730359559228": {}
}
\ No newline at end of file
{
{
"SWOT": {
"S": [
"C014",
"C015"
],
"W": [
"C017"
],
"O": [
"C016",
"C020"
],
"T": [
"C018",
"C019"
]
},
"ROI": {
"R": [
"C042",
"C043",
"C044",
"C045",
"C046"
],
"I": [
"C023",
"C024",
"C025",
"C026",
"C027",
"C028",
"C029",
"C030",
"C031",
"C032",
"C033",
"C034",
"C035",
"C036",
"C037",
"C038",
"C039",
"C040",
"C041"
]
},
"竞合": {
"供应商": [
"C003",
"C004"
],
"行业竞争": [
"C005"
],
"跨界竞争": [
"C006",
"C007"
],
"替代竞争": [
"C008",
"C009",
"C010"
],
"消费者": [
"C011"
]
},
"1730359573927": {}
}
\ No newline at end of file
{
{
"1730359573927": {},
"1730359559228": {
"原材料": {
"瓷器": "C040",
"颜料": "C039"
},
"运输": "C037"
}
}
\ No newline at end of file
No preview for this file type
No preview for this file type
/**
* 线索
* S:100、A:100-85、B:85-70、C:70-55、D:55-0
*/
import { gongziTableData, xiansuoTableData } from "../data/table/tableData";
import { changeJsonData, getJsonData, getRandomInt } from "../util/tools";
import { HARITYPE, NOWCLUE } from "../config/enum";
import { xiansuoTableData, guyongTableData } from "../data/table/tableData";
import { successResult } from "../tools/systemTools";
import { changeJsonData, getJsonData } from "../util/tools";
/**
* 线索
* 有参数返回对应线索类型数据,没有参数返回全部线索数据
* @param clueType 线索类型
* @returns
* 是否启用线索
* @param userId
*/
export function isEnabled(userId:string) {
//获取已有json数据
let baseData = getJsonData("json/基础数据.json")[userId];
let isEnabled = {
"SWOT": baseData.SWOT,
"ROI": baseData.ROI,
"竞合": baseData.竞合
};
return isEnabled;
}
/**
* 添加线索
* @param userId
*/
export function getClue(clueType?) {
export function addClue(userId:string) {
let excelData = xiansuoTableData();
let clueExcelData = excelData["线索表"].dataList;
let writeClueAll = {};
/**添加全部线索 */
let clueData = {};
let writeClueAll = {"1727399696222":[]};
clueExcelData.forEach( info => {
let {xsid, xsnr, xslx, xslxxf, zs, dhgl} = info;
let {xsid, xsnr, xslx, xslxxf, zs, dhgl, sfbx} = info;
if (!clueData[xslx]) clueData[xslx] = [];
clueData[xslx].push({xsid, xsnr});
writeClueAll["1727399696222"].push({xsid, xsnr, isChoice:false});
if (!writeClueAll[userId]) writeClueAll[userId] = [];
writeClueAll[userId].push({xsid, xsnr, isChoice:false});
})
let clueList = [];
let allClueJson = getJsonData("json/全部线索.json");
if(!clueType || Object.keys(allClueJson).length === 0) addAllClue(writeClueAll);
if(clueType) {
clueData[clueType].forEach( info => {
allClueJson["1727399696222"].forEach( thisClue => {
if(info.xsid == thisClue.xsid) {
clueList.push(thisClue);
}
})
writeClueAll["1727399696222"].push({xsid:info.xsid, xsnr:info.xsnr, isChoice:false});
})
}
else {
clueList = allClueJson["1727399696222"];
}
if(clueList) {
clueList.sort( (a, b) => {
if (a.isChoice === true && b.isChoice === false) {
return 1;
} else if (a.isChoice === false && b.isChoice === true) {
return -1;
}
// a.isChoice - b.isChoice
return 0;
});
}
return clueList;
if(!allClueJson[userId] || allClueJson[userId].length == 0) addAllClue(writeClueAll);
console.log(`${userId}全部线索添加成功`);
}
/**
* 添加线索
* @param clueType 线索类型【SWOT、ROI、竞合】
* @param xxType 线索细分类型【S、O、W ...】
* @param xs [{xsid:"", xsnr:""}, ...]
* @param xsid 线索id: C001
* @param xsnr 线索内容: ""
* 添加细分线索
*/
export function addClue(clueType, xxType, xs) {
let jsonData = getJsonData("json/已选择线索.json");
let baseData = jsonData;
export function xfxxClue() {
let excelData = xiansuoTableData();
//isSubmit:false【未提交】、true【提交】
/**当前线索类型未提交时,可以修改添加线索 */
if (!baseData["1727399696222"][clueType]["isSubmit"]) {
for (let i = 0; i < xs.length; i++) {
baseData["1727399696222"][clueType][xxType].push(xs[i]);
let clueExcelData = excelData["线索表"].dataList;
let swotClue = { "S":[], "W":[], "O":[], "T":[] };
let roiClue = { "R":[], "I":[] };
let jinheClue = { "供应商":[], "行业竞争":[], "跨界竞争":[], "替代竞争":[], "消费者":[] }
clueExcelData.forEach( info => {
let xslxxf = info.xslxxf;
for (let key in swotClue) {
if (xslxxf == key) swotClue[key].push(info.xsid);
}
changeJsonData("json/已选择线索.json", baseData);
console.log("添加线索成功");
} else {
console.log("线索已提交,无法重复提交");
for (let key in roiClue) {
if (xslxxf == key) roiClue[key].push(info.xsid);
}
/**修改全部线索 */
let allClueJson = getJsonData("json/全部线索.json");
let allClueData = allClueJson;
for (let key in jinheClue) {
if (xslxxf == key) jinheClue[key].push(info.xsid);
}
// let changeClue = [];
xs.forEach( info => {
let {xsid, xsnr} = info;
allClueData["1727399696222"].forEach( thisClue => {
if(xsid == thisClue.xsid) thisClue.isChoice = true;
})
});
changeJsonData("json/全部线索.json", allClueData);
let xfxxClueJson = {
"SWOT":swotClue,
"ROI":roiClue,
"竞合":jinheClue
};
return "添加线索成功";
changeJsonData("json/细分线索.json", xfxxClueJson);
// let xfClueJson = getJsonData("json/细分线索.json");
// if(!xfClueJson || Object.keys(xfxxClueJson).length === 0) changeJsonData("json/细分线索.json", xfxxClueJson);
console.log(`细分线索添加成功`);
}
/**
* 提交线索
* @param clueType 线索类型【SWOT、ROI、竞合】
*/
export function submitClue(clueType) {
let jsonData = getJsonData("json/已选择线索.json");
export function submitClue(userId, clueType) {
let jsonData = getJsonData(`json/${clueType}.json`);
let baseData = jsonData;
//isSubmit:false【未提交】、true【提交】
baseData["1727399696222"][clueType]["isSubmit"] = true;
baseData[userId]["isSubmit"] = true;
changeJsonData("json/已提交线索.json", baseData);
console.log("已提交线索");
/**清空原有剧情和线索 */
restart();
// restart(userId);
return "已提交线索";
return successResult();
}
/**
* 添加全部线索
* @param clueType 线索类型【SWOT、ROI、竞合】
* @param data
*/
export function addAllClue(data) {
export function addAllClue(data) {
let jsonData = getJsonData("json/全部线索.json");
let baseData = jsonData;
......@@ -141,14 +131,138 @@ export function submitClue(clueType) {
/**
* 线索
* 有参数返回对应线索类型数据,没有参数返回全部线索数据
* @param clueType 线索类型
* @returns
*/
export function getClue(userId, clueType?) {
let excelData = xiansuoTableData();
let clueExcelData = excelData["线索表"].dataList;
let clueData = {};
clueExcelData.forEach( info => {
let {xsid, xsnr, xslx, sfbx} = info;
if (!clueData[xslx]) clueData[xslx] = [];
clueData[xslx].push({xsid, xsnr, sfbx});
})
/**如果登录的账号没有全部线索数据,则写入json */
let allClueJson = getJsonData("json/全部线索.json");
let writeClueAll = allClueJson;
if (Object.keys(allClueJson[userId]).length == 0) {
writeClueAll[userId] = {};
clueExcelData.forEach( info => {
let {xsid, xsnr, xslx, xslxxf, sfbx} = info;
if (!writeClueAll[userId][xslx]) writeClueAll[userId][xslx] = [];
writeClueAll[userId][xslx].push({xsid, xsnr, isChoice:false, sfbx});
})
//写入json
changeJsonData("json/全部线索.json", writeClueAll);
}
let clueList = [];
let guyongJson = getJsonData("json/雇佣选择.json");
let guyongUserJson = guyongJson[userId];
let grData:any = {"工人":[], "画师":[], "掌柜":[], "运输":[], "颜料":[], "瓷器":[], "是":[], "否":[], "制成瓷器":[]};
/**特化ROI线索列表,返回已选择的工人、画师、掌柜 */
if (clueType == "ROI") {
//根据原材料选择出制作的是哪个款式的瓷器
let gyExcelData = guyongTableData();
let zzcqExcelData = gyExcelData["制作瓷器"].dataList;
let 瓷器材料 = guyongUserJson["原材料"]["瓷器"];
let 颜料材料 = guyongUserJson["原材料"]["颜料"];
zzcqExcelData.forEach( info => {
let {xsid, lx, sj, yl, cq} = info;
if (yl == 颜料材料 && cq == 瓷器材料) {
guyongUserJson["制成瓷器"] = xsid;
}
})
guyongJson[userId] = guyongUserJson;
changeJsonData("json/雇佣选择.json", guyongJson);
let ROI = [];
clueData[clueType].forEach( info => {
let {xsid, xsnr, sfbx} = info;
for (let key in grData) {
if (key == sfbx) {
grData[sfbx].push({xsid, xsnr});
}
}
})
let ptgr = guyongUserJson["人工"]["工人"] || "";
let hs = guyongUserJson["人工"]["画师"] || "";
let zg = guyongUserJson["人工"]["掌柜"] || "";
let ys = guyongUserJson["运输"] || "";
let cq = 瓷器材料 || "";
let yl = 颜料材料 || "";
let zccq = guyongUserJson["制成瓷器"] || "";
for (let key in grData) {
let xsid = guyongUserJson[key];
grData[key].forEach(info => {
if(info.xsid == ptgr || info.xsid == hs || info.xsid == zg || info.xsid == ys || info.xsid == cq || info.xsid == yl || info.xsid == zccq) {
ROI.push(info);
}
if (key == "是" || key == "否") {
ROI.push(info);
}
})
}
clueData["ROI"] = ROI;
}
let allClueChange = getJsonData("json/全部线索.json");
if(clueType) {
clueData[clueType].forEach( info => {
for(let key in allClueChange[userId]) {
allClueChange[userId][key].forEach( thisClue => {
if(info.xsid == thisClue.xsid) {
clueList.push(thisClue);
}
})
}
})
} else {
for(let key in allClueChange[userId]) {
allClueChange[userId][key].forEach( thisClue => {
clueList.push(thisClue);
})
}
}
if(clueList) {6
clueList.sort( (a, b) => {
if (a.isChoice === true && b.isChoice === false) {
return 1;
} else if (a.isChoice === false && b.isChoice === true) {
return -1;
}
return 0;
});
}
return clueList;
}
/**
* 回显细分线索
* @param clueType 线索类型【SWOT、ROI、竞合】
*/
export function getChoiceClue(clueType) {
let jsonData = getJsonData("json/已选择线索.json");
let baseData = jsonData["1727399696222"];
export function getChoiceClue(userId, clueType) {
let jsonData = getJsonData(`json/${clueType}.json`);
let baseData = {};
if (Object.keys(jsonData).length === 0) baseData = {};
else baseData = jsonData[userId];
return baseData[clueType];
return baseData;
}
......@@ -159,204 +273,184 @@ export function getChoiceClue(clueType) {
* @param xsid 线索id: C001
* @returns
*/
export function delClue(clueType, xxType, xsid) {
let jsonData = getJsonData("json/已选择线索.json");
export function delClue(userId, clueType, xxType, xsid) {
let jsonData = getJsonData(`json/${clueType}.json`);
let baseData = jsonData;
let clueData = baseData["1727399696222"][clueType][xxType];
let clueData = baseData[userId][xxType];
/**过滤掉xsid的元素 */
let clueDelData = clueData.filter(x => ![xsid].includes(x.xsid));
baseData["1727399696222"][clueType][xxType] = clueDelData;
changeJsonData("json/已选择线索.json", baseData);
baseData[userId][xxType] = clueDelData;
changeJsonData(`json/${clueType}.json`, baseData);
console.log(baseData);
let allClueJson = getJsonData("json/全部线索.json");
// let allClueData = allClueJson;
allClueJson["1727399696222"].forEach( thisClue => {
for (let key in allClueJson[userId]) {
allClueJson[userId][key].forEach( thisClue => {
if(xsid == thisClue.xsid) thisClue.isChoice = false;
});
changeJsonData("json/全部线索.json", allClueJson);
return "删除成功";
}
}
export function getWages(gr:string) {
let excelData = gongziTableData();
let wagesExcelData = excelData['工资表'].dataList;
changeJsonData("json/全部线索.json", allClueJson);
let wagesData = {};
wagesExcelData.forEach( info => {
let nlz = getRandomInt(info.nlfwksz, info.nlfwjsz);
let xqz = getRandomInt(0, info.xqz);
let cl = nlz*xqz;
let gz = nlz*2;
wagesData[info.gr] = {nlz, xqz, cl, gz};
})
if (xxType == "R") {
let excelData = guyongTableData();
let ciqiExcel = excelData['制作瓷器'].dataList;
let ciqiMoney = 0;
let baseClueJson = getJsonData("json/基础数据.json");
ciqiExcel.forEach( info => {
if (info.xsid == xsid) ciqiMoney = info.sj;
});
//加上定制瓷器金额
let jsje = baseClueJson[userId]["结算"] || 0;
baseClueJson[userId]["结算"] = jsje - ciqiMoney * 1000;
changeJsonData("json/基础数据.json", baseClueJson);
}
return wagesData[gr];
return successResult();
}
/**
* 统计线索数量
* @param clueType
* @returns
* 提交线索
* @param userId
*/
export function getCount() {
let jsonData = getJsonData("json/已选择线索.json");
let clueData = jsonData["1727399696222"];
let personalData = {
clue:0,
tael:0,
hire:0
};
export function checkClue(userId) {
let jsonData = getJsonData("json/提交分数.json")[userId];
let swot = jsonData["SWOT"] || 0;
let roi = jsonData["ROI"] || 0;
let jinhe = jsonData["竞合"] || 0;
let score = swot + roi + jinhe;
// 线索数
for(let type in clueData) {
for(let key in clueData[type]) {
if (key != "isSubmit") personalData.clue += clueData[type][key].length;
let result = {
rating: "",
msg: "",
nextAct: false
}
if (score >= 100) {
result.rating = "S";
result.msg = "恭喜你本次学习获得评级"
result.nextAct = true;
}
// 银两数
let baseData = getJsonData("json/基础数据.json");
personalData.tael = baseData["1727399696222"]["结算"] || 0;
if (score > 85 && score < 100) {
result.rating = "A";
result.msg = "恭喜你本次学习获得评级"
result.nextAct = true;
}
if (score > 70 && score < 85) {
result.rating = "B";
result.msg = "建议重新答题,本次学习获得评级"
result.nextAct = true;
}
// 雇佣人数
if (score > 55 && score < 70) {
result.rating = "C";
result.msg = "建议重新答题,本次学习获得评级"
result.nextAct = false;
}
if (score < 55) {
result.rating = "D";
result.msg = "建议重新答题,本次学习获得评级"
result.nextAct = false;
}
return personalData;
return result;
}
/**
* 基础数据【当前天数、银两数】
* @returns
* 重新答题
* 只需清空已选择线索,剧情不需要重新玩
* @param userId
*/
export function getBaseData() {
let baseData = getJsonData("json/基础数据.json");
let basicsData = {
day:0,
tael:0
export function againAnswer(userId) {
//根据原材料选择出制作的是哪个款式的瓷器
let baseClueJson = getJsonData("json/基础数据.json");
let guyongJson = getJsonData("json/雇佣选择.json");
let guyongUserJson = guyongJson[userId];
let gyExcelData = guyongTableData();
let zzcqExcelData = gyExcelData["制作瓷器"].dataList;
let 瓷器材料 = guyongUserJson["原材料"]["瓷器"];
let 颜料材料 = guyongUserJson["原材料"]["颜料"];
let ciqiMoney = 0;
zzcqExcelData.forEach( info => {
let {xsid, lx, sj, yl, cq} = info;
if (yl == 颜料材料 && cq == 瓷器材料) {
zzcqExcelData.forEach( info => {
if (info.xsid == xsid) ciqiMoney = info.sj;
});
}
basicsData.day = baseData["1727399696222"]["天数"];
basicsData.tael = baseData["1727399696222"]["结算"];
return basicsData;
}
/**结算页面 */
export function getSettlement(clueType) {
let jsonData = getJsonData("json/已提交线索.json");
let clueData = jsonData["1727399696222"][clueType];
let baseData = getJsonData("json/基础数据.json");
let settlement = {
isPass:89,
clue:0,
tael:0,
hire:0
};
})
//是否通关
// let defaultMoney = baseData["1727399696222"]["初始资金"];
let endMoney = baseData["1727399696222"]["结算"];
// if (endMoney > defaultMoney) settlement.isPass = "通关"
//删去结算金额上的定制瓷器金额
let jsje = baseClueJson[userId]["结算"] || 0;
baseClueJson[userId]["结算"] = jsje - ciqiMoney * 1000;
changeJsonData("json/基础数据.json", baseClueJson);
// 线索数
for(let key in clueData) {
if (key != "isSubmit") settlement.clue += clueData[key].length;
let againJson = ["SWOT", "ROI", "竞合"];
for (let i = 0; i < againJson.length; i++) {
let allJson = getJsonData(`json/${againJson[i]}.json`);
allJson[userId] = {};
changeJsonData(`json/${againJson[i]}.json`, allJson);
}
// 银两数
settlement.tael = endMoney;
// 雇佣人数
/**修改全部线索的已选中 */
let allClueJson = getJsonData("json/全部线索.json");
// let allClueData = allClueJson;
for (let key in allClueJson[userId]) {
allClueJson[userId][key].forEach( thisClue => {
thisClue.isChoice = false;
});
}
changeJsonData("json/全部线索.json", allClueJson);
return settlement;
return successResult();
}
/**
* 清空原有剧情和线索
* 重新开始
* 当前用户数据全部清空
* @param userId
*/
export function restart() {
let yxzxs = {
"1727399696222":{
"SWOT":{
"isSubmit":false,
"S":[],
"W":[],
"O":[],
"T":[]
},
"ROI":{
"isSubmit":false,
"R":[],
"I":[]
},
"竞合":{
"isSubmit":false,
"供应商":[],
"行业竞争":[],
"跨界竞争":[],
"潜在替代":[],
"消费者":[]
}
}
};
changeJsonData("json/已选择线索.json", yxzxs);
export function againStart(userId) {
let againJson = ["雇佣选择", "全部线索", "提交分数", "细分线索", "SWOT", "ROI", "竞合"];
let jsonData = getJsonData("json/全部线索.json");
let qbData = {"1727399696222":[]};
jsonData["1727399696222"].forEach( info => {
let isChoice = false;
info.isChoice = isChoice;
qbData[1727399696222].push(info);
})
for (let i = 0; i < againJson.length; i++) {
let allJson = getJsonData(`json/${againJson[i]}.json`);
allJson[userId] = {};
changeJsonData(`json/${againJson[i]}.json`, allJson);
}
changeJsonData("json/全部线索.json", qbData);
let jcsj = {
"1727399696222":{
let userJson = getJsonData("json/基础数据.json");
let writeBaseAll = userJson;
writeBaseAll[userId] = {
"初始资金": 500,
"天数":1,
"结算":500
"结算":500,
"广州府介绍": true, //广州府第一次介绍:true
// "酒馆雇佣": false, //酒馆已选择雇佣工人:true
"酒馆剧情": HARITYPE.未开始, //酒馆剧情:默认未开始,已开始需要SWOT确认
"当前线索确认": NOWCLUE.未开始,
"商行选择":false,
"SWOT": false,
"ROI": false,
"竞合": false
}
};
changeJsonData("json/基础数据.json", jcsj);
console.log("已清空内容");
return true;
}
//写入json
changeJsonData("json/基础数据.json", writeBaseAll);
/**
* 回显线索选择弹窗 停用
* @param clueType 线索类型【SWOT、ROI、竞合】
* @param xxType 线索细分类型【S、O、W ...】
*/
export function choiceClueAll() {
let allClueJson = getJsonData("json/全部线索.json");
let clueData = allClueJson["1727399696222"];
clueData.sort( (a, b) => {
if (a.isChoice === true && b.isChoice === false) {
return 1;
} else if (a.isChoice === false && b.isChoice === true) {
return -1;
}
// a.isChoice - b.isChoice
return 0;
});
return clueData;
return successResult();
}
......@@ -367,3 +461,4 @@ export function restart() {
/**
* 竞合线索
* 20:竞合线索总分数 (该公式计算错误:N/M*(1/5)*20)
* 分数计算规则:N/M*20
* M:线索总数
* N:选对线索数
* 1/5:细分线索类型数量(供应商、行业竞争、跨界竞争、替代竞争、消费者)
*/
import { NOWCLUE } from "../config/enum";
import { successResult } from "../tools/systemTools";
import { changeJsonData, getJsonData } from "../util/tools";
/**
* 竞合线索确认
* @param subdivide 细分线索类型【供应商、行业竞争、跨界竞争、替代竞争、消费者】
* @param xs [{xsid:"", xsnr:""}, ...]
*/
export function submitJinheClue(userId, subdivide, xs) {
let jsonData = getJsonData("json/竞合.json");
/**处理确认选择的线索 */
let jinheClueData = jsonData;
//没有对应用户数据先添加一个基础格式,有的话直接push
if (!jinheClueData[userId] || Object.keys(jinheClueData[userId]).length === 0) {
jinheClueData[userId] = {
"isSubmit": false,
"供应商": [],
"行业竞争": [],
"跨界竞争": [],
"替代竞争": [],
"消费者": []
};
}
//isSubmit:false【未提交】、true【提交】
/**当前线索类型未提交时,可以修改添加线索 */
if (!jinheClueData[userId]["isSubmit"]) {
for (let i = 0; i < xs.length; i++) {
// let xsInfo = xs[i];
jinheClueData[userId][subdivide].push(xs[i]);
}
changeJsonData("json/竞合.json", jinheClueData);
console.log("添加ROI线索成功");
} else {
console.log("线索已提交,无法重复提交");
}
/**修改全部线索.json的对应线索为已选择 isChoice:true */
let allClueJson = getJsonData("json/全部线索.json");
let allClueData = allClueJson;
xs.forEach( info => {
let {xsid, xsnr} = info;
for(let key in allClueData[userId]) {
allClueData[userId][key].forEach( thisClue => {
if(xsid == thisClue.xsid) thisClue.isChoice = true;
})
}
});
changeJsonData("json/全部线索.json", allClueData);
let baseJsonData = getJsonData("json/基础数据.json");
baseJsonData[userId]["当前线索确认"] = NOWCLUE.竞合;
changeJsonData("json/基础数据.json", baseJsonData);
return successResult();
}
/**
* 计算选择正确的竞合线索
* @param userId
*/
export function checkJinhe(userId) {
/**获取细分线索 */
let xfclueJson = getJsonData("json/细分线索.json");
let clueJson = getJsonData("json/竞合.json")[userId];
let sumClue = 0; //线索总数
let rightClue = 0; //选对线索数
let xfclueROIJson = xfclueJson["竞合"];
let score = 0;
let conf = ["供应商", "行业竞争", "跨界竞争", "替代竞争", "消费者"];
for (let i = 0; i < conf.length; i++) {
let allxf = xfclueROIJson[conf[i]] || []; //所有细分的线索
sumClue += allxf.length;
let rightXf = clueJson[conf[i]] || []; //选中提交的细分线索
for (let xf = 0; xf < allxf.length; xf++) {
rightXf.forEach( info => {
if (allxf[xf] == info.xsid) rightClue++;
})
}
}
/**计算分数 */
// score = rightClue/sumClue*(1/5)*20;
score = (rightClue/sumClue)*20;
let submitJsonData = getJsonData("json/提交分数.json");
let submitScore = submitJsonData;
submitScore[userId]["竞合"] = score;
changeJsonData("json/提交分数.json", submitScore);
return successResult();
}
......@@ -2,9 +2,15 @@
* 剧情
*/
import { HARITYPE, NOWCLUE } from "../config/enum";
import { ERRORENUM } from "../config/errorEnum";
import { systemConfig } from "../config/serverConfig";
import { juqingTableData, NPCTableData } from "../data/table/tableData";
import { guyongTableData, juqingTableData, NPCTableData } from "../data/table/tableData";
import { successResult } from "../tools/systemTools";
import { BizError } from "../util/bizError";
import { changeJsonData, getJsonData } from "../util/tools";
import { addClue, xfxxClue } from "./clue";
/**
* 剧情
......@@ -13,11 +19,10 @@ import { changeJsonData, getJsonData } from "../util/tools";
* @param dhId 对话id(后置剧情id)
* @returns
*/
export function getPlayData(type:string, playId:string, dhId:string) {
export function getPlayData(userId:string, type:string, playId:string, dhId:string) {
let excelData = juqingTableData(type, playId);
let playData = excelData[playId].dataList;
// let duihua = 1;
let nextStory:any = {};
playData.forEach( info => {
let {dhid, dh, jqlx, hzjqid, glnpc, glxsid} = info;
......@@ -28,7 +33,7 @@ export function getPlayData(type:string, playId:string, dhId:string) {
nextStory["img"] = `${systemConfig.ipUrl}NPC/${glnpc}.png`;
//记录当前走到的剧情
plotClues(type, playId, dhId, glxsid);
plotClues(userId, type, playId, dhId, glxsid);
}
});
......@@ -43,6 +48,84 @@ export function getPlayData(type:string, playId:string, dhId:string) {
nextStory.hzjq = dhStory;
nextStory.img = `${systemConfig.ipUrl}NPC/${nextStory.glnpc}.png`
}
if (nextStory.hzjqid == '999') {
//剧情走完添加对应用户的对应线索数据
addClue(userId);
xfxxClue();
/**剧情完成可添加SWOT线索 */
let allClueJson = getJsonData("json/基础数据.json");
allClueJson[userId]["SWOT"] = true;
//更新json数据
changeJsonData("json/基础数据.json", allClueJson);
}
}
return nextStory;
}
/**
* 酒馆剧情
* @param type 酒馆
* @param playId SO12
* @param dhId 对话id(后置剧情id)
* @returns
*/
export function getJGPlayData(userId:string, type:string, playId:string, dhId:string) {
let allClueJson = getJsonData("json/基础数据.json");
let duihua = `${playId}_1`;
if (allClueJson[userId]["酒馆剧情"] > HARITYPE.未开始) {
duihua = `${playId}_${allClueJson[userId]["酒馆剧情"]}`;
}
/**剧情完成可添加ROI线索 */
let excelData = juqingTableData(type, duihua);
let playData = excelData[duihua].dataList;
let nextStory:any = {};
playData.forEach( info => {
let {dhid, dh, jqlx, hzjqid, glnpc, glxsid} = info;
if (dhid == dhId) {
//根据传入的id查找对应对话
nextStory = info;
nextStory["img"] = `${systemConfig.ipUrl}NPC/${glnpc}.png`;
//记录当前走到的剧情
plotClues(userId, type, duihua, dhId, glxsid);
}
});
if (nextStory) {
let dhStory = [];
if(nextStory.jqlx == "选择") {
nextStory.hzjqid = JSON.parse(nextStory.hzjqid);
for (let i = 0; i < nextStory.hzjqid.length; i++ ) {
let dhData = playData.find(s => s.dhid == nextStory.hzjqid[i]);
dhData["ispop"] = false;
if(dhData.jqlx == "工人" || dhData.jqlx == "画师" || dhData.jqlx == "掌柜") {
dhData.ispop = true;
}
if(dhData) dhStory.push(dhData);
}
nextStory.hzjq = dhStory;
nextStory.img = `${systemConfig.ipUrl}NPC/${nextStory.glnpc}.png`;
}
}
if (nextStory.hzjqid == '999') {
//剧情走完添加对应用户的全部线索
addClue(userId);
xfxxClue();
allClueJson[userId]["酒馆剧情"] = HARITYPE.已选择;
//酒馆剧情观看完毕、颜料瓷器已选择、SWOT已确认、工人已选择
if(allClueJson[userId]["酒馆剧情"] == HARITYPE.已选择 && allClueJson[userId]["商行选择"]) allClueJson[userId]["ROI"] = true;
//更新json数据
changeJsonData("json/基础数据.json", allClueJson);
}
return nextStory;
......@@ -60,9 +143,9 @@ export function getNPCData(type) {
let npcByType = [];
npcData.forEach( info => {
let {mc, lx, dyjqid} = info;
let {mc, lx, npc, dyjqid} = info;
if(lx == type) {
npcByType.push({name:mc, type:lx, img:`${systemConfig.ipUrl}NPC/${mc}.png`, jqid:dyjqid})
npcByType.push({name:mc, type:lx, img:`${systemConfig.ipUrl}NPC/${mc}.png`, npc, jqid:dyjqid})
}
})
......@@ -70,17 +153,27 @@ export function getNPCData(type) {
}
/**
* 剧情相关线索
*/
export function plotClues(type:string, playId:string, dhId:string, glxsid:string) {
export function plotClues(userId:string, type:string, playId:string, dhId:string, glxsid:string) {
//获取已有json数据
let baseData = getJsonData("json/基础数据.json");
let userData = {};
if(Object.keys(baseData).length === 0) { //没有对应数据的情况
userData["初始资金"] = 500;
userData = {
"初始资金": 500,
"天数":1,
"结算":500,
"广州府介绍": true, //广州府第一次介绍:true
"酒馆剧情": false, //酒馆已选择雇佣工人:true
"当前线索确认": NOWCLUE.未开始,
"商行选择":false,
"SWOT": false,
"ROI": false,
"竞合": false
}
userData[type] = {};
if (Object.keys(userData[type]).length === 0) {
userData[type][playId] = {"当前对话id": dhId, "已获得的线索":[]};
......@@ -101,7 +194,7 @@ export function plotClues(type:string, playId:string, dhId:string, glxsid:string
}
}
} else { //已经有对应数据
userData = baseData["1727399696222"];
userData = baseData[userId];
// userData["结算"] = baseData["1727399696222"]["结算"] + 50; //暂时一个剧情对话回合加50银两
if (!userData[type]) {
userData[type] = {};
......@@ -146,8 +239,8 @@ export function plotClues(type:string, playId:string, dhId:string, glxsid:string
}
}
//暂定一个默认用户1727399696222
let changeData = {"1727399696222":userData};
let changeData = baseData;
changeData[userId] = userData
//更新json数据
changeJsonData("json/基础数据.json", changeData);
......@@ -155,73 +248,205 @@ export function plotClues(type:string, playId:string, dhId:string, glxsid:string
}
/**
* 雇佣工人信息表格
* @param playType 剧情类型
* @returns
*/
export function pubHire(playType) {
let excelData = guyongTableData();
let hireData = excelData['雇佣表'].dataList;
let titleList = [];
if (playType == "工人") titleList = ["工人", "月产量", "费用(两/月)"];
if (playType == "画师") titleList = ["画师", "月产量", "费用(两/月)"];
if (playType == "掌柜") titleList = ["掌柜", "月产量", "费用(两/月)"];
let hireWorker = {};
hireData.forEach( info => {
let type = info.lx;
if(!hireWorker[type]) hireWorker[type] = [];
hireWorker[type].push({xsId:info.xsid, ry:info.ry, sjcl:info.sjcl, gz:info.gz});
});
return { titleList, dataList:hireWorker[playType] };
}
function a(type:string, playId:string, dhId:string, glxsid:string) {
/**
* 提交雇佣工人
* @param playType 剧情类型
* @param xsId 线索id
*/
export function submitHire(userId, playType, xsId) {
//获取已有json数据
let hireData = getJsonData("json/雇佣选择.json");
let hireWorker = hireData;
let oldxsid = "";
if (!hireWorker[userId]) hireWorker[userId] = {};
if (!hireWorker[userId]["人工"]) hireWorker[userId]["人工"] = {};
else oldxsid = hireWorker[userId]["人工"][playType];
hireWorker[userId]["人工"][playType] = xsId;
changeJsonData("json/雇佣选择.json", hireWorker);
console.log(`雇佣${playType}添加成功,线索id${xsId}`);
/**雇佣工人成功,扣除工资部分 */
let excelData = guyongTableData();
let hireExcel = excelData['雇佣表'].dataList;
let hireMoney = 0;
let oldgz = 0;
hireExcel.forEach( info => {
if (info.xsid == xsId) hireMoney = parseInt(info.gz);
if (info.xsid == oldxsid) oldgz = parseInt(info.gz);
});
//扣除雇佣工人工资
let baseData = getJsonData("json/基础数据.json");
let jisuan = baseData[userId]["结算"] || 0;
baseData[userId]["结算"] = jisuan + oldgz - hireMoney;
changeJsonData("json/基础数据.json", baseData);
let userData = {};
if(Object.keys(baseData).length === 0) { //没有对应数据的情况
userData["初始资金"] = 500;
userData[type] = {};
if (Object.keys(userData[type]).length === 0) {
userData[type][playId] = {"当前对话id": dhId, "已获得的线索":[]};
return successResult();
}
if (glxsid) {
let fruitsEmpty;
if(glxsid.includes(',')) fruitsEmpty = glxsid.split(",");
else fruitsEmpty = [glxsid];
if(!userData[type][playId]["已获得的线索"]) userData[type][playId]["已获得的线索"] = fruitsEmpty
else {
for(let i = 0; i < fruitsEmpty.length; i++) {
userData[type][playId]["已获得的线索"].push(fruitsEmpty[i]);
}
}
}
}
} else { //已经有对应数据
userData = baseData["1727399696222"];
if (!userData[type]) {
userData[type] = {};
if(!userData[type][playId]) userData[type][playId] = {"当前对话id":"", "已获得的线索":[]};
userData[type][playId]["当前对话id"] = dhId;
userData[type][playId]["已获得的线索"] = [];
/**回显雇佣工人 */
export function displayHire(userId) {
//获取已有json数据
let hireData = getJsonData("json/雇佣选择.json");
let hireWorker = {};
if (!hireData[userId] || Object.keys(hireData[userId]).length === 0) hireData[userId] = {"人工":{"工人": "", "画师": "", "掌柜": ""}};
hireWorker = hireData[userId]["人工"];
if (glxsid) {
let fruitsEmpty;
if(glxsid.includes(',')) fruitsEmpty = glxsid.split(",");
else fruitsEmpty = [glxsid];
return hireWorker;
}
if(!userData[type][playId]["已获得的线索"]) userData[type][playId]["已获得的线索"] = fruitsEmpty
else {
for(let i = 0; i < fruitsEmpty.length; i++) {
let 线索data = userData[type][playId]["已获得的线索"].push(fruitsEmpty[i]);
let uniqueArray = [...new Set(线索data)];
userData[type][playId]["已获得的线索"] = uniqueArray;
}
}
}
} else {
if (userData[type][playId]) {
if (userData[type][playId]["当前对话id"] == dhId) return;
else userData[type][playId]["当前对话id"] = dhId;
} else userData[type][playId] = {"当前对话id":dhId};
// userData[type][playId]["当前对话id"] = dhId;
if (glxsid) {
let fruitsEmpty;
if(glxsid.includes(',')) fruitsEmpty = glxsid.split(",");
else fruitsEmpty = [glxsid];
if(!userData[type][playId]["已获得的线索"]) userData[type][playId]["已获得的线索"] = fruitsEmpty
else {
for(let i = 0; i < fruitsEmpty.length; i++) {
userData[type][playId]["已获得的线索"].push(fruitsEmpty[i]);
}
}
}
}
}
/**
* 颜料、瓷器信息表格
* @param type 类型
* @returns
*/
export function rawMaterial(type) {
let excelData = guyongTableData();
let rawMaterialData = excelData['原材料'].dataList;
let titleList = [];
if (type == "颜料") titleList = ["颜料", "费用(两/个)"];
if (type == "瓷器") titleList = ["瓷器", "费用(两/个)"];
let rawMaterial = {};
rawMaterialData.forEach( info => {
let type = info.lx;
if(!rawMaterial[type]) rawMaterial[type] = [];
rawMaterial[type].push({xsId:info.xsid, type:info.lx, mc:info.sjmc, jg:info.jg}); //
});
return { titleList, dataList:rawMaterial[type] };
}
/**
* 提交颜料、瓷器
* @param type 剧情类型
* @param xsId 线索id
*/
export function submitRawMaterial(userId, type, xsId) {
//获取已有json数据
let rawMaterialData = getJsonData("json/雇佣选择.json");
let rawMaterial = rawMaterialData;
let oldxsid = "";
if (!rawMaterial[userId]) rawMaterial[userId] = {};
if (!rawMaterial[userId]["原材料"]) rawMaterial[userId]["原材料"] = {};
else oldxsid = rawMaterial[userId]["原材料"][type];
rawMaterial[userId]["原材料"][type] = xsId;
//运输类型默认水路 todo
rawMaterial[userId]["运输"] = "C037";
changeJsonData("json/雇佣选择.json", rawMaterial);
console.log(`选择${type}添加成功,线索id${xsId}`);
/**购买原材料成功,扣除原材料价格 */
let excelData = guyongTableData();
let rawMaterialExcel = excelData['原材料'].dataList;
let rawMaterialMoney = 0;
let oldgz = 0;
rawMaterialExcel.forEach( info => {
if (info.xsid == xsId) rawMaterialMoney = parseInt(info.jg);
if (info.xsid == oldxsid) oldgz = parseInt(info.jg);
});
//扣除100个瓷器和颜料的价格 todo
let baseData = getJsonData("json/基础数据.json");
let jsje = baseData[userId]["结算"] || 0;
baseData[userId]["结算"] = jsje + oldgz*1000 - rawMaterialMoney*1000;
baseData[userId]["商行选择"] = true;
//酒馆剧情观看完毕、颜料瓷器已选择、SWOT已确认、工人已选择
if(baseData[userId]["酒馆剧情"] == HARITYPE.已选择 && baseData[userId]["商行选择"]) baseData[userId]["ROI"] = true;
changeJsonData("json/基础数据.json", baseData);
return successResult();
}
/**
* 回显颜料、瓷器
* @param userId
* @returns
*/
export function displayRawMaterial(userId) {
//获取已有json数据
let hireData = getJsonData("json/雇佣选择.json");
let hireWorker = {};
if (!hireData[userId] || Object.keys(hireData[userId]).length === 0) hireData[userId] = {"原材料":{"瓷器":"", "颜料":""}};
hireWorker = hireData[userId]["原材料"];
return hireWorker;
}
/**
* 广州府是否第一次阅读
* @param userId
*/
export function getGzf(userId) {
//获取已有json数据
let baseJsonData = getJsonData("json/基础数据.json");
let writeBaseAll = baseJsonData;
writeBaseAll[userId]["广州府介绍"] = false;
changeJsonData("json/基础数据.json", writeBaseAll);
return {firstGzf:baseJsonData[userId]["广州府介绍"]};
}
/**
* 广州府介绍
* @param userId
*/
export function getIntroduceGzf() {
//获取已有json数据
let baseJsonData = getJsonData("json/广州府介绍.json");
return baseJsonData;
}
/**
* 是否能进入酒馆剧情
* @param userId
*/
export function firstPubHire(userId) {
let baseJsonData = getJsonData("json/基础数据.json");
let isEnabled = false;
/**判断是否确认SWOT线索 */
if (baseJsonData[userId]["酒馆剧情"] > HARITYPE.未开始) isEnabled = true;
return {isEnabled};
}
......
/**
* ROI线索
* 30:ROI线索总分数
* 分数计算规则:暂定
* 满分:净利润超过30
* 20分:净利润大于25,小于30
* 10分:净利润大于20,小于25
* 0分:净利润小于20
*/
import { NOWCLUE } from "../config/enum";
import { guyongTableData } from "../data/table/tableData";
import { successResult } from "../tools/systemTools";
import { changeJsonData, getJsonData } from "../util/tools";
/**
* ROI线索确认
* @param subdivide 细分线索类型【R、O、I】
* @param xs [{xsid:"", xsnr:""}, ...]
*/
export function submitROIClue(userId, subdivide, xs) {
let jsonData = getJsonData("json/ROI.json");
let baseClueJson = getJsonData("json/基础数据.json");
/**处理确认选择的线索 */
let ROIClueData = jsonData;
//没有对应用户数据先添加一个基础格式,有的话直接push
if (!ROIClueData[userId] || Object.keys(ROIClueData[userId]).length === 0) {
ROIClueData[userId] = {
"isSubmit": false,
"R": [],
"I": []
};
}
//isSubmit:false【未提交】、true【提交】
/**当前线索类型未提交时,可以修改添加线索 */
if (!ROIClueData[userId]["isSubmit"]) {
for (let i = 0; i < xs.length; i++) {
// let xsInfo = xs[i];
ROIClueData[userId][subdivide].push(xs[i]);
}
changeJsonData("json/ROI.json", ROIClueData);
console.log("添加ROI线索成功");
} else {
console.log("线索已提交,无法重复提交");
}
/**修改全部线索.json的对应线索为已选择 isChoice:true */
let allClueJson = getJsonData("json/全部线索.json");
let allClueData = allClueJson;
xs.forEach( info => {
let {xsid, xsnr} = info;
for(let key in allClueData[userId]) {
allClueData[userId][key].forEach( thisClue => {
if(xsid == thisClue.xsid) thisClue.isChoice = true;
})
}
/**如果添加的R线索,马可波罗需要支付瓷器金额 */
if (subdivide == "R") {
/**制作瓷器成功,支付定制瓷器金额 */
let excelData = guyongTableData();
let ciqiExcel = excelData['制作瓷器'].dataList;
let ciqiMoney = 0;
let oldgz = 0;
ciqiExcel.forEach( info => {
if (info.xsid == xsid) ciqiMoney = info.sj;
});
//加上定制瓷器金额
baseClueJson[userId]["结算"] = baseClueJson[userId]["结算"] + ciqiMoney * 1000;
}
});
changeJsonData("json/全部线索.json", allClueData);
/**ROI线索选择完成可添加竞合线索 */
baseClueJson[userId]["竞合"] = true;
baseClueJson[userId]["当前线索确认"] = NOWCLUE.ROI;
//更新json数据
changeJsonData("json/基础数据.json", baseClueJson);
return successResult();
}
/**
* 计算选择正确的ROI线索
* @param userId
*/
export function checkROI(userId) {
let gygrJson = getJsonData("json/雇佣选择.json"); //获取雇佣工人表
let 雇佣选择 = gygrJson[userId];
let cqzzJson = getJsonData("json/瓷器制造.json");
/**
* 计算工人、画师、掌柜一起的人员成本
*/
let 人员成本 = cqzzJson["人员成本"];
let worker = {};
for (let key in 雇佣选择["人工"]) {
worker[key] = 人员成本[雇佣选择["人工"][key]].fjcb; //拿到玩家选择工人的附加成本
}
let rycb = 0;
for (let key in worker) {
rycb += worker[key];
}
/**
* 计算原材料成本
*/
let 瓷器成本 = cqzzJson["瓷器"];
let 瓷器利润 = 0;
let 瓷器单价 = 0;
for (let cq in 瓷器成本) {
if(瓷器成本[cq]["瓷器"] == 雇佣选择["原材料"]["瓷器"] && 瓷器成本[cq]["颜料"] == 雇佣选择["原材料"]["颜料"]) {
let dj = 瓷器成本[cq]["单价"];
let gdcb = 瓷器成本[cq]["固定成本"];
瓷器利润 = dj-gdcb;
}
}
/**
* 计算运输成本
*/
let 运输成本 = cqzzJson["运输成本"];
let yscb = 运输成本[雇佣选择["运输"]].xjb;
let 净利润 = (瓷器利润-rycb-yscb)/瓷器单价;
/**计算分数 */
let score = 0;
if (净利润>30) score = 30;
if (净利润>25 && 净利润<30) score = 20;
if (净利润>20 && 净利润<25) score = 10;
if (净利润<20) score = 0;
let submitJsonData = getJsonData("json/提交分数.json");
let submitScore = submitJsonData;
submitScore[userId]["ROI"] = score;
changeJsonData("json/提交分数.json", submitScore);
return successResult();
}
/**
* SWOT线索
* 50:SWOT线索总分数 (该公式计算错误:N/M*(1/4)*50)
* 分数计算规则:N/M*50
* M:线索总数
* N:选对线索数
* 1/4:细分线索类型数量(S、W、O、T)
*/
import { HARITYPE, NOWCLUE } from "../config/enum";
import { successResult } from "../tools/systemTools";
import { changeJsonData, getJsonData } from "../util/tools";
/**
* SWOT线索确认
* @param subdivide 细分线索类型【S、W、O、T】
* @param xs [{xsid:"", xsnr:""}, ...]
*/
export function submitSWOTClue(userId, subdivide, xs) {
let jsonData = getJsonData("json/SWOT.json");
/**处理确认选择的线索 */
let SWOTClueData = jsonData;
//没有对应用户数据先添加一个基础格式,有的话直接push
if (!SWOTClueData[userId] || Object.keys(SWOTClueData[userId]).length === 0) {
SWOTClueData[userId] = {
"isSubmit": false,
"S": [],
"W": [],
"O": [],
"T": []
};
}
//isSubmit:false【未提交】、true【提交】
/**当前线索类型未提交时,可以修改添加线索 */
if (!SWOTClueData[userId]["isSubmit"]) {
for (let i = 0; i < xs.length; i++) {
// let xsInfo = xs[i];
SWOTClueData[userId][subdivide].push(xs[i]);
}
changeJsonData("json/SWOT.json", SWOTClueData);
console.log("添加SWOT线索成功");
} else {
console.log("线索已提交,无法重复提交");
}
/**修改全部线索.json的对应线索为已选择 isChoice:true */
let allClueJson = getJsonData("json/全部线索.json");
let allClueData = allClueJson;
xs.forEach( info => {
let {xsid, xsnr} = info;
for(let key in allClueData[userId]) {
allClueData[userId][key].forEach( thisClue => {
if(xsid == thisClue.xsid) thisClue.isChoice = true;
})
}
});
changeJsonData("json/全部线索.json", allClueData);
let baseJsonData = getJsonData("json/基础数据.json");
baseJsonData[userId]["当前线索确认"] = NOWCLUE.SWOT;
baseJsonData[userId]["酒馆剧情"] = HARITYPE.已开始;
changeJsonData("json/基础数据.json", baseJsonData);
return successResult();
}
/**
* 计算选择正确的SWOT线索
* @param userId
*/
export function checkSWOT(userId) {
/**获取细分线索 */
let xfclueJson = getJsonData("json/细分线索.json");
let clueJson = getJsonData("json/SWOT.json")[userId];
let sumClue = 0; //线索总数
let rightClue = 0; //选对线索数
let xfclueSWOTJson = xfclueJson["SWOT"];
let conf = ["S", "W", "O", "T"];
for (let i = 0; i < conf.length; i++) {
let allxf = xfclueSWOTJson[conf[i]] || []; //所有细分的线索
sumClue += allxf.length;
let rightXf = clueJson[conf[i]] || []; //选中提交的细分线索
for (let xf = 0; xf < allxf.length; xf++) {
rightXf.forEach( info => {
if (allxf[xf] == info.xsid) rightClue++; //计算当前选对线索数
})
}
}
/**计算分数 */
let score = 0;
// score = rightClue/sumClue*(1/4)*50;
score = (rightClue/sumClue)*50;
let submitJsonData = getJsonData("json/提交分数.json");
let submitScore = submitJsonData;
submitScore[userId]["SWOT"] = score;
changeJsonData("json/提交分数.json", submitScore);
return successResult();
}
/**
* 初始化全部线索
*/
import { HARITYPE, NOWCLUE } from "../config/enum";
import { guyongTableData, xiansuoTableData } from "../data/table/tableData";
import { changeJsonData, getJsonData } from "../util/tools";
/**
* 登录账号的时候判断是否有初始化全部线索,没有的话写入全部线索json
* 基础数据没有的话也写入
*/
export function initAllClue(userId) {
let excelData = xiansuoTableData();
let clueExcelData = excelData["线索表"].dataList;
let userJsonData = getJsonData("json/用户.json");
let allClueJsonData = getJsonData("json/全部线索.json");
let baseJsonData = getJsonData("json/基础数据.json");
let submitJsonData = getJsonData("json/提交分数.json");
let writeClueAll = allClueJsonData;
let writeBaseAll = baseJsonData;
let submitClue = submitJsonData;
/**如果登录的账号没有全部线索数据,则写入json */
if (!allClueJsonData[userId] || Object.keys(allClueJsonData[userId]).length === 0) {
writeClueAll[userId] = {};
clueExcelData.forEach( info => {
let {xsid, xsnr, xslx, xslxxf, sfbx} = info;
if (!writeClueAll[userId][xslx]) writeClueAll[userId][xslx] = [];
writeClueAll[userId][xslx].push({xsid, xsnr, isChoice:false, sfbx});
})
//写入json
changeJsonData("json/全部线索.json", writeClueAll);
}
/**如果登录的账号没有基础数据,则写入json */
if (!baseJsonData[userId] || Object.keys(baseJsonData[userId]).length === 0) {
writeBaseAll[userId] = {
"初始资金": 500,
"天数":0,
"结算":500,
"广州府介绍": true, //广州府第一次介绍:true
// "酒馆雇佣": false, //酒馆已选择雇佣工人:true
"酒馆剧情": HARITYPE.未开始, //酒馆剧情:默认未开始,已开始需要SWOT确认
"当前线索确认": NOWCLUE.未开始,
"商行选择":false,
"SWOT": false,
"ROI": false,
"竞合": false
}
//写入json
changeJsonData("json/基础数据.json", writeBaseAll);
}
/**如果登录的账号没有初始化分数数据,则写入json */
if (!submitJsonData[userId] || Object.keys(submitJsonData[userId]).length === 0) {
submitClue[userId] = {
SWOT:0,
ROI:0,
竞合:0
};
//写入json
changeJsonData("json/提交分数.json", submitClue);
}
}
/**
* 初始化制作瓷器成本数据
*/
export function initCiqi() {
let excelData = guyongTableData();
let 雇佣Data = excelData['雇佣表'].dataList;
let 运输Data = excelData['运输'].dataList;
let 原材料Data = excelData['原材料'].dataList;
let 人员成本 = {};
雇佣Data.forEach( info => {
let {lx, xsid, nlsjz, xqz, gz} = info //线索id,能力值,心情值,工资
let ycl = 0; //月产量 = 能力值*心情值*30
if (lx == "工人") ycl = nlsjz*xqz*30;
if (lx == "画师") ycl = nlsjz*xqz*20;
if (lx == "掌柜") ycl = nlsjz*xqz*10;
let fjcb = Math.round((gz/ycl)*100)/100; //附加成本 = 工资/月产量
人员成本[xsid] = {ycl, gz, fjcb};
})
let 运输成本 = {};
运输Data.forEach( info => {
let {xsid, sjmc, jg, myysl} = info; //线索id,运输类型(车路、水路),价格,每月运输量(速度)
let xjb = Math.round((jg/myysl)*100)/100; //性价比 = 价格/速度
运输成本[xsid] = {sjmc, xjb};
})
let 原材料 = {};
原材料Data.forEach( info => {
let {xsid, sjmc, jg} = info;
原材料[sjmc] = {xsid, jg:parseInt(jg)};
})
let 瓷器 = {
"定制精美瓷器": {
"瓷器":原材料["定制瓷器"].xsid,
"颜料":原材料["优质颜料"].xsid,
"单价":300,
"固定成本":原材料["定制瓷器"].jg + 原材料["优质颜料"].jg,
},
"定制普通瓷器": {
"瓷器":原材料["定制瓷器"].xsid,
"颜料":原材料["普通颜料"].xsid,
"单价":270,
"固定成本":原材料["定制瓷器"].jg + 原材料["普通颜料"].jg,
},
"通用精美瓷器": {
"瓷器":原材料["通用瓷器"].xsid,
"颜料":原材料["优质颜料"].xsid,
"单价":170,
"固定成本":原材料["通用瓷器"].jg + 原材料["优质颜料"].jg,
},
"通用普通瓷器": {
"瓷器":原材料["通用瓷器"].xsid,
"颜料":原材料["普通颜料"].xsid,
"单价":150,
"固定成本":原材料["通用瓷器"].jg + 原材料["普通颜料"].jg,
}
};
let 成本 = {瓷器, 人员成本, 运输成本}
changeJsonData("json/瓷器制造.json", 成本);
}
/**
* 游戏天数
* 登录开始计算 5分钟加一天
* @param userId
*/
export function gameLoop(userId) {
let baseJsonData = getJsonData("json/基础数据.json");
// let baseData = baseJsonData[userId];
baseJsonData[userId]["天数"]++;
//60000毫秒 = 1分钟,设定5分钟游戏内天数+1
setTimeout(gameLoop, 60000*5, userId);
changeJsonData("json/基础数据.json", baseJsonData);
}
/**
* 登录
* 用户.json 登录用户账号信息
*/
import { ERRORENUM } from "../config/errorEnum";
import { successResult } from "../tools/systemTools";
import { BizError } from "../util/bizError";
import { changeJsonData, getJsonData } from "../util/tools";
import { gameLoop, initAllClue } from "./task";
/**
* 登录
* @param loginId 账号
* @param pwd 密码
*/
export function login(loginId, pwd) {
let userData = getJsonData("json/用户.json");
let dataInfo = {};
/**判断是否有对应账号 */
let hasUser = userData.some(item => item.loginId === loginId);
if (!hasUser) throw new BizError(ERRORENUM.账号不存在);
userData.forEach( info => {
initAllClue(info.userId);
if (info.loginId == loginId) {
if (info.pwd != pwd) throw new BizError(ERRORENUM.账号或密码错误);
dataInfo = {userId:info.userId, loginId:info.loginId};
gameLoop(info.userId);
}
// dataInfo["firstlogin"] = initAllClue(info.userId);
})
return dataInfo;
}
/**
* 注册
* @param loginId 账号
* @param pwd 密码
*/
export function register(loginId, pwd) {
let userData = getJsonData("json/用户.json");
const NowMs = new Date().valueOf();
userData.push(
{
userId:`${NowMs}`,
loginId,
pwd
}
);
changeJsonData("json/用户.json", userData);
return successResult();
}
/**
* 基础数据【当前天数、银两数】
* @returns
*/
export function getBaseData(userId) {
let baseData = getJsonData("json/基础数据.json");
let basicsData = {
day:0,
tael:0
}
basicsData.day = baseData[userId]["天数"] || 0;
basicsData.tael = baseData[userId]["结算"] || 0;
return basicsData;
}
/**
* 统计线索数量
* @param clueType
* @returns
*/
export function getCount(userId) {
let jsonData = getJsonData("json/全部线索.json");
let clueData = jsonData[userId];
let personalData = {
clue:0,
tael:0,
hire:0
};
// 线索数
for (let key in clueData) {
clueData[key].forEach( info => {
if (info.isChoice) personalData.clue++
})
}
// 银两数
let baseData = getJsonData("json/基础数据.json");
personalData.tael = baseData[userId]["结算"];
// 雇佣人数
let hireData = getJsonData("json/雇佣选择.json");
if (Object.keys(hireData[userId]).length != 0) {
if (!hireData[userId]["人工"]) hireData[userId]["人工"] = {}
if (Object.keys(hireData[userId]["人工"]).length != 0) {
personalData.hire = Object.keys(hireData[userId]["人工"]).length;
}
}
return personalData;
}
......@@ -27,8 +27,18 @@ export enum FILETYPE {
}
export enum NOWCLUE {
未开始 = 0,
SWOT = 1,
ROI,
竞合
}
export enum HARITYPE {
未开始 = 0,
已开始 = 1,
已选择 = 2
}
......@@ -61,7 +61,9 @@ export enum ERRORENUM {
用户没有在此活动对象内,
黑名单用户不允许登录,
该订单未被退回,
文件不存在
文件不存在,
账号不存在,
需先确认SWOT线索选择
}
export enum ERRORCODEENUM {
......
......@@ -9,27 +9,27 @@ let daier = {};
* 初始化表格数据,加密保存到daier.yydata
*/
export async function initConfiguration() {
daier = {
// "剧情表": tableData.juqingTableData(),
"线索表": tableData.xiansuoTableData(),
"工资表": tableData.gongziTableData(),
};
//创建一个AES-256-CBC的加密算法
const algorithm = 'aes-256-cbc';
let key = systemConfig.cryptoKey;
let iv = systemConfig.cryptoIv;
//创建一个cipher实例
const cipher = crypto.createCipheriv(algorithm, key, iv);
/**加密数据 */
let encrypted = cipher.update(daier, 'utf8', 'hex');
encrypted += cipher.final('hex');
//将IV和加密后的数据一起写入文件
let dataToWrite = `${iv}:${encrypted}`;
//写入自定义后缀的文件
fs.writeFile('daier.yydata', dataToWrite, (err) => {
if (!err) console.log("数据已成功写入daier.yydata");
})
// daier = {
// // "剧情表": tableData.juqingTableData(),
// "线索表": tableData.xiansuoTableData(),
// "工资表": tableData.gongziTableData(),
// };
// //创建一个AES-256-CBC的加密算法
// const algorithm = 'aes-256-cbc';
// let key = systemConfig.cryptoKey;
// let iv = systemConfig.cryptoIv;
// //创建一个cipher实例
// const cipher = crypto.createCipheriv(algorithm, key, iv);
// /**加密数据 */
// let encrypted = cipher.update(daier, 'utf8', 'hex');
// encrypted += cipher.final('hex');
// //将IV和加密后的数据一起写入文件
// let dataToWrite = `${iv}:${encrypted}`;
// //写入自定义后缀的文件
// fs.writeFile('daier.yydata', dataToWrite, (err) => {
// if (!err) console.log("数据已成功写入daier.yydata");
// })
}
......
......@@ -49,6 +49,20 @@ function packageDataProcess(blockDataList, titltListConfig, keyValueOrTitleList,
export function juqingTableData(type, playId) {
let blockDataList = onceSheetBecomeOfblockData('剧情表.xlsx', `${type}`); //excel表名 sheet名称
// let blockTitleList = {};
// let keyToLookup;
// blockDataList.forEach( info => {
// let blockTitle = info.blockTitle;
// let hasUndersocre = blockTitle.includes('_');
// if (hasUndersocre) {
// keyToLookup = `${playId}_${duihua}`
// } else {
// keyToLookup = playId;
// }
// })
let keyValueOrTitleList = [`${playId}`]; //适配 饼图 键值以及需要多个Key的
// if (playId) keyValueOrTitleList.push(playId);
let barChartList = []; //适配 柱状图 折线图
......@@ -81,9 +95,6 @@ export function NPCTableData() {
}
/**
* 线索表
* @returns
......@@ -103,13 +114,13 @@ export function xiansuoTableData() {
/**
* 工资
* 雇佣
* @returns
*/
export function gongziTableData() {
export function guyongTableData() {
let blockDataList = onceSheetBecomeOfblockData('线索表.xlsx', 'Sheet2'); //excel表名 sheet名称
let keyValueOrTitleList = ['工资表']; //适配 饼图 键值以及需要多个Key的
let keyValueOrTitleList = ['雇佣表', '运输', '原材料', '制作瓷器']; //适配 饼图 键值以及需要多个Key的
let barChartList = []; //适配 柱状图 折线图
let stringList= [];
let decollatePlanarList = []; //适配 表格
......
......@@ -2,13 +2,14 @@ import { httpServer } from "./net/http_server";
import { initConfig, systemConfig } from "./config/serverConfig";
import { initConfiguration } from "./data/table/initConfiguration";
import { cxyxTableData } from "./data/table/tableData";
import { initCiqi } from "./biz/task";
async function lanuch() {
await initConfig();
httpServer.createServer( systemConfig.port );
console.log('This indicates that the server is started successfully.');
initCiqi();
// let key = crypto.randomBytes(32).toString('hex'); //"4fa9998e3be1bd3fa7b8def3969115858c6f19f9ef36e2e71f61645e9767764c"
// let iv = crypto.randomBytes(16).toString('hex'); //"db2be0c856f44e68b818ff6ef7f018c1"
// await initConfiguration();
......
import { ERRORENUM } from "../config/errorEnum";
import { BizError } from "../util/bizError";
/**
* 中间件
* @param req
* @param res
* @param next
* @returns
*/
export async function checkUser(req, res, next) {
if (!req.headers) req.headers = {};
let userId = req.headers.userid;
if (!userId) return next(new BizError(ERRORENUM.非法登录));
req.userId = userId
next();
}
......@@ -15,7 +15,7 @@ export class httpServer {
httpServer.all('*',function (req, res, next) {
res.header('Access-Control-Allow-Origin', req.headers.origin);
res.header("Access-Control-Allow-Headers", "X-Requested-With");
res.header('Access-Control-Allow-Headers', 'Content-Type');
res.header('Access-Control-Allow-Headers', 'Content-Type,request-origin,userid,token');
res.header("Access-Control-Allow-Methods", "PUT,POST,GET,DELETE,OPTIONS");
res.header('Access-Control-Allow-Credentials', true);
res.header("X-Powered-By", ' 3.2.1');
......
......@@ -3,27 +3,104 @@
*/
import * as asyncHandler from 'express-async-handler';
import * as userBiz from '../biz/user';
import * as playBiz from '../biz/play';
import * as clueBiz from '../biz/clue';
import * as swotBiz from '../biz/swot';
import * as roiBiz from '../biz/roi';
import * as jinheBiz from '../biz/jinhe';
import { eccReqParamater } from '../tools/eccParam';
export function setRouter(httpServer){
httpServer.post('/login', asyncHandler(login));
httpServer.post('/register', asyncHandler(register));
httpServer.post('/basedata', asyncHandler(getBaseData));
httpServer.post('/personal', asyncHandler(getCount));
httpServer.post('/play', asyncHandler(getPlay));
httpServer.post('/pubhire', asyncHandler(pubHire));
httpServer.post('/submithire', asyncHandler(submitHire));
httpServer.post('/displayhire', asyncHandler(displayHire));
httpServer.post('/rawmaterial', asyncHandler(rawMaterial));
httpServer.post('/submitrawmaterial', asyncHandler(submitRawMaterial));
httpServer.post('/displayrawmaterial', asyncHandler(displayRawMaterial));
httpServer.post('/gzf', asyncHandler(getGzf));
httpServer.post('/introducegzf', asyncHandler(getIntroduceGzf));
httpServer.post('/firstpubhire', asyncHandler(firstPubHire));
httpServer.post('/npc', asyncHandler(getNPC));
httpServer.post('/clue', asyncHandler(getClue));
httpServer.post('/addclue', asyncHandler(addClue));
httpServer.post('/submitclue', asyncHandler(submitClue));
httpServer.post('/choiceclue', asyncHandler(getChoiceClue));
httpServer.post('/checkclue', asyncHandler(checkClue));
httpServer.post('/againanswer', asyncHandler(againAnswer));
httpServer.post('/againstart', asyncHandler(againStart));
httpServer.post('/delclue', asyncHandler(delClue));
httpServer.post('/choiceclue', asyncHandler(getChoiceClue));
httpServer.post('/submitclue', asyncHandler(submitClue));
httpServer.post('/checkswot', asyncHandler(checkSWOT));
httpServer.post('/checkroi', asyncHandler(checkROI));
httpServer.post('/checkjinhe', asyncHandler(checkJinhe));
httpServer.post('/isenabled', asyncHandler(isEnabled));
// httpServer.post('/jgplay', asyncHandler(getJGPlay));
// httpServer.post('/submitswot', asyncHandler(submitSWOTClue));
// httpServer.post('/submitroi', asyncHandler(submitROIClue));
// httpServer.post('/submitjinhe', asyncHandler(submitJinheClue));
// httpServer.post('/addclue', asyncHandler(addClue));
// httpServer.post('/choiceclue', asyncHandler(getChoiceClue));
// httpServer.post('/delclue', asyncHandler(delClue));
// httpServer.post('/choiceclueall', asyncHandler(choiceClueAll));
httpServer.post('/wages', asyncHandler(getWages));
httpServer.post('/personal', asyncHandler(getCount));
httpServer.post('/settlement', asyncHandler(getSettlement));
httpServer.post('/restart', asyncHandler(restart));
httpServer.post('/basedata', asyncHandler(getBaseData));
// httpServer.post('/wages', asyncHandler(getWages));
// httpServer.post('/settlement', asyncHandler(getSettlement));
// httpServer.post('/restart', asyncHandler(restart));
}
/**
* 登录
* @param req
* @param res
*/
function login(req, res) {
let reqConf = {loginId:'String', pwd:'String'};
let {loginId, pwd} = eccReqParamater(reqConf, req.body);
let result = userBiz.login(loginId, pwd);
res.success(result);
}
/**
* 注册
* @param req
* @param res
*/
function register(req, res) {
let reqConf = {loginId:'String', pwd:'String'};
let {loginId, pwd} = eccReqParamater(reqConf, req.body);
let result = userBiz.register(loginId, pwd);
res.success(result);
}
/**基础数据 */
function getBaseData(req, res) {
let userId = req.headers.userid;
let result = userBiz.getBaseData(userId);
res.success(result);
}
/**统计获得线索数 */
function getCount(req, res) {
let userId = req.headers.userid;
let result = userBiz.getCount(userId);
res.success(result);
}
/**
* 剧情
......@@ -31,10 +108,151 @@ export function setRouter(httpServer){
* @param res
*/
function getPlay(req, res) {
let userId = req.headers.userid;
// 商行、SO11、对话Id(后置剧情id)
let {type, playId, dhId} = req.body;
let result;
if (type == "酒馆") {
result = playBiz.getJGPlayData(userId, type, playId, dhId);
} else {
result = playBiz.getPlayData(userId, type, playId, dhId);
}
res.success(result);
}
/**
* 酒馆剧情 弃用
* @param req
* @param res
*/
// function getJGPlay(req, res) {
// let userId = req.headers.userid;
// // 对话Id(后置剧情id)
// let {dhId} = req.body;
// let result = playBiz.getJGPlayData(userId, dhId);
// res.success(result);
// }
/**
* 雇佣工人表格
* @param req
* @param res
*/
function pubHire(req, res) {
// 剧情type
let {playType} = req.body;
let result = playBiz.pubHire(playType);
res.success(result);
}
/**
* 提交雇佣工人
* @param req
* @param res
*/
function submitHire(req, res) {
let userId = req.headers.userid;
// 剧情type
let {playType, xsId} = req.body;
let result = playBiz.submitHire(userId, playType, xsId);
res.success(result);
}
/**
* 回显雇佣工人
* @param req
* @param res
*/
function displayHire(req, res) {
let userId = req.headers.userid;
let result = playBiz.displayHire(userId);
res.success(result);
}
/**
* 原材料表格
* @param req
* @param res
*/
function rawMaterial(req, res) {
// 颜料、瓷器
let {type} = req.body;
let result = playBiz.rawMaterial(type);
res.success(result);
}
/**
* 提交原材料
* @param req
* @param res
*/
function submitRawMaterial(req, res) {
let userId = req.headers.userid;
let {type, xsId} = req.body;
let result = playBiz.submitRawMaterial(userId, type, xsId);
res.success(result);
}
/**
* 回显原材料
* @param req
* @param res
*/
function displayRawMaterial(req, res) {
let userId = req.headers.userid;
let result = playBiz.getPlayData(type, playId, dhId);
let result = playBiz.displayRawMaterial(userId);
res.success(result);
}
/**
* 广州府是否第一次阅读
* @param req
* @param res
*/
function getGzf(req, res) {
let userId = req.headers.userid;
let result = playBiz.getGzf(userId);
res.success(result);
}
/**
* 广州府是否第一次阅读
* @param req
* @param res
*/
function getIntroduceGzf(req, res) {
let result = playBiz.getIntroduceGzf();
res.success(result);
}
/**
* 是否能进入酒馆剧情
* @param req
* @param res
*/
function firstPubHire(req, res) {
let userId = req.headers.userid;
let result = playBiz.firstPubHire(userId);
res.success(result);
}
......@@ -52,6 +270,18 @@ function getNPC(req, res) {
}
/**
* 是否开启线索
* @param req
* @param res
*/
function isEnabled(req, res) {
let userId = req.headers.userid;
let result = clueBiz.isEnabled(userId);
res.success(result);
}
/**
* 线索
......@@ -60,38 +290,62 @@ function getNPC(req, res) {
* @param res
*/
function getClue(req, res) {
let userId = req.headers.userid;
let {clueType} = req.body;
let result;
if(clueType) result = clueBiz.getClue(clueType);
else result = clueBiz.getClue();
if(clueType) result = clueBiz.getClue(userId, clueType);
else result = clueBiz.getClue(userId);
res.success(result);
}
/**取消选中线索 */
function delClue(req, res) {
let userId = req.headers.userid;
let {clueType, xxType, xsid} = req.body;
let result = clueBiz.delClue(userId, clueType, xxType, xsid);
res.success(result);
}
/**
* 线索选择
* 提交线索
* @param req
* @param res
*/
function addClue(req, res) {
let {clueType, xxType, xs} = req.body;
function checkClue(req, res) {
let userId = req.headers.userid;
let result = clueBiz.addClue(clueType, xxType, xs);
let result = clueBiz.checkClue(userId);
res.success(result);
}
/**
* 线索提交
* 重新答题
* @param req
* @param res
*/
function submitClue(req, res) {
let {clueType} = req.body;
function againAnswer(req, res) {
let userId = req.headers.userid;
let result = clueBiz.submitClue(clueType);
let result = clueBiz.againAnswer(userId);
res.success(result);
}
/**
* 重新开始
* @param req
* @param res
*/
function againStart(req, res) {
let userId = req.headers.userid;
let result = clueBiz.againStart(userId);
res.success(result);
}
......@@ -102,72 +356,114 @@ function submitClue(req, res) {
* @param res
*/
function getChoiceClue(req, res) {
let userId = req.headers.userid;
let {clueType} = req.body;
let result = clueBiz.getChoiceClue(clueType);
let result = clueBiz.getChoiceClue(userId, clueType);
res.success(result);
}
/**取消选中线索 */
function delClue(req, res) {
let {clueType, xxType, xsid} = req.body;
/**
* 线索选择弹窗确认按钮
* @param req
* @param res
*/
function submitClue(req, res) {
let userId = req.headers.userid;
let {clueType, subdivide, xs} = req.body;
let result = clueBiz.delClue(clueType, xxType, xsid);
let result;
if (clueType == "SWOT") {
result = swotBiz.submitSWOTClue(userId, subdivide, xs);
} else if (clueType == "ROI") {
result = roiBiz.submitROIClue(userId, subdivide, xs);
} else if (clueType == "竞合") {
result = jinheBiz.submitJinheClue(userId, subdivide, xs);
}
res.success(result);
}
/**统计获得线索数 */
function getCount(req, res) {
let result = clueBiz.getCount();
/**
* 计算SWOT
* @param req
* @param res
*/
function checkSWOT(req, res) {
let userId = req.headers.userid;
let result = swotBiz.checkSWOT(userId);
res.success(result);
}
/**基础数据 */
function getBaseData(req, res) {
let result = clueBiz.getBaseData();
/**
* 计算ROI
* @param req
* @param res
*/
function checkROI(req, res) {
let userId = req.headers.userid;
let result = roiBiz.checkROI(userId);
res.success(result);
}
/**结算页面 */
function getSettlement(req, res) {
let {clueType} = req.body;
/**
* 计算竞合
* @param req
* @param res
*/
function checkJinhe(req, res) {
let userId = req.headers.userid;
let result = clueBiz.getSettlement(clueType);
let result = jinheBiz.checkJinhe(userId);
res.success(result);
}
/**重新开始 */
function restart(req, res) {
let result = clueBiz.restart();
/**
* SWOT线索提交 弃用
* @param req
* @param res
*/
function submitSWOTClue(req, res) {
let userId = req.headers.userid;
let {subdivide, xs} = req.body;
let result = swotBiz.submitSWOTClue(userId, subdivide, xs);
res.success(result);
}
/**
* 线索选择弹窗回显
* ROI线索提交 弃用
* @param req
* @param res
*/
function choiceClueAll(req, res) {
let result = clueBiz.choiceClueAll();
function submitROIClue(req, res) {
let userId = req.headers.userid;
let {subdivide, xs} = req.body;
let result = roiBiz.submitROIClue(userId, subdivide, xs);
res.success(result);
}
/**
* 工人
* @param req gr:工人等级【初级、中级、高级】
* 竞合线索提交 弃用
* @param req
* @param res
*/
function getWages(req, res) {
let {gr} = req.body;
function submitJinheClue(req, res) {
let userId = req.headers.userid;
let {subdivide, xs} = req.body;
let result = clueBiz.getWages(gr);
let result = jinheBiz.submitJinheClue(userId, subdivide, xs);
res.success(result);
}
......@@ -180,3 +476,4 @@ function getWages(req, res) {
......@@ -5,6 +5,24 @@ import { FILETYPE } from "../config/enum";
const md5 = require("md5");
/**
* 返回编辑正确的结果
* @returns
*/
export function successResult() {
return {success:true}
}
/**
* 抛出错误信息
* @returns
*/
export function successErrorResult(msg) {
return {code:500, success:false, msg};
}
export function getUserToken(loginId:string) {
return md5(`${loginId}_${Math.ceil(Math.random()*1000)}${new Date().valueOf()}`);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment