Пример #1
0
// @version 1.0.0
// @package hhxc
if (!defined('HHXC')) {
    die('Permission denied');
}
$result = array('code' => '101', 'msg' => '', 'data' => array());
$condition = array('schema' => 'car_type', 'fields' => array('id', 'keyword1'), 'filter' => array('pid' => 0, 'zhuangtai' => 1), 'others' => 'ORDER BY firstchar, id ASC');
$recordset = StorageFind($condition);
if (is_array($recordset) == FALSE or empty($recordset) == TRUE) {
    $result['msg'] = MESSAGE_EMPTY;
} else {
    $cache = array();
    foreach ($recordset as $index => $row) {
        $buffer = array('carType' => $row['id'], 'carTypeName' => $row['keyword1'], 'data' => array(), 'first' => substr(pinyin1($row['keyword1']), 0, 1));
        $condition_pid = array('schema' => 'car_type', 'fields' => array('id'), 'filter' => array('pid' => $row['id']));
        $condition_sub = array('schema' => 'car_type', 'fields' => array('id', 'keyword1'), 'filter' => array('pid' => array('IN', SQLSub($condition_pid))));
        $buf = StorageFind($condition_sub);
        if (is_array($buf) and empty($buf) == FALSE) {
            foreach ($buf as $number => $row_car) {
                $e = str_replace($row['keyword1'], '', $row_car['keyword1']);
                $buffer['data'][] = empty($e) ? $row_car['keyword1'] : $e;
            }
        }
        $cache[] = $buffer;
    }
    $alphas = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z');
    foreach ($alphas as $alpha) {
        $buffer = array('index' => strtoupper($alpha), 'carbrand' => array());
        foreach ($cache as $item) {
            if ($item['first'] == $alpha) {
                $buffer['carbrand'][] = $item;
Пример #2
0
// Use of this source that is governed by a Apache-style
// license that can be found in the LICENSE file.
//
// 技術版API編號021 查现象-获取现象数据
//
// @authors hjboss <*****@*****.**> 2015-12-16#
// @version 1.0.0
// @package hhxc
if (!defined('HHXC')) {
    die('Permission denied');
}
$content = SpeechWords(Assign($params['content']));
$word_id = explode(',', GetKeyword($content));
## 構建現象查詢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) {
Пример #3
0
// Use of this source that is governed by a Apache-style
// license that can be found in the LICENSE file.
//
// 技術版API編號103 查案例-獲取案例詳細信息 ##代替058
//
// @authors hjboss <*****@*****.**> 2015-12-18#
// @version 1.0.0
// @package hhxc
if (!defined('HHXC')) {
    die('Permission denied');
}
if (CheckOpenID($params['openid'], $params['uid']) == FALSE) {
    $result['msg'] = MESSAGE_WARNING;
} else {
    $the_times = CheckTimes($params['openid'], $params['uid']);
    $url_anli = sprintf(PAGE_ANLI, $params['uid'], $params['openid'], DEBUG);
    if (empty($the_times) == FALSE) {
        $result = array('code' => '101');
        $record = StorageFindID('search_result', Assign($params['cid'], 0));
        if (is_array($record) and empty($record) == FALSE) {
            $result['caseurl'] = $url_anli . $record['id'];
        }
    } else {
        $condition_sub = array('schema' => 'hh_techuser', 'fields' => array('grade'), 'filter' => array('id' => Assign($params['uid'], 0)));
        $condition = array('schema' => 'hh_score', 'fields' => array('chakan'), 'filter' => '(' . SQLSub($condition_sub) . ')');
        $record = StorageFindOne($condition);
        if (is_array($record) and empty($record) == FALSE) {
            $result = array('code' => '103', 'msg' => $recod['chakan']);
        }
    }
}
Пример #4
0
function StorageRows($condition = array())
{
    global $mysql;
    $sql = SQLSub($condition);
    $res = mysqli_query($mysql, $sql);
    if ($res) {
        return mysqli_num_rows($res);
    }
    if (DEBUG) {
        die(StorageError(__FUNCTION__, $sql));
    }
    return FALSE;
}
Пример #5
0
if (!defined('HHXC')) {
    die('Permission denied');
}
$condition = array('schema' => 'hh_techforum', 'fields' => array('*', '(SELECT nick FROM hh_techuser WHERE id=hh_techforum.pubuser) AS h_nick', '(SELECT headerimg FROM hh_techuser WHERE id=hh_techforum.pubuser) AS h_headerimg', '(SELECT grade FROM hh_techuser WHERE id=hh_techforum.pubuser)     AS h_grade', '(SELECT COUNT(*) FROM hh_techforum_img WHERE qid=hh_techforum.id) AS h_img_total', '(SELECT type FROM hh_techuser WHERE id=hh_techforum.pubuser)      AS h_official', '(SELECT rank FROM hh_techuser WHERE id=hh_techforum.pubuser)      AS h_rank', '(SELECT identified FROM hh_techuser WHERE id=hh_techforum.pubuser) AS h_identified', '(SELECT title FROM hh_rank WHERE dengji=(SELECT rankname FROM hh_techuser WHERE id=hh_techforum.pubuser)) AS h_rankname'), 'filter' => array('topsite' => 0, 'type' => Assign($params['tag'], 0)), 'others' => 'ORDER BY id DESC LIMIT 10');
if (empty($params['tid'])) {
    $condition['filter']['id'] = array('GT', Assign($params['databasever'], 0));
} else {
    $condition['filter']['id'] = array('LT', Assign($params['tid'], 0));
}
switch ($params['type']) {
    case '2':
        $condition['filter']['pubuser'] = Assign($params['uid'], 0);
        break;
    case '3':
        $condition_sub = array('schema' => 'hh_techuser_shoucang', 'fields' => array('tid'), 'filter' => array('uid' => Assign($params['uid'], 0), 'tag' => Assign($params['tag'], 0), 'type' => 1));
        $condition['filter']['id'] = array('IN', '(' . SQLSub($condition_sub) . ')');
}
$recordset = StorageFind($condition);
if (is_array($recordset) == FALSE or empty($recordset) == TRUE) {
    $result['msg'] = MESSAGE_EMPTY;
} else {
    $result = array('code' => '101', 'data' => array());
    foreach ($recordset as $index => $row) {
        if ($index == 0) {
            $result['databasever'] = $row['id'];
        }
        if ($params['type'] == '2' and $row['pubuser'] != $params['uid']) {
            continue;
        }
        $buffer = array('uid' => $row['pubuser'], 'userpic' => $row['h_headerimg'], 'usernick' => $row['h_nick'], 'grade' => $row['h_grade'], 'posttime' => $row['pubtime'], 'title' => $row['title'], 'context' => $row['content'], 'messages' => $row['replycount'], 'tid' => $row['id'], 'anonymous' => $row['anonymous'], 'medias' => $row['h_img_total'], 'mdata' => array(), 'collect' => '0', 'mypraise' => '0', 'praises' => '0', 'official' => Assign($row['h_official'], 0), 'identified' => Assign($row['h_identified'], 0), 'rank' => Assign($row['h_rank'], 0), 'rankname' => Assign($row['h_rankname']), 'reward' => Assign($row['rewarded'], 0), 'rewardata' => Assign($row['reward'], 0));
        $filter_count = array('uid' => Assign($params['uid'], 0), 'tag' => Assign($params['tag'], 0), 'tid' => $buffer['tid'], 'type' => 1);
Пример #6
0
<?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編號022 查現象之獲取故障點列表 ##已取消 新接口054
//
// @authors hjboss <*****@*****.**> 2015-12-17#
// @version 1.0.0
// @package hhxc
if (!defined('HHXC')) {
    die('Permission denied');
}
## 構建查詢故障點SQL
$condition_sub = array('schema' => 'car_symptom_fault', 'fields' => array('offault'), 'filter' => array('ofsymptom' => Assign($params['pheid'], 0)));
$condition = array('schema' => 'car_fault', 'fields' => array('id'), 'filter' => array('type' => array('NEQ', 7), 'id' => array('IN', SQLSub($condition_sub))), 'others' => 'LIMIT 20');
$recordset = StorageFind($condition);
if (is_array($recordset) == FALSE or empty($recordset) == TRUE) {
    $result['msg'] = MESSAGE_EMPTY;
} else {
    $result = array('code' => '101', 'data' => array());
    foreach ($recordset as $index => $row) {
        $result['data'][] = $row['id'];
    }
    if (CheckOpenID($params['openid'], $params['uid']) == TRUE) {
        Techuser_setScore($params['uid'], 2);
    }
}