//测试接口-增
helloAction:function*(self){
var time = getNowFullDate();
var list =self.http._post.list;
var body =self.http._post.body;
var insertId = yield P('test').add({list:list, body: body,time:time});
if(!insertId){
return this.fail('添加成功');
}else {
return this.fail('添加失败');
}
},
//测试接口-删
deleteAction:function(){
var time = getNowFullDate();
var affectedRows = yield P('test').where({body: [">", 5]}).delete();
if(!affectedRows){
return this.fail('成功');
}else {
return this.fail('失败');
}
},
//测试接口-改
testmodifyAction:function(){
var time = getNowFullDate();
yield P('test').where({body: id}).decrement("coins", 10);
if(!insertId){
return this.fail('成功');
}else {
return this.fail('失败');
}
},
//测试接口-查 //所有
queryAction:function*(){
var time = getNowFullDate();
var data = yield P('test').select();
return this.fail(data);
},
//测试接口-查 //单个数据
queryAction:function*(){
var time = getNowFullDate();
var data = yield P('test').where({body: "4546"}).find();
return this.fail(data);
},
网友评论