/** * 初始化经纪人绑定次数表 * * @param $brokerId * @param int $date * @return int */ public static function initBrokerBind($brokerId, $date = 0) { if (empty($date)) { $date = date('Ymd'); } try { $oBrokerBind = Model_Mobile_BrokerBind::data_access(); $oBrokerBind->set_field('brokerId', $brokerId); $oBrokerBind->set_field('date', $date); $oBrokerBind->set_field('binded', 0); if ($oBrokerBind->insert() == 0) { return 0; } return $oBrokerBind->connection->lastInsertId(); } catch (Exception $e) { return 0; } }
public function handle_request() { if ($this->request->is_post_method()) { $brokerId = $this->request->get_parameter('brokerId'); $deviceId = $this->request->get_parameter('deviceId'); //删除da_mobile_broker_find_user_upload表跟制定broker_id相关的数据 $brokerFindUserData = Model_Broker_BrokerFindUser::data_access()->filter('brokerId', $brokerId)->find(); foreach ($brokerFindUserData as $val) { $val->delete(); } //删除da_mobile_broker_find_user_upload表跟制定device_id相关的数据 $brokerFindUserData = Model_Broker_BrokerFindUser::data_access()->filter('userId', $deviceId)->find(); foreach ($brokerFindUserData as $val) { $val->delete(); } //删除broker_user_relation_XX表跟制定brokerId相关的数据 $brokerUserRelationData = Model_Mobile_BrokerUserRelation::data_access()->filter('brokerId', $brokerId)->find(); foreach ($brokerUserRelationData as $val) { $val->delete(); } //删除broker_user_relation_XX表跟制定user_device_id相关的数据 $brokerUserRelationData = Model_Mobile_BrokerUserRelation::data_access()->filter('userDeviceId', $deviceId)->find(); foreach ($brokerUserRelationData as $val) { $val->delete(); } //删除broker_bind表跟制定brokerId相关的数据 $brokerBindData = Model_Mobile_BrokerBind::data_access()->filter('brokerId', $brokerId)->find(); foreach ($brokerBindData as $val) { $val->delete(); } //删除user_bind表跟制定device_id相关的数据 $userBindData = Model_Mobile_UserBind::data_access()->filter('deviceId', $deviceId)->find(); foreach ($userBindData as $val) { $val->delete(); } $this->setAttribute('out', 1); } return 'Test_TruncateDataForCustomerRush'; }