Ejemplo n.º 1
0
 public function run($setting)
 {
     $res = $this->initWebApiArray();
     $uid = $this->getController()->uid;
     // test
     // $setting ='{"head": {"errCode": 0, "errInfo": ""}, "body": {"settingInfo": {"hidden": 0}, "externInfo": {}}}';
     $settings = rawurldecode($setting);
     $settings = WebUtils::jsonDecode($settings);
     $settings = !empty($settings) ? $settings['body']['settingInfo'] : array();
     // insert or update new settings
     AppbymeUserSetting::saveNewSettings($uid, $settings);
     echo WebUtils::outputWebApi($res, '', false);
 }
Ejemplo n.º 2
0
 private function _saveUserLocation($uid, $longitude, $latitude, $location)
 {
     // 插入用户定位开关设置
     $count = (int) DbUtils::getDzDbUtils(true)->queryScalar('
         SELECT COUNT(*) 
         FROM %t
         WHERE uid=%d
         AND ukey=%s
     ', array('appbyme_user_setting', $uid, AppbymeUserSetting::KEY_GPS_LOCATION));
     if (!$count) {
         AppbymeUserSetting::saveNewSettings($uid, array(AppbymeUserSetting::KEY_GPS_LOCATION => AppbymeUserSetting::VALUE_GPS_LOCATION_ON));
     }
     !empty($location) && SurroundingInfo::saveUserLocation($uid, $longitude, $latitude, $location);
 }
Ejemplo n.º 3
0
 public static function doAppAPNsHelper($uid, $payload, $timeout = 10, $charset = '')
 {
     $res = false;
     $deviceToken = AppbymeUserSetting::getUserDeviceToken($uid);
     $passphrase = AppbymeConfig::getAPNsCertfilePassword();
     $config = WebUtils::getMobcentConfig('misc');
     $certfile = $config['apnsCertfilePath'] . '/' . $config['apnsCertfileName'];
     if (file_exists($certfile) && $uid && $deviceToken && $passphrase && $payload) {
         $res = WebUtils::doAPNs($certfile, $passphrase, $deviceToken, $payload, $timeout, $charset);
     }
     return $res;
 }
Ejemplo n.º 4
0
 /**
  * 判断该用户是否开启GPS定位功能
  */
 public static function isGPSLocationOn($uid)
 {
     return AppbymeUserSetting::isGPSLocationOn($uid);
 }