修复增加不存在的鸡精时进程死掉的bug

master
宇天 2020-08-25 11:05:08 +08:00
parent 6493ee516e
commit 45ab088e89
2 changed files with 10 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "io.yutent.gaystat", "name": "io.yutent.gaystat",
"version": "1.6.0", "version": "1.7.0",
"description": "搞基数据", "description": "搞基数据",
"main": "src/main.js", "main": "src/main.js",
"scripts": { "scripts": {

View File

@ -23,8 +23,11 @@ const WIN = remote.getCurrentWindow()
const $doc = Anot(document) const $doc = Anot(document)
function getJsonp(str) { function getJsonp(str) {
if (~str.indexOf('jsonpgz')) {
return new Function(`function jsonpgz(d){return d}; return ${str}`)() return new Function(`function jsonpgz(d){return d}; return ${str}`)()
} }
return false
}
function getTableData(str) { function getTableData(str) {
var match = str.match(/<tbody[^]*?>.*?<\/tbody>/) var match = str.match(/<tbody[^]*?>.*?<\/tbody>/)
@ -93,6 +96,7 @@ Anot({
'net', 'net',
`https://fundgz.1234567.com.cn/js/${id}.js` `https://fundgz.1234567.com.cn/js/${id}.js`
) )
return getJsonp(res) return getJsonp(res)
}, },
@ -117,8 +121,9 @@ Anot({
} }
Anot.nextTick(_ => { Anot.nextTick(_ => {
var info = this.getTodayStat(id) var info = this.getTodayStat(id)
var last = this.getLastMonth(id) var last
if (info) { if (info) {
last = this.getLastMonth(id)
var tmp = { var tmp = {
code: info.fundcode, code: info.fundcode,
name: info.name, name: info.name,
@ -130,6 +135,8 @@ Anot({
this.list.unshift(tmp) this.list.unshift(tmp)
this.$dict[tmp.code] = this.list[0] this.$dict[tmp.code] = this.list[0]
Anot.ls('watch_list', this.list.$model) Anot.ls('watch_list', this.list.$model)
} else {
layer.toast('鸡精不存在', 'error')
} }
}) })
}) })