(最新更新:加入垃圾代码是没有用的,我加了几千行在不同的地方,仍然代码雷同审核不过。我修改了两个游戏雷同部分,也就是公共框架工具类的class、函数、变量名才能审核通过)
发布多个微信小游戏,因为用的游戏框架是同一个,被微信判定代码雷同不给过审核。
于是加了点废代码。不知道能不能过哦。如果是人工审核,那基本没戏。。。
工具类
/**
* 生成一些废代码,用于混淆
* @author chenkai 2018/10/7
*/
class ConfuseTool {
public constructor() {
}
public static createClass(num:number){
let str = "";
for(let i=0;i<num;i++){
//类
str += "class " + this.getLetter() + "{" + "\n";
//属性
for(let i=0;i<20;i++){
str += " public " + this.getLetter() + ";"+ "\n";
}
//函数
for(let i=0;i<20;i++){
str += " public " + this.getLetter() + "(){"+ "\n";
for(let i=0;i<10;i++){
str += " let " + this.getLetter() + " = '" + this.getLetter() + "';"+ "\n";
}
str += " }"+ "\n";
}
//类结束
str += "}"+ "\n";
}
return str;
}
/**混淆的字母和数字 */
public static confuseStr = "abcdefghijklmnopqrstuvwxyz";
/**获取混淆的字符串 */
public static getLetter(){
let str = "";
let strLen = this.confuseStr.length;
let len = 20;
for(let i=0;i<len;i++){
str += this.confuseStr.charAt(Math.round(Math.random()*(strLen-1)));
}
return str;
}
}
使用
console.log(ConfuseTool.createClass(1));
浏览器打印