Commit a3fd00bb authored by 刘松's avatar 刘松

update for kouling auto update

parent 1ae7fe7b
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -169,7 +169,7 @@ class Agent extends React.Component{
{getFieldDecorator('name', {
rules: [{ required: true, message: '推广页名称不能为空' }],
})(
<Input prefix={<span style={{ fontSize: 13 }}>推广名称</span>} placeholder="例如:推广1" />
<Input prefix={<span style={{ fontSize: 13 }}>推广名称</span>} placeholder="例如:商品页1" />
)}
</FormItem>
<FormItem>
......
......@@ -139,13 +139,27 @@ exports.createSchedule = async (req, res, next) => {
links.push(Link.findOne({name:item}));
});
Promise.all(links).then(function(arr){
let ids = arr.map(x => x.toJSON()._id);
arr = arr.map(x => x.toJSON()); //获取所有推广页id
ids = arr.map(x => x._id);
if(agent && ids.length){
let qd = agent.toJSON()['_id'];
let links = ids;
let tkl_Tasks = [];
tao.saveSchedule({qd,links,status,times},function(e,result){
if(e) throw e;
res.send({status:'ok',result:result});
if(e || !result._id) throw (e || result);
var schedule = result._id;
arr.forEach(async item => {
item['link'] = item._id;
item['schedule'] = schedule;
for(let i = 0;i<5;i++){
tkl_Tasks.push(createTbkl(item));
}
});
Promise.all(tkl_Tasks).then(function(arrs){
console.dir('----');
arrs.map(x => x.toJSON());
res.send({status:'ok',result:result,kls:arrs});
});
});
}
else{
......@@ -159,7 +173,8 @@ exports.createSchedule = async (req, res, next) => {
}
}
exports.createTbkl = async (data) => {
var createTbkl = async (data) => {
console.dir(data);
let {title,target,pic} = data;
return new Promise(async (r,d) => {
try {
......@@ -176,3 +191,4 @@ exports.createTbkl = async (data) => {
});
}
exports.createTbkl = createTbkl;
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment