ruiyong-lee / weapp-vue-eggjs-shop-demo Goto Github PK
View Code? Open in Web Editor NEW商城、商店批发或零售,pc管理端 + 微信小程序 + 后端服务
License: MIT License
商城、商店批发或零售,pc管理端 + 微信小程序 + 后端服务
License: MIT License
大佬,你好,如果我要对之前建好的表加一个字段,egg-sequelize应该要怎么加?
请问有教程视频吗?还有是不是没有商家商品展示界面的? 十分感谢~
你好, 我初次接触 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,
},
```
这些文件都是 手写的吗
可否给数据库添加个表前缀,便于业务的扩展。
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里加上安装依赖,启动的一些步骤啥的
先赞一个,
另外问下这个项目会持续维护么?
数据库的备份和导入怎么操作呢,有相关资料或插件名吗
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 的使用过程呢
VM1354 asdebug.js:1 GET http://192.168.96.129:7001/weapp/getGoodsWithCategory net::ERR_EMPTY_RESPONSE
微信小程序打开获取不到商品列表 这个baserul是获取哪的数据的呢
例如 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中,我没找到 模型关联的部分。 或者是我没发现,你能给我指出一下在哪里么
您好,使用您的项目的时候,显示网络错误,报错提示说检查
VM232 asdebug.js:1 POST http://localhost:7001/weapp/getGoodsWithCategory net::ERR_CONNECTION_REFUSED
按照网上的方法还是有些问题,请问该怎么解决呢?
存放的应该是数据库的数据结构,但是不知道具体有何作用。求大神赐教
jwt must be provided 这个egg-jwt 可以暂时先关闭吗 ,咋搞
能否给个*气的chrome主题 [email protected]
你好,
小程序里说用下面的UUID来绑定商家,但是我在web上的商家没有找到对应的值,请教一下,这个怎么弄的吗?现在我打开微信小程序,就是提示该应用未绑定商家。
MERCHANT_UUID: 'cff9c960-1ead-11e9-a89c-591ecd71c270', //根据不同商家手动配置
我看了下jwt鉴权token这块的功能,好像只有在路由白名单里的路由才能通过,好像没有去获取请求中的token去做鉴权啊。(不知道是不是哪里看漏了)
文件路径:app>extend>context.js>verifyToken()
期待线上支付功能
// app-server/app/middleware/auth.js
await ctx.verifyToken(); //先验证token,再进行下一个中间件
await next();
// 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"
现在是前端层面的静态文案,还有数据库里的数据也要能支持多语言,需要怎么设计呢
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.