Jelajahi Sumber

修改店铺查看信息

zs 1 tahun lalu
induk
melakukan
8a8ec64fcd

+ 3 - 2
app/controller/system/config/.banner.js

@@ -1,6 +1,6 @@
 module.exports = {
   create: {
-    requestBody: ['sort', 'content', 'name', 'url', 'type', 'to', 'status'],
+    requestBody: ['shop', 'sort', 'content', 'name', 'url', 'type', 'to', 'status'],
   },
   destroy: {
     params: ['!id'],
@@ -8,7 +8,7 @@ module.exports = {
   },
   update: {
     params: ['!id'],
-    requestBody: ['sort', 'content', 'name', 'url', 'type', 'to', 'status'],
+    requestBody: ['shop', 'sort', 'content', 'name', 'url', 'type', 'to', 'status'],
   },
   show: {
     parameters: {
@@ -21,6 +21,7 @@ module.exports = {
       query: {
         'meta.createdAt@start': 'meta.createdAt@start',
         'meta.createdAt@end': 'meta.createdAt@end',
+        shop: 'shop',
         name: 'name',
         type: 'type',
         status: 'status',

+ 3 - 2
app/controller/system/config/.config.js

@@ -1,6 +1,6 @@
 module.exports = {
   create: {
-    requestBody: ['reward_day', 'title', 'config', 'agree', 'bottom_title', 'bottom_menu','leader'],
+    requestBody: ['reward_day', 'shop', 'title', 'config', 'agree', 'bottom_title', 'bottom_menu', 'leader'],
   },
   destroy: {
     params: ['!id'],
@@ -8,7 +8,7 @@ module.exports = {
   },
   update: {
     params: ['!id'],
-    requestBody: ['reward_day', 'title', 'config', 'agree', 'bottom_title', 'bottom_menu','leader'],
+    requestBody: ['reward_day', 'shop', 'title', 'config', 'agree', 'bottom_title', 'bottom_menu', 'leader'],
   },
   show: {
     parameters: {
@@ -21,6 +21,7 @@ module.exports = {
       query: {
         'meta.createdAt@start': 'meta.createdAt@start',
         'meta.createdAt@end': 'meta.createdAt@end',
+        shop: 'shop',
       },
       // options: {
       //   "meta.state": 0 // 默认条件

+ 3 - 2
app/controller/system/config/.goodsTags.js

@@ -1,6 +1,6 @@
 module.exports = {
   create: {
-    requestBody: ['tags_file', 'label', 'code', 'sort', 'pid', 'level', 'file', 'status'],
+    requestBody: ['tags_file', 'shop', 'label', 'code', 'sort', 'pid', 'level', 'file', 'status'],
   },
   destroy: {
     params: ['!id'],
@@ -8,7 +8,7 @@ module.exports = {
   },
   update: {
     params: ['!id'],
-    requestBody: ['tags_file', 'label', 'code', 'sort', 'pid', 'level', 'file', 'status'],
+    requestBody: ['tags_file', 'shop', 'label', 'code', 'sort', 'pid', 'level', 'file', 'status'],
   },
   show: {
     parameters: {
@@ -21,6 +21,7 @@ module.exports = {
       query: {
         'meta.createdAt@start': 'meta.createdAt@start',
         'meta.createdAt@end': 'meta.createdAt@end',
+        shop: 'shop',
         label: 'label',
         code: 'code',
         pid: 'pid',

+ 3 - 2
app/controller/system/config/.indexModule.js

@@ -1,6 +1,6 @@
 module.exports = {
   create: {
-    requestBody: ['name', 'to_type', 'to', 'status', 'url', 'sort'],
+    requestBody: ['shop', 'name', 'to_type', 'to', 'status', 'url', 'sort'],
   },
   destroy: {
     params: ['!id'],
@@ -8,7 +8,7 @@ module.exports = {
   },
   update: {
     params: ['!id'],
-    requestBody: ['name', 'to_type', 'to', 'status', 'url', 'sort'],
+    requestBody: ['shop', 'name', 'to_type', 'to', 'status', 'url', 'sort'],
   },
   show: {
     parameters: {
@@ -22,6 +22,7 @@ module.exports = {
         'meta.createdAt@start': 'meta.createdAt@start',
         'meta.createdAt@end': 'meta.createdAt@end',
         name: 'name',
+        shop: 'shop',
       },
       // options: {
       //   "meta.state": 0 // 默认条件

+ 3 - 2
app/controller/system/config/.serviceContact.js

@@ -1,6 +1,6 @@
 module.exports = {
   create: {
-    requestBody: ['phone', 'wx', 'qq', 'email'],
+    requestBody: ['shop', 'phone', 'wx', 'qq', 'email'],
   },
   destroy: {
     params: ['!id'],
@@ -8,7 +8,7 @@ module.exports = {
   },
   update: {
     params: ['!id'],
-    requestBody: ['phone', 'wx', 'qq', 'email'],
+    requestBody: ['shop', 'phone', 'wx', 'qq', 'email'],
   },
   show: {
     parameters: {
@@ -21,6 +21,7 @@ module.exports = {
       query: {
         'meta.createdAt@start': 'meta.createdAt@start',
         'meta.createdAt@end': 'meta.createdAt@end',
+        shop: 'shop',
       },
       // options: {
       //   "meta.state": 0 // 默认条件

+ 2 - 0
app/model/system/banner.js

@@ -4,6 +4,7 @@ const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
 
 // 首屏滚动广告
 const banner = {
+  shop: { type: String, required: false, zh: '店铺id' }, //
   name: { type: String, required: false, zh: '名称' }, //
   url: { type: Array, required: false, zh: '路径' }, //
   type: { type: String, required: false, zh: '类型' }, // 字典表:banner_type
@@ -16,6 +17,7 @@ const schema = new Schema(banner, { toJSON: { getters: true, virtuals: true } })
 schema.index({ id: 1 });
 schema.index({ 'meta.createdAt': 1 });
 schema.index({ name: 1 });
+schema.index({ shop: 1 });
 schema.index({ type: 1 });
 schema.index({ status: 1 });
 schema.index({ sort: 1 });

+ 4 - 3
app/model/system/config.js

@@ -15,20 +15,21 @@ const bottom_menu = {
 // 系统设置
 const config = {
   title: { type: String, required: false, zh: '系统名称' }, //
+  shop: { type: String, required: false, zh: '店铺id' }, //
   config: { type: Object, required: false, zh: '设置' }, //
   agree: { type: String, required: false, zh: '用户协议' }, // 富文本
   bottom_title: { type: String, required: false, zh: '底部加载数据结束的文字提示' }, //
   bottom_menu: { type: Object, zh: '底部菜单' },
   reward_day: { type: Number, zh: '提现日期', default: 14 },
-  leader: { type: Object, required: false  , zh: '团长规则' }, // explain,rule 
+  leader: { type: Object, required: false, zh: '团长规则' }, // explain,rule
 };
 const schema = new Schema(config, { toJSON: { getters: true, virtuals: true } });
 schema.index({ id: 1 });
 schema.index({ 'meta.createdAt': 1 });
-
+schema.index({ shop: 1 });
 schema.plugin(metaPlugin);
 
-module.exports = app => {
+module.exports = (app) => {
   const { mongoose } = app;
   return mongoose.model('Config', schema, 'config');
 };

+ 2 - 0
app/model/system/goodsTags.js

@@ -4,6 +4,7 @@ const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
 
 // 商品标签
 const goodsTags = {
+  shop: { type: String, required: false, zh: '店铺id' }, //
   label: { type: String, required: false, zh: '显示名称' }, //
   code: { type: String, required: false, zh: '标签编码' }, //
   sort: { type: Number, default: 0, required: false, zh: '排序' }, //
@@ -16,6 +17,7 @@ const goodsTags = {
 const schema = new Schema(goodsTags, { toJSON: { getters: true, virtuals: true } });
 schema.index({ id: 1 });
 schema.index({ 'meta.createdAt': 1 });
+schema.index({ shop: 1 });
 schema.index({ label: 1 });
 schema.index({ code: 1 });
 schema.index({ sort: 1 });

+ 2 - 1
app/model/system/indexModule.js

@@ -4,6 +4,7 @@ const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
 
 // 首页模块管理
 const indexModule = {
+  shop: { type: String, required: false, zh: '店铺id' }, //
   name: { type: String, required: false, zh: '模块名称' }, //
   to_type: { type: String, required: false, zh: '跳转类型' }, // 字典:to_type
   to: { type: String, required: false, zh: '跳转至' }, //
@@ -14,8 +15,8 @@ const indexModule = {
 const schema = new Schema(indexModule, { toJSON: { getters: true, virtuals: true } });
 schema.index({ id: 1 });
 schema.index({ 'meta.createdAt': 1 });
+schema.index({ shop: 1 });
 schema.index({ name: 1 });
-
 schema.plugin(metaPlugin);
 
 module.exports = app => {

+ 2 - 1
app/model/system/serviceContact.js

@@ -4,6 +4,7 @@ const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
 
 // 联系客服
 const serviceContact = {
+  shop: { type: String, required: false, zh: '店铺id' }, //
   phone: { type: String, required: false, zh: '联系电话' }, //
   wx: { type: String, required: false, zh: '微信' }, //
   qq: { type: String, required: false, zh: 'QQ' }, //
@@ -12,7 +13,7 @@ const serviceContact = {
 const schema = new Schema(serviceContact, { toJSON: { getters: true, virtuals: true } });
 schema.index({ id: 1 });
 schema.index({ 'meta.createdAt': 1 });
-
+schema.index({ shop: 1 });
 schema.plugin(metaPlugin);
 
 module.exports = app => {

+ 3 - 3
app/service/system/config.js

@@ -10,9 +10,9 @@ class ConfigService extends CrudService {
     super(ctx, 'config');
     this.model = this.ctx.model.System.Config;
   }
-  async query() {
-    const data = await this.model.findOne({});
-    return data;
+  async query(shop) {
+    const data = await this.model.findOne(shop);
+    return data || {};
   }
 }
 

+ 1 - 1
app/z_router/system/config.js

@@ -9,7 +9,7 @@ const keyZh = '系统设置';
 const routes = [
   { method: 'get', path: `${rkey}`, controller: `${ckey}.index`, name: `${ckey}Query`, zh: `${keyZh}列表查询` },
   // { method: 'get', path: `${rkey}/:id`, controller: `${ckey}.show`, name: `${ckey}Show`, zh: `${keyZh}查询` },
-  // { method: 'post', path: `${rkey}`, controller: `${ckey}.create`, name: `${ckey}Create`, zh: `创建${keyZh}` },
+  { method: 'post', path: `${rkey}`, controller: `${ckey}.create`, name: `${ckey}Create`, zh: `创建${keyZh}` },
   { method: 'post', path: `${rkey}/:id`, controller: `${ckey}.update`, name: `${ckey}Update`, zh: `修改${keyZh}` },
   // { method: 'delete', path: `${rkey}/:id`, controller: `${ckey}.destroy`, name: `${ckey}Delete`, zh: `删除${keyZh}` },
 ];