Esempio n. 1
0
<?php 
require_once "../../beecloud.php";
$data = array();
$appSecret = "39a7a518-9ac8-4a9e-87bc-7885f33cf18c";
$data["app_id"] = "c5d1cba1-5e3f-4ba0-941d-9b0a371fe719";
$data["timestamp"] = time() * 1000;
$data["app_sign"] = md5($data["app_id"] . $data["timestamp"] . $appSecret);
$data["channel"] = "ALI_WEB";
$data["total_fee"] = 1;
$data["bill_no"] = "bcdemo" . $data["timestamp"];
$data["title"] = "白开水";
$data["return_url"] = "http://payservice.beecloud.cn";
//选填 optional
$data["optional"] = json_decode(json_encode(array("tag" => "msgtoreturn")));
//选填 show_url
//$data["show_url"] = "";
try {
    $result = BCRESTApi::bill($data);
    if ($result->result_code != 0) {
        echo json_encode($result);
        exit;
    }
    $htmlContent = $result->html;
    $url = $result->url;
    echo $htmlContent;
} catch (Exception $e) {
    echo $e->getMessage();
}
?>
</body>
</html>
Esempio n. 2
0
 public function orderAgency()
 {
     $data = static::returnDataArray();
     // $channel = Input::get('channel');
     // if( $channel != 'WX_NATIVE' || $channel != 'ALI_QRCODE' );
     // 	return Response::json(array( 'errCode'=>21, 'message'=>'支付方式只能选去微信或支付宝') );
     // $data["channel"] = $channel;
     $data["channel"] = "WX_NATIVE";
     // $order_id = 'dbdd5617c95a48d75575926404';
     $order_id = Input::get('order_id');
     if (!isset($order_id)) {
         return Response::json(array('errCode' => 21, 'message' => '请输入订单id'));
     }
     $order = AgencyOrder::find($order_id);
     if (!isset($order)) {
         return Response::json(array('errCode' => 22, 'message' => '该订单不存在'));
     }
     $data["bill_no"] = $order_id;
     $data["total_fee"] = (int) (($order->capital_sum + $order->service_charge_sum + $order->express_fee) * 100);
     $data['title'] = '订单代办';
     $order_auth_info = new OrderAuthInfo();
     $order_auth_info->transactionId = $data["bill_no"];
     //交易单号
     $order_auth_info->transactionFee = $data["total_fee"];
     //费用
     if (!$order_auth_info->save()) {
         return Response::json(array('errCode' => 23, 'message' => '数据库保存错误'));
     }
     Cache::put($order_id, $data, 1440);
     // dd( $data["total_fee"] );
     try {
         $result = BCRESTApi::bill($data);
         if ($result->result_code != 0) {
             return Response::json(array('errCode' => 24, 'message' => $result));
         }
         $code_url = $result->code_url;
         //生成支付链接
     } catch (Exception $e) {
         return Response::json(array('errCode' => 25, 'message' => $e->getMessage()));
     }
     $qrcode = array();
     $qrcode['bill_no'] = $data['bill_no'];
     $qrcode['code_url'] = $code_url;
     Session::put('qrcode', $qrcode);
     return Response::json(array('errCode' => 0, 'message' => 'ok', 'url' => '/beecloud/qrcode'));
 }