if ($params['result'] == 'success') { message('支付成功!', $_W['siteroot'] . 'app/' . $url, 'success'); $goodsid = pdo_fetchall('SELECT goodsid FROM ' . tablename('shop_order_goods') . ' WHERE orderid = :orderid', array(':orderid' => $_W['orderid'])); $result = array_unique($goodsid); foreach ($result as $item){ $goodssn = pdo_fetchall('SELECT goodssn FROM ' . tablename('ewei_shop_goods') . ' WHERE goodsid = :goodsid', array(':goodsid' => $item)); foreach ($goodssn as $value) { if($value){ $flag = 1; } } } if($flag) { $url="http://uatwebapi.51cpk.com/api/OrderAPI/PlaceYGDOrderWithPayment"; $appSecret = '1d89f93ed41d46a5896a8652942fa05d'; $RequestString[] = array( "ProductDetails" => [array( "ItemId" => 0, "ProductId" => 0, "ProductCode" => "THW075009", "Quantity" => 1, "RegisterCode" => null, "WarehouseType" => 0, "UnitPrice" => 10.0, "UnitPriceType" => 1 )], "OrderUserName" =>"apidemo", "OrderNotes" =>null, "ShipFromName" =>"testShip", "ShipFromEmail" =>"apidemo@gmail.com", "ShipFromPhone" =>null, "ShipFromCellPhone" =>"13333333333", "ShipFromAddress" =>"Anchor Wharf Yeo St", "ShipFromAddress2" =>null, "ShipFromAddress3" =>null, "ShipFromCity" =>"London", "ShipFromProvince" =>null, "ShipFromPostalCode" =>"E3 3QR", "ShipFromCountry" =>null, "ShipToName" =>"测试人员", "ShipToAddress" =>"上海市 徐汇区", "ShipToCity" =>"上海", "ShipToProvince" =>null, "ShipToPostalCode" =>"000000", "ShipToAreaCode" =>null, "ShipToProvinceId" =>0, "ShipToCountry" =>null, "ShipToIDCardType" =>0, "ShipToIDCardNumber" =>"310111199911111111", "ShipToQQ" =>null, "ShipToWechat" =>null, "ShipToEmail" =>"apidemo2@gmail.com", "ShipToPhone" =>null, "ShipToCellPhone" =>"13333333331", "PurchaseOrderNumber" =>"TEST20190214001", "ServiceProviderId" =>-100, "CustomerNote" =>null, "OrderTypeId" =>0, "IsSaveDeliveryAddress" =>false, "IsSaveCollectionAddress" =>false, "BondedInfo" =>array( "BuyerName" =>"tester", "BuyerIDCardNumber" =>"310111199911111111", "ClientCustomCode" =>"1111111111", "ClientCustomName" =>"51CPK", "ClientCompanyCode" =>"1105960Z48", "ClientCompanyName" =>"北京海星淘科技有限公司", "PaymentMethod" =>"支付宝", "PaymentUniqueId" =>"1234567890", "PaymentAmount" =>100.0, "ShippingFee" =>0.0, "DutiableDiscount" =>10.0 ) ); $datadata = json_encode($RequestString,JSON_UNESCAPED_UNICODE); $sign = strtoupper(md5($datadata.$appSecret)); $param=array( 'AppKey' => 259835, 'RequestString' =>$datadata, 'Sign' => $sign ); $data = json_encode($param,JSON_UNESCAPED_UNICODE); $ch = curl_init(); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json; charset=utf-8", "Content-Length:". strlen($data))); $message=curl_exec($ch); return $message; } } else { message('支付失败!', $_W['siteroot'] . 'app/' . $url, 'error'); } }
https://www.cgtblog.com/wx/3081.html