When using the Sina payment interface, need to create an interface, just by the summer blog a new Sina interface, the integration of the FANGWI Peer-to-peer Network Loan system, the following interface or relatively simple, just a binding authentication information interface, that is, to bind us on the Sina ID card and other information, operation steps as follows , only for summer reference learning use.
1, Background copy a button link
2,/admin/tpl/default/common/js/user.js add a jump, pay attention to the name
3, PHP adds a class, the path-->app/lib/module/collocationmodule.class.php, the code is as follows:
Public Function Adminunbinduser () {
$user _id= (int) $_get[' 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->adminunbinduser ($user _id);
}
4, add the following code in the/system/collocation/sina_collocation.php file:
function Adminunbinduser ($uid) {
Require_once (app_root_path. ' system/collocation/sina/adminunbinduser.php ');
Return Adminunbinduser ($UID);
}
5, create a new adminunbinduser in system/collocation/sina/, and the following code from
Find the service name in the/a/zjtg_php_demo/controller/controller_sina.php, copy the files from the class to the Adminubinduser ($uid), as follows:
<?php
function Adminunbinduser ($uid) {
$weibopay = new Weibopay ();
/************** Obtain the binding authentication information parameter ****************/
$service = ' unbinding_verify ';//Service Name
$version =sinapay_version;//Interface Version
$request _time=date ("Ymdhis");/Request time
$partner _id=sinapay_partner_id;//Partner Identity ID
$_input_charset=sinapay_input_charset;//parameter coded character set
$sign _type=sinapay_sign_type;//Signature Type
/**************** Business Parameter ***********************/
$identity _id=sinapay_identity_id. $uid//user identification information---the original $identity _id= $data [' identity_id '];//user identification information
$identity _type=sinapay_identity_type;//user Identity type
$verify _type= ' MOBILE ';//authentication type
$param =array ();
$param [' Service ']= $service;
$param [' Version ']= $version;
$param [' Request_time ']= $request _time;
$param [' partner_id ']= $partner _id;
$param [' _input_charset ']=$_input_charset;
$param [' Sign_type ']= $sign _type;
$param [' identity_id ']= $identity _id;
$param [' Identity_type ']= $identity _type;
$param [' Verify_type ']= $verify _type;
Ksort ($param)//To sort signature parameters
Signing a request for a SINA message
$sign = $weibopay->getsignmsg ($param, $sign _type);
Storing the signature results in an array of request Sina
$param [' sign ']= $sign;
$weibopay->write_log ("Bind authentication Information Request Parameters". Json_encode ($param));
$data = $weibopay->createcurl_data ($param); Call Createcurl_data to create the data needed to simulate a form
$result = $weibopay->curlpost (sinapay_mgs_url, $data); Submit a data submission using a mock form
$result = UrlDecode ($result);
$splitdata = Json_decode ($result, true);
$sign _type = $splitdata [' sign_type '];//signature method
Ksort ($splitdata); Ordering the signature parameters
Print_r ($param);p rint_r ($splitdata);d ie ();
if ($weibopay->checksignmsg ($splitdata, $sign _type)) {
if ($splitdata ["response_code"] = = ' apply_success ') {//successful
return $splitdata;
Exit ();
}else
{
Business processing failed
return $splitdata;
Exit ();
}
} else {
Die ("Sing error! " );
}
}
The file in/a/zjtg_php_demo/controller/controller_sina.php is an example of the interface provided by Sina, just pass a UID, others do not change.