Example #1
0
 * 付费平台记录同步
 */
require_once 'lib/WriteLog.lib.php';
require_once 'tasks/charge/ChargeDb.class.php';
$jsonCharge = isset($_POST['transdata']) ? $_POST['transdata'] : '';
if (empty($jsonCharge)) {
    $jsonCharge = file_get_contents("php://input");
    //isset($_POST['charge'])?$_POST['charge']:'';
}
// $jsonCharge = file_get_contents("php://input");//isset($_POST['charge'])?$_POST['charge']:'';
// $jsonCharge = '{"amt":"1.0","merid":"1001","mername":"测试","appid":"1001","appname":"应用场景","chargepoint":"","chargepointname":"","operators":"","orderdate":"2012-11-01 23:32:50","orderid":"121101233244538","ordersatus":"202","paytype":"100000000016","paytypename":"短信","phone":"","province":"","reqOrderId":"123456789","sign":"…………….."}';
Log::write('chargesync:: jsonCharge:' . $jsonCharge, 'debug');
if (empty($jsonCharge)) {
    Log::write('chargesync:: charge is empty', 'error');
    $result = array('resultCode' => 300);
    echo json_encode($result);
    exit;
}
$chargeDb = new ChargeDb();
$jsonCharge = stripslashes($jsonCharge);
$arrChargeRecord = json_decode($jsonCharge, true);
$chargeDb->setNChargeRecord($arrChargeRecord);
$bResult = $chargeDb->recordNCharge();
if (!$bResult) {
    Log::write('chargesync:: recordNCharge failed', 'error');
    $result = array('resultCode' => 300);
    echo json_encode($result);
    exit;
}
$result = array('resultCode' => 200);
echo json_encode($result);
Example #2
0
if (empty($jsonCharge)) {
    $jsonCharge = file_get_contents("php://input");
    //isset($_POST['charge'])?$_POST['charge']:'';
}
// $jsonCharge = file_get_contents("php://input");//isset($_POST['charge'])?$_POST['charge']:'';
/*$jsonCharge = '{"exorderno":"MN20198211142707956","transid":"02112080114270900125",'
			.' "waresid":"10001400123001100014","chargepoint":1,"feetype":0,"money":100,"result":0,"transtype":0,'
			.' "transtime":"2012-08-01 14:30:36","count":1,"sign":"aaf137a1134a5553bd207b90469c95c2"}';
*/
Log::write('chargerecord:: jsonCharge:' . $jsonCharge, 'debug');
if (empty($jsonCharge)) {
    Log::write('chargerecord:: charge is empty', 'error');
    echo 'FAILURE';
    exit;
}
$chargeDb = new ChargeDb();
$jsonCharge = stripslashes($jsonCharge);
$arrChargeRecord = json_decode($jsonCharge, true);
$chargeDb->setChargeRecord($arrChargeRecord, $strSgin);
$bResult = $chargeDb->recordCharge();
if (!$bResult) {
    Log::write('chargerecord:: recordCharge failed', 'error');
    echo 'FAILURE';
    exit;
}
// 	require_once 'tasks/Records/RecordFactory.class.php';
// 	require_once 'tasks/Exorder/ExorderDb.class.php';
// 	$rf = new RecordFactory();
// 	$exorderDb = new ExorderDb();
// 	$exorder = $exorderDb->getExorderById($strExorder);
// 	if(!$exorder){