foreach ($condition['column'] as $key => $val) { $buffer[$key] = Assign($row[$val], 0); } $filter_count = array('uid' => Assign($params['uid'], 0), 'tid' => Assign($params['tid'], 0), 'tag' => Assign($params['tag'], 0), 'type' => '1'); if (StorageCount('hh_techuser_shoucang', $filter_count)) { $buffer['collect'] = '1'; } if ($params['type'] == '3' and $buffer['collect'] == '0') { continue; } $filter_count['touid'] = 0; if (StorageCount('hh_techuser_dianzan', $filter_count)) { $buffer['mypraise'] = '1'; } $filter_total = array('tid' => Assign($params['tid'], 0), 'tag' => Assign($params['tag'], 0), 'type' => '1', 'touid' => 0); $buffer['praises'] = StorageCount('hh_techuser_dianzan', $filter_total); ## 獲取圖片信息 if ($params['tag'] == '1' or $params['tag'] == '2') { $buffer['mdata'] = array(); $condition_sub = array('schema' => 'hh_techforum_img', 'fields' => array('id'), 'filter' => array('qid' => Assign($row['id'], 0))); $buf = StorageFind($condition_sub); if (is_array($buf) and empty($buf) == FALSE) { foreach ($buf as $number => $row_img) { $buffer['mdata'][] = array('mid' => $row_img['id'], 'type' => '0', 'mname' => 'image' . ($number + 1), 'mpic' => "{$row_img['id']}_s.png", 'url' => ''); } } } $result['data'][] = $buffer; } } }
## 構建現象查詢SQL $condition_sub = array('schema' => array('car_symptom', 'car_symptom_fenxi', 'car_word'), 'fields' => array('resultid', 'keyid', 'title', 'miaoshu', 'lable', '(CASE oftype WHEN 3 THEN 100 WHEN 4 THEN 80 WHEN 5 THEN 60 WHEN 1 THEN 100 ELSE 10 END) AS wordtype', 'SUM((1-text_step))*20+score AS fenshu'), 'filter' => array('t1.resultid' => 't0.id', 't1.keyid' => 't2.id', 'keyid' => array('IN', $word_id)), 'others' => 'GROUP BY resultid, keyid'); $condition = array('schema' => '(' . SQLSub($condition_sub) . ') AS tb', 'fields' => array('resultid AS id', 'title', 'miaoshu', 'lable', 'sum(wordtype + fenshu) AS score'), 'others' => 'GROUP BY resultid ORDER BY score DESC'); ## 統計查詢總數 $count = StorageRows($condition); ## 截獲最新20條數據 $condition['others'] .= ' LIMIT 20'; $recordset = StorageFind($condition); if (is_array($recordset) and empty($recordset) == FALSE) { $result = array('code' => '101', 'data' => array()); $item = array('total' => $count, 'list' => array(), 'keys' => array()); foreach ($recordset as $index => $row) { $item['list'][] = array('id' => $row['id'], 'title' => fmtstr($row['title']), 'lable' => fmtstr($row['lable']), 'miaoshu' => fmtstr($row['miaoshu'])); } $condition_buf = array('schema' => 'car_word', 'filter' => array('id' => array('IN', $word_id))); $buf = StorageFind($condition_buf); if (is_array($buf) and empty($buf) == FALSE) { foreach ($buf as $row) { $item['keys'][] = $row['keyword']; for ($index = 1; $index <= 9; $index++) { if (empty($row['keyword' . $index]) == FALSE) { $item['keys'][] = $row['keyword' . $index]; } } } } $result['data'][] = $item; ## 積累積分 if (CheckOpenID($params['openid'], $params['uid']) == TRUE) { if (empty($params['uid']) == FALSE) { Techuser_setScore(Assign($params['uid'], 0), 2);
<?php // Copyright 2015 The Haohaoxiuche Team Authors. All right reserved. // Use of this source that is governed by a Apache-style // license that can be found in the LICENSE file. // // 技術版API編號107 獲取案例跟貼(服務器頁面Ajax專用) // // @authors hjboss <*****@*****.**> 2015-12-18# // @version 1.0.0 // @package hhxc if (!defined('HHXC')) { die('Permission denied'); } header('Access-Control-Allow-Origin:*'); $result = array('code' => '101', 'data' => array()); $condition = array('schema' => 'hh_anli_thread', 'filter' => array('cid' => empty($_REQUEST['cid']) ? Assign($params['cid'], 0) : $_REQUEST['cid']), 'others' => 'ORDER BY id DESC', 'charset' => TRUE); $recordset = StorageFind($condition); if (is_array($recordset) and empty($recordset) == FALSE) { foreach ($recordset as $index => $row) { $record = StorageFindID('hh_techuser', $row['uid']); $content = $row['content']; if (empty($row['version']) == FALSE) { $content = Charset($content, DB_CHARSET, CL_CHARSET); } $result['data'][] = array('uid' => Assign($row['uid'], 0), 'nick' => Assign($record['nick'], NICK_DEFAULT), 'image' => empty($record['headerimg']) ? ICON_DEFAULT : ICON_PATH . $record['headerimg'], 'potimes' => $row['createdat'], 'context' => $content, 'cid' => $row['cid']); } }
<?php // Copyright 2015 The Haohaoxiuche Team Authors. All right reserved. // Use of this source that is governed by a Apache-style // license that can be found in the LICENSE file. // // 技術版APP 分享APP頁面 // // @authors hjboss <*****@*****.**> 2015-01-02# // @version 1.0.0 // @package hhxc define('HHXC', TRUE); require_once 'common.php'; $condition = array('schema' => 'hh_tuijian_code', 'filter' => array('code' => Assign($_REQUEST['needcode']), 'createdat' => date('Y-m-d'))); if (empty($_REQUEST['needcode']) == FALSE) { $buffer = StorageFind($condition); if (is_array($buffer) and empty($buffer) == FALSE) { $fields = array('number' => 'number+1'); StorageEdit($condition['schema'], $fields, $condition['filter']); } else { $data = array('code' => Assign($_REQUEST['needcode']), 'createdat' => date('Y-m-d'), 'number' => 1); StorageAdd($condition['schema'], $data); } } ?> <!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" /> <title>好好修车-免费修车老师,私人汽车医生!</title>
function StorageFindOne($condition = array(), $debug = FALSE) { $condition['others'] = Assign($condition['others']) . ' LIMIT 1'; $recordset = StorageFind($condition, $debug); if (is_array($recordset) and empty($recordset) == FALSE) { return $recordset[0]; } return array(); }
} $buffer_main['hostdata'][] = $buffer_host; } else { continue; } ## }}} 獲取樓主信息 ## 獲取回帖者信息 {{{ if ($buffer_main['praisetype'] == '2') { $condition_repy = array('schema' => array('hh_techuser', $schemas[1]), 'fields' => array('*', 't0.id AS h_uid', 't1.id AS h_tid', 't0.type AS h_official', 't1.content AS h_content', 't0.grade AS h_grade', '(SELECT title FROM hh_rank WHERE dengji=t0.rankname) AS h_rankname'), 'filter' => array('t0.id' => "t1.{$keys[1][0]}", 't1.tid' => $buffer_tid), 'others' => "ORDER BY t1.{$keys[1][1]} DESC"); $recordset_repy = StorageFind($condition_repy); if (is_array($recordset_repy) and empty($recordset_repy) == FALSE) { foreach ($recordset_repy as $number_repy => $row_repy) { $buffer_repy = array('uid' => Assign($row_repy['h_uid'], 0), 'userpic' => Assign($row_repy['headerimg']), 'usernick' => Assign($row_repy['nick']), 'grade' => Assign($row_repy['h_grade']), 'adopt' => Assign($row_repy['adopt']), 'anonymous' => Assign($row_repy['anonymous']), 'official' => Assign($row_repy['h_official'], 0), 'identified' => Assign($row_repy['identified'], 0), 'rank' => Assign($row_repy['rank'], 0), 'rankname' => Assign($row_repy['h_rankname'], 0), 'posttime' => Assign($row_repy[$keys[1][1]]), 'context' => Assign($row_repy['h_content']), 'listid' => $buffer_tid, 'index' => Assign($row_repy['no'], 0), 'medias' => '0', 'mdata' => array(), 'content' => Assign($row_repy['h_content'])); ## 獲取圖片信息 $condition_repy_img = array('schema' => $schemas[1] . '_img', 'filter' => array('listid' => $row_repy['h_tid'])); $buffer_repy_img = StorageFind($condition_repy_img); if (is_array($buffer_repy_img) and empty($buffer_repy_img) == FALSE) { foreach ($buffer_repy_img as $number_img => $row_img) { $buffer_repy['mdata'][] = array('mid' => $row_img['id'], 'type' => '0', 'mname' => 'image' . ($number_repy + 1), 'mpic' => "{$row_img['id']}_s.png", 'url' => ''); } } $buffer_repy['medias'] = count($buffer_repy['mdata']); $buffer_main['repydata'][] = $buffer_repy; } } } ## }}} 獲取回帖者信息 $result['data'][] = $buffer_main; } } ## 數據列表排序
} $filter_total = array('tid' => Assign($params['tid'], 0), 'tag' => Assign($params['tag'], 0), 'type' => '1', 'touid' => 1); $buffer['praises'] = Assign(StorageCount('hh_techuser_dianzan', $filter_total), 0); ## 獲取圖片信息 if (in_array($params['tag'], array('1', '2', '3', '4'))) { $buffer['omdata'] = array(); $buffer['rmdata'] = array(); $buffer['omedias'] = 0; $buffer['rmedias'] = 0; $condition_sub_o = array('schema' => 'hh_techforum_img', 'fields' => array('id'), 'filter' => array('qid' => Assign($row['h_tid'], 0))); $buf_o = StorageFind($condition_sub_o); if (is_array($buf_o) and empty($buf_o) == FALSE) { foreach ($buf_o as $number => $row_img) { $buffer['omdata'][] = array('mid' => $row_img['id'], 'type' => '0', 'mname' => 'image' . ($number + 1), 'mpic' => "{$row_img['id']}_s.png", 'url' => ''); $buffer['omedias'] += 1; } } $condition_sub_r = array('schema' => 'hh_techforum_list_img', 'fields' => array('id'), 'filter' => array('listid' => Assign($row['h_ouid'], 0))); $buf_r = StorageFind($condition_sub_r); if (is_array($buf_r) and empty($buf_r) == FALSE) { foreach ($buf as $number => $row_img) { $buffer['omdata'][] = array('mid' => $row_img['h_ouid'], 'type' => '0', 'mname' => 'image' . ($number + 1), 'mpic' => "{$row_img['id']}_s.png", 'url' => ''); ${$buffer}['rmedias'] += 1; } } } $result['data'][] = $buffer; } //StorageEdit($edit['schema'], $edit['fields'], $edit['filter']); } }
$buf = array('uid' => Assign($row['pubuser'], 0), 'userpic' => Assign($row['h_headerimg']), 'usernick' => Assign($row['h_nick']), 'grade' => Assign($row['h_grade']), 'posttime' => Assign($row['pubtime']), 'content' => Assign($row['content']), 'index' => Assign($row['no'], 0), 'listid' => Assign($row['id'], 0), 'medias' => Assign($row['h_ct'], 0), 'mdata' => array(), 'official' => Assign($row['h_official'], 0), 'identified' => Assign($row['h_identified'], 0), 'rank' => Assign($row['h_rank'], 0), 'rankname' => Assign($row['h_rankname']), 'collect' => '0', 'mypraise' => '0', 'praises' => '0'); $filter_count = array('uid' => Assign($params['uid'], 0), 'tag' => 4, 'tid' => $buf['listid'], 'type' => 1); if (StorageCount('hh_techuser_shoucang', $filter_count)) { $buf['collect'] = '1'; } if ($params['type'] == '3' and $buf['collect'] == '0') { continue; } $filter_count['touid'] = 1; if (StorageCount('hh_techuser_dianzan', $filter_count)) { $buf['mypraise'] = '1'; } $filter_total = array('tag' => 4, 'tid' => $buf['listid'], 'type' => 1, 'touid' => 1); $buf['praises'] = Assign(StorageCount('hh_techuser_dianzan', $filter_total), 0); $condition_img = array('schema' => 'hh_zhaopin_list_img', 'filter' => array('listid' => $row['id'])); $recordset_img = StorageFind($condition_img); if (is_array($recordset_img) and empty($recordset_img) == FALSE) { foreach ($recordset_img as $number_img => $row_img) { $buf['mdata'][] = array('mid' => $row_img['id'], 'type' => 0, 'mname' => 'image' . ($number_img + 1), 'mpic' => $row_img['id'] . '_s.png', 'url' => ''); } } $buffer['messages'][] = $buf; } } $result['data'][] = $buffer; $schema = 'hh_zhaopin'; $filter0 = array('tid' => Assign($params['tid'], 0), 'pubuser' => Assign($params['uid'], 0)); $filter1 = array('tid' => Assign($params['tid'], 0), 'at' => Assign($params['uid'], 0)); $buffer_host = StorageFindID($schema, Assign($params['tid'], 0)); if (is_array($buffer_host) and empty($buffer_host) == FALSE) { if ($params['uid'] == $buffer_host['ofuser']) {