示例#1
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編號065 更新用戶積分和等級信息 ##代替051
//
// @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 {
    $condition = array('schema' => 'hh_techuser', 'fields' => array('*', '(SELECT title FROM hh_score WHERE dengji=grade) AS h_grade', '(SELECT title FROM hh_rank WHERE dengji=rankname) AS h_rankname'), 'filter' => array('id' => Assign($params['uid'], 0)));
    $record = StorageFindOne($condition);
    if (is_array($record) and empty($record) == FALSE) {
        $result = array('code' => '101', 'grade' => $record['h_grade'], 'score' => $record['score'], 'percent' => $record['percent'], 'needscore' => $record['needscore'], 'official' => Assign($record['type'], 0), 'identified' => Assign($record['identified'], 0), 'rank' => Assign($record['rank'], 0), 'rankname' => Assign($record['h_rankname']), 'userreward' => Techuser_viewRankScore(Assign($record['rankscore'], 0)));
    }
}
示例#2
0
if (CheckOpenID($params['openid'], $params['uid']) == FALSE) {
    $result['msg'] = MESSAGE_WARNING;
} else {
    if ($params['reward'] == 1) {
        $result['msg'] = '该回复已经被采纳!';
    } else {
        $info_tid = StorageFindID('hh_techforum_list', Assign($params['tolistid'], 0));
        $user_uid = StorageFindID('hh_techuser', Assign($params['uid'], 0));
        $user_touid = StorageFindID('hh_techuser', Assign($params['touid'], 0));
        $info_tid = StorageFindID('hh_techforum', Assign($params['tid'], 0));
        if ($info_tid['rewarded'] == 1) {
            die(JsonEncode(array('code' => '100', 'msg' => '该回复已经被采纳!')));
        }
        ## 設置回帖的採納狀態
        $fields_tolist = array('adopt' => 1);
        StorageEditByID('hh_techforum_list', $fields_tolist, Assign($params['tolistid'], 0));
        ## 添加會貼者之可兌換積分
        $message = sprintf(RANKSCORE_ADOPTED, $info_tid['title'], SafeUsername($user_uid), Techuser_viewRankScore($params['reward']));
        //Techuser_setRankscore(Assign($params['touid'], 0), $params['reward'], $message, TRUE);
        Techuser_setRankByScore(Assign($params['touid'], 0), Techuser_viewRankScore($params['reward']), $message);
        ## 設置主題悬赏狀態
        $fields_tid = array('rewarded' => 1);
        StorageEditByID('hh_techforum', $fields_tid, Assign($params['tid'], 0));
        ## 記錄樓主採納日誌
        $message = sprintf(RANKSCORE_ADOPT, SafeUsername($user_touid), Techuser_viewRankScore($params['reward']));
        Techuser_setRankscore(Assign($params['uid'], 0), 0, $message);
        ## 添加回帖者經驗值
        Techuser_setRank($params['touid'], 2);
        $result = array('code' => '101', 'msg' => MESSAGE_SUCCESS);
    }
}
示例#3
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編號112 懸賞值列表
//
// @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 {
    $result = array('code' => '101', 'data' => array());
    $record = StorageFindID('hh_techuser', $params['uid']);
    $buffer = array();
    $scores = array(50, 100, 150, 200, 300, 500);
    foreach ($scores as $score) {
        if ($score < Techuser_viewRankScore($record['rankscore'])) {
            $buffer['datavalue'][] = $score;
        }
    }
    $buffer['allreward'] = $record['rankscore'];
    $buffer['changevalue'] = RANK_RS2R;
    $result['data'][] = $buffer;
    //$result['msg'] = sprintf(ASK_MESSAGE, $record['rankscore'], RANK_RS2R);
}