|
|
|
|
@ -4,15 +4,20 @@ namespace App\Http\Controllers\Customer;
|
|
|
|
|
|
|
|
|
|
use App\Events\RechargeSucceed;
|
|
|
|
|
use App\Http\Controllers\Controller;
|
|
|
|
|
use App\Models\Orders;
|
|
|
|
|
use App\Models\Recharge;
|
|
|
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
|
|
|
|
|
|
class PayCallbackController extends Controller
|
|
|
|
|
{
|
|
|
|
|
public function index() {
|
|
|
|
|
public function index()
|
|
|
|
|
{
|
|
|
|
|
$xml = isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : file_get_contents("php://input");
|
|
|
|
|
Log::info($xml);
|
|
|
|
|
$notify = new \NotifyPub();
|
|
|
|
|
$array = json_decode(json_encode(simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
|
|
|
|
|
$order = (new Orders())->where("serial", $array["out_trade_no"])->first();
|
|
|
|
|
$notify = new \NotifyPub($order->project_id);
|
|
|
|
|
Log::info($xml);
|
|
|
|
|
//存储微信的回调
|
|
|
|
|
$notify->saveData($xml);
|
|
|
|
|
|
|
|
|
|
@ -35,7 +40,7 @@ class PayCallbackController extends Controller
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$recharge_serial = $notify->data["out_trade_no"];
|
|
|
|
|
$pay = (new Recharge())->where("serial",$recharge_serial)->first();
|
|
|
|
|
$pay = (new Recharge())->where("serial", $recharge_serial)->first();
|
|
|
|
|
if (!$pay) exit();
|
|
|
|
|
if ($pay->paid_at) exit();
|
|
|
|
|
$transaction_id = $notify->data["transaction_id"];
|
|
|
|
|
|