public static function clearAll() { foreach (self::$CACHETYPE as $key => $type) { BDataHelper::print_r($key); self::delete($key); } }
/** * wirte log * @author wjh 20150401 * @param $name * @param null $content * @param int $typeid * @throws Exception */ public function Log($name, $content = null, $typeid = 0) { $logtype = Yii::app()->params['switch']['logtype']; if (!empty($logtype) && $logtype == 'table') { DebugService::Log($name, $content = null, $typeid = 0); } else { BDataHelper::print_r($name); BDataHelper::print_r($content); } }
/** * @param $request * @return AccessToken * @throws IllegalArgumentException */ public static function authenticate($request) { $appkey = $request->getParam(self::APPKEY_PARAM_KEY); $clientid = $request->getParam(self::CLIENTID_PARAM_KEY); $clientsecurity = $request->getParam(self::CLIENTSECURITY_PARAM_KEY); Assert::hasText($appkey, "appkey传递参数为空!"); Assert::hasText($clientid, "clientid传递参数为空!"); Assert::hasText($clientsecurity, "clientsecurity传递参数为空!"); //判断权限 $token = self::validateAPIAuth($appkey, $clientid, $clientsecurity); //生成tokenid之前最好判断一下头部信息;然后把头部信息放入到AccessToken中;token.setHeader(); $tokenId = BDataHelper::getId(); $token->tokenid = $tokenId; ThirdAccessService::setCacheValue($clientid, $token); return $token; }
public static function testAll() { $returnType = 'array'; BDataHelper::print_r('------------testArray-----------'); $ht = BCacheHelper::testArray($returnType, true); BDataHelper::print_r($ht); BDataHelper::print_r('------------testModel-----------'); $ht = BCacheHelper::testModel($returnType, true); BDataHelper::print_r($ht); BDataHelper::print_r('------------testGetArray-----------'); $ht = BCacheHelper::testGetArray($returnType, true); BDataHelper::print_r($ht); BDataHelper::print_r('------------testGetModel-----------'); $ht = BCacheHelper::testGetModel($returnType, true); BDataHelper::print_r($ht); }
/** * logout */ public function actionIndex() { $sessionid = session_id(); $cacheToken = ThirdAccessService::getAllCacheValue(); BDataHelper::print_r($cacheToken); }
/** * 获取一个人的组织类型 * 门市、代理商、组团社、提供商 * @author wjh 20141113 * @param null $userid * @return string * @throws Exception */ public static function getOrgType($userid = null) { if (empty($userid)) { $userid = BDataHelper::getCurrentUserid(); } $isRole = BDataHelper::checkCurrentUserRole('group_'); if ($isRole) { return GroupTransaction::ORGTYPE_GROUP; } $isRole = BDataHelper::checkCurrentUserRole('sales_'); if ($isRole) { return GroupTransaction::ORGTYPE_SALES; } $isRole = BDataHelper::checkCurrentUserRole('provider_'); if ($isRole) { return GroupTransaction::ORGTYPE_PROVIDER; } $isRole = BDataHelper::checkCurrentUserRole('agent_'); if ($isRole) { return GroupTransaction::ORGTYPE_AGENT; } return GroupTransaction::ORGTYPE_SALES; }
/** * 模拟post提交 * @author wjh * @param $url * @param array $data * @param string $returnType json or string ,default json * @return string */ public static function curl_post_sessionid($url = null, $data = array()) { if (empty($url)) { $url = BDataHelper::getHltConfig('api') . "/j_spring_security_token_check?u=admin"; } $result = self::curl_post($url, $data, 'string', 1); preg_match('/Set-Cookie:(.*);/iU', $result, $str); $sessionid = !empty($str) && count($str) > 1 ? trim($str[1]) : ''; return $sessionid; }
/** * 获取HTL团渠道 * @param $gid * @return string */ public static function hltChanid($gid) { $bool = GroupService::hltProvider_exists($gid); $chanid = BDataHelper::getHltConfig('chanid'); if ($bool) { $chanid = BDataHelper::getHltConfig('menshisystem'); } return $chanid; }
/** * 根据$key处理$list数据,返回二维数组; * * @param $list * @param $key * @return Array Map; */ public static function model_group($list, $key) { if (!isset($list) || empty($list)) { return null; } $groups = array(); if (is_array($list)) { foreach ($list as $item) { $items = array(); $val = BDataHelper::getModelProperty($item, $key); if (isset($groups[$val])) { $items = $groups[$val]; } $items[] = $item; $groups[$val] = $items; } } return $groups; }