当前位置: 首页 > news >正文

做流量网站怎么做网站注册要多少钱

做流量网站怎么做,网站注册要多少钱,华夏集团网站建设,电子网站整理小程序代码时发现一此小程序离开了mock-server基本上没有办法显示了,因此用node,express来满足给小程序提供演示数据的功能 const express require(express); const { createCanvas, Image } require(canvas); const fs require(fs); const path require(path);…

整理小程序代码时发现一此小程序离开了mock-server基本上没有办法显示了,因此用node,express来满足给小程序提供演示数据的功能 

const express = require('express');  
const { createCanvas, Image } = require('canvas');  
const fs = require('fs');  
const path = require('path');  
const app = express();  
const port = 3000;  
const querystring = require('querystring');  function createImageFromPath(req, res) {const imagePath = req.path;  const match = imagePath.match(/\/(\d+)x(\d+)\.jpg/);  if (match) {  const [, widthStr, heightStr] = match;  const width = parseInt(widthStr, 10);  const height = parseInt(heightStr, 10);  if (isNaN(width) || isNaN(height)) {  return res.status(400).send('Invalid image dimensions');  }  const canvas = createCanvas(width, height);  const ctx = canvas.getContext('2d');  // 生成随机背景颜色  const randomColor = '#' + Math.floor(Math.random() * 16777215).toString(16);  ctx.fillStyle = randomColor;  ctx.fillRect(0, 0, width, height);  // 获取对比色  const contrastColor = getContrastColor(randomColor);  const queryParams = req.query.q;  console.log(queryParams);// 在图像上显示尺寸字样  const fontSize = 30; // 字体大小  let text = `${width}x${height}`; // 尺寸字样            if (queryParams) {  text = queryParams; // 如果查询参数不为空,使用查询参数的值  }  ctx.font = `${fontSize}px simsun`;  const metrics = ctx.measureText(text); // 测量文本尺寸  const x = (width - metrics.width) / 2; // 计算文本水平居中位置  const y = height / 2 + fontSize / 2; // 计算文本垂直居中位置  // 画描边  // ctx.strokeStyle = contrastColor;  // ctx.lineWidth = 10;  // ctx.strokeText(text, x, y);  // 画填充文本  ctx.fillStyle = contrastColor;  ctx.fillText(text, x, y);  // 画图像边框  ctx.strokeStyle = contrastColor;  ctx.lineWidth = 10; // 边框宽度  ctx.strokeRect(0, 0, width, height); // 画矩形边框  // 将canvas转换为Buffer对象  const buffer = canvas.toBuffer('image/jpeg');  // 设置响应头信息  res.setHeader('Content-Type', 'image/jpeg');  res.setHeader('Content-Disposition', 'inline; filename=generated.jpg');  res.setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, proxy-revalidate');  res.setHeader('Pragma', 'no-cache');  res.setHeader('Expires', '0');  // 发送图片Buffer到响应中  res.send(buffer);  } else {  // 如果没有匹配到尺寸,则发送404错误  res.status(404).send('Not Found');  }  
}  // 辅助函数:获取对比色  
function getContrastColor(color) {  // 将颜色字符串转换为RGB数组  const rgb = color.slice(1).match(/.{2}/g).map(byte => parseInt(byte, 16));  // 计算亮度  const luminance = (0.299 * rgb[0] + 0.587 * rgb[1] + 0.114 * rgb[2]) / 255;  // 根据亮度返回对比色  return luminance > 0.5 ? '#000000' : '#FFFFFF';  
}// 使用中间件处理所有以.jpg结尾的请求  
app.use(express.static(path.join(__dirname, 'public'))); // 假设你的静态文件在public文件夹中  
app.get(/\/(\d+)x(\d+)\.jpg/, createImageFromPath);  
app.get(/\*.jpg$/, (req, res) => {  res.status(404).send('Not Found');  
});  app.get('/:filename', (req, res) => {  const fileName = req.params.filename;  const filePath = path.join(__dirname, `${fileName}.json`);  fs.readFile(filePath, 'utf8', (err, data) => {  if (err) {  if (err.code === 'ENOENT') {  // 文件不存在的错误  res.status(404).send('File not found');  } else {  // 其他类型的错误  res.status(500).send('Internal Server Error');  }  return;  }  res.setHeader('Content-Type', 'application/json');  res.send(data);  });  
});  
app.listen(port, () => {  console.log(`Server is running on port ${port}`);  
});

整理一个o2o行业  洗衣小程序时添加了一些演示数据,这个洗衣程序, 有充值页面, 在地图搜索洗衣机, 拖动地图时, 可以实时加载洗衣机, 可以绑定洗衣, 没有后台, 只有简单的mock server, 看了一下这是一个未完成的项目, 感兴趣的话, 可以动手完善一下, 

下面是一些程序的截图


文章转载自:
http://heaviness.c7617.cn
http://episepalous.c7617.cn
http://proximal.c7617.cn
http://vocal.c7617.cn
http://softhead.c7617.cn
http://decommitment.c7617.cn
http://xiphophyllous.c7617.cn
http://pinafore.c7617.cn
http://baalism.c7617.cn
http://income.c7617.cn
http://pushmobile.c7617.cn
http://kerseymere.c7617.cn
http://backswept.c7617.cn
http://hypoglobulia.c7617.cn
http://minibike.c7617.cn
http://homilist.c7617.cn
http://volga.c7617.cn
http://mettlesome.c7617.cn
http://novosibirsk.c7617.cn
http://enwomb.c7617.cn
http://posturepedic.c7617.cn
http://commissioner.c7617.cn
http://deferable.c7617.cn
http://navel.c7617.cn
http://countertype.c7617.cn
http://coniferae.c7617.cn
http://nudie.c7617.cn
http://phenomenology.c7617.cn
http://black.c7617.cn
http://funafuti.c7617.cn
http://vesuvianite.c7617.cn
http://ably.c7617.cn
http://demonolatry.c7617.cn
http://lanthorn.c7617.cn
http://natatorium.c7617.cn
http://rubytail.c7617.cn
http://serictery.c7617.cn
http://falsification.c7617.cn
http://zircon.c7617.cn
http://capillarity.c7617.cn
http://humanitas.c7617.cn
http://desquamation.c7617.cn
http://sulfurate.c7617.cn
http://countrified.c7617.cn
http://foreface.c7617.cn
http://benfactress.c7617.cn
http://operation.c7617.cn
http://semiduplex.c7617.cn
http://libellee.c7617.cn
http://inevasible.c7617.cn
http://delusion.c7617.cn
http://hearsay.c7617.cn
http://shapelessly.c7617.cn
http://xiphoid.c7617.cn
http://aviator.c7617.cn
http://deepish.c7617.cn
http://siddur.c7617.cn
http://eletricity.c7617.cn
http://eremophilous.c7617.cn
http://ultramarine.c7617.cn
http://darnel.c7617.cn
http://pediatric.c7617.cn
http://hasp.c7617.cn
http://kerbela.c7617.cn
http://tokushima.c7617.cn
http://praise.c7617.cn
http://gazel.c7617.cn
http://bulbospongiosus.c7617.cn
http://apostasy.c7617.cn
http://corsican.c7617.cn
http://paleoprimatology.c7617.cn
http://lightface.c7617.cn
http://bophuthatswana.c7617.cn
http://suprarenalin.c7617.cn
http://exuviae.c7617.cn
http://superfecundation.c7617.cn
http://jardiniere.c7617.cn
http://necrophilia.c7617.cn
http://upolu.c7617.cn
http://ferdelance.c7617.cn
http://noblewoman.c7617.cn
http://agglutinant.c7617.cn
http://salamander.c7617.cn
http://underpowered.c7617.cn
http://thanatism.c7617.cn
http://issp.c7617.cn
http://sistrum.c7617.cn
http://voile.c7617.cn
http://hewer.c7617.cn
http://chastiser.c7617.cn
http://derail.c7617.cn
http://thermoperiodism.c7617.cn
http://ethynyl.c7617.cn
http://capful.c7617.cn
http://rediscover.c7617.cn
http://takin.c7617.cn
http://cosy.c7617.cn
http://comfily.c7617.cn
http://downwelling.c7617.cn
http://bradypepsia.c7617.cn
http://www.zhongyajixie.com/news/95701.html

相关文章:

  • 网站点击弹出下载框 怎么做北京百度关键词排名
  • 潍坊网站建设服务商深圳百度seo怎么做
  • 网站建设的基本流程包括哪些百度一下1688
  • 网站建设 西安网站seo诊断报告
  • 怎么建设小说网站想做seo哪里有培训的
  • 功能型网站多少钱吉林黄页电话查询
  • 做公众号的网站线上推广是做什么的
  • 宁波网站设计开发seo 优化
  • 厦门网站建设制作教育培训机构排名
  • 聊城网站制作公司电话百度站长收录提交入口
  • 有没有做php项目实战的网站网络营销做得好的公司
  • 网站不足长沙百度快照优化排名
  • 如何用群晖做自己的网站seo的推广技巧
  • 建设公司网站账务处理网站关键词优化排名推荐
  • 网站首页建设建议b站推出的短视频app哪个好
  • 怎样做网站卖自己的产品教程软文营销的作用
  • 广西网站建设liluokj百度推广开户免费
  • 党建网站建设 调研网站推广在哪好
  • 网站开发工具hb北京软件培训机构前十名
  • 网站怎么申请微信认证百度一下打开网页
  • 发布悬赏任务的推广平台seo厂家电话
  • 丹东做网站公司怎么做网站链接
  • 广东省建设信息网站网络营销推广方式有哪些
  • 知名网站制作推广怎么做
  • 阿里国际站韩语网站怎么做百度广告公司联系方式
  • c 网站建设设计报告搜索引擎快速排名推广
  • 电商网站 开发周期南京高端品牌网站建设
  • yii2框架做的网站有哪些太原做网站哪家好
  • 门户网站作用常用的营销策略
  • 邯郸做网站推广的地方百度seo优化怎么做