Commit eb13b8dd authored by hujun's avatar hujun

异常捕获

parent 4fac74d6
...@@ -17,7 +17,7 @@ class VipService ...@@ -17,7 +17,7 @@ class VipService
/** /**
* 是否具有查看vip客户权限 * 是否具有查看vip客户权限
* *
* @param $id 经纪人ID * @param $id //经纪人ID
* @param string $name * @param string $name
* @return int 是否可以查看vip客户 0:可查看 1:不可查看 * @return int 是否可以查看vip客户 0:可查看 1:不可查看
*/ */
......
...@@ -24,17 +24,19 @@ use app\task\controller\ResultsSummaryNewTask; ...@@ -24,17 +24,19 @@ use app\task\controller\ResultsSummaryNewTask;
class HouseService class HouseService
{ {
protected $house; protected $m_house;
protected $agent; protected $agent;
protected $agent_house; protected $agent_house;
protected $push; protected $push;
protected $m_house_ext;
public function __construct() public function __construct()
{ {
$this->house = new GHouses(); $this->m_house = new GHouses();
$this->agent = new AAgents(); $this->agent = new AAgents();
$this->agent_house = new GHousesToAgents(); $this->agent_house = new GHousesToAgents();
$this->push = new PushMessageService(); $this->push = new PushMessageService();
$this->m_house_ext = new GHousesExt();
} }
/** /**
...@@ -44,7 +46,6 @@ class HouseService ...@@ -44,7 +46,6 @@ class HouseService
* @param int $agent_id * @param int $agent_id
* @param int $is_app * @param int $is_app
* @return array * @return array
* @throws \think\exception\PDOException
*/ */
public function addHouse(array $data, int $agent_id, $is_app = 0): array public function addHouse(array $data, int $agent_id, $is_app = 0): array
{ {
...@@ -69,8 +70,9 @@ class HouseService ...@@ -69,8 +70,9 @@ class HouseService
return $result; return $result;
} }
try {
if (!empty($data['id'])) { if (!empty($data['id'])) {
$house_data = $this->house->getHouseInfo('id,internal_address,internal_title', ['id'=>$data['id']]); $house_data = $this->m_house->getHouseInfo('id,internal_address,internal_title', ['id' => $data['id']]);
if (empty($house_data[0]['id'])) { if (empty($house_data[0]['id'])) {
$result['status'] = 'fail'; $result['status'] = 'fail';
$result['msg'] = '没有该商铺信息'; $result['msg'] = '没有该商铺信息';
...@@ -78,21 +80,20 @@ class HouseService ...@@ -78,21 +80,20 @@ class HouseService
} }
$m_operating = new GOperatingRecords(); $m_operating = new GOperatingRecords();
$remark = '修改为:剩余铺数'.$data['residue_num']; $remark = '修改为:剩余铺数' . $data['residue_num'];
if ($data['is_exclusive_type'] == 1) { if ($data['is_exclusive_type'] == 1) {
$remark .= ',独家有效期 '.$data['agent_start_time'].'—'.$data['agent_end_time']; $remark .= ',独家有效期 ' . $data['agent_start_time'] . '—' . $data['agent_end_time'];
} }
if ($data['internal_title'] != $house_data[0]['internal_title']) { if ($data['internal_title'] != $house_data[0]['internal_title']) {
$remark .= ',商铺名改为:'.$data['internal_title']; $remark .= ',商铺名改为:' . $data['internal_title'];
} }
if ($data['internal_address'] != $house_data[0]['internal_address']) { if ($data['internal_address'] != $house_data[0]['internal_address']) {
$remark .= ',地址改为:'.$data['internal_address']; $remark .= ',地址改为:' . $data['internal_address'];
} }
$house_ext = new GHousesExt();
$house_data_ext = $house_ext->getInfo('landlord_phone', ['house_id'=>$data['id']]); $house_data_ext = $this->m_house_ext->getInfo('landlord_phone', ['house_id' => $data['id']]);
if (!empty($house_data_ext['landlord_phone'])) { if (!empty($house_data_ext['landlord_phone'])) {
$landlord_phone_arr = $landlord_phone_new_arr = $landlord_phone_old = []; $landlord_phone_arr = $landlord_phone_new_arr = $landlord_phone_old = [];
...@@ -119,14 +120,14 @@ class HouseService ...@@ -119,14 +120,14 @@ class HouseService
} }
if (!empty($landlord_phone_old)) { if (!empty($landlord_phone_old)) {
$remark .= ',删除房东手机号:'. implode(',', $landlord_phone_old); $remark .= ',删除房东手机号:' . implode(',', $landlord_phone_old);
} }
} }
$m_operating->record($agent_id, 6, $remark, $data['id']); $m_operating->record($agent_id, 6, $remark, $data['id']);
} }
$house_id = $this->house->addHouse($data, $agent_id); $house_id = $this->m_house->addHouse($data, $agent_id);
if (empty($house_id)) { if (empty($house_id)) {
$result['status'] = 'fail'; $result['status'] = 'fail';
...@@ -134,11 +135,10 @@ class HouseService ...@@ -134,11 +135,10 @@ class HouseService
return $result; return $result;
} }
$houses_ext = new GHousesExt();
$house_img = new GHousesImgs(); $house_img = new GHousesImgs();
//商铺扩展字段 //商铺扩展字段
$houses_ext->addHouseExt($data, $house_id, $is_app); $this->m_house_ext->addHouseExt($data, $house_id, $is_app);
//商铺图片 //商铺图片
if ($is_app == 1) { if ($is_app == 1) {
...@@ -193,7 +193,7 @@ class HouseService ...@@ -193,7 +193,7 @@ class HouseService
if (!empty($data['id'])) { if (!empty($data['id'])) {
//剩余商铺为0下架 //剩余商铺为0下架
if (empty($data['residue_num']) || empty($data['total'])) { if (empty($data['residue_num']) || empty($data['total'])) {
$this->push->record(1, [ 0 => $house_id ], 0, $agent_id); //记录推送信息 $this->push->record(1, [0 => $house_id], 0, $agent_id); //记录推送信息
} }
} }
...@@ -201,6 +201,10 @@ class HouseService ...@@ -201,6 +201,10 @@ class HouseService
$result['data']['internal_title'] = $data['internal_title']; $result['data']['internal_title'] = $data['internal_title'];
$result['status'] = 'successful'; $result['status'] = 'successful';
$result['msg'] = '新增或编辑成功!'; $result['msg'] = '新增或编辑成功!';
} catch (\Exception $e) {
$result['status'] = 'fail';
$result['msg'] = '内部错误:' . $e->getMessage();
}
return $result; return $result;
} }
......
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