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';
 }
Пример #2
0
 /**
  * 获取经纪人和用户的关系
  *
  * @param string $deviceId
  * @param int $brokerId
  * @param string $date
  * @param string $splitSuffix
  * @return array
  */
 public static function getCustomerRelation($deviceId, $brokerId, $date, $splitSuffix = '')
 {
     if (empty($splitSuffix)) {
         $splitSuffix = date('Ym');
     }
     try {
         return Model_Mobile_BrokerUserRelation::data_access($splitSuffix)->filter('userDeviceId', $deviceId)->filter('brokerId', $brokerId)->filter('uploadDt', $date)->get_row();
     } catch (Exception $e) {
         return array();
     }
 }
 private function pushLastMsgNum($brokerId)
 {
     $thisPushLastMsgNum = Model_Mobile_CustomerLatestPushCount::data_access()->filter('brokerId', $brokerId)->filter('pushDate', date('Y-m-d', time()))->find_only();
     if (!empty($thisPushLastMsgNum)) {
         $thisPushLastMsgNum->incrPushedCount();
     } else {
         $insertData['brokerId'] = $brokerId;
         $insertData['pushDate'] = date('Y-m-d', time());
         $insertData['count'] = 1;
         try {
             $MODEL = Model_Mobile_CustomerLatestPushCount::create($insertData);
             $MODEL::$enable_cache = false;
             $MODEL->save();
         } catch (Exception $e) {
             Model_Mobile_BrokerUserRelation::data_access()->roll_back();
         }
     }
 }
Пример #4
0
 /**
  * 获取经纪人和客户今日推送的关系
  *
  * @param $deviceId
  * @param $brokerId
  * @return Model_Mobile_BrokerUserRelation|null
  */
 public function getUserBrokerTodayRelation($deviceId, $brokerId)
 {
     return Model_Mobile_BrokerUserRelation::data_access(date('Ym'))->filter('userDeviceId', $deviceId)->filter('brokerId', $brokerId)->filter('uploadDt', date('Y-m-d'))->sort('id')->find_only();
 }