Commit ce92b964 by cwq0219

修改

1 parent 9c0735f3
/*
* @Author: chenwq
* @Date: 2020-06-12 14:30:26
* @Last Modified by: chenwq
* @Last Modified time: 2020-06-12 17:17:26
*/
"use strict";
const Controller = require("egg").Controller;
/**
* @Controller biz/merchant
* @Description 商户信息
*/
class merchantController extends Controller {
constructor(ctx) {
super(ctx);
this.validate = ctx.app.validate.validate;
this.request = ctx.request;
this.helper = ctx.helper;
this.redis = ctx.app.redis;
this.merchantService = ctx.service.biz.merchant;
// this.CacheService = ctx.service.cache; //redis 缓存服务
this.ServerResponseCode = ctx.response.ServerResponseCode;
this.ServerResponse = ctx.response.ServerResponse;
}
/**
* @summary 查询所有商户信息
* @Router POST /biz/merchant/findAll
* @Description 查询所有商户信息
* @Request pager
* @Request searcher
* @Response 200 response ok
*/
async findAll({ request: { body: { pager, searcher } } }) { //get : async findAll( {query: { pager, searcher } })
const result = await this.merchantService.findAll({ pager, searcher });
this.ctx.body = this.ServerResponse.Success(result);
}
}
module.exports = merchantController;
\ No newline at end of file
/* indent size: 2 */
module.exports = app => {
const DataTypes = app.Sequelize;
const Model = app.model.define('dj_system_merchant', {
id: {
type: DataTypes.INTEGER(11),
allowNull: false,
primaryKey: true,
autoIncrement: true
},
merchant_id: {
type: DataTypes.INTEGER(11),
allowNull: false,
unique: true
},
account_name: {
type: DataTypes.STRING(20),
allowNull: false
},
merchant_name: {
type: DataTypes.STRING(100),
allowNull: false
},
short_name: {
type: DataTypes.STRING(100),
allowNull: true
},
user_type: {
type: DataTypes.INTEGER(2),
allowNull: false
},
merchant_type: {
type: DataTypes.INTEGER(2),
allowNull: true
},
contact_name: {
type: DataTypes.STRING(20),
allowNull: true
},
phone: {
type: DataTypes.STRING(15),
allowNull: true
},
channel_id: {
type: DataTypes.INTEGER(11),
allowNull: true
},
address: {
type: DataTypes.STRING(100),
allowNull: true
},
province_id: {
type: DataTypes.INTEGER(11),
allowNull: true
},
province_name: {
type: DataTypes.STRING(20),
allowNull: true
},
city_id: {
type: DataTypes.INTEGER(11),
allowNull: true
},
city_name: {
type: DataTypes.STRING(20),
allowNull: true
},
area_id: {
type: DataTypes.INTEGER(11),
allowNull: true
},
area_name: {
type: DataTypes.STRING(20),
allowNull: true
},
lng: {
type: "DOUBLE",
allowNull: true
},
lat: {
type: "DOUBLE",
allowNull: true
},
shop_photo: {
type: DataTypes.STRING(200),
allowNull: true
},
business_hours: {
type: DataTypes.STRING(20),
allowNull: true
},
parent_merchant_id: {
type: DataTypes.INTEGER(11),
allowNull: true
},
parent_merchant_name: {
type: DataTypes.STRING(100),
allowNull: true
},
svr_merchant_id: {
type: DataTypes.INTEGER(11),
allowNull: true
},
created_by: {
type: DataTypes.STRING(64),
allowNull: false
},
created_date: {
type: DataTypes.DATE,
allowNull: false
},
updated_by: {
type: DataTypes.STRING(64),
allowNull: false
},
updated_date: {
type: DataTypes.DATE,
allowNull: false
},
deleted_flag: {
type: DataTypes.CHAR(1),
allowNull: false
}
}, {
tableName: 'dj_system_merchant'
});
Model.associate = function() {
}
return Model;
};
/* indent size: 2 */
module.exports = app => {
const DataTypes = app.Sequelize;
const Model = app.model.define('glsx_basic_clues', {
id: {
type: DataTypes.INTEGER(11),
allowNull: false,
primaryKey: true,
autoIncrement: true
},
sn: {
type: DataTypes.STRING(32),
allowNull: true
},
stand_no: {
type: DataTypes.STRING(64),
allowNull: true
},
name: {
type: DataTypes.STRING(64),
allowNull: true
},
mobile: {
type: DataTypes.STRING(16),
allowNull: true
},
biz_type: {
type: DataTypes.INTEGER(1),
allowNull: true
},
clue_time: {
type: DataTypes.DATE,
allowNull: true
},
arrshop_time: {
type: DataTypes.DATE,
allowNull: true
},
price: {
type: DataTypes.FLOAT,
allowNull: true
},
merchant_id: {
type: DataTypes.INTEGER(11),
allowNull: false
},
merchant_name: {
type: DataTypes.STRING(64),
allowNull: true
},
create_time: {
type: DataTypes.DATE,
allowNull: true
},
update_time: {
type: DataTypes.DATE,
allowNull: true
}
}, {
tableName: 'glsx_basic_clues'
});
Model.associate = function() {
}
return Model;
};
/* indent size: 2 */
module.exports = app => {
const DataTypes = app.Sequelize;
const Model = app.model.define('glsx_basic_devices', {
id: {
type: DataTypes.INTEGER(11),
allowNull: false,
primaryKey: true,
autoIncrement: true
},
sn: {
type: DataTypes.STRING(32),
allowNull: true
},
sim_phone: {
type: DataTypes.STRING(32),
allowNull: true
},
biz_type: {
type: DataTypes.INTEGER(4),
allowNull: true
},
device_type: {
type: DataTypes.INTEGER(6),
allowNull: true
},
in_storage_time: {
type: DataTypes.DATE,
allowNull: true
},
out_storage_time: {
type: DataTypes.DATE,
allowNull: true
},
shop_merchant_id: {
type: DataTypes.INTEGER(11),
allowNull: true
},
active_time: {
type: DataTypes.DATE,
allowNull: true
},
active_lng: {
type: "DOUBLE(10,6)",
allowNull: true
},
active_lat: {
type: "DOUBLE(10,6)",
allowNull: true
},
active_provcode: {
type: DataTypes.INTEGER(6),
allowNull: true
},
active_province: {
type: DataTypes.STRING(64),
allowNull: true
},
active_citycode: {
type: DataTypes.INTEGER(6),
allowNull: true
},
active_city: {
type: DataTypes.STRING(64),
allowNull: true
},
latest_gpstime: {
type: DataTypes.DATE,
allowNull: true
},
latest_cityname: {
type: DataTypes.STRING(64),
allowNull: true
},
latest_citycode: {
type: DataTypes.INTEGER(6),
allowNull: true
},
latest_provname: {
type: DataTypes.STRING(32),
allowNull: true
},
latest_provcode: {
type: DataTypes.INTEGER(6),
allowNull: true
},
user_phone: {
type: DataTypes.STRING(32),
allowNull: true
},
user_standno: {
type: DataTypes.STRING(32),
allowNull: true
},
drive_days: {
type: DataTypes.INTEGER(11),
allowNull: true
},
avr_day_miles: {
type: "DOUBLE(12,2)",
allowNull: true
},
pk_begin_time: {
type: DataTypes.DATE,
allowNull: true
},
pk_end_time: {
type: DataTypes.DATE,
allowNull: true
},
datafrom: {
type: DataTypes.STRING(32),
allowNull: true
},
create_time: {
type: DataTypes.DATE,
allowNull: true
},
update_time: {
type: DataTypes.DATE,
allowNull: true
}
}, {
tableName: 'glsx_basic_devices'
});
Model.associate = function() {
}
return Model;
};
/* indent size: 2 */
module.exports = app => {
const DataTypes = app.Sequelize;
const Model = app.model.define('glsx_biz_delivery', {
id: {
type: DataTypes.INTEGER(11),
allowNull: false,
primaryKey: true,
autoIncrement: true
},
month: {
type: DataTypes.STRING(32),
allowNull: false
},
shop_merchant_id: {
type: DataTypes.INTEGER(11),
allowNull: false
},
merchant_id: {
type: DataTypes.INTEGER(11),
allowNull: false
},
biz_type: {
type: DataTypes.INTEGER(4),
allowNull: true
},
device_type: {
type: DataTypes.INTEGER(6),
allowNull: true
},
delivery_total: {
type: DataTypes.INTEGER(11),
allowNull: true,
defaultValue: '0'
},
active_total: {
type: DataTypes.INTEGER(11),
allowNull: true,
defaultValue: '0'
}
}, {
tableName: 'glsx_biz_delivery'
});
Model.associate = function() {
}
return Model;
};
/* indent size: 2 */
module.exports = app => {
const DataTypes = app.Sequelize;
const Model = app.model.define('glsx_biz_opportunity', {
id: {
type: DataTypes.INTEGER(11),
allowNull: false,
primaryKey: true,
autoIncrement: true
},
month: {
type: DataTypes.STRING(32),
allowNull: false
},
merchant_id: {
type: DataTypes.INTEGER(11),
allowNull: false
},
total_gmv: {
type: "DOUBLE(12,2)",
allowNull: true,
defaultValue: '0.00'
},
maintain_crues: {
type: DataTypes.INTEGER(11),
allowNull: true,
defaultValue: '0'
},
maintain_arr: {
type: DataTypes.INTEGER(11),
allowNull: true,
defaultValue: '0'
},
maintain_gmv: {
type: "DOUBLE(12,2)",
allowNull: true,
defaultValue: '0.00'
},
loss_crues: {
type: DataTypes.INTEGER(11),
allowNull: true,
defaultValue: '0'
},
loss_arr: {
type: DataTypes.INTEGER(11),
allowNull: true,
defaultValue: '0'
},
loss_gmv: {
type: "DOUBLE(12,2)",
allowNull: true,
defaultValue: '0.00'
},
collision_crues: {
type: DataTypes.INTEGER(11),
allowNull: true,
defaultValue: '0'
},
collision_arr: {
type: DataTypes.INTEGER(11),
allowNull: true,
defaultValue: '0'
},
collision_gmv: {
type: "DOUBLE(12,2)",
allowNull: true,
defaultValue: '0.00'
}
}, {
tableName: 'glsx_biz_opportunity'
});
Model.associate = function() {
}
return Model;
};
/*
* @Author: limin
* @Date: 2019-11-21 11:19:15
* @Last Modified by: limin
* @Last Modified time: 2020-04-15 10:11:40
* @Last Modified by: chenwq
* @Last Modified time: 2020-06-15 10:07:44
*/
module.exports = (app) => {
......@@ -10,4 +10,5 @@ module.exports = (app) => {
app.router.get("/biz/maintain/findAll", app.controller.biz.maintain.findAll);
app.router.get("/biz/shop/findAll", app.controller.biz.shop.findAll);
app.router.get("/biz/record/findAll", app.controller.biz.record.findAll);
app.router.get("/biz/merchant/findAll", app.controller.biz.merchant.findAll);
};
/*
* @Author: chenwq
* @Date: 2020-06-12 15:19:31
* @Last Modified by: chenwq
* @Last Modified time: 2020-06-12 18:03:58
*/
const Service = require("egg").Service;
class MerchantService extends Service {
constructor(ctx) {
super(ctx);
this.helper = ctx.helper;
this._reg_models_alias_();
}
/**
* 绑定model 在 this 上的 别名
*/
_reg_models_alias_() {
const {
DjSystemMerchant
} = this.app.model.Biz;
this.MDSM = DjSystemMerchant;
}
/**
* 绑定表关系
*/
_associate_() {}
/**
* @param field {String}
* @param value {String}
* @return {Promise.<boolean>}
* @Description 查询所有
*/
async findAll({
pager = {},
searcher = {}
}) {
const {
current = 1, size = 10
} = pager
const {
merchantId,
merchantName,
channel,
provinceId,
distributor
} = searcher;
const offset = (current - 1) * size;
const {
Op,
col,
literal
} = this.app.Sequelize;
let where = {
// is_new: 1
};
return await this.MDSM.findAndCountAll({
offset,
limit: +size,
where,
raw: true,
});
}
}
module.exports = MerchantService;
/*
* @Author: limin
* @Date: 2019-11-16 09:26:53
* @Last Modified by: limin
* @Last Modified time: 2020-04-16 18:49:17
* @Last Modified by: chenwq
* @Last Modified time: 2020-06-12 15:08:29
*/
/* eslint valid-jsdoc: "off" */
......@@ -69,7 +69,7 @@ module.exports = app => {
secret: "glsx-insurence-egg-server" //自定义 token 的加密条件字符串
};
config.cors = {
origin: "http://192.168.2.222:8085",
// origin: "http://192.168.2.222:8085",
credentials: true,
allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH'
};
......@@ -78,7 +78,8 @@ module.exports = app => {
enable: false,
ignoreJSON: true
},
domainWhiteList: ["http://192.168.2.222:8085"] //允许访问接口的白名单
// domainWhiteList: ["http://192.168.2.222:8085"] //允许访问接口的白名单
domainWhiteList: ["http://localhost:8085", "http://192.168.2.201:8085"] //允许访问接口的白名单
};
config.redis = {
client: {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!