Пример #1
0
 /**
  * @return array
  */
 public function get_commodity($conn)
 {
     require_once 'DBtraverser.php';
     $DBtraveser = new DBtraverser(Config_commodity::table_name, $this->where);
     $retval = $DBtraveser->excute($conn);
     $result_array = mysqli_fetch_array($retval, MYSQLI_ASSOC);
     mysqli_free_result($retval);
     return $result_array;
 }
Пример #2
0
 public static function get_user_info($conn, $username)
 {
     require_once 'Config_user.php';
     require_once 'DBtraverser.php';
     $myDBtraveser = new DBtraverser(Config_user::table_name, ' where ' . Config_user::log_name . "='{$username}'");
     $retval = $myDBtraveser->excute($conn);
     $array = mysqli_fetch_array($retval, MYSQLI_ASSOC);
     mysqli_free_result($retval);
     return $array;
 }
Пример #3
0
/**
 * 执行更新操作更新商品信息,并根据商品ID查询商品信息
 * @param 数据库连接 $conn
 * @param bigint $commodity_id
 * @param tinyint $state
 * @return array 以数组形式返回查询结果
 */
function update_commodity_state_and_return_commodity($conn, $commodity_id, $state)
{
    require_once 'class/commodity/Transaction_state_config.php';
    require_once 'class/Config_commodity.php';
    require_once 'class/DBupdater.php';
    require_once 'class/DBtraverser.php';
    $ary = array(Config_commodity::commodity_state => $state);
    $where = ' where ' . Config_commodity::id . ' = ' . "'{$commodity_id}'";
    $DBupdater = new DBupdater(Config_commodity::table_name, $ary, $where);
    $DBupdater->excute($conn);
    $DBtraveser = new DBtraverser(Config_commodity::table_name, $where);
    $retval = $DBtraveser->excute($conn);
    return mysqli_fetch_array($retval, MYSQLI_ASSOC);
}
Пример #4
0
/**
 * @param  $conn
 * @return boolean 判断当前用户是否拥有权限
 */
function loginer_isPublisher($conn, $commodity_id)
{
    $where = ' where ' . Config_commodity::id . ' = ' . "'" . $commodity_id . "'";
    $DBtraverser = new DBtraverser(Config_commodity::table_name, $where);
    $result = $DBtraverser->excute($conn);
    $array = mysqli_fetch_array($result, MYSQLI_ASSOC);
    if ($array) {
        $is_publisher = $array[Config_commodity::publisher] == $_SESSION['CURRENT_LOGIN_ID'];
    } else {
        $is_publisher = false;
    }
    mysqli_free_result($result);
    return $is_publisher;
}
Пример #5
0
function show_buy_html($commodity_id, $conn)
{
    require_once 'class/Config_commodity.php';
    require_once 'class/DBtraverser.php';
    $where = ' where ' . Config_commodity::id . ' = ' . "'" . $commodity_id . "'";
    $DBtraverser = new DBtraverser(Config_commodity::table_name, $where);
    $result = $DBtraverser->excute($conn);
    $array_commofity_info = mysqli_fetch_array($result, MYSQLI_ASSOC);
    if ($array_commofity_info) {
        require_once 'Include_picture.php';
        require_once 'class/Info_user.php';
        require_once 'class/Config_user.php';
        $acceptor_info_array = Info_user::get_user_info_by_id($conn, $_SESSION['CURRENT_LOGIN_ID']);
        $publisher_info_array = Info_user::get_user_info_by_id($conn, $array_commofity_info[Config_commodity::publisher]);
        $commodity_array_for_display = array('nickname' => $acceptor_info_array[Config_user::log_name], 'acceptor_phone' => $acceptor_info_array[Config_user::phone_number], 'publisher_name' => $publisher_info_array[Config_user::log_name], 'publisher_phone' => $array_commofity_info[Config_commodity::communication_number], 'title' => $array_commofity_info[Config_commodity::title], 'time' => get_time($array_commofity_info[Config_commodity::release_date]), 'price' => $array_commofity_info[Config_commodity::price], 'description' => $array_commofity_info[Config_commodity::description], 'description_img' => get_one_commodity_pic($conn, $array_commofity_info[Config_commodity::id]), 'img' => 'upload/avatar.png', 'id' => $commodity_id);
        return $commodity_array_for_display;
    }
}
Пример #6
0
function evaluate()
{
    require_once 'class/Injection.php';
    require_once 'class/Config_evaluation.php';
    require_once 'class/DBtraverser.php';
    require_once 'class/Config.php';
    require_once 'class/Config_transaction.php';
    include 'smarty_init.php';
    $content = '';
    //    $content = Injection::excute('content');  //评价内容
    $transaction_id = (int) $_REQUEST['transaction_id'];
    //评价交易单
    $evaluater_id = $_SESSION['CURRENT_LOGIN_ID'];
    //评价人ID
    $score1 = $_REQUEST['score1'];
    $score2 = $_REQUEST['score2'];
    $score3 = $_REQUEST['score3'];
    $score = 10;
    $conn = Config::connect();
    //判断订单是否已经存在
    $trasaction_DBtraveser = new DBtraverser(Config_transaction::table_name, ' where ' . Config_transaction::id . ' = ' . "'" . $transaction_id . "'");
    $transaction_retval = $trasaction_DBtraveser->excute($conn);
    $transaction_array = mysqli_fetch_array($transaction_retval, MYSQLI_ASSOC);
    if ($transaction_array) {
        $is_payer = $transaction_array[Config_transaction::commodity_buyer_id] == $evaluater_id ? 1 : 0;
        require_once 'class/Config_transaction.php';
        $evaluation_DBtraveser = new DBtraverser(Config_evaluation::tbl_name, ' where ' . Config_evaluation::commodity_id . ' = ' . "'" . $transaction_array[Config_transaction::choosed_id] . "'" . 'AND' . Config_evaluation::is_payer . ' = ' . "'" . $is_payer . "'");
        if (!mysqli_fetch_array($evaluation_DBtraveser->excute($conn))) {
            $evaluated = $transaction_array[Config_transaction::commodity_buyer_id] == $evaluater_id ? $transaction_array[Config_transaction::commodity_holder_id] : $transaction_array[Config_transaction::commodity_buyer_id];
            $ary = array(Config_evaluation::evaluate_time => date('Y-m-d H:i:s', time()), Config_evaluation::evaluation => $content, Config_evaluation::is_payer => $is_payer, Config_evaluation::score1 => $score1, Config_evaluation::score2 => $score2, Config_evaluation::score3 => $score3, Config_evaluation::score => $score, Config_evaluation::commodity_id => $transaction_array[Config_transaction::choosed_id], Config_evaluation::valuator => $evaluater_id, Config_evaluation::valuated => $evaluated);
            $DBadder = new DBadder(Config_evaluation::tbl_name, $ary);
            $DBadder->excute($conn);
            echo "<script language='javascript'> alert('done!');\r\n                window.history.go(-1);\r\n                </script>";
        } else {
        }
    } else {
    }
    mysqli_free_result($transaction_retval);
    mysqli_close($conn);
}
Пример #7
0
 * must get 'id'
 * id
 * multi picture
 * leave message: name time content 
 */
define('MESSAGE_EACH_PAGE', 10);
session_start();
require_once 'class/DBtraverser.php';
require_once 'class/Config_commodity.php';
include_once 'smarty_init.php';
require_once 'class/Config.php';
$conn = Config::connect();
$commodity_id = (int) $_REQUEST['id'];
$where = ' where ' . Config_commodity::id . ' = ' . "'" . $commodity_id . "'";
$DBtraverser = new DBtraverser(Config_commodity::table_name, $where);
$result = $DBtraverser->excute($conn);
$array_commofity_info = mysqli_fetch_array($result, MYSQLI_ASSOC);
if ($array_commofity_info) {
    require_once 'Include_picture.php';
    require_once 'class/Info_user.php';
    $array_pictures = get_commodity_pic($conn, $commodity_id);
    $array_message = get_leave_message($commodity_id, $conn);
    $userInfo = new Info_user();
    $username = $userInfo->get_user_logname($conn, $array_commofity_info[Config_commodity::publisher]);
    $commodity_array_for_display = array('nickname' => $username, 'title' => $array_commofity_info[Config_commodity::title], 'time' => get_time($array_commofity_info[Config_commodity::release_date]), 'price' => $array_commofity_info[Config_commodity::price], 'description' => $array_commofity_info[Config_commodity::description], 'description-img' => get_one_commodity_pic($conn, $array_commofity_info[Config_commodity::id]), 'img' => 'upload/avatar.png', 'id' => $commodity_id, 'star_numbers' => $array_commofity_info[Config_commodity::praise], 'message_numbers' => $array_commofity_info[Config_commodity::leave_message_time]);
    $smarty->assign('messages', $array_message);
    $smarty->assign('skill', $commodity_array_for_display);
    $smarty->assign('msg-total', $array_commofity_info[Config_commodity::leave_message_time]);
    $smarty->display('Reward&Market/market-skill.html');
} else {
}