关于super关键字bug

请输入内容...

/**
* 设置一条或者多条数据的状态
*/​​
async setstatusAction() {
const ids = this.para('ids');
if (think.isEmpty(ids)) {
return this.fail('请选择要操作的数据');
}
const data = await this.model('document').where({id: ['IN', ids]}).select();
switch (Number(this.para('status'))) {
case -1:
for (const v of data) {
// 权限验证
const priv = await this.admin_priv('delete', v.category_id);
if (!priv) {
const error = this.controller('cmswing/error');
return error.noAction('您无权进行该操作!');
}
}
break;
case 1:
for (const v of data) {
// 权限验证
const priv = await this.admin_priv('examine', v.category_id);
if (!priv) {
const error = this.controller('cmswing/error');
return error.noAction('您无权进行该操作!');
}
}
break;
case 0:
for (const v of data) {
// 权限验证
const priv = await this.admin_priv('disable', v.category_id);
if (!priv) {
const error = this.controller('cmswing/error');
return error.noAction('您无权进行该操作!');
}
}
break;
}

if (this.para('status') == -1 || this.para('status') == 0) {
for (const v of data) {
// 删除
await this.model('cmswing/search').delsearch(v.model_id, v.id);
if (!think.isEmpty(v.keyname) || v.keyname != 0) {
await this.model('cmswing/keyword').delkey(v.id, v.model_id);
}
}
} else if (this.para('status') == 1) {
for (const v of data) {
// 添加到搜索
await this.model('cmswing/search').addsearch(v.model_id, v.id, v);
console.log(v.keyname);
if (!think.isEmpty(v.keyname) || v.keyname != 0) {
await this.model('cmswing/keyword').addkey(v.keyname, v.id, v.uid, v.model_id, 0);
}
}
}
await super.setstatusAction('document');
}

这是源代码

yield super.setstatusAction('document');
            ^^^^^

SyntaxError: 'super' keyword unexpected here
    at new Script (vm.js:74:7)
    at createScript (vm.js:246:10)
    at Object.runInThisContext (vm.js:298:10)
    at Module._compile (internal/modules/cjs/loader.js:670:28)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
    at Module.load (internal/modules/cjs/loader.js:612:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
    at Function.Module._load (internal/modules/cjs/loader.js:543:3)
    at Module.require (internal/modules/cjs/loader.js:650:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at exports.interopRequire (/Users/lcz/WebstormProjects/CmsWing/node_modules/think-loader/loader/util.js:14:13)
    at files.forEach.file (/Users/lcz/WebstormProjects/CmsWing/node_modules/think-loader/loader/common.js:16:26)
    at Array.forEach (<anonymous>)
    at Object.loadFiles (/Users/lcz/WebstormProjects/CmsWing/node_modules/think-loader/loader/common.js:12:11)
    at Object.load (/Users/lcz/WebstormProjects/CmsWing/node_modules/think-loader/loader/common.js:64:32)
    at Loader.loadController (/Users/lcz/WebstormProjects/CmsWing/node_modules/think-loader/index.js:49:19)
    at thinkLoader.loadData (/Users/lcz/WebstormProjects/CmsWing/node_modules/thinkjs/lib/loader.js:45:42)
    at thinkLoader.loadAll (/Users/lcz/WebstormProjects/CmsWing/node_modules/thinkjs/lib/loader.js:110:12)
    at Application.run (/Users/lcz/WebstormProjects/CmsWing/node_modules/thinkjs/lib/application.js:205:18)
    at Object.<anonymous> (/Users/lcz/WebstormProjects/CmsWing/development.js:15:10)
    at Module._compile (internal/modules/cjs/loader.js:699:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
    at Module.load (internal/modules/cjs/loader.js:612:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
    at Function.Module._load (internal/modules/cjs/loader.js:543:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:744:10)
    at startup (internal/bootstrap/node.js:238:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:572:3)

这是报错

代码中使用的是await,编译了直接变成yield,这是咋了

1 个回复

要回复问题请先 登录注册

发起人

静♥♡置じ☆ve快 乐빠 사

要么庸俗,要么孤独
1 month ago
你好! 你还没有登录,请先登录. 登录CmsWing内容管理框架

6 个月前

最近活动

365

浏览次数

关注者: 1 人

网站导航