Commit 7ae8a6c6 authored by hujun's avatar hujun

房东手机号拆分

parent 637bf014
......@@ -577,18 +577,14 @@ class Shop extends Basic
* 新增和编辑商铺
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function edit()
{
$result['code'] = 200;
$result['msg'] = '';
$result_data = [];
$house = new HouseService();
if ($this->request->isPost()) {
$house = new HouseService();
$data = $house->addHouse($this->params, $this->agentId, 1);
if ($data['status'] == 'successful') {
......@@ -605,7 +601,13 @@ class Shop extends Basic
$result['msg'] = 'Id is null';
} else {
//获取商铺详情
$result_data = $this->gHousesModel->getHouseById($this->params['id'], 1);
$data = $house->getHouseById($this->params['id'], 1);
if ($data['status'] == 'successful') {
$result_data = $data;
} else {
$result['msg'] = $data['msg'];
$result['code'] = 101;
}
}
}
......
......@@ -40,79 +40,6 @@ class Houses extends Basic
$this->house = new GHouses();
}
/**
* 新增和编辑商铺
*
* @return \think\Response|\think\response\View
* @throws \Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function edit()
{
$result['code'] = 200;
$result['msg'] = '';
if ($this->request->isPost()) {
$validate = new HouseValidate();
$check = $validate->check($this->params);
if(true !== $check){
return $this->response(101,$validate->getError());
}
$house_id = $this->house->add($this->params, $this->userId); //添加或编辑商铺
if (!empty($this->params['sublet_id']) && $this->params['source'] == 'transfer_list') {
$m_sublet = new SubletModel();
$sublet_data['house_id'] = $house_id['house_id'];
$sublet_data['status'] = 2;
$sublet_data['agents_id'] = $this->userId;
$m_sublet->editData($sublet_data, $this->params['sublet_id']);
}
if ($house_id['house_id']) {
$return = $this->response($result['code'], $result['msg'], [ 'id', $house_id['house_id'] ]);
// if (isset($house_id['status']) && $house_id['status'] == 2) {
// $push_service = new PushMessageService();
// $push_service->pushHouseDownMessage($house_id['house_id']);
// }
} else {
$return = $this->response(101, 'add houses is error');
}
//编辑商铺
} elseif ($this->params['id']) {
if ($this->request->isAjax()) {
//获取商铺详情
$house = new GHouses();
$result['data'] = $house->getHouseById($this->params['id'], 0);
$return = $this->response($result['code'], $result['msg'], $result['data']);
} else {
//商铺添加页面
$return = view('edit');
}
//转铺页面跳转过来的
} elseif (isset($this->params['source']) && $this->params['source'] == 'transfer_list') {
if ($this->request->isAjax()) {
$sublet = new SubletModel();
$result['data'] = $sublet->getSubletHouse($this->params['sublet_id']);
$return = $this->response($result['code'], $result['msg'], $result['data']);
} else {
//商铺添加页面
$return = view('edit');
}
} else {
//商铺添加页面
$return = view('edit');
}
return $return;
}
/**
* 新增和编辑商铺
*
......@@ -123,9 +50,10 @@ class Houses extends Basic
{
$result['code'] = 200;
$result['msg'] = $return = '';
$result['data'] = [];
$house = new HouseService();
if ($this->request->isPost()) {
$house = new HouseService();
$house_data = $house->addHouse($this->params, $this->userId);
if ($house_data['status'] == 'successful') {
......@@ -147,8 +75,12 @@ class Houses extends Basic
if ($this->request->isAjax()) {
//获取商铺详情
try {
$house = new GHouses();
$result['data'] = $house->getHouseById($this->params['id'], 0);
$list = $house->getHouseById($this->params['id'], 0);
if ($list['status'] == 'successful') {
$result['data'] = $list['data'];
} else {
$result['msg'] = $list['msg'];
}
} catch (\Exception $e) {
$result['data'] = [];
$result['code'] = 101;
......@@ -760,8 +692,7 @@ class Houses extends Basic
return $this->response(101, '参数错误');
}
$house = new GHouses();
$num = $house->editData(['is_lock'=>$this->params['is_lock']], $this->params['house_id']);
$num = $this->house->editData(['is_lock'=>$this->params['is_lock']], $this->params['house_id']);
if ($num > 0) {
return $this->response(200,'');
......@@ -808,8 +739,7 @@ class Houses extends Basic
}
try {
$house = new GHouses();
$house_data = $house->getHouseDetail('id,is_show', ['id'=>$this->params['id']]);
$house_data = $this->house->getHouseDetail('id,is_show', ['id'=>$this->params['id']]);
if (empty($house_data['id'])) {
$code = 101;
......@@ -843,15 +773,14 @@ class Houses extends Basic
}
try {
$house = new GHouses();
$house_data = $house->getHouseDetail('id,is_vip', ['id'=>$this->params['id']]);
$house_data = $this->house->getHouseDetail('id,is_vip', ['id'=>$this->params['id']]);
if (empty($house_data['id'])) {
$code = 101;
$msg = '没有该商铺';
} else {
if ($house_data['is_vip'] != $this->params['vip']) {
$house->editData(['is_vip'=> $this->params['vip']], $this->params['id']);
$this->house->editData(['is_vip'=> $this->params['vip']], $this->params['id']);
}
}
} catch (\Exception $e) {
......
......@@ -124,7 +124,7 @@ class WatchShop extends Basic
$appoint_data = $appoint_watch->getAppointInfo($fields, $where);
if (empty($appoint_data['id'])) {
return $this->response(101, '没有预约铺经纪人信息');
return $this->response(101, '没有预约铺经纪人信息');
}
$agent = new AAgents();
......
This diff is collapsed.
......@@ -58,4 +58,19 @@ class ACase extends BaseModel
$id_str = rtrim($id_str,',');
return $id_str;
}
/**
* @param $field
* @param $where
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getListAll($field, $where)
{
return $this->field($field)
->where($where)
->select();
}
}
\ No newline at end of file
......@@ -41,4 +41,13 @@ class GBusinessDistrict extends BaseModel
return $this->query($sql);
}
/**
* @param $where
* @param $field
* @return mixed
*/
public function getValue($where, $field) {
return $this->where($where)->value($field);
}
}
......@@ -33,15 +33,15 @@ class GHouses extends BaseModel
if ($select_data) {
$data = $select_data->getData();
$data['landlord_phone_array'] = json_decode($data['landlord_phone'], true);
// $data['landlord_phone_array'] = json_decode($data['landlord_phone'], true);
$landlord_phone = '';
// $landlord_phone = '';
foreach ($data['landlord_phone_array'] as $kk => $vv) {
$landlord_phone[] = $vv['phone'];
}
// foreach ($data['landlord_phone_array'] as $kk => $vv) {
// $landlord_phone[] = $vv['phone'];
// }
$data['landlord_phone'] = implode(',', $landlord_phone);
// $data['landlord_phone'] = implode(',', $landlord_phone);
$data['landmark'] = empty($data['landmark']) ? $data['internal_address'] : $data['landmark'];
/*案场,盘方,独家 start*/
......@@ -1623,4 +1623,20 @@ class GHouses extends BaseModel
return $this->where($where)
->value($field);
}
/**
* @param $field
* @param $where_
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getHouseExtInfo($field, $where_) {
return $this->field($field)
->alias("a")
->join("g_houses_ext b", "a.id = b.house_id", "left")
->where($where_)
->find();
}
}
......@@ -120,43 +120,43 @@ class GHousesExt extends BaseModel
}
//房东手机号
if (!empty($data['landlord_phone'])) {
$landlord_phone = [];
if ($is_app == 1) {
$landlord_phone_arr = json_decode($data['landlord_phone'], true);
if (is_array($landlord_phone_arr)) {
foreach ($landlord_phone_arr as $k => $v) {
if (!empty($v['phone'])) {
$landlord_phone[$k]['name'] = empty($v['name']) ? '房东' : $v['name'];
$landlord_phone[$k]['phone'] = $v['phone'];
}
}
}
} else {
if (is_array($data['landlord_phone'])) {
foreach ($data['landlord_phone'] as $k => $v) {
if (!empty($v['phone'])) {
$landlord_phone[$k]['name'] = empty($v['name']) ? '房东' : $v['name'];
$landlord_phone[$k]['phone'] = $v['phone'];
}
}
} else {
//兼容之前逗号隔开的手机号
$params['landlord_phone'] = explode(',', $data['landlord_phone']);
foreach ($params['landlord_phone'] as $key => $val) {
$landlord_phone[$key]['name'] = '房东';
$landlord_phone[$key]['phone'] = trim($val);
}
}
}
if (isset($landlord_phone[0]['phone'])) {
$save_data['landlord_phone'] = json_encode($landlord_phone);
}
}
// if (!empty($data['landlord_phone'])) {
// $landlord_phone = [];
//
// if ($is_app == 1) {
// $landlord_phone_arr = json_decode($data['landlord_phone'], true);
//
// if (is_array($landlord_phone_arr)) {
// foreach ($landlord_phone_arr as $k => $v) {
// if (!empty($v['phone'])) {
// $landlord_phone[$k]['name'] = empty($v['name']) ? '房东' : $v['name'];
// $landlord_phone[$k]['phone'] = $v['phone'];
// }
// }
// }
// } else {
// if (is_array($data['landlord_phone'])) {
// foreach ($data['landlord_phone'] as $k => $v) {
// if (!empty($v['phone'])) {
// $landlord_phone[$k]['name'] = empty($v['name']) ? '房东' : $v['name'];
// $landlord_phone[$k]['phone'] = $v['phone'];
// }
// }
// } else {
// //兼容之前逗号隔开的手机号
// $params['landlord_phone'] = explode(',', $data['landlord_phone']);
//
// foreach ($params['landlord_phone'] as $key => $val) {
// $landlord_phone[$key]['name'] = '房东';
// $landlord_phone[$key]['phone'] = trim($val);
// }
// }
// }
//
// if (isset($landlord_phone[0]['phone'])) {
// $save_data['landlord_phone'] = json_encode($landlord_phone);
// }
// }
//房东备注
if (isset($data['landlord_remark'])) {
......
......@@ -292,4 +292,19 @@ class GHousesImgs extends BaseModel
$this->add($params, $house_id);
return $this->saveAll($house_img_edit);
}
/**
* @param $field
* @param $where
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getListAll($field, $where)
{
return $this->field($field)
->where($where)
->select();
}
}
\ No newline at end of file
......@@ -9,8 +9,75 @@
namespace app\model;
use think\Db;
class GLandlordPhone extends BaseModel
{
protected $table = 'g_landlord_phone';
private $db_;
public function __construct($data = [])
{
parent::__construct($data);
$this->db_ = Db::name($this->table);
}
/**
* @param $field
* @param $where
* @return array|false|\PDOStatement|string|\think\Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getInfo($field, $where) {
return $this->db_->field($field)
->where($where)
->find();
}
/**
* @param $field
* @param $where
* @return array|false|\PDOStatement|string|\think\Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAllList($field, $where) {
return $this->db_->field($field)
->where($where)
->select();
}
/**
* @param $field
* @param $where
* @return array
*/
public function getColumn($field, $where) {
return $this->db_->where($where)
->column($field);
}
/**
* @param $data
* @return int|string
*/
public function insertData($data) {
return $this->db_->insertAll($data);
}
/**
* @param $data
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function updateData($data) {
foreach ($data as $v) {
$this->db_->update($v);
}
return ;
}
}
\ No newline at end of file
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