|
|
@@ -164,6 +164,76 @@ class AliCallBackController extends \Phalcon\Mvc\Controller |
|
|
|
$model->update_at = date("Y-m-d H:i:s"); |
|
|
|
$model->save(); |
|
|
|
|
|
|
|
$response = [ |
|
|
|
"code" => "10000", |
|
|
|
"msg" => "Success", |
|
|
|
]; |
|
|
|
break; |
|
|
|
case "alipay.planet.ecocampus.spi.debt.sync": |
|
|
|
//SPI::交易通知 |
|
|
|
$this->logger(["params" => $params], 'alipay.planet.ecocampus.spi.debt.sync', true); |
|
|
|
$biz_content = json_decode($params["biz_content"], true); |
|
|
|
$this->logger(["biz_content" => $biz_content], 'alipay.planet.ecocampus.spi.debt.sync', true); |
|
|
|
|
|
|
|
$isHasSchool = SelfSupportForSchoolInfo::findFirst("school_code = '{$biz_content["school_code"]}'"); |
|
|
|
if (empty($isHasSchool)) { |
|
|
|
$response = [ |
|
|
|
"code" => "40000", |
|
|
|
"msg" => "Business Failed", |
|
|
|
"sub_code" => "20000", |
|
|
|
"sub_msg" => "not found school records", |
|
|
|
]; |
|
|
|
break; |
|
|
|
} |
|
|
|
$this->logger(["isHasSchool" => $isHasSchool, "school_code" => $biz_content["school_code"]], 'alipay.planet.ecocampus.spi.debt.sync', true); |
|
|
|
|
|
|
|
//获取用户身份信息 |
|
|
|
$iaHasUserIdentity = SelfSupportForUserFaceInfo::findFirst("user_id = '{$biz_content["face_uid"]}'"); |
|
|
|
if (empty($iaHasUserIdentity)) { |
|
|
|
$response = [ |
|
|
|
"code" => "40000", |
|
|
|
"msg" => "Business Failed", |
|
|
|
"sub_code" => "20000", |
|
|
|
"sub_msg" => "not found user records", |
|
|
|
]; |
|
|
|
break; |
|
|
|
} |
|
|
|
$userIdentityId = $iaHasUserIdentity->user_identity_id; //身份id |
|
|
|
|
|
|
|
$userIdentity = UserIdentity::findFirst("id = '{$userIdentityId}'"); |
|
|
|
$this->logger(["userIdentity1" => $userIdentity], 'alipay.planet.ecocampus.spi.debt.sync', true); |
|
|
|
|
|
|
|
// 修改 / 新增`自营-学校-订单表`数据 |
|
|
|
$out_order_no = $biz_content["out_order_no"] ?? ""; |
|
|
|
$model = SelfSupportForSchoolOrd::findFirst("out_order_no = '$out_order_no'"); |
|
|
|
if (empty($model)) { |
|
|
|
$model = new SelfSupportForSchoolOrd(); |
|
|
|
$model->create_at = date("Y-m-d H:i:s"); |
|
|
|
} |
|
|
|
$model->enterprise_id = $userIdentity->enterprise_id; |
|
|
|
$model->uid = $userIdentity->uid; |
|
|
|
$model->user_identity_id = $userIdentityId; |
|
|
|
$model->out_order_no = $out_order_no; |
|
|
|
$model->trade_no = ""; |
|
|
|
$model->consumer = $biz_content["roster_name"] ?? ""; |
|
|
|
$model->buyer_id = $biz_content["face_uid"] ?? ""; |
|
|
|
$model->seller_id = ""; |
|
|
|
$model->device_sn = $biz_content["device_sn"] ?? ""; |
|
|
|
$model->school_name = $biz_content["school_name"] ?? ""; |
|
|
|
$model->school_code = $biz_content["school_code"] ?? ""; |
|
|
|
$model->store_business_scenario = $biz_content["business_scene"] ?? ""; |
|
|
|
$model->store_name = $biz_content["store_name"] ?? ""; |
|
|
|
$model->cp_store_id = $biz_content["store_code"] ?? ""; |
|
|
|
$model->merchant_name = $biz_content["merchant_name"] ?? ""; |
|
|
|
$model->cp_merchant_id = $biz_content["merchant_code"] ?? ""; |
|
|
|
$model->trade_amount = $biz_content["debt_amount"] ?? ""; |
|
|
|
$model->face_time = $biz_content["face_scan_time"] ?? ""; |
|
|
|
$model->order_status = 1; //TODO::待支付状态 |
|
|
|
$model->debt_business_code = ""; |
|
|
|
$model->debt_business_msg = $biz_content["debt_msg"] ?? ""; |
|
|
|
$model->update_at = date("Y-m-d H:i:s"); |
|
|
|
$model->save(); |
|
|
|
|
|
|
|
$response = [ |
|
|
|
"code" => "10000", |
|
|
|
"msg" => "Success", |
|
|
|