/** * 获取订单详细信息 * @param $id int 订单ID */ function get_order_detail($id, $table) { if (!is_numeric($id)) { return false; } if ($table == 'order_info') { $sql = 'SELECT t.*,IFNULL(t.platform_order_sn,t.order_sn)order_sn,p.region_name province,c.region_name city,d.region_name district, r.role_name sale_platform FROM '; } else { $sql = 'SELECT t.*, p.region_name province, c.region_name city, d.region_name district, r.role_name sale_platform FROM '; } $sql .= $GLOBALS['ecs']->table($table) . ' t LEFT JOIN ' . $GLOBALS['ecs']->table('region') . ' p ON p.region_id=t.province LEFT JOIN ' . $GLOBALS['ecs']->table('region') . ' c ON c.region_id=t.city LEFT JOIN ' . $GLOBALS['ecs']->table('region') . ' d ON d.region_id=t.district LEFT JOIN ' . $GLOBALS['ecs']->table('role') . " r ON t.team=r.role_id WHERE order_id={$id}"; $order_info = $GLOBALS['db']->getAll($sql); $order_info[0]['address'] = mb_chunk_split($order_info[0]['address'], 20, '<br/>'); return $order_info[0]; }
/** * @param $from_text * @param $to_text * * @param bool $charDiff * * @return array */ function mb_renderDiffHtml($from_text, $to_text, $charDiff = null) { //if ($from_text === 'Lang' && $to_text === 'Language') xdebug_break(); if ($from_text == $to_text) { return $to_text; } $removeSpaces = false; if ($charDiff === null) { $charDiff = mb_strtolower($from_text) === mb_strtolower($to_text) || abs(mb_strlen($from_text) - mb_strlen($to_text)) <= 2 || $from_text && $to_text && (strpos($from_text, $to_text) !== false || $to_text && strpos($to_text, $from_text) !== false); } if ($charDiff) { //use word diff but space all entities so that we get char diff $removeSpaces = true; $from_text = mb_chunk_split($from_text, 1, ' '); $to_text = mb_chunk_split($to_text, 1, ' '); } $from_text = mb_convert_encoding($from_text, 'HTML-ENTITIES', 'UTF-8'); $to_text = mb_convert_encoding($to_text, 'HTML-ENTITIES', 'UTF-8'); $opcodes = \FineDiff::getDiffOpcodes($from_text, $to_text, \FineDiff::$wordGranularity); $diff = \FineDiff::renderDiffToHTMLFromOpcodes($from_text, $opcodes); $diff = mb_convert_encoding($diff, 'UTF-8', 'HTML-ENTITIES'); if ($removeSpaces) { $diff = mb_unsplit($diff, ' '); } return $diff; }
function parseProperty($property) { return trim(mb_chunk_split($property,74,"\r\n ")); }