You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pdd-order-api/app/libs/tool/class.OrderDecryptTool.php

24 lines
913 B
PHP

<?php
class OrderDecryptTool {
public static function decryptInfoListByTableName($infoList, $tableName){
if (empty($infoList) || !is_array($infoList)) {
return $infoList;
}
$encryptTableFieldsMap = OrderPrintConst::getEncryptTableFieldsMap();
foreach ($infoList as &$info){
$fields = CommonTool::underScoreToCamelCaseArr($encryptTableFieldsMap[$tableName]);
$hasEncrypt = !empty($info[$fields[0] . 'S']) ? true : false;
foreach ($fields as $field){
$info[$field] = $hasEncrypt ? CommonTool::decrypt($info[$field . 'S'], null) : $info[$field];
}
if($tableName == 'op_waybill_info'){
$info['receiverName'] = CommonTool::decrypt($info['receiverNameS'], null);
$info['receiverMobile'] = CommonTool::decrypt($info['receiverMobileS'], null);
$info['receiverPhone'] = CommonTool::decrypt($info['receiverPhoneS'], null);
}
unset($info);
}
return $infoList;
}
}