程序代码里面 除了线下支付,增加了4个线上支付方式
1、新增短信接口:短信宝、云片短信、网建短信。
2、新增阿里API实名认证,支持开启或关闭。
3、新增阿里API银行卡实名认证,支持开启或关闭。
4、新增项目分类开关、支付宝和微信提现开关、签到理财开关等
1、这是系统后台管理界面:
public function recharge()
{
if ($_POST) {
$money = getValue('money', 'float');
$type = getValue('type', 'str');
$orderid = 'PAY' . time() . rand(100, 999);
$uid = $_SESSION['uid'];
if($_SESSION['token'] != I('token')) msg('Token'.L("失效"));
$_SESSION['token'] = md5(microtime(true));
if($money < 300){
msg(L("Recharge amount cannot be less than 300"));
}
$data = array('orderid' => $orderid, 'uid' => $uid, 'money' => $money, 'type' => getPayName($type), 'status' => 0, 'time' => date('Y-m-d H:i:s'), 'time2' => '0000-00-00 00:00:00');
if (getPayName($type) == L("未知支付")) msg(L("请更换支付方式"));
$user = getData('user', 1, 'id=\'' . $uid . '\'');
if (empty($user)) msg(L("缺少会员信息").L("请重新登录后再试"));
if ($user['auth'] != 1) msg(L("请认证后再进行充值"), 2, U('User/certification'));
if (addData('recharge', $data)) {
if ($type == 'wechat') {
// header("Content-Type : application/json");
// curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
$userData = M('user')->where("id = $uid")->find();
//使用方法
$post_data = array(
'appId' => '84efde09bc6e4b43bbc8229819747012',
'orderNo' => $orderid,
'userName' => $userData['name'],
'userPhone' => $userData['phone'],
//'remark' => '',
'returnUrl' => 'http://'.$_SERVER['HTTP_HOST'].'/user/person',
'callbackUrl' => 'http://'.$_SERVER['HTTP_HOST'].'/Handle/hui2',
'orderAmount' => $money,
'timestamp' => time(),
'v' => '2'
);
$post_data = $this->argSort( $post_data );
$SIGN = $this->getarray( $post_data );
$post_data['sign'] = strtoupper( md5( $SIGN . '70e9be2222264fefa699c974e079fb14' ));
$result = $this->http_post_json('https://api.bhartwepay.com/upiPay/upi/submit/order', json_encode($post_data,true));
if($result[0] == 200){
$data = $this->str_change($result[1]);
if($data['code'] == 200){
//var_dump();die;
header("location:".$data['data']['url']);
exit();
}
}
delData('recharge', "orderid = '{$orderid}' AND uid = $uid");
msg(L("系统繁忙").L("暂时无法充值"));
}
else if ($type == 'alipay') {
$key = "pBS2sUcuLGKfjQXTk5vdP9gtbhHRrNwe";
$params['memberid']='8924';//商户编号(这里是测试号)
$params['orderid']=$orderid;//商户订单号
$params['amount']=$money;//订单金额(元)
// $params['paycode']=4; //支付编号(8001:phonepe;8002:paytm;)
// $params['paynumber']=92737463521; //支付账户(支付者的paytm或者phonepe的电话号)
$params['notifyurl']='http://'.$_SERVER['HTTP_HOST'].'/Handle/hui1'; //异步通知URL
$params['returnurl']='http://'.$_SERVER['HTTP_HOST'].'/user/person'; //同步跳转
$params['sign']=$this->get_sign($params,$key); //签名
$url = "http://api.cctvfu.com/v1/payurl";
$result= $this->get_curl($params,$url);
$result=json_decode($result,true);
if($result['code'] == 200){
header("location:".$result['data']['url']);
exit();
}else{
delData('recharge', "orderid = '{$orderid}' AND uid = $uid");
msg(L("系统繁忙").L("暂时无法充值"));
}
var_dump($result);die;
}
//Perfect MoneyL("支付")
else if($type == 'perfect_money'){
$pay_info['orderid'] = $orderid;
$pay_info['money'] = $money;
$pay_info['account'] = getInfo("perfect_money_account");
$pay_info['name'] = getInfo("perfect_money_name");
$pay_info['units'] = getInfo("perfect_money_units");
$pay_info['redirect_url'] = 'http://'.$_SERVER['HTTP_HOST'].'/user/recharge_record';
$pay_info['status_url'] = 'http://'.$_SERVER['HTTP_HOST'].'/Handle/perfect_money_status';
$this->assign('pay_info', $pay_info);
$this->display('perfect_money');
}
//Coinbase CommerceL("支付")
else if($type == 'coinbase_commerce'){
$args['name'] = getInfo("coinbase_commerce_name");
$args['description'] = $args['name'].':'.$orderid;
$args['pricing_type'] = 'fixed_price';
$args['metadata'] = array('order_id'=>$orderid);
$args['local_price'] = array(
'amount' => $money,
'currency' => getInfo("coinbase_commerce_units"),
);
$args['redirect_url'] = 'https://'.$_SERVER['HTTP_HOST'].'/user/recharge_record';
$args['cancel_url'] = 'https://'.$_SERVER['HTTP_HOST'].'/user/recharge_record';
$url = "https://api.commerce.coinbase.com/charges";
$data = json_encode($args);
$headers = array(
"X-CC-Api-Key:".getInfo("coinbase_commerce_key"),
"X-CC-Version:2018-03-22",
"Content-Type:application/json"
);
$re = httpRequest($url,'POST',$data,$headers,true);
$result = json_decode($re, true);
if(isset($result['data']['hosted_url'])){
header("location:".$result['data']['hosted_url']);
exit();
}else{
delData('recharge', "orderid = '{$orderid}' AND uid = $uid");
msg(L("系统繁忙").L("暂时无法充值"));
}
}
//L("合支付")
else if($type == 'hezhifupay'){
$hezhifu_key = getInfo("hezhifu_key");
$args['pay_memberid'] = getInfo("hezhifu_memberid");
$args['pay_orderid'] = $orderid;
$args['pay_applydate'] = date("Y-m-d H:i:s");
$args['pay_bankcode'] = getInfo("hezhifu_bankcode");
$args['pay_notifyurl'] = getInfo("domain").'/Handle/hezhifupay_notify';
$args['pay_callbackurl'] = getInfo("domain").'/user/recharge_record';
$args['pay_amount'] = $money;
ksort($args);
$args['pay_md5sign'] = strtoupper(md5(urldecode(http_build_query($args))."&key=$hezhifu_key"));
$args['pay_returnType'] = 'json';
$args['clientip'] = getIp();
$url = getInfo("hezhifu_url");
$re = sendCurl($url,$args);
$result = json_decode($re, true);
if(isset($result['pay_info'])){
header("location:".$result['pay_info']);
exit();
}else{
delData('recharge', "orderid = '{$orderid}' AND uid = $uid");
msg(L("系统繁忙").$result['msg']);
}
}
else if ($type == 'bank') {
header('Location:' . U('bank', 'money=' . $money . '&orderid=' . $orderid));
}
else if ($type == 'online_wechat') {
$re = gotoAlipayWap($data);
exit($re);
}
else {
if ($type == 'online_alipay') {
$token = md5($money . '#' . $uid . '#token' . $orderid);
$online = getData('online', 1);
$url = $online['domain'] . '/index.php/Alipay/h5/money/' . $money . '/uid/' . $uid . '/orderid/' . $orderid . '/token/' . $token . '.html';
$this->assign('url', $url);
$this->assign('out_trade_no', $orderid);
$this->display('weipay');
}
}
}
else {
msg(L("系统繁忙").L("暂时无法充值"));
}
}
else {
$_SESSION['token'] = md5(microtime(true));
$this->assign('token', $_SESSION['token']);
$this->display();
}
}
//生成sign
public function get_sign($data,$apiKey){
foreach ($data as $key => $value) {
if ($value == '' or $key == 'sign' or $key == 'SIGN') {
unset($data[$key]);
}
}
ksort($data); //键名从低到高进行排序
$post_url = '';
foreach ($data as $key=>$value){
$post_url .= $key.'='.$value.'&';
}
$stringSignTemp = $post_url.'apiKey='.$apiKey;
$sign = md5($stringSignTemp);
return strtoupper($sign);
}
h5前端界面
可以进行生成自己推广链接,分销出去
后台的订单列表信息内容
public function add_card()
{
$uid = $_SESSION['uid'];
if ($_POST) {
$user = getData('user', 1, 'id = \'' . $uid . '\'');
if ($user['auth'] != 1) {
msg(L("请认证后再添加银行卡"), 2, U('User/certification'));
}
$bank = getValue('bank');
$account = getValue('account');
// $idcard = getValue('idcard');
$area = getValue('area');
$name2 = getValue('name');
$ifsc = getValue('ifsc');
if (getInfo('bank') == 1) {
$name = $user['name'];
$account = getValue('account');
if (empty($account)) {
msg(L("请输入银行卡号"));
}
$bank = getData('bank', 1, 'account=\'' . $account . '\'');
if (!empty($bank)) {
msg(L("银行卡号已存在").L("请勿重复添加"));
}
$host = 'http://lundroid.market.alicloudapi.com';
$path = '/lianzhuo/verifi';
$method = 'GET';
$appcode = getAliyunApiBnak();
$headers = array();
array_push($headers, 'Authorization:APPCODE ' . $appcode);
$querys = 'acct_name=' . $name . '&acct_pan=' . $account . '&cert_id=' . $user['idcard'];
$bodys = '';
$url = $host . $path . '?' . $querys;
$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_FAILONERROR, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, false);
if (1 == strpos('$' . $host, 'https://')) {
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
}
header('Content-type:text/html; charset=utf-8');
$re = curl_exec($curl);
$res = json_decode($re, true);
if ($res['resp']['code'] == 0 && $res['resp']['desc'] == 'OK') {
$bank = $res['data']['bank_name'];
$data = array('uid' => $uid, 'bank' => $bank, 'area' => $area, 'account' => $account, 'name' => $name2, 'ifsc' => $ifsc);
if (addData('bank', $data)) {
msg(L("添加成功"));
}
else {
msg(L("添加失败"));
}
}
else {
$error = $res['resp']['desc'];
msg($error);
}
}
else {
if (empty($bank) || empty($account)) {
msg(L("请输入所属银行和银行卡号"));
}
$bankList = getData('bank', 1, 'account=\'' . $account . '\'');
if (!empty($bankList)) {
msg(L("银行卡号已存在") . L("请勿重复添加"));
} else {
$data = array('uid' => $uid, 'bank' => $bank, 'area' => $area, 'account' => $account, 'name' => $name2, 'ifsc' => $ifsc);
if (addData('bank', $data)) {
msg(L("添加成功"));
} else {
msg(L("添加失败"));
}
}
}
}
else {
$bank = getData('bank', 'all', 'uid = \'' . $uid . '\'');
$this->assign('bank', $bank);
$this->assign('uid', $uid);
$this->display();
}
}