|
@@ -3,10 +3,7 @@ |
|
|
namespace SRVX\Api\Controllers; |
|
|
namespace SRVX\Api\Controllers; |
|
|
|
|
|
|
|
|
use SRVX\Model\SelfSupportForUserFaceInfo; |
|
|
use SRVX\Model\SelfSupportForUserFaceInfo; |
|
|
use SRVX\Msg; |
|
|
|
|
|
use SRVX\Service\AliBPass\demo\AliEcoService; |
|
|
|
|
|
use SRVX\Service\Pay\EasyAlipayService; |
|
|
use SRVX\Service\Pay\EasyAlipayService; |
|
|
use SRVX\Service\Pay\PayService; |
|
|
|
|
|
use SRVX\Traits\BasisFun; |
|
|
use SRVX\Traits\BasisFun; |
|
|
|
|
|
|
|
|
class CallBackController extends \Phalcon\Mvc\Controller |
|
|
class CallBackController extends \Phalcon\Mvc\Controller |
|
@@ -165,7 +162,7 @@ class CallBackController extends \Phalcon\Mvc\Controller |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 支付宝 - 公共异步回调 |
|
|
|
|
|
|
|
|
* 微信 - 公共异步回调 |
|
|
*/ |
|
|
*/ |
|
|
public function wxpayAsyncNotifyCallBackAction() |
|
|
public function wxpayAsyncNotifyCallBackAction() |
|
|
{ |
|
|
{ |
|
@@ -173,9 +170,84 @@ class CallBackController extends \Phalcon\Mvc\Controller |
|
|
$this->logger($args, 'wxpayAsyncNotifyCallBack', true); |
|
|
$this->logger($args, 'wxpayAsyncNotifyCallBack', true); |
|
|
|
|
|
|
|
|
if ($this->request->isPost()) { |
|
|
if ($this->request->isPost()) { |
|
|
$data = file_get_contents('php://input'); |
|
|
|
|
|
$data = json_decode($data, true); |
|
|
|
|
|
$this->logger($data, 'wxpayAsyncNotifyCallBack_post', true); |
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
$data = file_get_contents('php://input'); |
|
|
|
|
|
$data = json_decode($data, true); |
|
|
|
|
|
if ($data["event_type"] == "TRANSACTION.SUCCESS") { |
|
|
|
|
|
|
|
|
|
|
|
$ciphertext=(new \SRVX\Service\Pay\AesUtilService())->decryptToString($data['resource']['associated_data'],$data['resource']['nonce'],$data['resource']['ciphertext']); |
|
|
|
|
|
//转数组 |
|
|
|
|
|
$res = json_decode($ciphertext,true); |
|
|
|
|
|
logger(json_encode([ |
|
|
|
|
|
"msg" => "异步回调", |
|
|
|
|
|
"data" => $data, |
|
|
|
|
|
"res" => $res |
|
|
|
|
|
], 320), 'common_alipay_sync_notify', true); |
|
|
|
|
|
|
|
|
|
|
|
if(!empty($res['out_trade_no']) and isset($res['trade_state']) and $res['trade_state']=='SUCCESS') |
|
|
|
|
|
{ |
|
|
|
|
|
//成功回调 |
|
|
|
|
|
dd($res); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}catch (\Exception $e) { |
|
|
|
|
|
logger(json_encode([ |
|
|
|
|
|
"msg" => "异步回调异常", |
|
|
|
|
|
"data" => $params ?? [], |
|
|
|
|
|
"exception" => $e->getMessage() |
|
|
|
|
|
], 320), 'wxpay_sync_notify_exception', true); |
|
|
|
|
|
//回調異常 |
|
|
|
|
|
echo "fail"; |
|
|
|
|
|
die(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 支付宝-行业云-云支付- 交易完成回调 |
|
|
|
|
|
*/ |
|
|
|
|
|
public function cloudpayAliPayCallBackAction() |
|
|
|
|
|
{ |
|
|
|
|
|
$args = $this->request->get(); |
|
|
|
|
|
$this->logger($args, 'cloudpayAliPayCallBackAction', true); |
|
|
|
|
|
if ($this->request->isPost()) { |
|
|
|
|
|
switch ($_POST["msg_method"] ?? ""){ |
|
|
|
|
|
case "alipay.commerce.educate.service.status.changed" : |
|
|
|
|
|
$biz_content = json_decode($_POST["biz_content"], true); |
|
|
|
|
|
$selfSupportForSchoolInfo = SelfSupportForUserFaceInfo::findFirst("user_id = '{$biz_content["user_id"]}' and school_std_code = '{$biz_content["school_std_code"]}'"); |
|
|
|
|
|
if (!empty($selfSupportForSchoolInfo)) { |
|
|
|
|
|
if ($biz_content["service_name"] == "SCHOOL_FACE_PASS_OPEN") { |
|
|
|
|
|
//一脸通行开通 |
|
|
|
|
|
$selfSupportForSchoolInfo->school_face_pass_status = "OPEN"; |
|
|
|
|
|
} |
|
|
|
|
|
if ($biz_content["service_name"] == "SCHOOL_FACE_PASS_CLOSE") { |
|
|
|
|
|
//一脸通行关闭 |
|
|
|
|
|
$selfSupportForSchoolInfo->school_face_pass_status = "CLOSE"; |
|
|
|
|
|
} |
|
|
|
|
|
if ($biz_content["service_name"] == "SCHOOL_FACE_PAYMENT_OPEN") { |
|
|
|
|
|
//校园刷脸支付开通 |
|
|
|
|
|
$selfSupportForSchoolInfo->school_face_payment_status = "OPEN"; |
|
|
|
|
|
} |
|
|
|
|
|
if ($biz_content["service_name"] == "SCHOOL_FACE_PAYMENT_CLOSE") { |
|
|
|
|
|
//校园刷脸支付关闭 |
|
|
|
|
|
$selfSupportForSchoolInfo->school_face_payment_status = "CLOSE"; |
|
|
|
|
|
} |
|
|
|
|
|
$selfSupportForSchoolInfo->save(); |
|
|
|
|
|
//TODO::通知行业云 alipay.planet.ecocampus.api.roster.signUpInfo(签约信息同步) |
|
|
|
|
|
// (new AliEcoService())->alipayPlanetEcocampusApiRosterSignUpInfo( |
|
|
|
|
|
// $selfSupportForSchoolInfo->user_id, $selfSupportForSchoolInfo->parent_user_id, |
|
|
|
|
|
// $selfSupportForSchoolInfo->parent_logon_id, $selfSupportForSchoolInfo->user_identity_id, |
|
|
|
|
|
// $selfSupportForSchoolInfo->user_identity_id, $selfSupportForSchoolInfo->school_code, |
|
|
|
|
|
// $args["school_name"], $args["face_open_status"], $args["scan_face_pay_status"] |
|
|
|
|
|
// ); |
|
|
|
|
|
} |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
$this->logger($_POST, 'alipayCommonCallBack_post', true); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
echo "success"; |
|
|
|
|
|
die(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |