We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
async addMany(data, options, replace){ if (!think.isArray(data) || !think.isObject(data[0])) { return think.reject(new Error(think.locale('DATA_MUST_BE_ARRAY'))); } if (options === true) { replace = true; options = {}; } options = await this.parseOptions(options); let promises = data.map(item => { item = this.parseData(item); return this.beforeAdd(item, options); }); data = await Promise.all(promises); await this.db().addMany(data, options, replace); let insertId = this.db().getLastInsertId(); let insertIds = []; promises = data.map((item, i) => { let id = insertId + i; item[this.pk] = id; insertIds.push(id); return this.afterAdd(item, options); }); data = await Promise.all(promises); return insertIds; }
this.db().getLastInsertId();获取的是添加数据后的最后一行的id, 下面循环递增的代码就不正确了
2.2.x Platform: window10 Node.js Version: 4.2.x ThinkJS Version:
The text was updated successfully, but these errors were encountered:
cd414b2
No branches or pull requests
DESC
this.db().getLastInsertId();获取的是添加数据后的最后一行的id,
下面循环递增的代码就不正确了
ENV
2.2.x
Platform:
window10
Node.js Version:
4.2.x
ThinkJS Version:
The text was updated successfully, but these errors were encountered: