private function cryptArray($array, $databucket) { if (false == is_array($array)) return $array; if(isset($array[0])) { foreach($array as $key => $value) { $array[$key] = $this->cryptArray($value, $databucket); } } else { foreach($array as $key => $value) { if ($key == "_s") { if(false == empty($value)) { $array[$key] = DataCrypt::cryptWithKey(json_encode($value), $databucket->cryptKey); } else { $array[$key] = ''; } } } } return $array; }
public function processInput($request) {/*{{{*/ $this->transferSecurityInfo($request);//如果有$data['_s']参数,要对其加密,然后与不加密的数据合并 $this->sortRequestArgs($request); $this->args = $this->formatInput($this->args); $version = BeanFinder::get('configs')->version; $requestVersion = $request->version; if ($requestVersion == 'fu1.0') { $version = $request->version; } //记录医生端医生操作日志 $app = $request->getRequest('app'); $v = $request->getRequest('v'); if(('doctor' == $app && $v >= '2.0.0') || 'doctorhd' == strtolower($app)) { // $spaceId = $request->getRequest('spaceId'); $s = $request->getRequest('_s'); $spaceId = $request->getRequest('spaceId'); if($s != '' && $spaceId == '') { $key = self::CRYPE_KEY; $decrypts = json_decode(DataCrypt::decryptWithKey($s, $key), true); $spaceId = isset($decrypts['spaceId']) ? $decrypts['spaceId'] : 0; } $action = $request->action; $os = $request->getRequest('os'); if(trim($spaceId) != '' && $spaceId != 0) { StationLetterClient::getInstance()->createwapdoctoractionlog('wapdoctoractionlog', $spaceId, $action, $app, $os, $v); } } return array('action'=>$request->action, 'os'=>$request->os, 'version'=>$version, 'signature'=>$request->signature, 'args'=>$this->args, 'databucket'=>$this->databucket); }/*}}}*/
public static function getSecurityInfo($s, $key = '') {/*{{{*/ return json_decode(DataCrypt::decryptWithKey($s, $key), true); }/*}}}*/