方维P2P添加富友金账户接口实例

第一步、到富友官方下载开发文档 open.fuiou.com/jzh/index.d…

第二步、准备为系统添加销户功能

创建接口文件 system\collocation\fuyou\UserCancel.php

function UserCancel($cfg,$user_id,$post_url){
    $ReturnURL= SITE_DOMAIN.APP_ROOT."/index.php?ctl=collocation&act=response&class_name=Fuyou&class_act=UserCancel&from=".$_REQUEST['from'];
    $NotifyURL= SITE_DOMAIN.APP_ROOT."/index.php?ctl=collocation&act=notify&class_name=Fuyou&class_act=UserCancel&from=".$_REQUEST['from'];
    $user = array();
    $user = get_user_info("*","is_delete=0 and id=".$user_id);
    
    $data['ver']='1.00';
    $data['code']='userCancel';
    if($_GET["from"]!='wap'){
        $data['client_tp'] = '0';
    }else{//wap
        $data['client_tp'] = '1';
    }
    $data['mchnt_cd'] = $cfg['mchnt_cd'];
    $data['mchnt_txn_ssn'] = date("YmdHis").$user_id;
    $data['login_id'] = $user["ips_acct_no"];
    $data['page_notify_url'] = $ReturnURL;

    $sign=$data['client_tp'].'|'.$data['code'].'|'.$data['login_id'].'|'.$data['mchnt_cd'].'|'.$data['mchnt_txn_ssn'].'|'.$data['page_notify_url'].'|'.$data['ver'];
      
    $data['signature'] = rsaSign($sign);
        
    $html = '<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8" /></head><body>
		<form name="form1" id="form1" method="post" action="'.$post_url.'" target="_self" style="display:;">';
    foreach ($data as $key=>$val){
        if($key!="create_time" && $key!="user_id" && $key!="ptrdbnkcode"){
            $html=$html.'<input type="hidden" name="'.$key.'" value="'.$val.'" />';
        }
    }
    $html = $html.'<input type="submit" value="提交" /></form></body></html>
		<script language="javascript">document.form1.submit();</script>';

    return $html;
}
复制代码

第三步、在system\collocation\Fuyou_collocation.php中创建调用

/*销户  */
public function UserCancel($user_id){
    require_once(APP_ROOT_PATH.'system/collocation/fuyou/UserCancel.php');
    return UserCancel($this->cfg,$user_id,$this->post_url);
}
复制代码

并在该文件判断class后拿到返回信息

elseif ($class_act == 'UserCancel'){
    $str3Req = $_REQUEST;
    echo "<br/>失败,错误码:".$str3Req['resp_code']."<br/>错误信息:".$str3Req['resp_desc'];exit;
}
复制代码

第四步、在app\Lib\module\collocationModule.class.php中添加申明

public function UserCancel(){
    $user_id = intval(strim($_REQUEST['user_id']));

    $class_name = getCollName();
    require_once APP_ROOT_PATH."system/collocation/".$class_name."_collocation.php";
	$collocation_class = $class_name."_collocation";
    $collocation_object = new $collocation_class();
    
    $collocation_code = $collocation_object->UserCancel($user_id);
    print_r( $collocation_code);
}
复制代码

第五步、在模板中调用接口

<a href="index.php?ctl=collocation&act=UserCancel&user_id={$user_info.id}">申请销户</a>

本博客记录本人研究学习历程,拒绝吐槽!转载请附上本帖地址。

转载于:https://juejin.im/post/5bd5e905f265da0ad701f0d0

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值