public static function EncryptMsg($sRespData, $reqData) { $reqData['msg_encrypt'] = self::$options['encodingAesKey']; $sRespData['msgType'] = $sRespData['type'] ? $sRespData['type'] : 'text'; $sRespData['createTime'] = time(); $sRespData['FromUserName'] = self::$options['corpId']; $template = Template::GetContent('weixin/enteprise/resp_data.xml', array('data' => $sRespData, 'reqData' => $reqData)); $template = strtr($template, array("\n" => '', "\r" => '', "\t" => '', " " => '')); $sEncryptMsg = ""; //xml格式的密文 $errCode = self::$instance->EncryptMsg($template, $reqData['timestamp'], $reqData['nonce'], $sEncryptMsg); if ($errCode != 0) { self::Error("ERR: " . $errCode, $errCode); } return self::SetResponce($sEncryptMsg); }
public static function CreateDataSet($data, $table_name, $one = true) { if (empty($data)) { return ''; } if ($one) { $data = array($data); } $columns = array(); $rowValues = array(); foreach ($data as $rows) { foreach ($rows as $rowIndex => $row) { $columns[] = $rowIndex; } break; } foreach ($data as $rows) { $rowValue = array(); foreach ($rows as $rowIndex => $row) { $rowValue[] = $row; } $rowValues[] = $rowValue; } $template = 'corp/block/template/dataset.xml'; return Template::GetContent($template, array('columns' => $columns, 'rowValues' => $rowValues, 'table_name' => $table_name)); }