Browse Source

1、现金券关联商铺店址;

Lawsun_M 3 months ago
parent
commit
e3bd66097d
2 changed files with 4 additions and 3 deletions
  1. 2 1
      app/controller/home/user.js
  2. 2 2
      app/models/mysql/dinner_coins.js

+ 2 - 1
app/controller/home/user.js

@@ -495,6 +495,7 @@ module.exports = class UserController extends shopController {
       const data = await that.ctx.validate(that.userMoneyValidate, await that.ctx.getParse());
       const selectBean = await that.app.comoBean.instance(data, {
         where: { user_id: data.user_id, expired: false },
+        include: { model: that.app.model.PartnerInfo, as: 'partnerInfo', attributes: [ 'latitude', 'longitude' ] }
       });
       // 2023/2/28 直接查询所有数据 不分页
       const result = await that.service.base.select(selectBean, that.app.model.DinnerCoins, '查询餐饮币账户失败,请稍候重试', false, true);
@@ -553,7 +554,7 @@ module.exports = class UserController extends shopController {
       },
       attributes: [ [ seq.fn('sum', seq.col('account')), 'account' ] ],
     });
-    const result = await that.service.base.select(selectBean, that.app.model.DinnerCoins, '查询餐饮币账户余额失败,请稍候重试', false, false);
+    const result = await that.service.base.select(selectBean, that.app.model.DinnerCoins, '查询客户卡券账户失败,请稍候重试', false, false);
     const res = JSON.parse(JSON.stringify(result));
     res.customer_id = userInfo.user_id;
     res.partner_id = businessInfo.partner_id;

+ 2 - 2
app/models/mysql/dinner_coins.js

@@ -64,8 +64,8 @@ module.exports = app => {
   });
 
   Model.associate = function() {
-    // 关联户表
-    // Model.belongsTo(app.model.Users, { foreignKey: 'user_id', targetKey: 'user_id', as: 'user' });
+    // 关联户表
+    Model.belongsTo(app.model.PartnerInfo, { foreignKey: 'partner_id', targetKey: 'id', as: 'partnerInfo' });
   };
   // 同步:没有就新建,有就不变
   Model.sync();