public function setPushModule($deviceToken, $moduleId, $moduleValue)
 {/*{{{*/
     $mobileUser = DAL::get()->find_by_devicetoken('mobileuser', $deviceToken);
     if($mobileUser->isNull() == false)
     {
         $mobileModel = DAL::get()->find_by_mobileuserid_and_modelkey('mobilemodel', $mobileUser->id, $moduleId);
         if($mobileModel->isNull() == false)
         {
             MobileUserClient::getInstance()->modifyMobileModel($mobileModel->id, $moduleValue);
         }
         else
         {
             MobileUserClient::getInstance()->createMobileModel($deviceToken, $moduleId, $moduleValue);
         }
         $this->content = array('moduleValue' => $moduleValue);
     }
     else
     {
         $this->setErrorCode(156);
         return 0;
     }
 }/*}}}*/
Example #2
0
 public function setDeviceToken($deviceToken, $userId, $platform, $deviceType, $v = '1.0.0', $app = 'haodf', $bundleid = '')
 {/*{{{*/
     $version = $v ? $v : '1.0.0';
 	$user = DAL::get()->find('user', $userId);
     if ($user->isNull())
     {
         $this->setErrorCode(107);
         return 0;
     }
     $mobileUser = DAL::get()->find_by_deviceToken_and_platform('mobileuser', $deviceToken, $platform);
     //同一个手机上不同的号
     if($mobileUser->isNull() == false)
     {
         MobileUserClient::getInstance()->modifyMobileUser($mobileUser->id, $userId, $version, $app, $bundleid);
     }
     else
     {
         MobileUserClient::getInstance()->createMobileUser($userId, $platform, $deviceType, $deviceToken, $version, $app, $bundleid);
     }
 }/*}}}*/