public static function getAllowVisitGids() { return DbUtils::getDzDbUtils(true)->queryColumn(' SELECT groupid FROM %t WHERE allowvisit>0', array('common_usergroup')); }
public static function getActivityInvite() { return DbUtils::getDzDbUtils(true)->queryAll(' SELECT * FROM %t ', array('appbyme_activity')); }
public static function deleteByTidUid($tid, $uid) { return DbUtils::getDzDbUtils(true)->query(' DELETE FROM %t WHERE tid=%s AND uid=%s ', array('forum_activityapply', $tid, $uid)); }
public static function getModuleParam($mid) { return DbUtils::getDzDbUtils(true)->queryScalar(' SELECT param FROM %t WHERE mid=%d ', array('appbyme_portal_module', $mid)); }
public static function getTidByPid($pid) { return DbUtils::getDzDbUtils(true)->queryScalar(' SELECT tid FROM %t WHERE pid = %d ', array('forum_post', $pid)); }
public static function getAnnouncementByUid($uid) { return DbUtils::getDzDbUtils(true)->queryRow(' SELECT * FROM %t WHERE id = %d ', array('forum_announcement', $uid)); }
protected function generateDependentData() { if ($this->sql != '') { return DbUtils::getDzDbUtils(true)->queryRow($this->sql, $this->params); } else { throw new CException(Yii::t('yii', 'CDbCacheDependency.sql cannot be empty.')); } }
public static function getInfoByAuthorid($authorid) { return DbUtils::getDzDbUtils(true)->queryRow(' SELECT * FROM %t WHERE uid=%d ', array('common_member', $authorid)); }
private function _getQQinfoByOpenId($openId) { return DbUtils::getDzDbUtils(true)->queryRow(' SELECT * FROM %t WHERE conopenid=%s ', array('common_member_connect', $openId)); }
public static function getSupportTopicCount($tid) { return DbUtils::getDzDbUtils(true)->queryScalar(' SELECT recommend_add FROM %t WHERE tid = %d ', array('forum_thread', $tid)); }
public static function updateApplyNumberByTid($tid) { return DbUtils::getDzDbUtils(true)->query(' UPDATE %t SET applynumber=%d WHERE tid=%d ', array('forum_activity', DzForumActivityApply::getCountByTid($tid), $tid)); }
public static function updateReadStatus($uid) { DbUtils::getDzDbUtils(true)->query(' UPDATE %t SET new=0 WHERE uid=%d AND new=1 ', array('home_notification', $uid)); }
public static function getAPNsCertfilePassword() { $data = DbUtils::getDzDbUtils(true)->queryScalar(' SELECT cvalue FROM %t WHERE ckey = %s ', array('appbyme_config', 'certfile_apns_passphrase')); return (string) base64_decode($data); }
public static function getAlbumListCount($uid) { $count = DbUtils::getDzDbUtils(true)->queryScalar(' SELECT COUNT(*) as num FROM %t WHERE uid = %d ', array('home_album', $uid)); return $count + 1; }
public static function getUserBindInfo($uid, $type = self::WECHAT_TYPE) { return DbUtils::getDzDbUtils(true)->queryRow(' SELECT * FROM %t WHERE uid=%d AND type=%d ', array('appbyme_connection', $uid, $type)); }
public static function getCountByTid($tid, $params) { $authorSql = isset($params['authorId']) && $params['authorId'] != 0 ? 'AND authorid=' . $params['authorId'] : ''; $sql = ' SELECT COUNT(*) FROM %t WHERE tid=%d AND first!=%d AND invisible>=%d ' . $authorSql; return (int) DbUtils::getDzDbUtils(true)->queryScalar($sql, array(self::getTableName($tid), $tid, 1, 0)); }
public static function getCommentById($id) { return DbUtils::getDzDbUtils(true)->queryRow(' SELECT * FROM %t WHERE cid=%d LIMIT 1 ', array('portal_comment', $id)); }
public static function getUserDeviceToken($uid) { return (string) DbUtils::getDzDbUtils(true)->queryScalar(' SELECT uvalue FROM %t WHERE uid=%d AND ukey=%s ', array('appbyme_user_setting', $uid, self::KEY_DEVICE_TOKEN)); }
public static function isDsuPaulsignAvailable() { $count = (int) DbUtils::getDzDbUtils(true)->queryScalar(' SELECT COUNT(*) FROM %t WHERE identifier=%s AND available=%d ', array('common_plugin', 'dsu_paulsign', 1)); return $count > 0; }
private function _getNotifyInfo($uid, $type) { $data = DbUtils::getDzDbUtils(true)->queryAll(' SELECT * FROM %t WHERE uid=%d AND type=%s AND new=%d ORDER BY dateline DESC ', array('home_notification', $uid, $type, 1)); $info = array('count' => count($data), 'time' => !empty($data) ? $data[0]['dateline'] . '000' : "0"); return $info; }
public function run() { $userIds = null; if ($this->messages) { foreach ($this->messages as $message) { $userIds[] = $message->from_user_id; } } $first_name = DbUtils::getDbValues(new UserProfiles(), 'user_id', $userIds, 'first_name'); $last_name = DbUtils::getDbValues(new UserProfiles(), 'user_id', $userIds, 'last_name'); $this->render('pmbInbox', array('messages' => $this->messages, 'first_name' => $first_name, 'last_name' => $last_name, 'unread' => $this->unread, 'pages' => $this->pages)); }
public function init() { parent::init(); $this->rootUrl = Yii::app()->getBaseUrl(true); $this->dzRootUrl = substr($this->rootUrl, 0, -16); // $_GET['accessToken'] = '8d5478c77477933169ab8cfde10b5'; $_GET['accessSecret'] = 'a57002aab240f3ff831d868b623ff'; // $_GET['accessToken'] = 'a4f26a1de6a3fd60e133075eecc73'; $_GET['accessSecret'] = '35394ccf5119fc6a01d2dc3c2786a'; // 初始化数据库连接 DbUtils::init($this->initDzDb); $this->mobcentDiscuzApp = new MobcentDiscuzApp(); $this->mobcentDiscuzApp->init(); }
public function init() { parent::init(); global $_G; $_G['siteurl'] = substr($_G['siteurl'], 0, -16); $_G['siteroot'] = substr($_G['siteroot'], 0, -16); $this->rootUrl = Yii::app()->getBaseUrl(true); $this->dzRootUrl = substr($this->rootUrl, 0, -16); loadcache('plugin'); loadcache(MOBCENT_DZ_PLUGIN_ID); DbUtils::init(false); }
public static function init($initDzDb = true) { self::$rawDzDb == null && (self::$rawDzDb = DbUtils::createDbUtils(true)); $dbConfig = Yii::app()->params['mobcent']['db']; if ($initDzDb) { if (self::$mobcentDiscuzDb == null) { self::$mobcentDiscuzDb = DbUtils::createDbUtils(); if (!self::$mobcentDiscuzDb->init($dbConfig['discuz'])) { throw new CDbException('mobcentDiscuzDb connect failed'); } } } }
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); }
public function actionPluginConfig() { $appbymeAppConfig = WebUtils::getDzPluginAppbymeAppConfig(); $appbymeApp = DbUtils::getDzDbUtils(true)->queryRow(' SELECT * FROM %t WHERE identifier=%s ', array('common_plugin', MOBCENT_DZ_PLUGIN_ID)); $unserializeKeys = array('cache_usergroup', 'forum_announcement_show', 'forum_show', 'forum_show_image', 'forum_photo_show'); foreach ($unserializeKeys as $key => $value) { $appbymeAppConfig[$value] = unserialize($appbymeAppConfig[$value]); } $config = array_merge(array('appbyme_app_info' => $appbymeApp), array('appbyme_app_config' => $appbymeAppConfig)); debug($config); // echo WebUtils::jsonEncode($config); }
public function actionView($id) { Yii::beginProfile('requirements_view'); //$requirements=RequirementApi::getRequirementByUserId(Yii::app()->user->id); //$this->render('view',array('requirements'=>$requirements)); $session = Yii::app()->session; $requirement = RequirementApi::getRequirementById($id); if (!$requirement) { throw new CHttpException(404, 'The requested page does not exist.'); } $userDetails = UserApi::getUserProfileDetails($requirement->user_id); $propertyIds = RequirementPropertyTypesApi::getPropertyTypesByRequirementId($id); $properties = ""; $propertyNames = ""; if ($propertyIds) { foreach ($propertyIds as $propertyId) { $properties[] = $propertyId->property_type_id; } $propertyNames = DbUtils::getDbValues(new PropertyTypes(), 'id', $properties, 'property_type'); } $amenityIds = RequirementAmenitiesApi::getAmenitiesByRequirementId($id); $amenities = ""; $amenityNames = ""; if ($amenityIds) { foreach ($amenityIds as $amenityId) { $amenities[] = $amenityId->amenity_id; } $amenityNames = DbUtils::getDbValues(new CategoryAmenities(), 'id', $amenities, 'amenity'); } $cityIds = RequirementCitiesApi::getCitiesByRequirementId($id); $cities = ""; $cityNames = ""; if ($cityIds) { foreach ($cityIds as $cityId) { $cities[] = $cityId->city_id; } $cityNames = DbUtils::getDbValues(new GeoCity(), 'id', $cities, 'city'); } $bedroomsRequirement = RequirementBedroomsApi::getBedroomsByRequirementId($id); $this->render('view', array('requirement' => $requirement, 'amenityNames' => $amenityNames, 'cityNames' => $cityNames, 'propertyNames' => $propertyNames, 'bedroomsRequirement' => $bedroomsRequirement, 'userDetails' => $userDetails)); Yii::endProfile('requirements_view'); }
public static function getArticleCountByAid($aid) { return DbUtils::getDzDbUtils(true)->queryRow(' SELECT * FROM %t WHERE aid=%d ', array('portal_article_count', $aid)); }
private function _getUidsByGid($gid) { $gids = $this->_getGids($gid); $uids = DbUtils::getDzDbUtils(true)->queryColumn(' SELECT uid FROM %t WHERE groupid IN (%n) GROUP BY groupid ', array('common_member', $gids)); $uids[] = 0; return $uids; }
function updateOfficeGroup($officeID, $officeName, $address, $phone, $mail) { $sql = "UPDATE offices \n\t\tSET office_name='{$officeName}',office_address='{$address}',office_phone='{$phone}',office_mail='{$mail}' \n\t\tWHERE office_id = '{$officeID}'"; return parent::selectQuery($sql); }