/** * 通过brokerIds 删除weshop_prop_ext表数据 * @param $brokerIdArr * @param $idArr * @return array */ public function deleteWeshopExtByBrokerIds($brokerIdArr, $idArr) { $weshopExtData = Bll_Weshop_WeshopPropExt::getDataByBrokerId($brokerIdArr); $weshopExtIds = array(); foreach ($weshopExtData as $v) { if (in_array($v['weshopPropId'], $idArr)) { $weshopExtIds[] = $v['id']; } } return Bll_Weshop_WeshopPropExt::deleteDataById($weshopExtIds); }
public function handle_request_internal() { if (Bll_Weshop::weshopPropsIsMaintain()) { return array('status' => 'error', 'message' => "系统维护中,请稍后再试!"); } header("Access-Control-Allow-Origin: *"); $brokerId = $this->_params['brokerId']; $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId); if (!$brokerInfo) { throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS); } $propId = $this->_params['propId']; //获取房源信息 $propInfo = Model_Weshop_Props::getWeshopProp($propId); if (empty($propInfo)) { throw new Exception_Property_NotFound(); } if ($propInfo->brokerId != $brokerId) { throw new Exception_Prop_PropNotBelongBroker('brokerId' . $propInfo->brokerId); } //更新房源状态 删除 $propInfo->status = 0; $propInfo->save(); //获取房源图片 删除房源图片 $oldImages = Model_Weshop_PropImages::getWeshopPropImages($propId); foreach ($oldImages as $image) { $image->isDelete = 1; //删除 $image->save(); } $weshopExtData = Bll_Weshop_WeshopPropExt::getDataByBrokerId($brokerId); $weshopExtId = 0; foreach ($weshopExtData as $v) { if ($v['weshopPropId'] == $propId) { $weshopExtId = $v['id']; break; } } Bll_Weshop_WeshopPropExt::deleteDataById($weshopExtId); return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('message' => '删除成功')); }