Giter Site home page Giter Site logo

ruiyong-lee / weapp-vue-eggjs-shop-demo Goto Github PK

View Code? Open in Web Editor NEW
836.0 16.0 220.0 4.32 MB

商城、商店批发或零售,pc管理端 + 微信小程序 + 后端服务

License: MIT License

JavaScript 52.39% HTML 0.20% Vue 25.80% CSS 21.60%
weapp nodejs eggjs vue es6 shop demo javascript

weapp-vue-eggjs-shop-demo's Issues

关于 schema 目录

你好, 我初次接触 Egg.js 准备根据你们的 demo 进行学习

有个问题

schema 目录下 有非常多的 关于 数据库 表 字段 的 描述文件
如 :

module.exports = app => {
  const { STRING, BIGINT, DATE, UUIDV1 } = app.Sequelize;

  return {
    uuid: {
      type: STRING(38),
      allowNull: false,
      primaryKey: true,
      defaultValue: UUIDV1,
    },
    userName: {
      type: STRING(32),
      allowNull: false,
    },
    modifiedUserName: {
      type: STRING(76),
      allowNull: false,
    },
```

这些文件都是 手写的吗

cool

thanks for your demo , i am a newer for the vue&&eggjs but i am very like to learn the these web-world's things. i am game-programer by the way .

关于readme

建议readme里加上安装依赖,启动的一些步骤啥的

一处bug望看一下

async saveNew() {
const { ctx } = this;
try {
const rule = {
merchant: "object",
};
ctx.validate(rule);
const uuid = await ctx.service.user.merchant.saveNew(ctx.request.body);
this.success(uuid);
} catch (err) {
const { fields = {}, name } = err;
if (name === "SequelizeUniqueConstraintError") {
this.fail(ctx.UNIQUE_CODE, 账号:${fields.userName} 的商家已存在);
} else {
throw new Error(err);
}
}
}

在这段代码中如果抓取err且确实抓取到Unique的错误,确实会报(账号:undefined 的商家已存在)的错误.
可是在后续更换一个账号名去再次注册,且保证账号名是唯一的前提,依旧会报(账号:undefined 的商家已存在)的错误.
if (name === "SequelizeUniqueConstraintError") {} 应该是不能用这种方式去捕获错误吧?

关于jwt

能不能简单的给我说一下 JWT 的使用过程呢

带了 DEMO 没有找到 模型关联的部分

例如 BelongsTo

const Player = this.sequelize.define('player', {/* attributes */});
const Team  = this.sequelize.define('team', {/* attributes */});

Player.belongsTo(Team); // 将向 Player 添加一个 teamId 属性以保存 Team 的主键值

代码来自 https://github.com/demopark/sequelize-docs-Zh-CN

在你的demo中,我没找到 模型关联的部分。 或者是我没发现,你能给我指出一下在哪里么

小程序和商家怎么绑定

你好,
小程序里说用下面的UUID来绑定商家,但是我在web上的商家没有找到对应的值,请教一下,这个怎么弄的吗?现在我打开微信小程序,就是提示该应用未绑定商家。
MERCHANT_UUID: 'cff9c960-1ead-11e9-a89c-591ecd71c270', //根据不同商家手动配置

项目的jwt的token鉴权是不是没做完啊?

我看了下jwt鉴权token这块的功能,好像只有在路由白名单里的路由才能通过,好像没有去获取请求中的token去做鉴权啊。(不知道是不是哪里看漏了)
文件路径:app>extend>context.js>verifyToken()

两个建议

  1. 将verifyToken放在next()前面:
// app-server/app/middleware/auth.js

await ctx.verifyToken(); //先验证token,再进行下一个中间件
await next();
  1. 推荐userUuid挂在到ctx上
// app-server/app/extend/content.js

if (userUuid !== verifyResult.message.userUuid) {
      this.verifyFail(401, '用户 UUID 与 Token 不一致');
      return false;
}
this.userUuid = verifyResult.message.userUuid;
this.userName= verifyResult.message.userName;
return true;

如何同步数据库

如果我修改了 schema 后, 如何同步到数据库呢
我再次运行 npm run db:up

会提示
No migrations were executed, database schema was already up to date.

    "db:init": "npx sequelize migration:generate --name",
    "db:up": "npx sequelize db:migrate",
    "db:down": "npx sequelize db:migrate:undo",
    "db:down-all": "npx sequelize db:migrate:undo:all"

多语言要怎么设计

现在是前端层面的静态文案,还有数据库里的数据也要能支持多语言,需要怎么设计呢

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.