TypeError:Cannot read property 'type' of undefined

 由于某些原因采集会经常遇到 TypeError:Cannot read property 'type' of undefined 错误,开不出奖。

大搜给的结果是“ 类型错误:无法读取未定义的属性“type”

type 不要轻易修改,在修改之前请提前做好备份,以免无法挽回,

导致这种错误的原因有很多,首先要确认代码的正确性,可以参考以下代码,逐步排渣,保证没有错误,

如果还是不能解决相关问题,可以联系我,提供有偿修复,二次开发。

联系方式在代码内最底部,仔细查找哦!!!

 1 {
 2         title:'重庆',
 3         source:'正在采集',
 4         name:'cqssc',
 5         enable:true,
 6         timer:'cqssc',
 7         option:{
 8             host:"127.0.0.1",
 9             timeout:50000,
10             path: '/cqssc/cqssc.php',
11             headers:{
12                 "User-Agent": "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0) "
13             }
14         },
15         parse:function(str){
16             try{
17                 str=str.substr(0,200);
18                 var reg=/<row expect="([\d\-]+?)" opencode="([\d\,]+?)" opentime="([\d\:\- ]+?)"/;
19                 var m;
20                 if(m=str.match(reg)){
21                     return {
22                         type:1,
23                         time:m[3],
24                         number:m[1],
25                         data:m[2]
26                     };
27                 }
28             }catch(err){
29                 throw('重庆-解析数据不正确,开发、采集修复QQ:1969170027');
30             }
31         }
32     },

猜你喜欢

转载自www.cnblogs.com/shenjingwa/p/11314965.html