王总上门按摩后台代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

169 lines
3.7 KiB

<?php
namespace app\massage\controller;
use app\AdminRest;
use app\ApiRest;
use app\fdd\model\FddAgreementRecord;
use app\fdd\model\FddAttestationRecord;
use app\fdd\model\FddConfig;
use app\massage\model\FddRealnameCallback;
use app\virtual\model\PlayRecord;
use longbingcore\wxcore\Fdd;
use longbingcore\wxcore\PayNotify;
use think\App;
use think\facade\Db;
use WxPayApi;
class CallBack extends ApiRest
{
protected $app;
public function __construct ( App $app )
{
$this->app = $app;
}
/**
* @author chenniang
* @DataTime: 2022-12-08 15:33
* @功能说明:发大大实名认证回调
*/
public function fddAttestationCallBack(){
$inputs = $_POST;
$dis = [
'customer_id' => $inputs['customerId'],
'status' => 1
];
$att_model = new FddAttestationRecord();
$record = $att_model->dataInfo($dis);
if(!empty($record)){
if($inputs['status']==2){
$update['status'] = 2;
$core = new Fdd($record['uniacid']);
$res = $core->ApplyCert($record['customer_id'],$record['transactionNo']);
if(isset($res['code'])&&$res['code']==1){
$update['status'] = 3;
}
}
$update['statusDesc'] = $inputs['statusDesc'];
$update['sign'] = base64_encode($inputs['sign']);
// $update['result_code']= $inputs['result_code'];
$att_model->dataUpdate($dis,$update);
}
$res = ['code'=>0,'msg'=>'成功'];
echo json_encode($res);exit;
}
/**
* @author chenniang
* @DataTime: 2023-04-14 11:24
* @功能说明:发大大签署回调
*/
public function fddSignCallBack(){
$inputs = $_POST;
$dis = [
'transaction_id' => $inputs['transaction_id'],
'contract_id' => $inputs['contract_id'],
'status' => 1
];
$model = new FddAgreementRecord();
$data = $model->dataInfo($dis);
if(!empty($data)){
$update = [
'result_code' => $inputs['result_code'],
'result_desc' => $inputs['result_desc'],
'msg_digest' => base64_decode($inputs['msg_digest']),
];
//签署成功
if($inputs['result_code']==3000){
$update['status'] = 2;
}
if(!empty($inputs['download_url'])){
$update['download_url'] = $inputs['download_url'];
}
if(!empty($inputs['viewpdf_url'])){
$update['viewpdf_url'] = $inputs['viewpdf_url'];
}
$model->dataUpdate($dis,$update);
//合同归档
if(!empty($update['status'])&&$update['status']==2){
$attestation_model = new FddAttestationRecord();
$res = $attestation_model->ContractFiling($data['user_id'],$data['uniacid'],$data['admin_id']);
//归档成功
if(empty($res['code'])){
$admin_model = new \app\massage\model\Admin();
if(!empty($data['admin_id'])){
$admin = $admin_model->dataInfo(['id'=>$data['admin_id']]);
}else{
$admin = $admin_model->dataInfo(['is_admin'=>1]);
}
$model->dataUpdate(['id'=>$data['id']],['status'=>3,'end_time'=>$admin['agreement_time']*365*86400+time()]);
}
}
}
$res = ['code'=>0,'msg'=>'成功'];
echo json_encode($res);exit;
}
}