Commit 087281d1 authored by 李尚科's avatar 李尚科

house 2.1 fix

parent 3250a3ff
Pipeline #10984 passed with stage
in 18 seconds
......@@ -148,6 +148,7 @@ class ToolController extends Controller {
const gps_info = await ctx.helper.getGPS(address, city);
if (gps_info.lng && gps_info.lat) {
result = {
house_id,
name: new_house_name,
longitude: gps_info.lng,
latitude: gps_info.lat,
......
......@@ -64,7 +64,7 @@ class ResponseController extends Controller {
delete (node_user_center_login_ret.device_login_logs_id);
}
if (!phone || !channel_id || !app_id || !node_user_center_login_ret.token) {//没有手机号 或渠道错误 或直接注册新用户中心失败时 使用设备登录
if (!phone || !channel_id || !app_id || !node_user_center_login_ret.token) {// 或渠道错误 或直接注册新用户中心失败时 使用设备登录
const user_agent = header.user_agent ? header.user_agent : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36';
const ip = ctx.helper.getClientIP();
const device_no = ctx.helper.md5(user_agent + ip);
......@@ -101,7 +101,7 @@ class ResponseController extends Controller {
const value = node_user_center_login_ret[key];
const exist_value = ctx.cookies.get(key, { signed: false });
if(!exist_value){
ctx.cookies.set(key, value, { httpOnly: false, signed: false, maxAge: expire, expires: date, path: '/' });
ctx.cookies.set(key, value, { httpOnly: false, signed: false, path: '/', overwrite: true });
}
}
......
......@@ -201,7 +201,7 @@ module.exports = () => {
const value = user_login_info[key];
const exist_value = ctx.cookies.get(key, { signed: false });
if (!exist_value) {
ctx.cookies.set(key, value, { httpOnly: false, signed: false, maxAge: expire, expires: date, path: '/' });
ctx.cookies.set(key, value, { httpOnly: false, signed: false, path: '/', overwrite: true });
}
}
return user_login_info;
......
......@@ -48,10 +48,18 @@ module.exports = app => {
type: INTEGER,
allowNull: true
},
surplus_amount: {
type: INTEGER,
allowNull: true
},
address: {
type: STRING,
allowNull: true
},
gps: {
type: STRING,
allowNull: true
},
price: {
type: DECIMAL,
allowNull: true
......@@ -205,7 +213,8 @@ module.exports = app => {
const where = data.where;
const params = data.params;
try {
return res = await RentalHouse.update(params, { where: where })
const res = await RentalHouse.update(params, { where: where })
return res;
} catch (error) {
throw (error);
}
......
......@@ -63,7 +63,7 @@ class RentalHouseService extends Service {
const rental_houses_results = await ctx.realestateModel.RentalHouse.list({ page: page, limit: Number(limit), where: where, order: [['order_id', 'desc'], ['id', 'desc']] });
let rental_houses = await this.formatRentalHouseBasic(rental_houses_results.rows);
rental_houses = R.project(['id', 'image', 'name', 'address', 'price', 'tags', 'favourable_info'])(rental_houses);
rental_houses = R.project(['id', 'image', 'name', 'address', 'price', 'surplus_amount', 'tags', 'favourable_info'])(rental_houses);
return { page: page, count: rental_houses_results.count, results: rental_houses };
......@@ -100,11 +100,24 @@ class RentalHouseService extends Service {
//添加用户足迹
ctx.service.house.v2.footPrint.addFootPrint({ type: 2, id: rental_house_id });
const city_codes = [rental_house_info.province, rental_house_info.city, rental_house_info.area];
const cities = await ctx.blockModel.City.all({ where: { code: { $in: city_codes } } });
const city = (cities && cities[1] && cities[1].name) ? cities[1].name : '';
const address = R.pluck('name', cities).join('') + rental_house_info.address;
const gps_info = await ctx.helper.getGPS(address, city);
let gps_info = {};
if (!rental_house_info.gps) {
const city_codes = [rental_house_info.province, rental_house_info.city, rental_house_info.area];
const cities = await ctx.blockModel.City.all({ where: { code: { $in: city_codes } } });
const city = (cities && cities[1] && cities[1].name) ? cities[1].name : '';
const address = R.pluck('name', cities).join('') + rental_house_info.address;
console.info(address);
gps_info = await ctx.helper.getGPS(address, city);
ctx.realestateModel.RentalHouse.edit({ where: { id: rental_house_id }, params: { gps: `${gps_info.lat},${gps_info.lng}` } });
} else {
const gps_str = ctx.helper.checkGps(rental_house_info.gps);
const gps_array = gps_str.split(',');
gps_info = {
lng: gps_array[1],
lat: gps_array[0],
}
}
house_basic.longitude = gps_info.lng;
house_basic.latitude = gps_info.lat;
......@@ -169,11 +182,13 @@ class RentalHouseService extends Service {
image: rental_house.image,//列表展示图片
// residential_id: rental_house.residentialId,//小区id
address: rental_house.address,//详细地址
gps: rental_house.gps,//项目地址经纬度
price: rental_house.price,//价格
discount: rental_house.discount,//折扣
// business_license: rental_house.businessLicense,
tags: rental_house.tags,//房源特点
rental_type: rental_house.rental_type,//租房类型 1整租 2合租 3独栋公寓
surplus_amount: rental_house.surplus_amount,//剩余数量 目前如果为0则展示 "满租",其他情况不展示
favourable_info: rental_house.favourable_info,//优惠信息
introduce: rental_house.description || `该社区亮点:
1、房源介绍:精装公寓,家电齐全,独立卫生间,南通北透,独门独户。
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment