faker-data.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. module.exports = function () {
  2. var faker = require("faker");
  3. faker.locale = "zh_CN";
  4. var _ = require("lodash");
  5. return {
  6. "index-count":{
  7. code:200,
  8. data:{
  9. wait_edit:(faker.random.number()%100)+1,
  10. wait_sign:(faker.random.number()%100)+1,
  11. already_active:(faker.random.number()%100)+1,
  12. already_sign:(faker.random.number()%100)+1,
  13. temp:(faker.random.number()%100)+1,
  14. out_date:(faker.random.number()%100)+1
  15. }
  16. },
  17. contract:{
  18. code:200,
  19. data:_.times(20,function (n) {
  20. return _.times(5,function (j) {
  21. return {
  22. id:n*10+j,
  23. status:(j%2===0?'待签署':'已签署'),
  24. title:faker.commerce.productName(),
  25. date:faker.date.recent(),
  26. }
  27. })
  28. })
  29. },
  30. contact:{
  31. code:200,
  32. data:_.times(20,function (n) {
  33. return{
  34. username:faker.name.firstName()+faker.name.lastName(),
  35. userRealname:'已实名',
  36. phone:faker.phone.phoneNumber('1##########'),
  37. userImg:faker.image.avatar()
  38. }
  39. })
  40. },
  41. 'current-user':{
  42. code:200,
  43. data:{
  44. username:faker.name.firstName()+faker.name.lastName(),
  45. userRealname:'已实名',
  46. phone:faker.phone.phoneNumber('1##########'),
  47. userImg:faker.image.avatar()
  48. }
  49. },
  50. 'switch-user':{
  51. code:200,
  52. data:_.times(5,function (n) {
  53. return{
  54. username:((faker.random.number()%100>50)?faker.name.firstName()+faker.name.lastName():faker.company.companyName()),
  55. isRealname:'已实名',
  56. }
  57. })
  58. }
  59. }
  60. }