@gopalroy/biz-testdrive
v1.0.5
Published
The test drive business logic
Downloads
2
Readme
英卡试乘试驾业务
TestDrive
试乘试驾
TestDrive.FromJson(src)
从一个JSON对象创建一个TestDrive对象 src: 一个JSON对象,包含一组TestDrive的属性 return: 新创建的TestDrive对象
var bizTestDrive = require('@gopalroy/biz-testDrive');
var testDriveNew = bizTestDrive.TestDrive.FromJson({
{ name: 'testdrive', short_name: 'td' }
});
TestDrive.FromIdG*(id)
Generator方法.从id生成一个对应的TestDrive对象 id: 组织的id. return: TestDrive对象
var co = require('co');
co(function*(){
var bizTestDrive = require('@gopalroy/biz-testDrive');
var testDrive = yield bizTestDrive.TestDrive.FromIdG(696);
}).catch(console.error);
TestDrive.prototype.getAllTestDrivingG*(filter, sortBy,pageSize, nextMarker)
Generator方法.获取所有的TestDrive对象. filter: 过滤条件, 如{ name: /s/i }, 代表返回所有name包含s(不区分大小写) 如果过滤条件里是一个正则表达式,那么把属性转换为字符串,做字符串匹配; 如果过滤条件里不是正则表达式,那么直接比较值是否相等匹配. pageSize: 可选.分页大小,默认不分页,返回全部. nextMarker: 可选.填入上下页返回的第一个testDriving.id, 默认不填表示从第1页开始返回. sortBy: 可选.排序属性,默认按id升序.如name-表示按name降序, id+或id表示按id升序. return: { total: 34, testDriving: [] }. total,符合过滤条件的对象总数;testDriving,对象testDriving的数组
var co = require('co');
co(function*(){
var bizTestDrive = require('@gopalroy/biz-testDrive');
var total = yield bizTestDrive.TestDrive.getAllTestDrivingCountG({tdriveId:696});
var orgAlls = yield bizTestDrive.TestDrive.getAllTestDrivingG({tdriveId:696},10,0,"id+");
res.json({total:total.rowsCount,orgs:orgAlls});
}).catch(console.error);
TestDrive.prototype.getTestDrivingByIdG*(tdrivingId)
tdrivingId:试乘试驾信息的id
var co = require('co');
var bizTestDrive = require('@gopalroy/biz-testDrive');
co(function*(){
var testDrive = yield bizTestDrive.TestDrive.FromIdG(696);
var testDriving = yield testDrive.getTestDrivingByIdG(2);
}).catch(console.error);
TestDrive.prototype.addTestDrivingG(testDriving)
testDriving:添加的试乘试驾信息 return:添加后的试乘试驾信息
var co = require('co');
var bizTestDrive = require('@gopalroy/biz-testDrive');
co(function*(){
var testDrive = yield bizTestDrive.TestDrive.FromIdG(696);
var testDriveNew = bizTestDrive.TestDriving.FromJson({
tdriveId:696,
staffId:388,
vehicleId:375,
cust_name:'hao'+suffix,
cust_license:'420117'+suffix,
cust_sex:1,
cust_phone:13888888888
});
testDriving = yield testDrive.addTestDrivingG(testDriveNew);
}).catch(console.error);
TestDrive.prototype.removeTestDrivingG(testDriving)
testDriving:要删除的试乘试驾信息
var co = require('co');
var bizTestDrive = require('@gopalroy/biz-testDrive');
co(function*(){
var testDrive = yield bizTestDrive.TestDrive.FromIdG(696);
var testDriveNew = bizTestDrive.TestDriving.FromIdG(5);
yield testDrive.removeTestDrivingG(testDriveNew);
}).catch(console.error);
TestDrive.prototype.getAllTestDrivingReportG*(filter, sortBy,pageSize, nextMarker)
Generator方法.获取所有的TestDriveReport对象. filter: 过滤条件, 如{ name: /s/i }, 代表返回所有name包含s(不区分大小写) 如果过滤条件里是一个正则表达式,那么把属性转换为字符串,做字符串匹配; 如果过滤条件里不是正则表达式,那么直接比较值是否相等匹配. sortBy: 可选.排序属性,默认按id升序.如name-表示按name降序, id+或id表示按id升序. pageSize: 可选.分页大小,默认不分页,返回全部. nextMarker: 可选.填入上下页返回的第一个TestDrivingReport.id, 默认不填表示从第1页开始返回. return: { total: 34, TestDrivingReport: [] }. total,符合过滤条件的对象总数;TestDrivingReport,对象TestDrivingReport的数组
var co = require('co');
co(function*(){
var bizTestDrive = require('@gopalroy/biz-testDrive');
var total = yield bizTestDrive.TestDrive.getAllTestDrivingReportCountG({tdriveId:696});
var orgAlls = yield bizTestDrive.TestDrive.getAllTestDrivingReportG({tdriveId:696},10,0,"id+");
res.json({total:total.rowsCount,orgs:orgAlls});
}).catch(console.error);
TestDrive.prototype.getTestDrivingReportByIdG*(tdrivingId)
tdrivingId:试乘试驾报告的id
var co = require('co');
var bizTestDrive = require('@gopalroy/biz-testDrive');
co(function*(){
var testDrive = yield bizTestDrive.TestDrive.FromIdG(696);
var testDrivingReport = yield testDrive.getTestDrivingReportByIdG(2);
}).catch(console.error);
TestDrive.prototype.addTestDrivingReportG(testDrivingReport)
testDrivingReport:添加的试乘试驾报告 return:添加后的试乘试驾报告
var co = require('co');
var bizTestDrive = require('@gopalroy/biz-testDrive');
co(function*(){
var testDrive = yield bizTestDrive.TestDrive.FromIdG(696);
var testDriveNew = bizTestDrive.TestDrivingReport.FromJson({
tdriveId:696,
staffId:388,
vehicleId:375,
tripId:suffix,
status:0,
reportTime:new Date()
});
testDrivingReport = yield testDrive.addTestDrivingReportG(testDriveNew);
}).catch(console.error);
TestDrive.prototype.removeTestDrivingReportG(testDrivingReport)
testDrivingReport:要删除的试乘试驾报告
var co = require('co');
var bizTestDrive = require('@gopalroy/biz-testDrive');
co(function*(){
var testDrive = yield bizTestDrive.TestDrive.FromIdG(696);
var testDriveNew = bizTestDrive.TestDrivingReport.FromIdG(5);
yield testDrive.removeTestDrivingReportG(testDriveNew);
}).catch(console.error);
TestDriving
试乘试驾信息
TestDriving.FromJson(src)
从一个JSON对象创建一个试驾对象
var bizTestDrive = require('@gopalroy/biz-testDrive');
var TestDriveNew = bizTestDrive.TestDriving.FromJson({
tdriveId:696,
staffId:388,
vehicleId:375,
cust_name:'hao'+suffix,
cust_license:'420117'+suffix,
cust_sex:1,
cust_phone:13888888888
});
TestDriving.prototype.updateG*()
修改一条试乘试驾信息
var bizTestDrive = require('@gopalroy/biz-testDrive');
var TestDriveNew = bizTestDrive.TestDriving.FromJson({
id:5,
tdriveId:696,
staffId:388,
vehicleId:375,
cust_name:'hao'+suffix,
cust_license:'420117'+suffix,
cust_sex:1,
cust_phone:13888888888
});
testDriving = yield testDriveNew.updateG();
TestDrivingReport
试乘试驾报告
TestDrivingReport.FromJson(src)
从一个JSON对象创建一个试驾报告对象
var bizTestDrive = require('@gopalroy/biz-testDrive');
var TestDriveNew = bizTestDrive.TestDrivingReport.FromJson({
tdriveId:696,
staffId:388,
vehicleId:375,
tripId:22,
status:0,
reportTime:new Date()
});
TestDrivingReport.prototype.updateG*()
修改一条试乘试驾报告
var bizTestDrive = require('@gopalroy/biz-testDrive');
var TestDriveNew = bizTestDrive.TestDrivingReport.FromJson({
id:5,
tdriveId:696,
staffId:388,
vehicleId:375,
tripId:33,
status:0,
reportTime:new Date()
});
testDrivingReport = yield testDriveNew.updateG();