第一步、到富友官方下载开发文档 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>
本博客记录本人研究学习历程,拒绝吐槽!转载请附上本帖地址。