当前位置: 首页 > 工具软件 > EasyMock.NET > 使用案例 >

easymock模拟post接口请求数据

罗源
2023-12-01

实现传参keywords + page + pagesize 请求

{

  "status": 200,
  "msg": "OK",
  "data": {
    "data": function({
      _req,
      Mock
    }) {
      let i = 0,
        _data = [],
        keywords = _req.query.keywords,
        page = _req.query.page, //当前页数
        pageSize = _req.query.pageSize, //每次返回的条数
        len = (1000 - pageSize * (page - 1)) < pageSize ? (1000 - pageSize * (page - 1)) : pageSize;
      for (i; i < len; i++) {
        _data.push(
          Mock.mock({
            "page": 1,
            "total": 6,
            "records": 50,
            "userdata": null,
            "rows": [{
                "id": "10025",
                "name": "小Q",
                "poster": "https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=3469382960,394633929&fm=11&gp=0.jpg",
                "cover": "https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=141638989,1254374469&fm=11&gp=0.jpg",
                "trailer": "http://maoyan.meituan.net/movie/videos/854x480a81a2eaf340e447ba9e8c8eeb2008489.mp4",
                "score": 9.1,
                "prisedCounts": 123,
                "basicInfo": "中国大陆",
                "originalName": "主演: 任达华,梁咏琪,罗仲谦",
                "releaseDate": "2019-09-20大陆上映",
                "totalTime": "影片时常:90分钟",
                "detail": "聪明可爱的小Q在训练师悉心照料和训练过程中成长为一只合格的导盲犬,并遇到了主人李宝庭(任达华 饰)——中年失明、孤僻又坏脾气的天才糕点师。他们共同生活的日子里,小Q逐渐融化并走入了宝庭的心里,温情的陪伴令处于低谷期的宝庭有了新生活,一人一犬,深深的羁绊,他们谁也无法再失去彼此。"
              },
              {
                "id": "108825",
                "name": "诛仙Ⅰ",
                "cover": "https://p0.meituan.net/128.180/movie/845dce25ba800e91ac591b683a0c3ba92450317.jpg",
                "poster": "https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1025153290,2887674968&fm=11&gp=0.jpg",
                "trailer": "http://maoyan.meituan.net/movie/videos/854x48080946e01720c47c3bda0656fa41395d1.mp4",
                "score": 7.6,
                "prisedCounts": 1238,
                "basicInfo": "中国大陆",
                "originalName": "主演: 肖战,李沁,孟美岐",
                "releaseDate": "2019-09-13 09:00大陆上映",
                "totalTime": "影片时常:101分钟",
                "detail": "草庙村被屠,少年张小凡(肖战 饰)双亲离世,被青云门大竹峰收留。机缘巧合之下,他习得佛门天音功法,又意外获得魔教法器烧火棍,踏上强者之路的同时,也让他陷入了巨大的危机。至魔法器的现世,与陆雪琪(李沁 饰)、碧瑶(孟美岐 饰)、田灵儿(唐艺昕 饰)三个女生间命运的交错,都让他原本单纯的人生轨迹充满变数。一个勇者驳斥命运的传奇之旅就此展开......"
              },
              {
                "id": "10825",
                "name": "罗小黑战记",
                "cover": "https://p0.meituan.net/128.180/movie/2918a5e403dde6e4254941968d7719ce3942369.jpg",
                "poster": "http://img5.imgtn.bdimg.com/it/u=875658279,643337630&fm=11&gp=0.jpg",
                "trailer": "http://maoyan.meituan.net/movie/videos/854x480ba9a9bc461224b7ca0fdf3436ef6e4e3.mp4",
                "score": 9.3,
                "prisedCounts": 12358,
                "basicInfo": "中国大陆",
                "originalName": "主演: 山新,郝翔海,皇贞季",
                "releaseDate": "2019-09-07大陆上映",
                "totalTime": "影片时常:101分钟",
                "detail": "在熙攘的人类世界里,很多妖精隐匿其中,他们与人类相安无事地生活着。猫妖罗小黑因为家园被破坏,开始了它的流浪之旅。这场旅途中惺惺相惜的妖精同类与和谐包容的人类伙伴相继出现,让小黑陷入了两难抉择,究竟何处才是真正的归属?"

              },
              {
                "id": "1005",
                "name": "小Q",
                "poster": "https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=3469382960,394633929&fm=11&gp=0.jpg",
                "cover": "https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=141638989,1254374469&fm=11&gp=0.jpg",
                "trailer": "http://maoyan.meituan.net/movie/videos/854x480a81a2eaf340e447ba9e8c8eeb2008489.mp4",
                "score": 9.1,
                "prisedCounts": 123,
                "basicInfo": "中国大陆",
                "originalName": "主演: 任达华,梁咏琪,罗仲谦",
                "releaseDate": "2019-09-20大陆上映",
                "totalTime": "影片时常:90分钟",
                "detail": "聪明可爱的小Q在训练师悉心照料和训练过程中成长为一只合格的导盲犬,并遇到了主人李宝庭(任达华 饰)——中年失明、孤僻又坏脾气的天才糕点师。他们共同生活的日子里,小Q逐渐融化并走入了宝庭的心里,温情的陪伴令处于低谷期的宝庭有了新生活,一人一犬,深深的羁绊,他们谁也无法再失去彼此。"
              },
              {
                "id": "825",
                "name": "诛仙Ⅰ",
                "cover": "https://p0.meituan.net/128.180/movie/845dce25ba800e91ac591b683a0c3ba92450317.jpg",
                "poster": "https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1025153290,2887674968&fm=11&gp=0.jpg",
                "trailer": "http://maoyan.meituan.net/movie/videos/854x48080946e01720c47c3bda0656fa41395d1.mp4",
                "score": 7.6,
                "prisedCounts": 1238,
                "basicInfo": "中国大陆",
                "originalName": "主演: 肖战,李沁,孟美岐",
                "releaseDate": "2019-09-13 09:00大陆上映",
                "totalTime": "影片时常:101分钟",
                "detail": "草庙村被屠,少年张小凡(肖战 饰)双亲离世,被青云门大竹峰收留。机缘巧合之下,他习得佛门天音功法,又意外获得魔教法器烧火棍,踏上强者之路的同时,也让他陷入了巨大的危机。至魔法器的现世,与陆雪琪(李沁 饰)、碧瑶(孟美岐 饰)、田灵儿(唐艺昕 饰)三个女生间命运的交错,都让他原本单纯的人生轨迹充满变数。一个勇者驳斥命运的传奇之旅就此展开......"
              },
              {
                "id": "1555",
                "name": "罗小黑战记",
                "cover": "https://p0.meituan.net/128.180/movie/2918a5e403dde6e4254941968d7719ce3942369.jpg",
                "poster": "http://img5.imgtn.bdimg.com/it/u=875658279,643337630&fm=11&gp=0.jpg",
                "trailer": "http://maoyan.meituan.net/movie/videos/854x480ba9a9bc461224b7ca0fdf3436ef6e4e3.mp4",
                "score": 9.3,
                "prisedCounts": 12358,
                "basicInfo": "中国大陆",
                "originalName": "主演: 山新,郝翔海,皇贞季",
                "releaseDate": "2019-09-07大陆上映",
                "totalTime": "影片时常:101分钟",
                "detail": "在熙攘的人类世界里,很多妖精隐匿其中,他们与人类相安无事地生活着。猫妖罗小黑因为家园被破坏,开始了它的流浪之旅。这场旅途中惺惺相惜的妖精同类与和谐包容的人类伙伴相继出现,让小黑陷入了两难抉择,究竟何处才是真正的归属?"

              },
              {
                "id": "1003325",
                "name": "小Q",
                "poster": "https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=3469382960,394633929&fm=11&gp=0.jpg",
                "cover": "https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=141638989,1254374469&fm=11&gp=0.jpg",
                "trailer": "http://maoyan.meituan.net/movie/videos/854x480a81a2eaf340e447ba9e8c8eeb2008489.mp4",
                "score": 9.1,
                "prisedCounts": 123,
                "basicInfo": "中国大陆",
                "originalName": "主演: 任达华,梁咏琪,罗仲谦",
                "releaseDate": "2019-09-20大陆上映",
                "totalTime": "影片时常:90分钟",
                "detail": "聪明可爱的小Q在训练师悉心照料和训练过程中成长为一只合格的导盲犬,并遇到了主人李宝庭(任达华 饰)——中年失明、孤僻又坏脾气的天才糕点师。他们共同生活的日子里,小Q逐渐融化并走入了宝庭的心里,温情的陪伴令处于低谷期的宝庭有了新生活,一人一犬,深深的羁绊,他们谁也无法再失去彼此。"
              },
              {
                "id": "1083835",
                "name": "诛仙Ⅰ",
                "cover": "https://p0.meituan.net/128.180/movie/845dce25ba800e91ac591b683a0c3ba92450317.jpg",
                "poster": "https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1025153290,2887674968&fm=11&gp=0.jpg",
                "trailer": "http://maoyan.meituan.net/movie/videos/854x48080946e01720c47c3bda0656fa41395d1.mp4",
                "score": 7.6,
                "prisedCounts": 1238,
                "basicInfo": "中国大陆",
                "originalName": "主演: 肖战,李沁,孟美岐",
                "releaseDate": "2019-09-13 09:00大陆上映",
                "totalTime": "影片时常:101分钟",
                "detail": "草庙村被屠,少年张小凡(肖战 饰)双亲离世,被青云门大竹峰收留。机缘巧合之下,他习得佛门天音功法,又意外获得魔教法器烧火棍,踏上强者之路的同时,也让他陷入了巨大的危机。至魔法器的现世,与陆雪琪(李沁 饰)、碧瑶(孟美岐 饰)、田灵儿(唐艺昕 饰)三个女生间命运的交错,都让他原本单纯的人生轨迹充满变数。一个勇者驳斥命运的传奇之旅就此展开......"
              },
              {
                "id": "1082354",
                "name": "罗小黑战记",
                "cover": "https://p0.meituan.net/128.180/movie/2918a5e403dde6e4254941968d7719ce3942369.jpg",
                "poster": "http://img5.imgtn.bdimg.com/it/u=875658279,643337630&fm=11&gp=0.jpg",
                "trailer": "http://maoyan.meituan.net/movie/videos/854x480ba9a9bc461224b7ca0fdf3436ef6e4e3.mp4",
                "score": 9.3,
                "prisedCounts": 12358,
                "basicInfo": "中国大陆",
                "originalName": "主演: 山新,郝翔海,皇贞季",
                "releaseDate": "2019-09-07大陆上映",
                "totalTime": "影片时常:101分钟",
                "detail": "在熙攘的人类世界里,很多妖精隐匿其中,他们与人类相安无事地生活着。猫妖罗小黑因为家园被破坏,开始了它的流浪之旅。这场旅途中惺惺相惜的妖精同类与和谐包容的人类伙伴相继出现,让小黑陷入了两难抉择,究竟何处才是真正的归属?"

              },
              {
                "id": "103025",
                "name": "小Q",
                "poster": "https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=3469382960,394633929&fm=11&gp=0.jpg",
                "cover": "https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=141638989,1254374469&fm=11&gp=0.jpg",
                "trailer": "http://maoyan.meituan.net/movie/videos/854x480a81a2eaf340e447ba9e8c8eeb2008489.mp4",
                "score": 9.1,
                "prisedCounts": 123,
                "basicInfo": "中国大陆",
                "originalName": "主演: 任达华,梁咏琪,罗仲谦",
                "releaseDate": "2019-09-20大陆上映",
                "totalTime": "影片时常:90分钟",
                "detail": "聪明可爱的小Q在训练师悉心照料和训练过程中成长为一只合格的导盲犬,并遇到了主人李宝庭(任达华 饰)——中年失明、孤僻又坏脾气的天才糕点师。他们共同生活的日子里,小Q逐渐融化并走入了宝庭的心里,温情的陪伴令处于低谷期的宝庭有了新生活,一人一犬,深深的羁绊,他们谁也无法再失去彼此。"
              },
              {
                "id": "1038825",
                "name": "诛仙Ⅰ",
                "cover": "https://p0.meituan.net/128.180/movie/845dce25ba800e91ac591b683a0c3ba92450317.jpg",
                "poster": "https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1025153290,2887674968&fm=11&gp=0.jpg",
                "trailer": "http://maoyan.meituan.net/movie/videos/854x48080946e01720c47c3bda0656fa41395d1.mp4",
                "score": 7.6,
                "prisedCounts": 1238,
                "basicInfo": "中国大陆",
                "originalName": "主演: 肖战,李沁,孟美岐",
                "releaseDate": "2019-09-13 09:00大陆上映",
                "totalTime": "影片时常:101分钟",
                "detail": "草庙村被屠,少年张小凡(肖战 饰)双亲离世,被青云门大竹峰收留。机缘巧合之下,他习得佛门天音功法,又意外获得魔教法器烧火棍,踏上强者之路的同时,也让他陷入了巨大的危机。至魔法器的现世,与陆雪琪(李沁 饰)、碧瑶(孟美岐 饰)、田灵儿(唐艺昕 饰)三个女生间命运的交错,都让他原本单纯的人生轨迹充满变数。一个勇者驳斥命运的传奇之旅就此展开......"
              },
              {
                "id": "103825",
                "name": "罗小黑战记",
                "cover": "https://p0.meituan.net/128.180/movie/2918a5e403dde6e4254941968d7719ce3942369.jpg",
                "poster": "http://img5.imgtn.bdimg.com/it/u=875658279,643337630&fm=11&gp=0.jpg",
                "trailer": "http://maoyan.meituan.net/movie/videos/854x480ba9a9bc461224b7ca0fdf3436ef6e4e3.mp4",
                "score": 9.3,
                "prisedCounts": 12358,
                "basicInfo": "中国大陆",
                "originalName": "主演: 山新,郝翔海,皇贞季",
                "releaseDate": "2019-09-07大陆上映",
                "totalTime": "影片时常:101分钟",
                "detail": "在熙攘的人类世界里,很多妖精隐匿其中,他们与人类相安无事地生活着。猫妖罗小黑因为家园被破坏,开始了它的流浪之旅。这场旅途中惺惺相惜的妖精同类与和谐包容的人类伙伴相继出现,让小黑陷入了两难抉择,究竟何处才是真正的归属?"

              },
              {
                "id": "10035",
                "name": "小Q",
                "poster": "https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=3469382960,394633929&fm=11&gp=0.jpg",
                "cover": "https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=141638989,1254374469&fm=11&gp=0.jpg",
                "trailer": "http://maoyan.meituan.net/movie/videos/854x480a81a2eaf340e447ba9e8c8eeb2008489.mp4",
                "score": 9.1,
                "prisedCounts": 123,
                "basicInfo": "中国大陆",
                "originalName": "主演: 任达华,梁咏琪,罗仲谦",
                "releaseDate": "2019-09-20大陆上映",
                "totalTime": "影片时常:90分钟",
                "detail": "聪明可爱的小Q在训练师悉心照料和训练过程中成长为一只合格的导盲犬,并遇到了主人李宝庭(任达华 饰)——中年失明、孤僻又坏脾气的天才糕点师。他们共同生活的日子里,小Q逐渐融化并走入了宝庭的心里,温情的陪伴令处于低谷期的宝庭有了新生活,一人一犬,深深的羁绊,他们谁也无法再失去彼此。"
              },
              {
                "id": "8235",
                "name": "诛仙Ⅰ",
                "cover": "https://p0.meituan.net/128.180/movie/845dce25ba800e91ac591b683a0c3ba92450317.jpg",
                "poster": "https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1025153290,2887674968&fm=11&gp=0.jpg",
                "trailer": "http://maoyan.meituan.net/movie/videos/854x48080946e01720c47c3bda0656fa41395d1.mp4",
                "score": 7.6,
                "prisedCounts": 1238,
                "basicInfo": "中国大陆",
                "originalName": "主演: 肖战,李沁,孟美岐",
                "releaseDate": "2019-09-13 09:00大陆上映",
                "totalTime": "影片时常:101分钟",
                "detail": "草庙村被屠,少年张小凡(肖战 饰)双亲离世,被青云门大竹峰收留。机缘巧合之下,他习得佛门天音功法,又意外获得魔教法器烧火棍,踏上强者之路的同时,也让他陷入了巨大的危机。至魔法器的现世,与陆雪琪(李沁 饰)、碧瑶(孟美岐 饰)、田灵儿(唐艺昕 饰)三个女生间命运的交错,都让他原本单纯的人生轨迹充满变数。一个勇者驳斥命运的传奇之旅就此展开......"
              },
              {
                "id": "15355",
                "name": "罗小黑战记",
                "cover": "https://p0.meituan.net/128.180/movie/2918a5e403dde6e4254941968d7719ce3942369.jpg",
                "poster": "http://img5.imgtn.bdimg.com/it/u=875658279,643337630&fm=11&gp=0.jpg",
                "trailer": "http://maoyan.meituan.net/movie/videos/854x480ba9a9bc461224b7ca0fdf3436ef6e4e3.mp4",
                "score": 9.3,
                "prisedCounts": 12358,
                "basicInfo": "中国大陆",
                "originalName": "主演: 山新,郝翔海,皇贞季",
                "releaseDate": "2019-09-07大陆上映",
                "totalTime": "影片时常:101分钟",
                "detail": "在熙攘的人类世界里,很多妖精隐匿其中,他们与人类相安无事地生活着。猫妖罗小黑因为家园被破坏,开始了它的流浪之旅。这场旅途中惺惺相惜的妖精同类与和谐包容的人类伙伴相继出现,让小黑陷入了两难抉择,究竟何处才是真正的归属?"

              },
              {
                "id": "1003325",
                "name": "小Q",
                "poster": "https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=3469382960,394633929&fm=11&gp=0.jpg",
                "cover": "https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=141638989,1254374469&fm=11&gp=0.jpg",
                "trailer": "http://maoyan.meituan.net/movie/videos/854x480a81a2eaf340e447ba9e8c8eeb2008489.mp4",
                "score": 9.1,
                "prisedCounts": 123,
                "basicInfo": "中国大陆",
                "originalName": "主演: 任达华,梁咏琪,罗仲谦",
                "releaseDate": "2019-09-20大陆上映",
                "totalTime": "影片时常:90分钟",
                "detail": "聪明可爱的小Q在训练师悉心照料和训练过程中成长为一只合格的导盲犬,并遇到了主人李宝庭(任达华 饰)——中年失明、孤僻又坏脾气的天才糕点师。他们共同生活的日子里,小Q逐渐融化并走入了宝庭的心里,温情的陪伴令处于低谷期的宝庭有了新生活,一人一犬,深深的羁绊,他们谁也无法再失去彼此。"
              },
              {
                "id": "1088335",
                "name": "诛仙Ⅰ",
                "cover": "https://p0.meituan.net/128.180/movie/845dce25ba800e91ac591b683a0c3ba92450317.jpg",
                "poster": "https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1025153290,2887674968&fm=11&gp=0.jpg",
                "trailer": "http://maoyan.meituan.net/movie/videos/854x48080946e01720c47c3bda0656fa41395d1.mp4",
                "score": 7.6,
                "prisedCounts": 1238,
                "basicInfo": "中国大陆",
                "originalName": "主演: 肖战,李沁,孟美岐",
                "releaseDate": "2019-09-13 09:00大陆上映",
                "totalTime": "影片时常:101分钟",
                "detail": "草庙村被屠,少年张小凡(肖战 饰)双亲离世,被青云门大竹峰收留。机缘巧合之下,他习得佛门天音功法,又意外获得魔教法器烧火棍,踏上强者之路的同时,也让他陷入了巨大的危机。至魔法器的现世,与陆雪琪(李沁 饰)、碧瑶(孟美岐 饰)、田灵儿(唐艺昕 饰)三个女生间命运的交错,都让他原本单纯的人生轨迹充满变数。一个勇者驳斥命运的传奇之旅就此展开......"
              },
              {
                "id": "10938254",
                "name": "罗小黑战记",
                "cover": "https://p0.meituan.net/128.180/movie/2918a5e403dde6e4254941968d7719ce3942369.jpg",
                "poster": "http://img5.imgtn.bdimg.com/it/u=875658279,643337630&fm=11&gp=0.jpg",
                "trailer": "http://maoyan.meituan.net/movie/videos/854x480ba9a9bc461224b7ca0fdf3436ef6e4e3.mp4",
                "score": 9.3,
                "prisedCounts": 12358,
                "basicInfo": "中国大陆",
                "originalName": "主演: 山新,郝翔海,皇贞季",
                "releaseDate": "2019-09-07大陆上映",
                "totalTime": "影片时常:101分钟",
                "detail": "在熙攘的人类世界里,很多妖精隐匿其中,他们与人类相安无事地生活着。猫妖罗小黑因为家园被破坏,开始了它的流浪之旅。这场旅途中惺惺相惜的妖精同类与和谐包容的人类伙伴相继出现,让小黑陷入了两难抉择,究竟何处才是真正的归属?"

              },

            ]

          })
        );
      }
      return _data;
    },
    "count": 1000
  },
  "msg": "获取成功"
}
 类似资料: