Example #1
0
function dobid2($deal_id, $bid_money, $bid_paypassword)
{
    $root = check_dobid2($deal_id, $bid_money, $bid_paypassword);
    if ($root["status"] == 0) {
        return $root;
    } elseif ($root["status"] == 2) {
        $root['jump'] = APP_ROOT . "/index.php?ctl=collocation&act=RegisterCreditor&deal_id={$deal_id}&user_id=" . $GLOBALS['user_info']['id'] . "&bid_money={$bid_money}&bid_paypassword={$bid_paypassword}";
        return $root;
    }
    $root["status"] = 0;
    $bid_money = floatval($bid_money);
    $bid_paypassword = strim($bid_paypassword);
    if ($bid_money > $GLOBALS['user_info']['money']) {
        $root["show_err"] = $GLOBALS['lang']['MONEY_NOT_ENOUGHT'];
        return $root;
    }
    $data['user_id'] = $GLOBALS['user_info']['id'];
    $data['user_name'] = $GLOBALS['user_info']['user_name'];
    $data['deal_id'] = $deal_id;
    $data['money'] = $bid_money;
    $data['create_time'] = TIME_UTC;
    $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_load", $data, "INSERT");
    $load_id = $GLOBALS['db']->insert_id();
    if ($load_id > 0) {
        //更改资金记录
        $msg = sprintf('编号%s的投标,付款单号%s', $deal_id, $load_id);
        require_once APP_ROOT_PATH . "system/libs/user.php";
        modify_account(array('money' => -$bid_money, 'score' => 0), $GLOBALS['user_info']['id'], $msg);
        dobid2_ok($deal_id, $GLOBALS['user_info']['id']);
        //$root["show_err"] = $GLOBALS['lang']['ERROR_TITLE'];
        $root["status"] = 1;
        //0:出错;1:正确;
        return $root;
        //showSuccess($GLOBALS['lang']['DEAL_BID_SUCCESS'],$ajax,url("index","deal",array("id"=>$id)));
    } else {
        $root["show_err"] = $GLOBALS['lang']['ERROR_TITLE'];
        return $root;
    }
}
 /**
  * 登记债权人
  * @param int $user_id  用户ID
  * @param int $deal_id  标的ID
  * @param float $bid_money 投资金额
  * @param float $bid_paypassword 支付密码
  * @return string
  */
 public function RegisterCreditor()
 {
     $user_id = intval(strim($_REQUEST['user_id']));
     $deal_id = intval(strim($_REQUEST['deal_id']));
     $bid_money = floatval(strim($_REQUEST['bid_money']));
     $bid_paypassword = strim($_REQUEST['bid_paypassword']);
     require_once APP_ROOT_PATH . "app/Lib/deal_func.php";
     //print_r($_REQUEST);
     //常用状态检查
     $result = check_dobid2($deal_id, $bid_money, $bid_paypassword);
     //print_r($result); exit;
     if ($result['status'] == 0) {
         showErr($result['show_err'], 0);
     } else {
         $deal = get_deal($deal_id, 0);
         // $GLOBALS['db']->getRow("select * from ".DB_PREFIX."deal where id = ".$deal_id);
         if (!empty($deal)) {
             if (!empty($deal['ips_bill_no'])) {
                 $user = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $user_id);
                 if (!empty($user) && !empty($user['ips_acct_no'])) {
                     $class_name = 'Ips';
                     require_once APP_ROOT_PATH . "system/collocation/" . $class_name . "_collocation.php";
                     $collocation_class = $class_name . "_collocation";
                     $collocation_object = new $collocation_class();
                     $collocation_code = $collocation_object->RegisterCreditor($user_id, $deal_id, $bid_money);
                     print_r($collocation_code);
                 } else {
                     showErr('用户不存在,或未申请资金托管帐户', 0);
                 }
             } else {
                 showErr('该标还未发布托管登记', 0);
             }
         } else {
             showErr('标的ID不存在:' . $deal_id, 0);
         }
     }
 }
Example #3
0
function dobid2($deal_id, $bid_money, $bid_paypassword, $is_pc = 0)
{
    $root = check_dobid2($deal_id, $bid_money, $bid_paypassword, $is_pc);
    if ($root["status"] == 0) {
        return $root;
    } elseif ($root["status"] == 2) {
        $root['jump'] = APP_ROOT . "/index.php?ctl=collocation&act=RegisterCreditor&deal_id={$deal_id}&user_id=" . $GLOBALS['user_info']['id'] . "&bid_money=" . $root['bid_money'] . "&bid_paypassword={$bid_paypassword}" . "&from=" . $GLOBALS['request']['from'];
        $root['jump'] = str_replace("/mapi", "", SITE_DOMAIN . $root['jump']);
        return $root;
    }
    $root["status"] = 0;
    $bid_money = floatval($root['bid_money']);
    $bid_paypassword = strim($bid_paypassword);
    if ($bid_money > $GLOBALS['user_info']['money']) {
        $root["show_err"] = $GLOBALS['lang']['MONEY_NOT_ENOUGHT'];
        return $root;
    }
    $data['user_id'] = $GLOBALS['user_info']['id'];
    $data['user_name'] = $GLOBALS['user_info']['user_name'];
    $data['deal_id'] = $deal_id;
    $data['money'] = $bid_money;
    $insertdata = return_deal_load_data($data, $GLOBALS['user_info'], $root['deal']);
    $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_load", $insertdata, "INSERT");
    $load_id = $GLOBALS['db']->insert_id();
    if ($load_id > 0) {
        //更改资金记录
        $msg = '[<a href="' . $root['deal']['url'] . '" target="_blank">' . $root['deal']['name'] . '</a>]的投标,付款单号' . $load_id;
        require_once APP_ROOT_PATH . "system/libs/user.php";
        modify_account(array('money' => -$bid_money, 'lock_money' => $bid_money), $GLOBALS['user_info']['id'], $msg, 2);
        dobid2_ok($deal_id, $GLOBALS['user_info']['id']);
        //$root["show_err"] = $GLOBALS['lang']['ERROR_TITLE'];
        $root["status"] = 1;
        //0:出错;1:正确;
        return $root;
        //showSuccess($GLOBALS['lang']['DEAL_BID_SUCCESS'],$ajax,url("index","deal",array("id"=>$id)));
    } else {
        $root["show_err"] = $GLOBALS['lang']['ERROR_TITLE'];
        return $root;
    }
}