2020.02新版
9
.htaccess
Normal file
@@ -0,0 +1,9 @@
|
||||
<IfModule mod_rewrite.c>
|
||||
Options +FollowSymlinks
|
||||
RewriteEngine On
|
||||
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule ^(.[a-zA-Z0-9\-\_]+).html$ index.php?mod=$1 [QSA,PT,L]
|
||||
RewriteRule ^pay/(.*)$ pay.php?s=$1 [QSA,PT,L]
|
||||
</IfModule>
|
||||
826
admin/ajax.php
Normal file
@@ -0,0 +1,826 @@
|
||||
<?php
|
||||
include("../includes/common.php");
|
||||
if($islogin==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
$act=isset($_GET['act'])?daddslashes($_GET['act']):null;
|
||||
|
||||
if(strpos($_SERVER['HTTP_REFERER'],$_SERVER['HTTP_HOST'])===false)exit('{"code":403}');
|
||||
|
||||
@header('Content-Type: application/json; charset=UTF-8');
|
||||
|
||||
switch($act){
|
||||
case 'getcount':
|
||||
$thtime=date("Y-m-d").' 00:00:00';
|
||||
$count1=$DB->getColumn("SELECT count(*) from pre_order");
|
||||
$count2=$DB->getColumn("SELECT count(*) from pre_user");
|
||||
|
||||
$paytype = [];
|
||||
$rs = $DB->getAll("SELECT id,name,showname FROM pre_type WHERE status=1");
|
||||
foreach($rs as $row){
|
||||
$paytype[$row['id']] = $row['showname'];
|
||||
}
|
||||
unset($rs);
|
||||
|
||||
$channel = [];
|
||||
$rs = $DB->getAll("SELECT id,name FROM pre_channel WHERE status=1");
|
||||
foreach($rs as $row){
|
||||
$channel[$row['id']] = $row['name'];
|
||||
}
|
||||
unset($rs);
|
||||
|
||||
$tongji_cachetime=getSetting('tongji_cachetime', true);
|
||||
$tongji_cache = $CACHE->read('tongji');
|
||||
if($tongji_cachetime+3600>=time() && $tongji_cache){
|
||||
$array = unserialize($tongji_cache);
|
||||
$result=["code"=>0,"type"=>"cache","paytype"=>$paytype,"channel"=>$channel,"count1"=>$count1,"count2"=>$count2,"usermoney"=>round($array['usermoney'],2),"settlemoney"=>round($array['settlemoney'],2),"order_today"=>$array['order_today'],"order"=>[]];
|
||||
}else{
|
||||
$usermoney=$DB->getColumn("SELECT SUM(money) FROM pre_user WHERE money!='0.00'");
|
||||
$settlemoney=$DB->getColumn("SELECT SUM(money) FROM pre_settle");
|
||||
|
||||
$today=date("Y-m-d");
|
||||
$rs=$DB->query("SELECT type,channel,money from pre_order where status=1 and date>='$today'");
|
||||
foreach($paytype as $id=>$type){
|
||||
$order_paytype[$id]=0;
|
||||
}
|
||||
foreach($channel as $id=>$type){
|
||||
$order_channel[$id]=0;
|
||||
}
|
||||
while($row = $rs->fetch())
|
||||
{
|
||||
$order_paytype[$row['type']]+=$row['money'];
|
||||
$order_channel[$row['channel']]+=$row['money'];
|
||||
}
|
||||
foreach($order_paytype as $k=>$v){
|
||||
$order_paytype[$k] = round($v,2);
|
||||
}
|
||||
foreach($order_channel as $k=>$v){
|
||||
$order_channel[$k] = round($v,2);
|
||||
}
|
||||
$allmoney=0;
|
||||
foreach($order_paytype as $order){
|
||||
$allmoney+=$order;
|
||||
}
|
||||
$order_today['all']=round($allmoney,2);
|
||||
$order_today['paytype']=$order_paytype;
|
||||
$order_today['channel']=$order_channel;
|
||||
|
||||
saveSetting('tongji_cachetime',time());
|
||||
$CACHE->save('tongji',serialize(["usermoney"=>$usermoney,"settlemoney"=>$settlemoney,"order_today"=>$order_today]));
|
||||
|
||||
$result=["code"=>0,"type"=>"online","paytype"=>$paytype,"channel"=>$channel,"count1"=>$count1,"count2"=>$count2,"usermoney"=>round($usermoney,2),"settlemoney"=>round($settlemoney,2),"order_today"=>$order_today,"order"=>[]];
|
||||
}
|
||||
for($i=1;$i<7;$i++){
|
||||
$day = date("Ymd", strtotime("-{$i} day"));
|
||||
if($order_tongji = $CACHE->read('order_'.$day)){
|
||||
$result["order"][$day] = unserialize($order_tongji);
|
||||
}else{
|
||||
break;
|
||||
}
|
||||
}
|
||||
exit(json_encode($result));
|
||||
break;
|
||||
case 'uploadimg':
|
||||
if($_POST['do']=='upload'){
|
||||
$type = $_POST['type'];
|
||||
$filename = $type.'_'.md5_file($_FILES['file']['tmp_name']).'.png';
|
||||
$fileurl = 'assets/img/Product/'.$filename;
|
||||
if(copy($_FILES['file']['tmp_name'], ROOT.'assets/img/Product/'.$filename)){
|
||||
exit('{"code":0,"msg":"succ","url":"'.$fileurl.'"}');
|
||||
}else{
|
||||
exit('{"code":-1,"msg":"上传失败,请确保有本地写入权限"}');
|
||||
}
|
||||
}
|
||||
exit('{"code":-1,"msg":"null"}');
|
||||
break;
|
||||
case 'setStatus':
|
||||
$trade_no=trim($_GET['trade_no']);
|
||||
$status=is_numeric($_GET['status'])?intval($_GET['status']):exit('{"code":200}');
|
||||
if($status==5){
|
||||
if($DB->exec("DELETE FROM pre_order WHERE trade_no='$trade_no'"))
|
||||
exit('{"code":200}');
|
||||
else
|
||||
exit('{"code":400,"msg":"删除订单失败!['.$DB->error().']"}');
|
||||
}else{
|
||||
if($DB->exec("update pre_order set status='$status' where trade_no='$trade_no'")!==false)
|
||||
exit('{"code":200}');
|
||||
else
|
||||
exit('{"code":400,"msg":"修改订单失败!['.$DB->error().']"}');
|
||||
}
|
||||
break;
|
||||
case 'order':
|
||||
$trade_no=trim($_GET['trade_no']);
|
||||
$row=$DB->getRow("select A.*,B.showname typename,C.name channelname from pre_order A,pre_type B,pre_channel C where trade_no='$trade_no' and A.type=B.id and A.channel=C.id limit 1");
|
||||
if(!$row)
|
||||
exit('{"code":-1,"msg":"当前订单不存在或未成功选择支付通道!"}');
|
||||
$result=array("code"=>0,"msg"=>"succ","data"=>$row);
|
||||
exit(json_encode($result));
|
||||
break;
|
||||
case 'operation':
|
||||
$status=is_numeric($_POST['status'])?intval($_POST['status']):exit('{"code":-1,"msg":"请选择操作"}');
|
||||
$checkbox=$_POST['checkbox'];
|
||||
$i=0;
|
||||
foreach($checkbox as $trade_no){
|
||||
if($status==4)$DB->exec("DELETE FROM pre_order WHERE trade_no='$trade_no'");
|
||||
elseif($status==3){
|
||||
$row=$DB->getRow("select uid,getmoney,status from pre_order where trade_no='$trade_no' limit 1");
|
||||
if($row && $row['status']==3 && $row['getmoney']>0){
|
||||
if(changeUserMoney($row['uid'], $row['getmoney'], true, '解冻订单', $trade_no))
|
||||
$DB->exec("update pre_order set status='1' where trade_no='$trade_no'");
|
||||
}
|
||||
}
|
||||
elseif($status==2){
|
||||
$row=$DB->getRow("select uid,getmoney,status from pre_order where trade_no='$trade_no' limit 1");
|
||||
if($row && $row['status']==1 && $row['getmoney']>0){
|
||||
if(changeUserMoney($row['uid'], $row['getmoney'], false, '冻结订单', $trade_no))
|
||||
$DB->exec("update pre_order set status='3' where trade_no='$trade_no'");
|
||||
}
|
||||
}
|
||||
else $DB->exec("update pre_order set status='$status' where trade_no='$trade_no' limit 1");
|
||||
$i++;
|
||||
}
|
||||
exit('{"code":0,"msg":"成功改变'.$i.'条订单状态"}');
|
||||
break;
|
||||
case 'getmoney': //退款查询
|
||||
if(!$conf['admin_paypwd'])exit('{"code":-1,"msg":"你还未设置支付密码"}');
|
||||
$trade_no=trim($_POST['trade_no']);
|
||||
$api=isset($_POST['api'])?intval($_POST['api']):0;
|
||||
$row=$DB->getRow("select * from pre_order where trade_no='$trade_no' limit 1");
|
||||
if(!$row)
|
||||
exit('{"code":-1,"msg":"当前订单不存在!"}');
|
||||
if($row['status']!=1)
|
||||
exit('{"code":-1,"msg":"只支持退款已支付状态的订单"}');
|
||||
if($api==1){
|
||||
if(!$row['api_trade_no'])
|
||||
exit('{"code":-1,"msg":"接口订单号不存在"}');
|
||||
$channel = \lib\Channel::get($row['channel']);
|
||||
if(!$channel){
|
||||
exit('{"code":-1,"msg":"当前支付通道信息不存在"}');
|
||||
}
|
||||
if(\lib\Plugin::isrefund($channel['plugin'])==false){
|
||||
exit('{"code":-1,"msg":"当前支付通道不支持API退款"}');
|
||||
}
|
||||
$money = $row['money'];
|
||||
}else{
|
||||
$money = $row['getmoney'];
|
||||
}
|
||||
exit('{"code":0,"money":"'.$money.'"}');
|
||||
break;
|
||||
case 'refund': //退款操作
|
||||
$trade_no=trim($_POST['trade_no']);
|
||||
$row=$DB->getRow("select uid,getmoney,status from pre_order where trade_no='$trade_no' limit 1");
|
||||
if(!$row)
|
||||
exit('{"code":-1,"msg":"当前订单不存在!"}');
|
||||
if($row['status']!=1)
|
||||
exit('{"code":-1,"msg":"只支持退款已支付状态的订单"}');
|
||||
if($row['getmoney']>0){
|
||||
changeUserMoney($row['uid'], $row['getmoney'], false, '订单退款', $trade_no);
|
||||
$DB->exec("update pre_order set status='2' where trade_no='$trade_no'");
|
||||
}
|
||||
exit('{"code":0,"msg":"已成功从UID:'.$row['uid'].'扣除'.$row['getmoney'].'元余额"}');
|
||||
break;
|
||||
case 'apirefund': //API退款操作
|
||||
$trade_no=trim($_POST['trade_no']);
|
||||
$paypwd=trim($_POST['paypwd']);
|
||||
if($paypwd!=$conf['admin_paypwd'])
|
||||
exit('{"code":-1,"msg":"支付密码输入错误!"}');
|
||||
$row=$DB->getRow("select uid,money,getmoney,status from pre_order where trade_no='$trade_no' limit 1");
|
||||
if(!$row)
|
||||
exit('{"code":-1,"msg":"当前订单不存在!"}');
|
||||
if($row['status']!=1)
|
||||
exit('{"code":-1,"msg":"只支持退款已支付状态的订单"}');
|
||||
$message = null;
|
||||
if(api_refund($trade_no, $message)){
|
||||
if($row['getmoney']>0){
|
||||
if(changeUserMoney($row['uid'], $row['getmoney'], false, '订单退款', $trade_no)){
|
||||
$addstr = ',并成功从UID:'.$row['uid'].'扣除'.$row['getmoney'].'元余额';
|
||||
}
|
||||
$DB->exec("update pre_order set status='2' where trade_no='$trade_no'");
|
||||
}
|
||||
exit('{"code":0,"msg":"API退款成功!退款金额¥'.$row['money'].$addstr.'"}');
|
||||
}else{
|
||||
exit('{"code":-1,"msg":"API退款失败:'.$message.'"}');
|
||||
}
|
||||
break;
|
||||
case 'freeze': //冻结订单
|
||||
$trade_no=trim($_POST['trade_no']);
|
||||
$row=$DB->getRow("select uid,getmoney,status from pre_order where trade_no='$trade_no' limit 1");
|
||||
if(!$row)
|
||||
exit('{"code":-1,"msg":"当前订单不存在!"}');
|
||||
if($row['status']!=1)
|
||||
exit('{"code":-1,"msg":"只支持冻结已支付状态的订单"}');
|
||||
if($row['getmoney']>0){
|
||||
changeUserMoney($row['uid'], $row['getmoney'], false, '订单冻结', $trade_no);
|
||||
$DB->exec("update pre_order set status='3' where trade_no='$trade_no'");
|
||||
}
|
||||
exit('{"code":0,"msg":"已成功从UID:'.$row['uid'].'冻结'.$row['getmoney'].'元余额"}');
|
||||
break;
|
||||
case 'unfreeze': //解冻订单
|
||||
$trade_no=trim($_POST['trade_no']);
|
||||
$row=$DB->getRow("select uid,getmoney,status from pre_order where trade_no='$trade_no' limit 1");
|
||||
if(!$row)
|
||||
exit('{"code":-1,"msg":"当前订单不存在!"}');
|
||||
if($row['status']!=3)
|
||||
exit('{"code":-1,"msg":"只支持解冻已冻结状态的订单"}');
|
||||
if($row['getmoney']>0){
|
||||
changeUserMoney($row['uid'], $row['getmoney'], true, '订单解冻', $trade_no);
|
||||
$DB->exec("update pre_order set status='1' where trade_no='$trade_no'");
|
||||
}
|
||||
exit('{"code":0,"msg":"已成功为UID:'.$row['uid'].'恢复'.$row['getmoney'].'元余额"}');
|
||||
break;
|
||||
case 'notify':
|
||||
$trade_no=trim($_POST['trade_no']);
|
||||
$row=$DB->getRow("select * from pre_order where trade_no='$trade_no' limit 1");
|
||||
if(!$row)
|
||||
exit('{"code":-1,"msg":"当前订单不存在!"}');
|
||||
$url=creat_callback($row);
|
||||
if($row['notify']>0)
|
||||
$DB->exec("update pre_order set notify=0 where trade_no='$trade_no'");
|
||||
exit('{"code":0,"url":"'.($_POST['isreturn']==1?$url['return']:$url['notify']).'"}');
|
||||
break;
|
||||
case 'getPayType':
|
||||
$id=intval($_GET['id']);
|
||||
$row=$DB->getRow("select * from pre_type where id='$id' limit 1");
|
||||
if(!$row)
|
||||
exit('{"code":-1,"msg":"当前支付方式不存在!"}');
|
||||
$result = ['code'=>0,'msg'=>'succ','data'=>$row];
|
||||
exit(json_encode($result));
|
||||
break;
|
||||
case 'setPayType':
|
||||
$id=intval($_GET['id']);
|
||||
$status=intval($_GET['status']);
|
||||
$row=$DB->getRow("select * from pre_type where id='$id' limit 1");
|
||||
if(!$row)
|
||||
exit('{"code":-1,"msg":"当前支付方式不存在!"}');
|
||||
$sql = "UPDATE pre_type SET status='$status' WHERE id='$id'";
|
||||
if($DB->exec($sql))exit('{"code":0,"msg":"修改支付方式成功!"}');
|
||||
else exit('{"code":-1,"msg":"修改支付方式失败['.$DB->error().']"}');
|
||||
break;
|
||||
case 'delPayType':
|
||||
$id=intval($_GET['id']);
|
||||
$row=$DB->getRow("select * from pre_type where id='$id' limit 1");
|
||||
if(!$row)
|
||||
exit('{"code":-1,"msg":"当前支付方式不存在!"}');
|
||||
$row=$DB->getRow("select * from pre_channel where type='$id' limit 1");
|
||||
if($row)
|
||||
exit('{"code":-1,"msg":"删除失败,存在使用该支付方式的支付通道"}');
|
||||
$sql = "DELETE FROM pre_type WHERE id='$id'";
|
||||
if($DB->exec($sql))exit('{"code":0,"msg":"删除支付方式成功!"}');
|
||||
else exit('{"code":-1,"msg":"删除支付方式失败['.$DB->error().']"}');
|
||||
break;
|
||||
case 'savePayType':
|
||||
if($_POST['action'] == 'add'){
|
||||
$name=trim($_POST['name']);
|
||||
$showname=trim($_POST['showname']);
|
||||
$device=intval($_POST['device']);
|
||||
if(!preg_match('/^[a-zA-Z0-9]+$/',$name)){
|
||||
exit('{"code":-1,"msg":"调用值不符合规则"}');
|
||||
}
|
||||
$row=$DB->getRow("select * from pre_type where name='$name' and device='$device' limit 1");
|
||||
if($row)
|
||||
exit('{"code":-1,"msg":"同一个调用值+支持设备不能重复"}');
|
||||
$sql = "INSERT INTO pre_type (name, showname, device, status) VALUES ('{$name}','{$showname}',{$device},1)";
|
||||
if($DB->exec($sql))exit('{"code":0,"msg":"新增支付方式成功!"}');
|
||||
else exit('{"code":-1,"msg":"新增支付方式失败['.$DB->error().']"}');
|
||||
}else{
|
||||
$id=intval($_POST['id']);
|
||||
$name=trim($_POST['name']);
|
||||
$showname=trim($_POST['showname']);
|
||||
$device=intval($_POST['device']);
|
||||
if(!preg_match('/^[a-zA-Z0-9]+$/',$name)){
|
||||
exit('{"code":-1,"msg":"调用值不符合规则"}');
|
||||
}
|
||||
$row=$DB->getRow("select * from pre_type where name='$name' and device='$device' and id<>$id limit 1");
|
||||
if($row)
|
||||
exit('{"code":-1,"msg":"同一个调用值+支持设备不能重复"}');
|
||||
$sql = "UPDATE pre_type SET name='{$name}',showname='{$showname}',device='{$device}' WHERE id='$id'";
|
||||
if($DB->exec($sql)!==false)exit('{"code":0,"msg":"修改支付方式成功!"}');
|
||||
else exit('{"code":-1,"msg":"修改支付方式失败['.$DB->error().']"}');
|
||||
}
|
||||
break;
|
||||
case 'getPlugin':
|
||||
$name = trim($_GET['name']);
|
||||
$row=$DB->getRow("select * from pre_plugin where name='$name'");
|
||||
if($row){
|
||||
$result = ['code'=>0,'msg'=>'succ','data'=>$row];
|
||||
exit(json_encode($result));
|
||||
}
|
||||
else exit('{"code":-1,"msg":"当前支付插件不存在!"}');
|
||||
break;
|
||||
case 'getPlugins':
|
||||
$typeid = intval($_GET['typeid']);
|
||||
$type=$DB->getColumn("select name from pre_type where id='$typeid' limit 1");
|
||||
if(!$type)
|
||||
exit('{"code":-1,"msg":"当前支付方式不存在!"}');
|
||||
$list=$DB->getAll("select name,showname from pre_plugin where types like '%$type%'");
|
||||
if($list){
|
||||
$result = ['code'=>0,'msg'=>'succ','data'=>$list];
|
||||
exit(json_encode($result));
|
||||
}
|
||||
else exit('{"code":-1,"msg":"没有找到支持该支付方式的插件"}');
|
||||
break;
|
||||
case 'getChannel':
|
||||
$id=intval($_GET['id']);
|
||||
$row=$DB->getRow("select * from pre_channel where id='$id' limit 1");
|
||||
if(!$row)
|
||||
exit('{"code":-1,"msg":"当前支付通道不存在!"}');
|
||||
$result = ['code'=>0,'msg'=>'succ','data'=>$row];
|
||||
exit(json_encode($result));
|
||||
break;
|
||||
case 'getChannels':
|
||||
$typeid = intval($_GET['typeid']);
|
||||
$type=$DB->getColumn("select name from pre_type where id='$typeid' limit 1");
|
||||
if(!$type)
|
||||
exit('{"code":-1,"msg":"当前支付方式不存在!"}');
|
||||
$list=$DB->getAll("select id,name from pre_channel where type='$typeid' and status=1");
|
||||
if($list){
|
||||
$result = ['code'=>0,'msg'=>'succ','data'=>$list];
|
||||
exit(json_encode($result));
|
||||
}
|
||||
else exit('{"code":-1,"msg":"没有找到支持该支付方式的通道"}');
|
||||
break;
|
||||
case 'setChannel':
|
||||
$id=intval($_GET['id']);
|
||||
$status=intval($_GET['status']);
|
||||
$row=$DB->getRow("select * from pre_channel where id='$id' limit 1");
|
||||
if(!$row)
|
||||
exit('{"code":-1,"msg":"当前支付通道不存在!"}');
|
||||
if($status==1 && (empty($row['appid']) || empty($row['appkey']))){
|
||||
exit('{"code":-1,"msg":"请先配置好密钥后再开启"}');
|
||||
}
|
||||
$sql = "UPDATE pre_channel SET status='$status' WHERE id='$id'";
|
||||
if($DB->exec($sql))exit('{"code":0,"msg":"修改支付通道成功!"}');
|
||||
else exit('{"code":-1,"msg":"修改支付通道失败['.$DB->error().']"}');
|
||||
break;
|
||||
case 'delChannel':
|
||||
$id=intval($_GET['id']);
|
||||
$row=$DB->getRow("select * from pre_channel where id='$id' limit 1");
|
||||
if(!$row)
|
||||
exit('{"code":-1,"msg":"当前支付通道不存在!"}');
|
||||
$sql = "DELETE FROM pre_channel WHERE id='$id'";
|
||||
if($DB->exec($sql))exit('{"code":0,"msg":"删除支付通道成功!"}');
|
||||
else exit('{"code":-1,"msg":"删除支付通道失败['.$DB->error().']"}');
|
||||
break;
|
||||
case 'saveChannel':
|
||||
if($_POST['action'] == 'add'){
|
||||
$name=trim($_POST['name']);
|
||||
$rate=trim($_POST['rate']);
|
||||
$type=intval($_POST['type']);
|
||||
$plugin=trim($_POST['plugin']);
|
||||
if(!preg_match('/^[0-9.]+$/',$rate)){
|
||||
exit('{"code":-1,"msg":"分成比例不符合规则"}');
|
||||
}
|
||||
$row=$DB->getRow("select * from pre_channel where name='$name' limit 1");
|
||||
if($row)
|
||||
exit('{"code":-1,"msg":"支付通道名称重复"}');
|
||||
$sql = "INSERT INTO pre_channel (name, rate, type, plugin) VALUES ('{$name}', '{$rate}', {$type}, '{$plugin}')";
|
||||
if($DB->exec($sql))exit('{"code":0,"msg":"新增支付通道成功!"}');
|
||||
else exit('{"code":-1,"msg":"新增支付通道失败['.$DB->error().']"}');
|
||||
}else{
|
||||
$id=intval($_POST['id']);
|
||||
$name=trim($_POST['name']);
|
||||
$rate=trim($_POST['rate']);
|
||||
$type=intval($_POST['type']);
|
||||
$plugin=trim($_POST['plugin']);
|
||||
if(!preg_match('/^[0-9.]+$/',$rate)){
|
||||
exit('{"code":-1,"msg":"分成比例不符合规则"}');
|
||||
}
|
||||
$row=$DB->getRow("select * from pre_channel where name='$name' and id<>$id limit 1");
|
||||
if($row)
|
||||
exit('{"code":-1,"msg":"支付通道名称重复"}');
|
||||
$sql = "UPDATE pre_channel SET name='{$name}',rate='{$rate}',type='{$type}',plugin='{$plugin}' WHERE id='$id'";
|
||||
if($DB->exec($sql)!==false)exit('{"code":0,"msg":"修改支付通道成功!"}');
|
||||
else exit('{"code":-1,"msg":"修改支付通道失败['.$DB->error().']"}');
|
||||
}
|
||||
break;
|
||||
case 'channelInfo':
|
||||
$id=intval($_GET['id']);
|
||||
$row=$DB->getRow("select * from pre_channel where id='$id' limit 1");
|
||||
if(!$row)
|
||||
exit('{"code":-1,"msg":"当前支付通道不存在!"}');
|
||||
$apptype = explode(',',$row['apptype']);
|
||||
$plugin=$DB->getRow("select `inputs`,`select` from `pre_plugin` where `name`='{$row['plugin']}' limit 1");
|
||||
if(!$plugin)
|
||||
exit('{"code":-1,"msg":"当前支付插件不存在!"}');
|
||||
$arr = explode(',',$plugin['inputs']);
|
||||
$inputs = [];
|
||||
foreach($arr as $item){
|
||||
$a = explode(':',$item);
|
||||
$inputs[$a[0]] = $a[1];
|
||||
}
|
||||
$data = '<div class="modal-body"><form class="form" id="form-info">';
|
||||
if(!empty($plugin['select'])){
|
||||
$arr = explode(',',$plugin['select']);
|
||||
$select = '';
|
||||
foreach($arr as $item){
|
||||
$a = explode(':',$item);
|
||||
$select .= '<label><input type="checkbox" '.(in_array($a[0],$apptype)?'checked':null).' name="apptype[]" value="'.$a[0].'">'.$a[1].'</label> ';
|
||||
}
|
||||
$data .= '<div class="form-group"><input type="hidden" id="isapptype" name="isapptype" value="1"/><label>请选择可用的接口:</label><br/><div class="checkbox">'.$select.'</div></div>';
|
||||
}
|
||||
if($inputs['appid'])$data .= '<div class="form-group"><label>'.$inputs['appid'].':</label><br/><input type="text" id="appid" name="appid" value="'.$row['appid'].'" class="form-control" required/></div>';
|
||||
if($inputs['appkey'])$data .= '<div class="form-group"><label>'.$inputs['appkey'].':</label><br/><textarea id="appkey" name="appkey" rows="2" class="form-control" required>'.$row['appkey'].'</textarea></div>';
|
||||
if($inputs['appsecret'])$data .= '<div class="form-group"><label>'.$inputs['appsecret'].':</label><br/><textarea id="appsecret" name="appsecret" rows="2" class="form-control" required>'.$row['appsecret'].'</textarea></div>';
|
||||
if($inputs['appurl'])$data .= '<div class="form-group"><label>'.$inputs['appurl'].':</label><br/><input type="text" id="appurl" name="appurl" value="'.$row['appurl'].'" class="form-control" required/></div>';
|
||||
if($inputs['appmchid'])$data .= '<div class="form-group"><label>'.$inputs['appmchid'].':</label><br/><input type="text" id="appmchid" name="appmchid" value="'.$row['appmchid'].'" class="form-control" required/></div>';
|
||||
|
||||
$data .= '<button type="button" id="save" onclick="saveInfo('.$id.')" class="btn btn-primary btn-block">保存</button></form></div>';
|
||||
$result=array("code"=>0,"msg"=>"succ","data"=>$data);
|
||||
exit(json_encode($result));
|
||||
break;
|
||||
case 'saveChannelInfo':
|
||||
$id=intval($_GET['id']);
|
||||
$appid=isset($_POST['appid'])?trim($_POST['appid']):null;
|
||||
$appkey=isset($_POST['appkey'])?trim($_POST['appkey']):null;
|
||||
$appsecret=isset($_POST['appsecret'])?trim($_POST['appsecret']):null;
|
||||
$appurl=isset($_POST['appurl'])?trim($_POST['appurl']):null;
|
||||
$appmchid=isset($_POST['appmchid'])?trim($_POST['appmchid']):null;
|
||||
if(isset($_POST['isapptype'])){
|
||||
if(!isset($_POST['apptype']) || count($_POST['apptype'])<=0)exit('{"code":-1,"msg":"请至少选择一个可用的支付接口"}');
|
||||
$apptype=implode(',',$_POST['apptype']);
|
||||
}else{
|
||||
$apptype=null;
|
||||
}
|
||||
$sql = "UPDATE pre_channel SET appid='{$appid}',appkey='{$appkey}',appsecret='{$appsecret}',appurl='{$appurl}',appmchid='{$appmchid}',apptype='{$apptype}' WHERE id='$id'";
|
||||
if($DB->exec($sql)!==false)exit('{"code":0,"msg":"修改支付密钥成功!"}');
|
||||
else exit('{"code":-1,"msg":"修改支付密钥失败['.$DB->error().']"}');
|
||||
break;
|
||||
case 'getRoll':
|
||||
$id=intval($_GET['id']);
|
||||
$row=$DB->getRow("select * from pre_roll where id='$id' limit 1");
|
||||
if(!$row)
|
||||
exit('{"code":-1,"msg":"当前轮询组不存在!"}');
|
||||
$result = ['code'=>0,'msg'=>'succ','data'=>$row];
|
||||
exit(json_encode($result));
|
||||
break;
|
||||
case 'setRoll':
|
||||
$id=intval($_GET['id']);
|
||||
$status=intval($_GET['status']);
|
||||
$row=$DB->getRow("select * from pre_roll where id='$id' limit 1");
|
||||
if(!$row)
|
||||
exit('{"code":-1,"msg":"当前轮询组不存在!"}');
|
||||
if($status==1 && empty($row['info'])){
|
||||
exit('{"code":-1,"msg":"请先配置好支付通道后再开启"}');
|
||||
}
|
||||
$sql = "UPDATE pre_roll SET status='$status' WHERE id='$id'";
|
||||
if($DB->exec($sql))exit('{"code":0,"msg":"修改轮询组成功!"}');
|
||||
else exit('{"code":-1,"msg":"修改轮询组失败['.$DB->error().']"}');
|
||||
break;
|
||||
case 'delRoll':
|
||||
$id=intval($_GET['id']);
|
||||
$row=$DB->getRow("select * from pre_roll where id='$id' limit 1");
|
||||
if(!$row)
|
||||
exit('{"code":-1,"msg":"当前轮询组不存在!"}');
|
||||
$sql = "DELETE FROM pre_roll WHERE id='$id'";
|
||||
if($DB->exec($sql))exit('{"code":0,"msg":"删除轮询组成功!"}');
|
||||
else exit('{"code":-1,"msg":"删除轮询组失败['.$DB->error().']"}');
|
||||
break;
|
||||
case 'saveRoll':
|
||||
if($_POST['action'] == 'add'){
|
||||
$name=trim($_POST['name']);
|
||||
$type=intval($_POST['type']);
|
||||
$kind=intval($_POST['kind']);
|
||||
$row=$DB->getRow("select * from pre_roll where name='$name' limit 1");
|
||||
if($row)
|
||||
exit('{"code":-1,"msg":"轮询组名称重复"}');
|
||||
$sql = "INSERT INTO pre_roll (name, type, kind) VALUES ('{$name}', {$type}, {$kind})";
|
||||
if($DB->exec($sql))exit('{"code":0,"msg":"新增轮询组成功!"}');
|
||||
else exit('{"code":-1,"msg":"新增轮询组失败['.$DB->error().']"}');
|
||||
}else{
|
||||
$id=intval($_POST['id']);
|
||||
$name=trim($_POST['name']);
|
||||
$type=intval($_POST['type']);
|
||||
$kind=intval($_POST['kind']);
|
||||
$row=$DB->getRow("select * from pre_roll where name='$name' and id<>$id limit 1");
|
||||
if($row)
|
||||
exit('{"code":-1,"msg":"轮询组名称重复"}');
|
||||
$sql = "UPDATE pre_roll SET name='{$name}',type='{$type}',kind='{$kind}' WHERE id='$id'";
|
||||
if($DB->exec($sql)!==false)exit('{"code":0,"msg":"修改轮询组成功!"}');
|
||||
else exit('{"code":-1,"msg":"修改轮询组失败['.$DB->error().']"}');
|
||||
}
|
||||
break;
|
||||
case 'rollInfo':
|
||||
$id=intval($_GET['id']);
|
||||
$row=$DB->getRow("select * from pre_roll where id='$id' limit 1");
|
||||
if(!$row)
|
||||
exit('{"code":-1,"msg":"当前轮询组不存在!"}');
|
||||
$list=$DB->getAll("select id,name from pre_channel where type='{$row['type']}' and status=1");
|
||||
if(!$list)exit('{"code":-1,"msg":"没有找到支持该支付方式的通道"}');
|
||||
if(!empty($row['info'])){
|
||||
$arr = explode(',',$row['info']);
|
||||
$info = [];
|
||||
foreach($arr as $item){
|
||||
$a = explode(':',$item);
|
||||
$info[] = ['channel'=>$a[0], 'weight'=>$a[1]?$a[1]:1];
|
||||
}
|
||||
}else{
|
||||
$info = null;
|
||||
}
|
||||
$result=array("code"=>0,"msg"=>"succ","channels"=>$list,"info"=>$info);
|
||||
exit(json_encode($result));
|
||||
break;
|
||||
case 'saveRollInfo':
|
||||
$id=intval($_GET['id']);
|
||||
$row=$DB->getRow("select * from pre_roll where id='$id' limit 1");
|
||||
if(!$row)
|
||||
exit('{"code":-1,"msg":"当前轮询组不存在!"}');
|
||||
$list=$_POST['list'];
|
||||
if(empty($list))
|
||||
exit('{"code":-1,"msg":"通道配置不能为空!"}');
|
||||
$info = '';
|
||||
foreach($list as $a){
|
||||
$info .= $row['kind']==1 ? $a['channel'].':'.$a['weight'].',' : $a['channel'].',';
|
||||
}
|
||||
$info = trim($info,',');
|
||||
if(empty($info))
|
||||
exit('{"code":-1,"msg":"通道配置不能为空!"}');
|
||||
$sql = "UPDATE pre_roll SET info='{$info}' WHERE id='$id'";
|
||||
if($DB->exec($sql)!==false)exit('{"code":0,"msg":"修改轮询组成功!"}');
|
||||
else exit('{"code":-1,"msg":"修改轮询组失败['.$DB->error().']"}');
|
||||
break;
|
||||
case 'getGroup':
|
||||
$gid=intval($_GET['gid']);
|
||||
$row=$DB->getRow("select * from pre_group where gid='$gid' limit 1");
|
||||
if(!$row)
|
||||
exit('{"code":-1,"msg":"当前用户组不存在!"}');
|
||||
$result = ['code'=>0,'msg'=>'succ','gid'=>$gid,'name'=>$row['name'],'info'=>json_decode($row['info'],true)];
|
||||
exit(json_encode($result));
|
||||
break;
|
||||
case 'delGroup':
|
||||
$gid=intval($_GET['gid']);
|
||||
$row=$DB->getRow("select * from pre_group where gid='$gid' limit 1");
|
||||
if(!$row)
|
||||
exit('{"code":-1,"msg":"当前用户组不存在!"}');
|
||||
$sql = "DELETE FROM pre_group WHERE gid='$gid'";
|
||||
if($DB->exec($sql))exit('{"code":0,"msg":"删除用户组成功!"}');
|
||||
else exit('{"code":-1,"msg":"删除用户组失败['.$DB->error().']"}');
|
||||
break;
|
||||
case 'saveGroup':
|
||||
if($_POST['action'] == 'add'){
|
||||
$name=trim($_POST['name']);
|
||||
$row=$DB->getRow("select * from pre_group where name='$name' limit 1");
|
||||
if($row)
|
||||
exit('{"code":-1,"msg":"用户组名称重复"}');
|
||||
$info=$_POST['info'];
|
||||
$info=json_encode($info);
|
||||
$sql = "INSERT INTO pre_group (name, info) VALUES ('{$name}', '{$info}')";
|
||||
if($DB->exec($sql))exit('{"code":0,"msg":"新增用户组成功!"}');
|
||||
else exit('{"code":-1,"msg":"新增用户组失败['.$DB->error().']"}');
|
||||
}elseif($_POST['action'] == 'changebuy'){
|
||||
$gid=intval($_POST['gid']);
|
||||
$status=intval($_POST['status']);
|
||||
$sql = "UPDATE pre_group SET isbuy='{$status}' WHERE gid='$gid'";
|
||||
if($DB->exec($sql))exit('{"code":0,"msg":"修改上架状态成功!"}');
|
||||
else exit('{"code":-1,"msg":"修改上架状态失败['.$DB->error().']"}');
|
||||
}else{
|
||||
$gid=intval($_POST['gid']);
|
||||
$name=trim($_POST['name']);
|
||||
$row=$DB->getRow("select * from pre_group where name='$name' and gid<>$gid limit 1");
|
||||
if($row)
|
||||
exit('{"code":-1,"msg":"用户组名称重复"}');
|
||||
$info=$_POST['info'];
|
||||
$info=json_encode($info);
|
||||
$sql = "UPDATE pre_group SET name='{$name}',info='{$info}' WHERE gid='$gid'";
|
||||
if($DB->exec($sql)!==false)exit('{"code":0,"msg":"修改用户组成功!"}');
|
||||
else exit('{"code":-1,"msg":"修改用户组失败['.$DB->error().']"}');
|
||||
}
|
||||
break;
|
||||
case 'saveGroupPrice':
|
||||
$prices = $_POST['price'];
|
||||
$sorts = $_POST['sort'];
|
||||
foreach($prices as $gid=>$item){
|
||||
$price = trim($item);
|
||||
$sort = trim($sorts[$gid]);
|
||||
if(empty($price)||!is_numeric($price))exit('{"code":-1,"msg":"GID:'.$gid.'的售价填写错误"}');
|
||||
$DB->exec("UPDATE pre_group SET price='{$price}',sort='{$sort}' WHERE gid='$gid'");
|
||||
}
|
||||
exit('{"code":0,"msg":"保存成功!"}');
|
||||
break;
|
||||
case 'setUser':
|
||||
$uid=intval($_GET['uid']);
|
||||
$type=trim($_GET['type']);
|
||||
$status=intval($_GET['status']);
|
||||
if($type=='pay')$sql = "UPDATE pre_user SET pay='$status' WHERE uid='$uid'";
|
||||
elseif($type=='settle')$sql = "UPDATE pre_user SET settle='$status' WHERE uid='$uid'";
|
||||
elseif($type=='group')$sql = "UPDATE pre_user SET gid='$status' WHERE uid='$uid'";
|
||||
else $sql = "UPDATE pre_user SET status='$status' WHERE uid='$uid'";
|
||||
if($DB->exec($sql)!==false)exit('{"code":0,"msg":"修改用户成功!"}');
|
||||
else exit('{"code":-1,"msg":"修改用户失败['.$DB->error().']"}');
|
||||
break;
|
||||
case 'resetUser':
|
||||
$uid=intval($_GET['uid']);
|
||||
$key = random(32);
|
||||
$sql = "UPDATE pre_user SET `key`='$key' WHERE uid='$uid'";
|
||||
if($DB->exec($sql)!==false)exit('{"code":0,"msg":"重置密钥成功","key":"'.$key.'"}');
|
||||
else exit('{"code":-1,"msg":"重置密钥失败['.$DB->error().']"}');
|
||||
break;
|
||||
case 'user_settle_info':
|
||||
$uid=intval($_GET['uid']);
|
||||
$rows=$DB->getRow("select * from pre_user where uid='$uid' limit 1");
|
||||
if(!$rows)
|
||||
exit('{"code":-1,"msg":"当前用户不存在!"}');
|
||||
$data = '<div class="form-group"><div class="input-group"><div class="input-group-addon">结算方式</div><select class="form-control" id="pay_type" default="'.$rows['settle_id'].'">'.($conf['settle_alipay']?'<option value="1">支付宝</option>':null).''.($conf['settle_wxpay']?'<option value="2">微信</option>':null).''.($conf['settle_qqpay']?'<option value="3">QQ钱包</option>':null).''.($conf['settle_bank']?'<option value="4">银行卡</option>':null).'</select></div></div>';
|
||||
$data .= '<div class="form-group"><div class="input-group"><div class="input-group-addon">结算账号</div><input type="text" id="pay_account" value="'.$rows['account'].'" class="form-control" required/></div></div>';
|
||||
$data .= '<div class="form-group"><div class="input-group"><div class="input-group-addon">真实姓名</div><input type="text" id="pay_name" value="'.$rows['username'].'" class="form-control" required/></div></div>';
|
||||
$data .= '<input type="submit" id="save" onclick="saveInfo('.$uid.')" class="btn btn-primary btn-block" value="保存">';
|
||||
$result=array("code"=>0,"msg"=>"succ","data"=>$data,"pay_type"=>$rows['settle_id']);
|
||||
exit(json_encode($result));
|
||||
break;
|
||||
case 'user_settle_save':
|
||||
$uid=intval($_POST['uid']);
|
||||
$pay_type=trim(daddslashes($_POST['pay_type']));
|
||||
$pay_account=trim(daddslashes($_POST['pay_account']));
|
||||
$pay_name=trim(daddslashes($_POST['pay_name']));
|
||||
$sds=$DB->exec("update `pre_user` set `settle_id`='$pay_type',`account`='$pay_account',`username`='$pay_name' where `uid`='$uid'");
|
||||
if($sds!==false)
|
||||
exit('{"code":0,"msg":"修改记录成功!"}');
|
||||
else
|
||||
exit('{"code":-1,"msg":"修改记录失败!'.$DB->error().'"}');
|
||||
break;
|
||||
case 'user_cert':
|
||||
$uid=intval($_GET['uid']);
|
||||
$rows=$DB->getRow("select cert,certno,certname,certtime from pre_user where uid='$uid' limit 1");
|
||||
if(!$rows)
|
||||
exit('{"code":-1,"msg":"当前用户不存在!"}');
|
||||
$result = ['code'=>0,'msg'=>'succ','uid'=>$uid,'cert'=>$rows['cert'],'certno'=>$rows['certno'],'certname'=>$rows['certname'],'certtime'=>$rows['certtime']];
|
||||
exit(json_encode($result));
|
||||
break;
|
||||
case 'recharge':
|
||||
$uid=intval($_POST['uid']);
|
||||
$do=$_POST['actdo'];
|
||||
$rmb=floatval($_POST['rmb']);
|
||||
$row=$DB->getRow("select uid,money from pre_user where uid='$uid' limit 1");
|
||||
if(!$row)
|
||||
exit('{"code":-1,"msg":"当前用户不存在!"}');
|
||||
if($do==1 && $rmb>$row['money'])$rmb=$row['money'];
|
||||
if($do==0){
|
||||
changeUserMoney($uid, $rmb, true, '后台加款');
|
||||
}else{
|
||||
changeUserMoney($uid, $rmb, false, '后台扣款');
|
||||
}
|
||||
exit('{"code":0,"msg":"succ"}');
|
||||
break;
|
||||
case 'create_batch':
|
||||
$count=$DB->getColumn("SELECT count(*) from pre_settle where status=0");
|
||||
if($count==0)exit('{"code":-1,"msg":"当前不存在待结算的记录"}');
|
||||
$batch=date("Ymd").rand(111,999);
|
||||
$allmoney = 0;
|
||||
$rs=$DB->query("SELECT * from pre_settle where status=0");
|
||||
while($row = $rs->fetch())
|
||||
{
|
||||
$DB->exec("UPDATE pre_settle SET batch='$batch',status=2 WHERE id='{$row['id']}'");
|
||||
$allmoney+=$row['realmoney'];
|
||||
}
|
||||
$DB->exec("INSERT INTO `pre_batch` (`batch`, `allmoney`, `count`, `time`, `status`) VALUES ('{$batch}', '{$allmoney}', '{$count}', '{$date}', '0')");
|
||||
|
||||
exit('{"code":0,"msg":"succ","batch":"'.$batch.'","count":"'.$count.'","allmoney":"'.$allmoney.'"}');
|
||||
break;
|
||||
case 'complete_batch':
|
||||
$batch=trim($_POST['batch']);
|
||||
$DB->exec("UPDATE pre_settle SET status=1 WHERE batch='$batch'");
|
||||
exit('{"code":0,"msg":"succ"}');
|
||||
break;
|
||||
case 'setSettleStatus':
|
||||
$id=intval($_GET['id']);
|
||||
$status=intval($_GET['status']);
|
||||
if($status==4){
|
||||
if($DB->exec("DELETE FROM pre_settle WHERE id='$id'"))
|
||||
exit('{"code":200}');
|
||||
else
|
||||
exit('{"code":400,"msg":"删除记录失败!['.$DB->error().']"}');
|
||||
}else{
|
||||
if($status==1){
|
||||
$sql = "update pre_settle set status='$status',endtime='$date',result=NULL where id='$id'";
|
||||
}else{
|
||||
$sql = "update pre_settle set status='$status',endtime=NULL where id='$id'";
|
||||
}
|
||||
if($DB->exec($sql)!==false)
|
||||
exit('{"code":200}');
|
||||
else
|
||||
exit('{"code":400,"msg":"修改记录失败!['.$DB->error().']"}');
|
||||
}
|
||||
break;
|
||||
case 'opslist':
|
||||
$status=$_POST['status'];
|
||||
$checkbox=$_POST['checkbox'];
|
||||
$i=0;
|
||||
foreach($checkbox as $id){
|
||||
if($status==4){
|
||||
$sql = "DELETE FROM pre_settle WHERE id='$id'";
|
||||
}elseif($status==1){
|
||||
$sql = "update pre_settle set status='$status',endtime='$date',result=NULL where id='$id'";
|
||||
}else{
|
||||
$sql = "update pre_settle set status='$status',endtime=NULL where id='$id'";
|
||||
}
|
||||
$DB->exec($sql);
|
||||
$i++;
|
||||
}
|
||||
exit('{"code":0,"msg":"成功改变'.$i.'条记录状态"}');
|
||||
break;
|
||||
case 'settle_result':
|
||||
$id=intval($_POST['id']);
|
||||
$row=$DB->getRow("select * from pre_settle where id='$id' limit 1");
|
||||
if(!$row)
|
||||
exit('{"code":-1,"msg":"当前结算记录不存在!"}');
|
||||
$result = ['code'=>0,'msg'=>'succ','result'=>$row['result']];
|
||||
exit(json_encode($result));
|
||||
break;
|
||||
case 'settle_setresult':
|
||||
$id=intval($_POST['id']);
|
||||
$result=trim($_POST['result']);
|
||||
$row=$DB->getRow("select * from pre_settle where id='$id' limit 1");
|
||||
if(!$row)
|
||||
exit('{"code":-1,"msg":"当前结算记录不存在!"}');
|
||||
$sds = $DB->exec("UPDATE pre_settle SET result='$result' WHERE id='$id'");
|
||||
if($sds!==false)
|
||||
exit('{"code":0,"msg":"修改成功!"}');
|
||||
else
|
||||
exit('{"code":-1,"msg":"修改失败!'.$DB->error().'"}');
|
||||
break;
|
||||
case 'settle_info':
|
||||
$id=intval($_GET['id']);
|
||||
$rows=$DB->getRow("select * from pre_settle where id='$id' limit 1");
|
||||
if(!$rows)
|
||||
exit('{"code":-1,"msg":"当前结算记录不存在!"}');
|
||||
$data = '<div class="form-group"><div class="input-group"><div class="input-group-addon">结算方式</div><select class="form-control" id="pay_type" default="'.$rows['type'].'">'.($conf['settle_alipay']?'<option value="1">支付宝</option>':null).''.($conf['settle_wxpay']?'<option value="2">微信</option>':null).''.($conf['settle_qqpay']?'<option value="3">QQ钱包</option>':null).''.($conf['settle_bank']?'<option value="4">银行卡</option>':null).'</select></div></div>';
|
||||
$data .= '<div class="form-group"><div class="input-group"><div class="input-group-addon">结算账号</div><input type="text" id="pay_account" value="'.$rows['account'].'" class="form-control" required/></div></div>';
|
||||
$data .= '<div class="form-group"><div class="input-group"><div class="input-group-addon">真实姓名</div><input type="text" id="pay_name" value="'.$rows['username'].'" class="form-control" required/></div></div>';
|
||||
$data .= '<input type="submit" id="save" onclick="saveInfo('.$id.')" class="btn btn-primary btn-block" value="保存">';
|
||||
$result=array("code"=>0,"msg"=>"succ","data"=>$data,"pay_type"=>$rows['type']);
|
||||
exit(json_encode($result));
|
||||
break;
|
||||
case 'settle_save':
|
||||
$id=intval($_POST['id']);
|
||||
$pay_type=trim(daddslashes($_POST['pay_type']));
|
||||
$pay_account=trim(daddslashes($_POST['pay_account']));
|
||||
$pay_name=trim(daddslashes($_POST['pay_name']));
|
||||
$sds=$DB->exec("update `pre_settle` set `type`='$pay_type',`account`='$pay_account',`username`='$pay_name' where `id`='$id'");
|
||||
if($sds!==false)
|
||||
exit('{"code":0,"msg":"修改记录成功!"}');
|
||||
else
|
||||
exit('{"code":-1,"msg":"修改记录失败!'.$DB->error().'"}');
|
||||
break;
|
||||
case 'paypwd_check':
|
||||
if(isset($_SESSION['paypwd']) && $_SESSION['paypwd']==$conf['admin_paypwd'])
|
||||
exit('{"code":0,"msg":"ok"}');
|
||||
else
|
||||
exit('{"code":-1,"msg":"error"}');
|
||||
break;
|
||||
case 'paypwd_input':
|
||||
$paypwd=trim($_POST['paypwd']);
|
||||
if(!$conf['admin_paypwd'])exit('{"code":-1,"msg":"你还未设置支付密码"}');
|
||||
if($paypwd == $conf['admin_paypwd']){
|
||||
$_SESSION['paypwd'] = $paypwd;
|
||||
exit('{"code":0,"msg":"ok"}');
|
||||
}else{
|
||||
exit('{"code":-1,"msg":"支付密码错误!"}');
|
||||
}
|
||||
break;
|
||||
case 'paypwd_reset':
|
||||
unset($_SESSION['paypwd']);
|
||||
exit('{"code":0,"msg":"ok"}');
|
||||
break;
|
||||
case 'set':
|
||||
foreach($_POST as $k=>$v){
|
||||
saveSetting($k, $v);
|
||||
}
|
||||
$ad=$CACHE->clear();
|
||||
if($ad)exit('{"code":0,"msg":"succ"}');
|
||||
else exit('{"code":-1,"msg":"修改设置失败['.$DB->error().']"}');
|
||||
break;
|
||||
case 'setGonggao':
|
||||
$id=intval($_GET['id']);
|
||||
$status=intval($_GET['status']);
|
||||
$sql = "UPDATE pre_anounce SET status='$status' WHERE id='$id'";
|
||||
if($DB->exec($sql))exit('{"code":0,"msg":"修改状态成功!"}');
|
||||
else exit('{"code":-1,"msg":"修改状态失败['.$DB->error().']"}');
|
||||
break;
|
||||
case 'delGonggao':
|
||||
$id=intval($_GET['id']);
|
||||
$sql = "DELETE FROM pre_anounce WHERE id='$id'";
|
||||
if($DB->exec($sql))exit('{"code":0,"msg":"删除公告成功!"}');
|
||||
else exit('{"code":-1,"msg":"删除公告失败['.$DB->error().']"}');
|
||||
break;
|
||||
case 'getServerIp':
|
||||
$ip = getServerIp();
|
||||
exit('{"code":0,"ip":"'.$ip.'"}');
|
||||
break;
|
||||
case 'epayurl':
|
||||
$id = intval($_GET['id']);
|
||||
$conf['payapi']=$id;
|
||||
if($url = pay_api()){
|
||||
exit('{"code":0,"url":"'.$url.'"}');
|
||||
}else{
|
||||
exit('{"code":-1}');
|
||||
}
|
||||
break;
|
||||
case 'iptype':
|
||||
$result = [
|
||||
['name'=>'0_X_FORWARDED_FOR', 'ip'=>real_ip(0), 'city'=>get_ip_city(real_ip(0))],
|
||||
['name'=>'1_X_REAL_IP', 'ip'=>real_ip(1), 'city'=>get_ip_city(real_ip(1))],
|
||||
['name'=>'2_REMOTE_ADDR', 'ip'=>real_ip(2), 'city'=>get_ip_city(real_ip(2))]
|
||||
];
|
||||
exit(json_encode($result));
|
||||
break;
|
||||
default:
|
||||
exit('{"code":-4,"msg":"No Act"}');
|
||||
break;
|
||||
}
|
||||
75
admin/clean.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/**
|
||||
* 系统数据清理
|
||||
**/
|
||||
include("../includes/common.php");
|
||||
$title='系统数据清理';
|
||||
include './head.php';
|
||||
if($islogin==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
?>
|
||||
<div class="container" style="padding-top:70px;">
|
||||
<div class="col-xs-12 col-sm-10 col-lg-8 center-block" style="float: none;">
|
||||
<?php
|
||||
$mod=isset($_GET['mod'])?$_GET['mod']:null;
|
||||
if($mod=='cleancache'){
|
||||
$CACHE->clear();
|
||||
if(function_exists("opcache_reset"))@opcache_reset();
|
||||
showmsg('清理系统设置缓存成功!',1);
|
||||
}elseif($mod=='cleanorder'){
|
||||
$DB->exec("DELETE FROM `pre_order` WHERE addtime<'".date("Y-m-d H:i:s",strtotime("-30 days"))."'");
|
||||
$DB->exec("OPTIMIZE TABLE `pre_order`");
|
||||
showmsg('删除30天前订单记录成功!',1);
|
||||
}elseif($mod=='cleansettle'){
|
||||
$DB->exec("DELETE FROM `pre_settle` WHERE addtime<'".date("Y-m-d H:i:s",strtotime("-30 days"))."'");
|
||||
$DB->exec("OPTIMIZE TABLE `pre_settle`");
|
||||
showmsg('删除30天前结算记录成功!',1);
|
||||
}elseif($mod=='cleanrecord'){
|
||||
$DB->exec("DELETE FROM `pre_record` WHERE date<'".date("Y-m-d H:i:s",strtotime("-30 days"))."'");
|
||||
$DB->exec("OPTIMIZE TABLE `pre_record`");
|
||||
showmsg('删除30天前资金明细成功!',1);
|
||||
}elseif($mod=='cleanorderi' && $_POST['do']=='submit'){
|
||||
$days = intval($_POST['days']);
|
||||
if($days<=0)showmsg('请确保每项不能为空',3);
|
||||
$DB->exec("DELETE FROM `pre_order` WHERE addtime<'".date("Y-m-d H:i:s",strtotime("-{$days} days"))."'");
|
||||
$DB->exec("OPTIMIZE TABLE `pre_order`");
|
||||
showmsg('删除订单记录成功!',1);
|
||||
}elseif($mod=='cleansettlei' && $_POST['do']=='submit'){
|
||||
$days = intval($_POST['days']);
|
||||
if($days<=0)showmsg('请确保每项不能为空',3);
|
||||
$DB->exec("DELETE FROM `pre_settle` WHERE addtime<'".date("Y-m-d H:i:s",strtotime("-{$days} days"))."'");
|
||||
$DB->exec("OPTIMIZE TABLE `pre_settle`");
|
||||
showmsg('删除结算记录成功!',1);
|
||||
}elseif($mod=='cleanrecordi' && $_POST['do']=='submit'){
|
||||
$days = intval($_POST['days']);
|
||||
if($days<=0)showmsg('请确保每项不能为空',3);
|
||||
$DB->exec("DELETE FROM `pre_record` WHERE date<'".date("Y-m-d H:i:s",strtotime("-{$days} days"))."'");
|
||||
$DB->exec("OPTIMIZE TABLE `pre_record`");
|
||||
showmsg('删除资金明细成功!',1);
|
||||
}else{
|
||||
?>
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading"><h3 class="panel-title">系统数据清理</h3></div>
|
||||
<div class="panel-body">
|
||||
<a href="./clean.php?mod=cleancache" class="btn btn-block btn-default">清理设置缓存</a><br/>
|
||||
<a href="./clean.php?mod=cleanorder" onclick="return confirm('你确实要删除30天前的订单记录吗?');" class="btn btn-block btn-default">删除30天前订单记录</a><br/>
|
||||
<a href="./clean.php?mod=cleansettle" onclick="return confirm('你确实要删除30天前的结算记录吗?');" class="btn btn-block btn-default">删除30天前结算记录</a><br/>
|
||||
<a href="./clean.php?mod=cleanrecord" onclick="return confirm('你确实要删除30天前的资金明细吗?');" class="btn btn-block btn-default">删除30天前资金明细</a><br/>
|
||||
<h4>自定义清理:</h4>
|
||||
<form action="./clean.php?mod=cleanorderi" method="post" role="form"><input type="hidden" name="do" value="submit"/>
|
||||
<b>订单记录</b>:<input type="text" name="days" value="" placeholder="天数"/>天前的订单记录 <input type="submit" name="submit" value="立即删除" class="btn btn-sm btn-danger" onclick="return confirm('删除后无法恢复,确定继续吗?');"/>
|
||||
</form><br/>
|
||||
<form action="./clean.php?mod=cleansettlei" method="post" role="form"><input type="hidden" name="do" value="submit"/>
|
||||
<b>结算记录</b>:<input type="text" name="days" value="" placeholder="天数"/>天前的结算记录 <input type="submit" name="submit" value="立即删除" class="btn btn-sm btn-danger" onclick="return confirm('删除后无法恢复,确定继续吗?');"/>
|
||||
</form><br/>
|
||||
<form action="./clean.php?mod=cleanrecordi" method="post" role="form"><input type="hidden" name="do" value="submit"/>
|
||||
<b>资金明细</b>:<input type="text" name="days" value="" placeholder="天数"/>天前的订单记录 <input type="submit" name="submit" value="立即删除" class="btn btn-sm btn-danger" onclick="return confirm('删除后无法恢复,确定继续吗?');"/>
|
||||
</form><br/>
|
||||
</div>
|
||||
<div class="panel-footer">
|
||||
<span class="glyphicon glyphicon-info-sign"></span>
|
||||
定期清理数据有助于提升网站访问速度
|
||||
</div>
|
||||
</div>
|
||||
<?php }?>
|
||||
</div>
|
||||
</div>
|
||||
8
admin/code.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
session_start();
|
||||
define('ROOT_PATH', dirname(__FILE__));
|
||||
require '../includes/ValidateCode.class.php';
|
||||
$_vc = new ValidateCode();
|
||||
$_vc->doimg();
|
||||
$_SESSION['vc_code'] = $_vc->getCode();
|
||||
?>
|
||||
42
admin/download.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
include("../includes/common.php");
|
||||
|
||||
if($islogin==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
|
||||
$batch=$_GET['batch'];
|
||||
$allmoney=$_GET['allmoney'];
|
||||
$data='';
|
||||
$rs=$DB->query("SELECT * from pre_settle where batch='$batch' order by type asc,id asc");
|
||||
|
||||
function display_type($type){
|
||||
if($type==1)
|
||||
return '支付宝';
|
||||
elseif($type==2)
|
||||
return '微信';
|
||||
elseif($type==3)
|
||||
return 'QQ钱包';
|
||||
elseif($type==4)
|
||||
return '银行卡';
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
$i=0;
|
||||
while($row = $rs->fetch())
|
||||
{
|
||||
$i++;
|
||||
$data.=$i.','.display_type($row['type']).','.$row['account'].','.mb_convert_encoding($row['username'], "GB2312", "UTF-8").','.$row['money'].',彩虹易支付自动结算'."\r\n";
|
||||
}
|
||||
|
||||
$date=date("Ymd");
|
||||
$file="商户流水号,收款方式,收款账号,收款人姓名,付款金额(元),付款理由\r\n";
|
||||
$file.=$data;
|
||||
|
||||
$file_name='pay_'.date("YmdHis").'.csv';
|
||||
$file_size=strlen($file);
|
||||
header("Content-Description: File Transfer");
|
||||
header("Content-Type:application/force-download");
|
||||
header("Content-Length: {$file_size}");
|
||||
header("Content-Disposition:attachment; filename={$file_name}");
|
||||
echo $file;
|
||||
?>
|
||||
212
admin/glist.php
Normal file
@@ -0,0 +1,212 @@
|
||||
<?php
|
||||
/**
|
||||
* 用户组设置
|
||||
**/
|
||||
include("../includes/common.php");
|
||||
$title='用户组设置';
|
||||
include './head.php';
|
||||
if($islogin==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
?>
|
||||
<style>
|
||||
.table>tbody>tr>td{vertical-align: middle;}</style>
|
||||
<div class="container" style="padding-top:70px;">
|
||||
<div class="col-md-10 center-block" style="float: none;">
|
||||
<?php
|
||||
|
||||
$paytype = [];
|
||||
$rs = $DB->getAll("SELECT * FROM pre_type");
|
||||
foreach($rs as $row){
|
||||
$paytype[$row['id']] = $row['showname'];
|
||||
}
|
||||
unset($rs);
|
||||
|
||||
function display_info($info){
|
||||
global $paytype;
|
||||
$result = '';
|
||||
$arr = json_decode($info, true);
|
||||
foreach($arr as $k=>$v){
|
||||
if($v['channel']==0)continue;
|
||||
$result .= $paytype[$k].'('.$v['channel'].'):'.$v['rate'].',';
|
||||
}
|
||||
return substr($result,0,-1);
|
||||
}
|
||||
|
||||
$list = $DB->getAll("SELECT * FROM pre_group");
|
||||
?>
|
||||
<div class="modal" id="modal-store" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content animated flipInX">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal"><span
|
||||
aria-hidden="true">×</span><span
|
||||
class="sr-only">Close</span></button>
|
||||
<h4 class="modal-title" id="modal-title">用户组修改/添加</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form class="form-horizontal" id="form-store">
|
||||
<input type="hidden" name="action" id="action"/>
|
||||
<input type="hidden" name="gid" id="gid"/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label no-padding-right">显示名称</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" name="name" id="name" placeholder="不要与其他用户组名称重复">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">通道费率</label>
|
||||
<div class="col-sm-10">
|
||||
<table class="table">
|
||||
<thead><tr><th style="min-width:100px">支付方式</th><th>选择支付通道</th><th>填写分成比例</th></tr></thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach($paytype as $key=>$value)
|
||||
{
|
||||
$select = '';
|
||||
$rs = $DB->getAll("SELECT * FROM pre_channel WHERE type='$key' AND status=1");
|
||||
foreach($rs as $row){
|
||||
$select .= '<option value="'.$row['id'].'" rate="'.$row['rate'].'" type="channel">'.$row['name'].'</option>';
|
||||
}
|
||||
$rs = $DB->getAll("SELECT * FROM pre_roll WHERE type='$key' AND status=1");
|
||||
foreach($rs as $row){
|
||||
$select .= '<option value="'.$row['id'].'" rate="'.$row['rate'].'" type="roll">'.$row['name'].'</option>';
|
||||
}
|
||||
echo '<tr><td><b>'.$value.'</b><input type="hidden" name="info['.$key.'][type]" value=""></td><td><select id="channel" name="info['.$key.'][channel]" class="form-control" onchange="changeChannel('.$key.')"><option value="0">关闭</option><option value="-1" type="channel">随机可用通道</option>'.$select.'</select></td><td><div class="input-group"><input type="text" class="form-control" name="info['.$key.'][rate]" id="rate" placeholder="百分数"><span class="input-group-addon">%</span></div></td></tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
|
||||
<button type="button" class="btn btn-primary" id="store" onclick="save()">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-success">
|
||||
<div class="panel-heading"><h3 class="panel-title">系统共有 <b><?php echo count($list);?></b> 个用户组 <span class="pull-right"><a href="javascript:addframe()" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> 新增</a></span></h3></div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead><tr><th>GID</th><th>用户组名称</th><th>通道与费率</th><th>操作</th></tr></thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach($list as $res)
|
||||
{
|
||||
echo '<tr><td><b>'.$res['gid'].'</b></td><td>'.$res['name'].'</td><td>'.display_info($res['info']).'</td><td><a class="btn btn-xs btn-info" onclick="editframe('.$res['gid'].')">编辑</a> <a class="btn btn-xs btn-danger" onclick="delItem('.$res['gid'].')">删除</a></td></tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="panel-footer">
|
||||
<span class="glyphicon glyphicon-info-sign"></span> 未设置用户组的用户是默认用户组,会自动使用已添加的可用支付通道和通道默认费率
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="//cdn.staticfile.org/layer/2.3/layer.js"></script>
|
||||
<script>
|
||||
function changeChannel(type){
|
||||
var rate = $("select[name='info["+type+"][channel]'] option:selected").attr('rate');
|
||||
var type2 = $("select[name='info["+type+"][channel]'] option:selected").attr('type');
|
||||
if($("input[name='info["+type+"][rate]']").val()=='')$("input[name='info["+type+"][rate]']").val(rate);
|
||||
$("input[name='info["+type+"][type]']").val(type2);
|
||||
}
|
||||
function addframe(){
|
||||
$("#modal-store").modal('show');
|
||||
$("#modal-title").html("新增用户组");
|
||||
$("#action").val("add");
|
||||
$("#gid").val('');
|
||||
$("#name").val('');
|
||||
}
|
||||
function editframe(id){
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'GET',
|
||||
url : 'ajax.php?act=getGroup&gid='+id,
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
$("#modal-store").modal('show');
|
||||
$("#modal-title").html("修改用户组");
|
||||
$("#action").val("edit");
|
||||
$("#gid").val(data.gid);
|
||||
$("#name").val(data.name);
|
||||
$.each(data.info, function (i, res) {
|
||||
$("select[name='info["+i+"][channel]']").val(res.channel);
|
||||
$("input[name='info["+i+"][rate]']").val(res.rate);
|
||||
$("input[name='info["+i+"][type]']").val(res.type);
|
||||
})
|
||||
}else{
|
||||
layer.alert(data.msg, {icon: 2})
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
function save(){
|
||||
if($("#name").val()==''){
|
||||
layer.alert('请确保各项不能为空!');return false;
|
||||
}
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : 'ajax.php?act=saveGroup',
|
||||
data : $("#form-store").serialize(),
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
layer.alert(data.msg,{
|
||||
icon: 1,
|
||||
closeBtn: false
|
||||
}, function(){
|
||||
window.location.reload()
|
||||
});
|
||||
}else{
|
||||
layer.alert(data.msg, {icon: 2})
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
function delItem(id) {
|
||||
if(id==0){
|
||||
layer.msg('系统自带默认用户组不支持删除');
|
||||
return false;
|
||||
}
|
||||
var confirmobj = layer.confirm('你确实要删除此用户组吗?', {
|
||||
btn: ['确定','取消']
|
||||
}, function(){
|
||||
$.ajax({
|
||||
type : 'GET',
|
||||
url : 'ajax.php?act=delGroup&gid='+id,
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
if(data.code == 0){
|
||||
window.location.reload()
|
||||
}else{
|
||||
layer.alert(data.msg, {icon: 2});
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}, function(){
|
||||
layer.close(confirmobj);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
169
admin/gonggao.php
Normal file
@@ -0,0 +1,169 @@
|
||||
<?php
|
||||
/**
|
||||
* 公告设置
|
||||
**/
|
||||
include("../includes/common.php");
|
||||
$title='公告设置';
|
||||
include './head.php';
|
||||
if($islogin==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
?>
|
||||
<link href="//cdn.staticfile.org/bootstrap-colorpicker/2.5.3/css/bootstrap-colorpicker.min.css" rel="stylesheet"/>
|
||||
<div class="container" style="padding-top:70px;">
|
||||
<div class="col-xs-12 col-sm-10 col-lg-8 center-block" style="float: none;">
|
||||
<?php
|
||||
$my=isset($_GET['my'])?$_GET['my']:null;
|
||||
if($my=='edit'){
|
||||
$id=intval($_GET['id']);
|
||||
$rows=$DB->getRow("select * from pre_anounce where id='$id' limit 1");
|
||||
if(!$rows)
|
||||
showmsg('当前公告不存在!',3);
|
||||
?>
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading"><h3 class="panel-title">修改公告(ID:<?php echo $id?>)</h3></div>
|
||||
<div class="panel-body">
|
||||
<form action="./gonggao.php?my=edit_submit&id=<?php echo $id?>" role="form" class="form-horizontal" method="post">
|
||||
<div class="list-group-item">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">公告内容</div>
|
||||
<textarea class="form-control" name="content" rows="5" placeholder="输入公告内容" required><?php echo $rows['content']?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="list-group-item form-inline">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">排序</div>
|
||||
<input type="text" name="sort" value="<?php echo $rows['sort']?>" class="form-control" required/>
|
||||
</div>
|
||||
<div class="input-group input-colorpicker colorpicker-element">
|
||||
<input type="text" name="color" value="<?php echo $rows['color']?>" class="form-control" placeholder="文字颜色" maxlength="7"/>
|
||||
<span class="input-group-addon"><i></i></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="list-group-item">
|
||||
<input type="submit" value="保存" class="btn btn-primary btn-block">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
elseif($my=='add_submit'){
|
||||
$content=$_POST['content'];
|
||||
$sort=intval($_POST['sort']);
|
||||
$color=trim($_POST['color']);
|
||||
if(!$content || !$sort){
|
||||
showmsg('公告内容不能为空',3);
|
||||
} else {
|
||||
$sds=$DB->exec("INSERT INTO `pre_anounce` (`content`, `color`, `sort`, `addtime`, `status`) VALUES ('{$content}', '{$color}', '{$sort}', '{$date}', 1)");
|
||||
if($sds){
|
||||
showmsg('添加公告成功!<br/><br/><a href="./gonggao.php">>>返回公告列表</a>',1);
|
||||
}else
|
||||
showmsg('添加公告失败!<br/>错误信息:'.$DB->error(),4);
|
||||
}
|
||||
}
|
||||
elseif($my=='edit_submit'){
|
||||
$id=intval($_GET['id']);
|
||||
$rows=$DB->getRow("select * from pre_anounce where id='$id' limit 1");
|
||||
if(!$rows)
|
||||
showmsg('当前公告不存在!',3);
|
||||
$content=$_POST['content'];
|
||||
$sort=intval($_POST['sort']);
|
||||
$color=trim($_POST['color']);
|
||||
if(!$content || !$sort){
|
||||
showmsg('公告内容不能为空',3);
|
||||
} else {
|
||||
$sds=$DB->exec("UPDATE `pre_anounce` SET `content`='$content',`sort`='$sort',`color`='$color' WHERE `id`='$id'");
|
||||
if($sds!==false){
|
||||
showmsg('修改公告成功!<br/><br/><a href="./gonggao.php">>>返回公告列表</a>',1);
|
||||
}else
|
||||
showmsg('修改公告失败!<br/>错误信息:'.$DB->error(),4);
|
||||
}
|
||||
}else{
|
||||
$list = $DB->getAll("SELECT * FROM pre_anounce ORDER BY sort ASC");
|
||||
?>
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading"><h3 class="panel-title">添加公告</h3></div>
|
||||
<div class="panel-body">
|
||||
<form action="./gonggao.php?my=add_submit" role="form" class="form-horizontal" method="post">
|
||||
<div class="list-group-item">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">公告内容</div>
|
||||
<textarea class="form-control" name="content" rows="5" placeholder="输入公告内容" required></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="list-group-item form-inline">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">排序</div>
|
||||
<input type="text" name="sort" value="50" class="form-control" required/>
|
||||
</div>
|
||||
<div class="input-group input-colorpicker colorpicker-element">
|
||||
<input type="text" name="color" value="" class="form-control" placeholder="文字颜色" maxlength="7"/>
|
||||
<span class="input-group-addon"><i></i></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="list-group-item">
|
||||
<input type="submit" value="添加" class="btn btn-primary btn-block">
|
||||
<a href="./set.php?mod=gonggao" class="btn btn-default btn-block">弹出公告与首页底部设置</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading"><h3 class="panel-title">已发公告</h3></div>
|
||||
<div class="panel-body">
|
||||
<?php foreach($list as $row){?>
|
||||
<div class="list-group-item">
|
||||
<em class="fa fa-fw fa-volume-up"></em><font color="<?php echo $row['color']?$row['color']:null?>"><?php echo $row['content']?></font><small> -<?php echo $row['addtime']?></small> <?php echo $row['status']==1?'<span class="btn btn-xs btn-success" onclick="setStatus('.$row['id'].',0)">显示</span>':'<span class="btn btn-xs btn-warning" onclick="setStatus('.$row['id'].',1)">隐藏</span>'?> <a class="btn btn-xs btn-info" href="./gonggao.php?my=edit&id=<?php echo $row['id']?>">编辑</a> <a class="btn btn-xs btn-danger" href="javascript:delItem(<?php echo $row['id']?>)">删除</a>
|
||||
</div>
|
||||
<?php }?>
|
||||
</div>
|
||||
</div>
|
||||
<?php }?>
|
||||
</div>
|
||||
</div>
|
||||
<script src="//cdn.staticfile.org/layer/2.3/layer.js"></script>
|
||||
<script src="//cdn.staticfile.org/bootstrap-colorpicker/2.5.3/js/bootstrap-colorpicker.min.js"></script>
|
||||
<script>
|
||||
function setStatus(id,status) {
|
||||
$.ajax({
|
||||
type : 'GET',
|
||||
url : 'ajax.php?act=setGonggao&id='+id+'&status='+status,
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
if(data.code == 0){
|
||||
window.location.reload();
|
||||
}else{
|
||||
layer.msg(data.msg, {icon:2, time:1500});
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
function delItem(id) {
|
||||
var confirmobj = layer.confirm('你确实要删除此公告吗?', {
|
||||
btn: ['确定','取消']
|
||||
}, function(){
|
||||
$.ajax({
|
||||
type : 'GET',
|
||||
url : 'ajax.php?act=delGonggao&id='+id,
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
if(data.code == 0){
|
||||
window.location.reload();
|
||||
}else{
|
||||
layer.msg(data.msg, {icon:2, time:1500});
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
$(document).ready(function(){
|
||||
$('.input-colorpicker').colorpicker({format: 'hex'});
|
||||
})
|
||||
</script>
|
||||
133
admin/group.php
Normal file
@@ -0,0 +1,133 @@
|
||||
<?php
|
||||
/**
|
||||
* 用户组购买设置
|
||||
**/
|
||||
include("../includes/common.php");
|
||||
$title='用户组购买设置';
|
||||
include './head.php';
|
||||
if($islogin==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
?>
|
||||
<style>
|
||||
.table>tbody>tr>td{vertical-align: middle;}</style>
|
||||
<div class="container" style="padding-top:70px;">
|
||||
<div class="col-xs-12 col-sm-10 col-lg-8 center-block" style="float: none;">
|
||||
<?php
|
||||
|
||||
$list1 = $DB->getAll("SELECT * FROM pre_group WHERE isbuy=1 ORDER BY SORT ASC");
|
||||
$list2 = $DB->getAll("SELECT * FROM pre_group WHERE isbuy=0");
|
||||
?>
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-body">
|
||||
<div class="list-group-item">用户组购买开关:<?php echo $conf['group_buy']==1?'<span style="color:green">已开启</span> <a href="javascript:changeSetting(0)" class="btn btn-danger btn-sm">点击关闭</a>':'<span style="color:red">已关闭</span> <a href="javascript:changeSetting(1)" class="btn btn-success btn-sm">点击开启</a>';?></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-success">
|
||||
<div class="panel-heading"><h3 class="panel-title">可购买的用户组 (<b><?php echo count($list1);?></b>)</h3></div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead><tr><th>GID</th><th>用户组名称</th><th>售价</th><th>排序</th><th>操作</th></tr></thead>
|
||||
<tbody><form id="glist">
|
||||
<?php
|
||||
foreach($list1 as $res)
|
||||
{
|
||||
echo '<tr><td><b>'.$res['gid'].'</b></td><td>'.$res['name'].'</td><td><input type="text" class="form-control input-sm" name="price['.$res['gid'].']" value="'.$res['price'].'" placeholder="填写售价" required></td><td><input type="text" class="form-control input-sm" name="sort['.$res['gid'].']" value="'.$res['sort'].'" placeholder="填写数字,数字越小越靠前" required></td><td><a class="btn btn-sm btn-warning" onclick="setItem('.$res['gid'].',0)">下架</a></td></tr>';
|
||||
}
|
||||
if(count($list1)>0)echo '<tr><td></td><td></td><td colspan="2"><span class="btn btn-primary btn-sm btn-block" onclick="saveAll()">保存全部</span></td><td></td></tr>';
|
||||
?></form>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading"><h3 class="panel-title">不可购买的用户组 (<b><?php echo count($list2);?></b>)</h3></div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead><tr><th>GID</th><th>用户组名称</th><th>操作</th></tr></thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach($list2 as $res)
|
||||
{
|
||||
echo '<tr><td><b>'.$res['gid'].'</b></td><td>'.$res['name'].'</td><td><a class="btn btn-sm btn-success" onclick="setItem('.$res['gid'].',1)">上架</a></td></tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="//cdn.staticfile.org/layer/2.3/layer.js"></script>
|
||||
<script>
|
||||
function saveAll(){
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : 'ajax.php?act=saveGroupPrice',
|
||||
data : $("#glist").serialize(),
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
layer.alert(data.msg,{
|
||||
icon: 1,
|
||||
closeBtn: false
|
||||
}, function(){
|
||||
window.location.reload()
|
||||
});
|
||||
}else{
|
||||
layer.alert(data.msg, {icon: 2})
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
function setItem(id,status) {
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : 'ajax.php?act=saveGroup',
|
||||
data : {action:'changebuy', gid:id, status:status},
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
if(data.code == 0){
|
||||
window.location.reload()
|
||||
}else{
|
||||
layer.alert(data.msg, {icon: 2});
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
function changeSetting(value){
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : 'ajax.php?act=set',
|
||||
data : {group_buy:value},
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
layer.alert('更换设置成功!', {
|
||||
icon: 1,
|
||||
closeBtn: false
|
||||
}, function(){
|
||||
window.location.reload()
|
||||
});
|
||||
}else{
|
||||
layer.alert(data.msg, {icon: 2})
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
92
admin/head.php
Normal file
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
@header('Content-Type: text/html; charset=UTF-8');
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-cn">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title><?php echo $title ?></title>
|
||||
<link href="//cdn.staticfile.org/twitter-bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet"/>
|
||||
<link href="../assets/css/bootstrap.min.css" rel="stylesheet"/>
|
||||
<link href="//cdn.staticfile.org/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
|
||||
<script src="//cdn.staticfile.org/modernizr/2.8.3/modernizr.min.js"></script>
|
||||
<script src="//cdn.staticfile.org/jquery/2.1.4/jquery.min.js"></script>
|
||||
<script src="//cdn.staticfile.org/twitter-bootstrap/3.4.1/js/bootstrap.min.js"></script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//cdn.staticfile.org/html5shiv/3.7.3/html5shiv.min.js"></script>
|
||||
<script src="//cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
</head>
|
||||
<body>
|
||||
<?php if($islogin==1){?>
|
||||
<nav class="navbar navbar-fixed-top navbar-default">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
|
||||
<span class="sr-only">导航按钮</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="./">彩虹易支付管理中心</a>
|
||||
</div><!-- /.navbar-header -->
|
||||
<div id="navbar" class="collapse navbar-collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li class="<?php echo checkIfActive('index,')?>">
|
||||
<a href="./"><i class="fa fa-home"></i> 平台首页</a>
|
||||
</li>
|
||||
<li class="<?php echo checkIfActive('order')?>">
|
||||
<a href="./order.php"><i class="fa fa-list"></i> 订单管理</a>
|
||||
</li>
|
||||
<li class="<?php echo checkIfActive('settle,slist')?>">
|
||||
<a href="./slist.php"><i class="fa fa-cloud"></i> 结算管理</a>
|
||||
</li>
|
||||
<li class="<?php echo checkIfActive('ulist,glist,group,record')?>">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-user"></i> 商户管理<b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="./ulist.php">用户列表</a></li>
|
||||
<li><a href="./glist.php">用户组设置</a></li>
|
||||
<li><a href="./group.php">用户组购买</a></li>
|
||||
<li><a href="./record.php">资金明细</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="<?php echo checkIfActive('pay_channel,pay_roll,pay_type,pay_plugin')?>">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-credit-card"></i> 支付接口<b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="./pay_channel.php">支付通道</a></li>
|
||||
<li><a href="./pay_roll.php">通道轮询</a></li>
|
||||
<li><a href="./pay_type.php">支付方式</a></li>
|
||||
<li><a href="./pay_plugin.php">支付插件</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="<?php echo checkIfActive('set,gonggao')?>">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-cog"></i> 系统设置<b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="./set.php?mod=site">网站信息配置</a></li>
|
||||
<li><a href="./set.php?mod=pay">支付与结算配置</a><li>
|
||||
<li><a href="./set.php?mod=transfer">企业付款配置</a><li>
|
||||
<li><a href="./set.php?mod=oauth">快捷登录配置</a><li>
|
||||
<li><a href="./set.php?mod=certificate">实名认证配置</a><li>
|
||||
<li><a href="./gonggao.php">网站公告配置</a></li>
|
||||
<li><a href="./set.php?mod=template">首页模板配置</a><li>
|
||||
<li><a href="./set.php?mod=mail">邮箱与短信配置</a><li>
|
||||
<li><a href="./set.php?mod=upimg">网站Logo上传</a><li>
|
||||
<li><a href="./set.php?mod=cron">计划任务配置</a><li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="<?php echo checkIfActive('clean,log,transfer')?>">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-cube"></i> 其他功能<b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="./transfer.php">企业付款</a><li>
|
||||
<li><a href="./risk.php">风控记录</a><li>
|
||||
<li><a href="./log.php">登录日志</a><li>
|
||||
<li><a href="./clean.php">数据清理</a><li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="./login.php?logout"><i class="fa fa-power-off"></i> 退出登录</a></li>
|
||||
</ul>
|
||||
</div><!-- /.navbar-collapse -->
|
||||
</div><!-- /.container -->
|
||||
</nav><!-- /.navbar -->
|
||||
<?php }?>
|
||||
115
admin/index.php
Normal file
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
include("../includes/common.php");
|
||||
$title='彩虹易支付管理中心';
|
||||
include './head.php';
|
||||
if($islogin==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
?>
|
||||
<?php
|
||||
?>
|
||||
<div class="container" style="padding-top:70px;">
|
||||
<div class="col-xs-12 col-lg-9 center-block" style="float: none;">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-lg-8">
|
||||
<div class="panel panel-info">
|
||||
<div class="panel-heading"><h3 class="panel-title" id="title">后台管理首页</h3></div>
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item"><span class="glyphicon glyphicon-stats"></span> <b>订单总数:</b><span id="count1"></span></li>
|
||||
<li class="list-group-item"><span class="glyphicon glyphicon-tint"></span> <b>商户数量:</b><span id="count2"></span></li>
|
||||
<li class="list-group-item"><span class="glyphicon glyphicon-tint"></span> <b>总计余额:</b><span id="usermoney"></span>元(1小时更新一次)</li>
|
||||
<li class="list-group-item"><span class="glyphicon glyphicon-tint"></span> <b>结算总额:</b><span id="settlemoney"></span>元(1小时更新一次)</li>
|
||||
<li class="list-group-item"><span class="glyphicon glyphicon-time"></span> <b>现在时间:</b> <?=$date?></li>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-lg-4">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"><h3 class="panel-title" id="title">管理员信息</h3></div>
|
||||
<ul class="list-group text-center">
|
||||
<li class="list-group-item">
|
||||
<img src="<?php echo ($conf['kfqq'])?'//q2.qlogo.cn/headimg_dl?bs=qq&dst_uin='.$conf['kfqq'].'&src_uin='.$conf['kfqq'].'&fid='.$conf['kfqq'].'&spec=100&url_enc=0&referer=bu_interface&term_type=PC':'../assets/img/user.png'?>" alt="avatar" class="img-circle img-thumbnail"></br>
|
||||
<span class="text-muted"><strong>用户名:</strong><font color="blue"><?php echo $conf['admin_user']?></font></span><br/><span class="text-muted"><strong>用户权限:</strong><font color="orange">管理员</font></span></li>
|
||||
<li class="list-group-item"><a href="../" class="btn btn-xs btn-default">返回首页</a> <a href="./set.php?mod=account" class="btn btn-xs btn-info">修改密码</a> <a href="./login.php?logout" class="btn btn-xs btn-danger">退出登录</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-success">
|
||||
<div class="panel-heading"><h3 class="panel-title">支付方式收入统计(1小时更新一次)</h3></div>
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead><tr id="paytype_head"><th>日期</th></thead>
|
||||
<tbody id="paytype_list">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="panel panel-warning">
|
||||
<div class="panel-heading"><h3 class="panel-title">支付通道收入统计(1小时更新一次)</h3></div>
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead><tr id="channel_head"><th>日期</th></thead>
|
||||
<tbody id="channel_list">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$('#title').html('正在加载数据中...');
|
||||
$.ajax({
|
||||
type : "GET",
|
||||
url : "ajax.php?act=getcount",
|
||||
dataType : 'json',
|
||||
async: true,
|
||||
success : function(data) {
|
||||
$('#title').html('后台管理首页');
|
||||
$('#count1').html(data.count1);
|
||||
$('#count2').html(data.count2);
|
||||
$('#usermoney').html(data.usermoney);
|
||||
$('#settlemoney').html(data.settlemoney);
|
||||
|
||||
var paytype=new Array();
|
||||
$.each(data.paytype, function(k, v){
|
||||
paytype.push(k);
|
||||
$("#paytype_head").append('<th>'+v+'</th>');
|
||||
});
|
||||
$("#paytype_head").append('<th>总计</th>');
|
||||
var order = '';
|
||||
$.each(paytype, function(k, v){
|
||||
if(typeof data.order_today.paytype[v] != "undefined")order+='<td>'+data.order_today.paytype[v]+'</td>';
|
||||
else order+='<td>0</td>';
|
||||
});
|
||||
$("#paytype_list").append('<tr><td>今日</td>'+order+'<td>'+data.order_today.all+'</td></tr>');
|
||||
$.each(data.order, function(k, v){
|
||||
var order = '';
|
||||
$.each(paytype, function(key, value){
|
||||
if(typeof v.paytype[value] != "undefined")order+='<td>'+v.paytype[value]+'</td>';
|
||||
else order+='<td>0</td>';
|
||||
});
|
||||
$("#paytype_list").append('<tr><td>'+k+'</td>'+order+'<td>'+v.all+'</td></tr>');
|
||||
});
|
||||
|
||||
var channel=new Array();
|
||||
$.each(data.channel, function(k, v){
|
||||
channel.push(k);
|
||||
$("#channel_head").append('<th>'+v+'</th>');
|
||||
});
|
||||
$("#channel_head").append('<th>总计</th>');
|
||||
var order = '';
|
||||
$.each(channel, function(k, v){
|
||||
if(typeof data.order_today.channel[v] != "undefined")order+='<td>'+data.order_today.channel[v]+'</td>';
|
||||
else order+='<td>0</td>';
|
||||
});
|
||||
$("#channel_list").append('<tr><td>今日</td>'+order+'<td>'+data.order_today.all+'</td></tr>');
|
||||
$.each(data.order, function(k, v){
|
||||
var order = '';
|
||||
$.each(channel, function(key, value){
|
||||
if(typeof v.channel[value] != "undefined")order+='<td>'+v.channel[value]+'</td>';
|
||||
else order+='<td>0</td>';
|
||||
});
|
||||
$("#channel_list").append('<tr><td>'+k+'</td>'+order+'<td>'+v.all+'</td></tr>');
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
</script>
|
||||
69
admin/log-table.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/**
|
||||
* 登录日志
|
||||
**/
|
||||
include("../includes/common.php");
|
||||
if($islogin==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
|
||||
|
||||
if(isset($_GET['value'])) {
|
||||
$sql=" `{$_GET['column']}`='{$_GET['value']}'";
|
||||
$numrows=$DB->getColumn("SELECT count(*) from pre_log WHERE{$sql}");
|
||||
$con='包含 '.$_GET['value'].' 的共有 <b>'.$numrows.'</b> 条记录';
|
||||
$link='&my=search&column='.$_GET['column'].'&value='.$_GET['value'];
|
||||
}else{
|
||||
$numrows=$DB->getColumn("SELECT count(*) from pre_log WHERE 1");
|
||||
$sql=" 1";
|
||||
$con='共有 <b>'.$numrows.'</b> 条记录';
|
||||
}
|
||||
?>
|
||||
<div class="table-responsive">
|
||||
<?php echo $con?>
|
||||
<table class="table table-striped table-bordered table-vcenter">
|
||||
<thead><tr><th>ID</th><th>商户号</th><th>操作类型</th><th>操作IP</th><th>时间</th></tr></thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$pagesize=30;
|
||||
$pages=ceil($numrows/$pagesize);
|
||||
$page=isset($_GET['page'])?intval($_GET['page']):1;
|
||||
$offset=$pagesize*($page - 1);
|
||||
|
||||
$rs=$DB->query("SELECT * FROM pre_log WHERE{$sql} order by id desc limit $offset,$pagesize");
|
||||
while($res = $rs->fetch())
|
||||
{
|
||||
echo '<tr><td><b>'.$res['id'].'</b></td><td><b>'.($res['uid']>0?'<a href="./ulist.php?column=uid&value='.$res['uid'].'" target="_blank">'.$res['uid'].'</a>':'管理员').'</b></td><td>'.$res['type'].'</td><td><a href="http://m.ip138.com/ip.asp?ip='.$res['ip'].'" target="_blank" rel="noreferrer">'.$res['ip'].'</a></td><td>'.$res['date'].'</td></tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php
|
||||
echo'<div class="text-center"><ul class="pagination">';
|
||||
$first=1;
|
||||
$prev=$page-1;
|
||||
$next=$page+1;
|
||||
$last=$pages;
|
||||
if ($page>1)
|
||||
{
|
||||
echo '<li><a href="javascript:void(0)" onclick="listTable(\'page='.$first.$link.'\')">首页</a></li>';
|
||||
echo '<li><a href="javascript:void(0)" onclick="listTable(\'page='.$prev.$link.'\')">«</a></li>';
|
||||
} else {
|
||||
echo '<li class="disabled"><a>首页</a></li>';
|
||||
echo '<li class="disabled"><a>«</a></li>';
|
||||
}
|
||||
$start=$page-10>1?$page-10:1;
|
||||
$end=$page+10<$pages?$page+10:$pages;
|
||||
for ($i=$start;$i<$page;$i++)
|
||||
echo '<li><a href="javascript:void(0)" onclick="listTable(\'page='.$i.$link.'\')">'.$i .'</a></li>';
|
||||
echo '<li class="disabled"><a>'.$page.'</a></li>';
|
||||
for ($i=$page+1;$i<=$end;$i++)
|
||||
echo '<li><a href="javascript:void(0)" onclick="listTable(\'page='.$i.$link.'\')">'.$i .'</a></li>';
|
||||
if ($page<$pages)
|
||||
{
|
||||
echo '<li><a href="javascript:void(0)" onclick="listTable(\'page='.$next.$link.'\')">»</a></li>';
|
||||
echo '<li><a href="javascript:void(0)" onclick="listTable(\'page='.$last.$link.'\')">尾页</a></li>';
|
||||
} else {
|
||||
echo '<li class="disabled"><a>»</a></li>';
|
||||
echo '<li class="disabled"><a>尾页</a></li>';
|
||||
}
|
||||
echo'</ul></div>';
|
||||
69
admin/log.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/**
|
||||
* 登录日志
|
||||
**/
|
||||
include("../includes/common.php");
|
||||
$title='登录日志';
|
||||
include './head.php';
|
||||
if($islogin==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
?>
|
||||
<div class="container" style="padding-top:70px;">
|
||||
<div class="col-md-12 center-block" style="float: none;">
|
||||
<form onsubmit="return searchRecord()" method="GET" class="form-inline">
|
||||
<div class="form-group">
|
||||
<label>搜索</label>
|
||||
<select name="column" class="form-control"><option value="uid">商户号</option></select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" name="value" placeholder="搜索内容(0为管理员)">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">搜索</button>
|
||||
<a href="javascript:listTable('start')" class="btn btn-default" title="刷新登录日志"><i class="fa fa-refresh"></i></a>
|
||||
</form>
|
||||
|
||||
<div id="listTable"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="//cdn.staticfile.org/layer/2.3/layer.js"></script>
|
||||
<script>
|
||||
function listTable(query){
|
||||
var url = window.document.location.href.toString();
|
||||
var queryString = url.split("?")[1];
|
||||
query = query || queryString;
|
||||
if(query == 'start' || query == undefined){
|
||||
query = '';
|
||||
history.replaceState({}, null, './log.php');
|
||||
}else if(query != undefined){
|
||||
history.replaceState({}, null, './log.php?'+query);
|
||||
}
|
||||
layer.closeAll();
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'GET',
|
||||
url : 'log-table.php?'+query,
|
||||
dataType : 'html',
|
||||
cache : false,
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
$("#listTable").html(data)
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
function searchRecord(){
|
||||
var column=$("select[name='column']").val();
|
||||
var value=$("input[name='value']").val();
|
||||
if(value==''){
|
||||
listTable();
|
||||
}else{
|
||||
listTable('column='+column+'&value='+value);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
$(document).ready(function(){
|
||||
listTable();
|
||||
})
|
||||
</script>
|
||||
95
admin/login.php
Normal file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
/**
|
||||
* 登录
|
||||
**/
|
||||
$verifycode = 1;//验证码开关
|
||||
|
||||
if(!function_exists("imagecreate") || !file_exists('code.php'))$verifycode=0;
|
||||
include("../includes/common.php");
|
||||
if(isset($_POST['user']) && isset($_POST['pass'])){
|
||||
if(!$_SESSION['pass_error'])$_SESSION['pass_error']=0;
|
||||
$user=daddslashes($_POST['user']);
|
||||
$pass=daddslashes($_POST['pass']);
|
||||
$code=daddslashes($_POST['code']);
|
||||
if ($verifycode==1 && (!$code || strtolower($code) != $_SESSION['vc_code'])) {
|
||||
unset($_SESSION['vc_code']);
|
||||
@header('Content-Type: text/html; charset=UTF-8');
|
||||
exit("<script language='javascript'>alert('验证码错误!');history.go(-1);</script>");
|
||||
}elseif($_SESSION['pass_error']>5) {
|
||||
@header('Content-Type: text/html; charset=UTF-8');
|
||||
exit("<script language='javascript'>alert('用户名或密码不正确!');history.go(-1);</script>");
|
||||
}elseif($user==$conf['admin_user'] && $pass==$conf['admin_pwd']) {
|
||||
//$city=get_ip_city($clientip);
|
||||
$DB->exec("insert into `pre_log` (`uid`,`type`,`date`,`ip`,`city`) values (0,'登录后台','".$date."','".$clientip."','".$city."')");
|
||||
$session=md5($user.$pass.$password_hash);
|
||||
$expiretime=time()+604800;
|
||||
$token=authcode("{$user}\t{$session}\t{$expiretime}", 'ENCODE', SYS_KEY);
|
||||
setcookie("admin_token", $token, time() + 604800);
|
||||
@header('Content-Type: text/html; charset=UTF-8');
|
||||
exit("<script language='javascript'>alert('登陆管理中心成功!');window.location.href='./';</script>");
|
||||
}elseif ($pass != $conf['admin_pwd']) {
|
||||
$_SESSION['pass_error']++;
|
||||
@header('Content-Type: text/html; charset=UTF-8');
|
||||
exit("<script language='javascript'>alert('用户名或密码不正确!');history.go(-1);</script>");
|
||||
}
|
||||
}elseif(isset($_GET['logout'])){
|
||||
setcookie("admin_token", "", time() - 604800);
|
||||
@header('Content-Type: text/html; charset=UTF-8');
|
||||
exit("<script language='javascript'>alert('您已成功注销本次登陆!');window.location.href='./login.php';</script>");
|
||||
}elseif($islogin==1){
|
||||
exit("<script language='javascript'>alert('您已登陆!');window.location.href='./';</script>");
|
||||
}
|
||||
$title='用户登录';
|
||||
include './head.php';
|
||||
?>
|
||||
<nav class="navbar navbar-fixed-top navbar-default">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
|
||||
<span class="sr-only">导航按钮</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="./">彩虹易支付管理中心</a>
|
||||
</div><!-- /.navbar-header -->
|
||||
<div id="navbar" class="collapse navbar-collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li class="active">
|
||||
<a href="./login.php"><span class="glyphicon glyphicon-user"></span> 登陆</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div><!-- /.navbar-collapse -->
|
||||
</div><!-- /.container -->
|
||||
</nav><!-- /.navbar -->
|
||||
<div class="container" style="padding-top:70px;">
|
||||
<div class="col-xs-12 col-sm-10 col-md-8 col-lg-6 center-block" style="float: none;">
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading"><h3 class="panel-title">用户登陆</h3></div>
|
||||
<div class="panel-body">
|
||||
<form action="./login.php" method="post" class="form-horizontal" role="form">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
|
||||
<input type="text" name="user" value="<?php echo @$_POST['user'];?>" class="form-control input-lg" placeholder="用户名" required="required"/>
|
||||
</div><br/>
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></span>
|
||||
<input type="password" name="pass" class="form-control input-lg" placeholder="密码" required="required"/>
|
||||
</div><br/>
|
||||
<?php if($verifycode==1){?>
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon"><span class="glyphicon glyphicon-adjust"></span></span>
|
||||
<input type="text" class="form-control input-lg" name="code" placeholder="输入验证码" autocomplete="off" required>
|
||||
<span class="input-group-addon" style="padding: 0">
|
||||
<img src="./code.php?r=<?php echo time();?>"height="45"onclick="this.src='./code.php?r='+Math.random();" title="点击更换验证码">
|
||||
</span>
|
||||
</div><br/>
|
||||
<?php }?>
|
||||
<div class="form-group">
|
||||
<div class="col-xs-12"><input type="submit" value="登陆" class="btn btn-primary form-control input-lg"/></div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
141
admin/order-table.php
Normal file
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
/**
|
||||
* 订单列表
|
||||
**/
|
||||
include("../includes/common.php");
|
||||
if($islogin==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
|
||||
|
||||
function display_status($status,$notify){
|
||||
if($status==1)
|
||||
$msg = '<font color=green>已支付</font>';
|
||||
elseif($status==2)
|
||||
$msg = '<font color=red>已退款</font>';
|
||||
elseif($status==3)
|
||||
$msg = '<font color=red>已冻结</font>';
|
||||
else
|
||||
$msg = '<font color=blue>未支付</font>';
|
||||
if($notify==0 && $status>0)
|
||||
$msg .= '<br/><font color=green>通知成功</font>';
|
||||
elseif($status>0)
|
||||
$msg .= '<br/><font color=red>通知失败</font>';
|
||||
return $msg;
|
||||
}
|
||||
function display_operation($status, $trade_no){
|
||||
if($status==1)
|
||||
$msg = '<li><a href="javascript:setStatus(\''.$trade_no.'\', 0)">改未完成</a></li><li><a href="javascript:apirefund(\''.$trade_no.'\')">API退款</a></li><li><a href="javascript:refund(\''.$trade_no.'\')">手动退款</a></li><li><a href="javascript:freeze(\''.$trade_no.'\')">冻结订单</a></li><li role="separator" class="divider"></li><li><a href="javascript:callnotify(\''.$trade_no.'\')">重新通知</a></li><li><a href="javascript:setStatus(\''.$trade_no.'\', 5)">删除订单</a></li>';
|
||||
elseif($status==2)
|
||||
$msg = '<li><a href="javascript:setStatus(\''.$trade_no.'\', 0)">改未完成</a></li><li><a href="javascript:setStatus(\''.$trade_no.'\', 1)">改已完成</a></li><li role="separator" class="divider"></li><li><a href="javascript:callnotify(\''.$trade_no.'\')">重新通知</a></li><li><a href="javascript:setStatus(\''.$trade_no.'\', 5)">删除订单</a></li>';
|
||||
elseif($status==3)
|
||||
$msg = '<li><a href="javascript:unfreeze(\''.$trade_no.'\')">解冻订单</a></li><li role="separator" class="divider"></li><li><a href="javascript:callnotify(\''.$trade_no.'\')">重新通知</a></li><li><a href="javascript:setStatus(\''.$trade_no.'\', 5)">删除订单</a></li>';
|
||||
else
|
||||
$msg = '<li><a href="javascript:setStatus(\''.$trade_no.'\', 1)">改已完成</a></li><li role="separator" class="divider"></li><li><a href="javascript:callnotify(\''.$trade_no.'\')">重新通知</a></li><li><a href="javascript:setStatus(\''.$trade_no.'\', 5)">删除订单</a></li>';
|
||||
return $msg;
|
||||
}
|
||||
|
||||
$paytype = [];
|
||||
$paytypes = [];
|
||||
$rs = $DB->getAll("SELECT * FROM pre_type");
|
||||
foreach($rs as $row){
|
||||
$paytype[$row['id']] = $row['showname'];
|
||||
$paytypes[$row['id']] = $row['name'];
|
||||
}
|
||||
unset($rs);
|
||||
|
||||
$sqls="";
|
||||
$links='';
|
||||
if(isset($_GET['uid']) && !empty($_GET['uid'])) {
|
||||
$uid = intval($_GET['uid']);
|
||||
$sqls.=" AND A.`uid`='$uid'";
|
||||
$links.='&uid='.$uid;
|
||||
}
|
||||
if(isset($_GET['type']) && $_GET['type']>0) {
|
||||
$type = intval($_GET['type']);
|
||||
$sqls.=" AND A.`type`='$type'";
|
||||
$links.='&type='.$type;
|
||||
}elseif(isset($_GET['channel']) && $_GET['channel']>0) {
|
||||
$channel = intval($_GET['channel']);
|
||||
$sqls.=" AND A.`channel`='$channel'";
|
||||
$links.='&channel='.$channel;
|
||||
}
|
||||
if(isset($_GET['dstatus']) && $_GET['dstatus']>0) {
|
||||
$dstatus = intval($_GET['dstatus']);
|
||||
$sqls.=" AND A.status={$dstatus}";
|
||||
$links.='&dstatus='.$dstatus;
|
||||
}
|
||||
if(isset($_GET['value']) && !empty($_GET['value'])) {
|
||||
if($_GET['column']=='name'){
|
||||
$sql=" A.`{$_GET['column']}` like '%{$_GET['value']}%'";
|
||||
}elseif($_GET['column']=='addtime'){
|
||||
$kws = explode('>',$_GET['value']);
|
||||
$sql=" AND A.`addtime`>='{$kws[0]}' AND A.`addtime`<='{$kws[1]}'";
|
||||
}else{
|
||||
$sql=" A.`{$_GET['column']}`='{$_GET['value']}'";
|
||||
}
|
||||
$sql.=$sqls;
|
||||
$numrows=$DB->getColumn("SELECT count(*) from pre_order A WHERE{$sql}");
|
||||
$con='包含 '.$_GET['value'].' 的共有 <b>'.$numrows.'</b> 条订单';
|
||||
$link='&column='.$_GET['column'].'&value='.$_GET['value'].$links;
|
||||
}else{
|
||||
$sql=" 1";
|
||||
$sql.=$sqls;
|
||||
$numrows=$DB->getColumn("SELECT count(*) from pre_order A WHERE{$sql}");
|
||||
$con='共有 <b>'.$numrows.'</b> 条订单';
|
||||
$link=$links;
|
||||
}
|
||||
?>
|
||||
<form name="form1" id="form1">
|
||||
<div class="table-responsive">
|
||||
<?php echo $con?>
|
||||
<table class="table table-striped table-bordered table-vcenter">
|
||||
<thead><tr><th>系统订单号<br/>商户订单号</th><th>商户号<br/>网站域名</th><th>商品名称<br/>订单金额</th><th>实际支付<br/>商户分成</th><th>支付方式(通道ID)<br/>支付插件</th><th>创建时间<br/>完成时间</th><th>支付状态<br/>通知状态</th><th>操作</th></tr></thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$pagesize=30;
|
||||
$pages=ceil($numrows/$pagesize);
|
||||
$page=isset($_GET['page'])?intval($_GET['page']):1;
|
||||
$offset=$pagesize*($page - 1);
|
||||
|
||||
$rs=$DB->query("SELECT A.*,B.plugin FROM pre_order A LEFT JOIN pre_channel B ON A.channel=B.id WHERE{$sql} order by trade_no desc limit $offset,$pagesize");
|
||||
while($res = $rs->fetch())
|
||||
{
|
||||
echo '<tr><td><input type="checkbox" name="checkbox[]" id="list1" value="'.$res['trade_no'].'" onClick="unselectall1()"><b><a href="javascript:showOrder(\''.$res['trade_no'].'\')" title="点击查看详情">'.$res['trade_no'].'</a></b><br/>'.$res['out_trade_no'].'</td><td><a href="./ulist.php?my=search&column=uid&value='.$res['uid'].'" target="_blank">'.$res['uid'].'</a><br/><a onclick="openlink(\'http://'.$res['domain'].'\')">'.$res['domain'].'</a></td><td>'.$res['name'].'<br/>¥<b>'.$res['money'].'</b></td><td>¥<b>'.$res['realmoney'].'</b><br/>¥<b>'.$res['getmoney'].'</b></td><td><img src="/assets/icon/'.$paytypes[$res['type']].'.ico" width="16" onerror="this.style.display=\'none\'">'.$paytype[$res['type']].'('.$res['channel'].')<br/>'.$res['plugin'].'</td><td>'.$res['addtime'].'<br/>'.$res['endtime'].'</td><td>'.display_status($res['status'], $res['notify']).'</td><td><div class="btn-group" role="group"><button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">操作订单 <span class="caret"></span></button><ul class="dropdown-menu">'.display_operation($res['status'], $res['trade_no']).'</ul></div></td></tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<input name="chkAll1" type="checkbox" id="chkAll1" onClick="this.value=check1(this.form.list1)" value="checkbox"> 全选
|
||||
<select name="status"><option selected>操作订单</option><option value="0">改未完成</option><option value="1">改已完成</option><option value="2">冻结订单</option><option value="3">解冻订单</option><option value="4">删除订单</option></select>
|
||||
<button type="button" onclick="operation()">确定</button>
|
||||
</div>
|
||||
</form>
|
||||
<?php
|
||||
echo'<div class="text-center"><ul class="pagination">';
|
||||
$first=1;
|
||||
$prev=$page-1;
|
||||
$next=$page+1;
|
||||
$last=$pages;
|
||||
if ($page>1)
|
||||
{
|
||||
echo '<li><a href="javascript:void(0)" onclick="listTable(\'page='.$first.$link.'\')">首页</a></li>';
|
||||
echo '<li><a href="javascript:void(0)" onclick="listTable(\'page='.$prev.$link.'\')">«</a></li>';
|
||||
} else {
|
||||
echo '<li class="disabled"><a>首页</a></li>';
|
||||
echo '<li class="disabled"><a>«</a></li>';
|
||||
}
|
||||
$start=$page-10>1?$page-10:1;
|
||||
$end=$page+10<$pages?$page+10:$pages;
|
||||
for ($i=$start;$i<$page;$i++)
|
||||
echo '<li><a href="javascript:void(0)" onclick="listTable(\'page='.$i.$link.'\')">'.$i .'</a></li>';
|
||||
echo '<li class="disabled"><a>'.$page.'</a></li>';
|
||||
for ($i=$page+1;$i<=$end;$i++)
|
||||
echo '<li><a href="javascript:void(0)" onclick="listTable(\'page='.$i.$link.'\')">'.$i .'</a></li>';
|
||||
if ($page<$pages)
|
||||
{
|
||||
echo '<li><a href="javascript:void(0)" onclick="listTable(\'page='.$next.$link.'\')">»</a></li>';
|
||||
echo '<li><a href="javascript:void(0)" onclick="listTable(\'page='.$last.$link.'\')">尾页</a></li>';
|
||||
} else {
|
||||
echo '<li class="disabled"><a>»</a></li>';
|
||||
echo '<li class="disabled"><a>尾页</a></li>';
|
||||
}
|
||||
echo'</ul></div>';
|
||||
431
admin/order.php
Normal file
@@ -0,0 +1,431 @@
|
||||
<?php
|
||||
/**
|
||||
* 订单列表
|
||||
**/
|
||||
include("../includes/common.php");
|
||||
$title='订单列表';
|
||||
include './head.php';
|
||||
if($islogin==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
|
||||
$type_select = '<option value="0">所有支付方式</option>';
|
||||
$rs = $DB->getAll("SELECT * FROM pre_type");
|
||||
foreach($rs as $row){
|
||||
$type_select .= '<option value="'.$row['id'].'">'.$row['showname'].'</option>';
|
||||
}
|
||||
unset($rs);
|
||||
?>
|
||||
<style>
|
||||
#orderItem .orderTitle{word-break:keep-all;}
|
||||
#orderItem .orderContent{word-break:break-all;}
|
||||
.form-inline .form-control {
|
||||
display: inline-block;
|
||||
width: auto;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.form-inline .form-group {
|
||||
display: inline-block;
|
||||
margin-bottom: 0;
|
||||
vertical-align: middle;
|
||||
}
|
||||
</style>
|
||||
<div class="container-fluid" style="padding-top:70px;">
|
||||
<div class="col-md-12 center-block" style="float: none;">
|
||||
|
||||
<form onsubmit="return searchOrder()" method="GET" class="form-inline">
|
||||
<div class="form-group">
|
||||
<label>搜索</label>
|
||||
<select name="column" class="form-control" default="<?php echo $_GET['column']?$_GET['column']:'trade_no'?>"><option value="trade_no">订单号</option><option value="out_trade_no">商户订单号</option><option value="api_trade_no">接口订单号</option><option value="name">商品名称</option><option value="money">金额</option><option value="domain">网站域名</option><option value="buyer">支付账号</option><option value="ip">支付IP</option><option value="addtime">创建时间</option></select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" name="value" placeholder="搜索内容" value="<?php echo @$_GET['value']?>">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" name="uid" style="width: 100px;" placeholder="商户号" value="<?php echo @$_GET['uid']?>">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<select name="type" class="form-control" default="<?php echo $_GET['type']?$_GET['type']:0?>"><?php echo $type_select?></select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" name="channel" style="width: 80px;" placeholder="通道ID" value="<?php echo @$_GET['channel']?>">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">搜索</button>
|
||||
<a href="javascript:searchClear()" class="btn btn-default" title="刷新订单列表"><i class="fa fa-refresh"></i></a>
|
||||
<div class="form-group">
|
||||
<select id="dstatus" class="form-control"><option value="0">显示全部</option><option value="1">只显示已完成</option><option value="3">只显示已冻结</option><option value="2">只显示已退款</option></select>
|
||||
</div>
|
||||
<?php if($DB->getRow("SHOW TABLES LIKE 'pay_order_old'")){echo '<a href="./order_old.php" class="btn btn-default btn-xs">历史订单查询</a>';}?>
|
||||
</form>
|
||||
|
||||
<div id="listTable"></div>
|
||||
</div>
|
||||
</div>
|
||||
<a style="display: none;" href="" id="vurl" rel="noreferrer" target="_blank"></a>
|
||||
<script src="//cdn.staticfile.org/layer/2.3/layer.js"></script>
|
||||
<script>
|
||||
var checkflag1 = "false";
|
||||
function check1(field) {
|
||||
if (checkflag1 == "false") {
|
||||
for (i = 0; i < field.length; i++) {
|
||||
field[i].checked = true;}
|
||||
checkflag1 = "true";
|
||||
return "false"; }
|
||||
else {
|
||||
for (i = 0; i < field.length; i++) {
|
||||
field[i].checked = false; }
|
||||
checkflag1 = "false";
|
||||
return "true"; }
|
||||
}
|
||||
|
||||
function unselectall1()
|
||||
{
|
||||
if(document.form1.chkAll1.checked){
|
||||
document.form1.chkAll1.checked = document.form1.chkAll1.checked&0;
|
||||
checkflag1 = "false";
|
||||
}
|
||||
}
|
||||
|
||||
var dstatus = 0;
|
||||
function listTable(query){
|
||||
var url = window.document.location.href.toString();
|
||||
var queryString = url.split("?")[1];
|
||||
query = query || queryString;
|
||||
if(query == 'start' || query == undefined){
|
||||
query = '';
|
||||
history.replaceState({}, null, './order.php');
|
||||
}else if(query != undefined){
|
||||
history.replaceState({}, null, './order.php?'+query);
|
||||
}
|
||||
layer.closeAll();
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'GET',
|
||||
url : 'order-table.php?dstatus='+dstatus+'&'+query,
|
||||
dataType : 'html',
|
||||
cache : false,
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
$("#listTable").html(data)
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
function openlink(full_link){
|
||||
window.open('javascript:window.name;', '<script>location.replace("'+full_link+'")<\/script>');
|
||||
}
|
||||
function searchOrder(){
|
||||
var column=$("select[name='column']").val();
|
||||
var value=$("input[name='value']").val();
|
||||
var uid=$("input[name='uid']").val();
|
||||
var type=$("select[name='type']").val();
|
||||
var channel=$("input[name='channel']").val();
|
||||
if(value==''){
|
||||
listTable('uid='+uid+'&type='+type+'&channel='+channel);
|
||||
}else{
|
||||
listTable('column='+column+'&value='+value+'&uid='+uid+'&type='+type+'&channel='+channel);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function searchClear(){
|
||||
$("input[name='value']").val('');
|
||||
$("input[name='uid']").val('');
|
||||
$("select[name='type']").val(0);
|
||||
$("input[name='channel']").val('');
|
||||
listTable('start');
|
||||
}
|
||||
function operation(){
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : 'ajax.php?act=operation',
|
||||
data : $('#form1').serialize(),
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
listTable();
|
||||
layer.alert(data.msg);
|
||||
}else{
|
||||
layer.alert(data.msg);
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('请求超时');
|
||||
listTable();
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
function showOrder(trade_no) {
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
var status = ['<span class="label label-primary">未支付</span>','<span class="label label-success">已支付</span>','<span class="label label-red">已退款</span>'];
|
||||
$.ajax({
|
||||
type : 'GET',
|
||||
url : 'ajax.php?act=order&trade_no='+trade_no,
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
var data = data.data;
|
||||
var item = '<table class="table table-condensed table-hover" id="orderItem">';
|
||||
item += '<tr><td colspan="6" style="text-align:center" class="orderTitle"><b>订单信息</b></td></tr>';
|
||||
item += '<tr class="orderTitle"><td class="info" class="orderTitle">系统订单号</td><td colspan="5" class="orderContent">'+data.trade_no+'</td></tr>';
|
||||
item += '<tr><td class="info" class="orderTitle">商户订单号</td><td colspan="5" class="orderContent">'+data.out_trade_no+'</td></tr>';
|
||||
item += '<tr><td class="info" class="orderTitle">接口订单号</td><td colspan="5" class="orderContent">'+data.api_trade_no+'</td></tr>';
|
||||
item += '<tr><td class="info">商户ID</td class="orderTitle"><td colspan="5" class="orderContent"><a href="./ulist.php?my=search&column=uid&value='+data.uid+'" target="_blank">'+data.uid+'</a></td>';
|
||||
item += '</tr><tr><td class="info" class="orderTitle">支付方式</td><td colspan="5" class="orderContent">'+data.typename+'</td></tr>';
|
||||
item += '</tr><tr><td class="info" class="orderTitle">支付通道</td><td colspan="5" class="orderContent">'+data.channelname+'</td></tr>';
|
||||
item += '</tr><tr><td class="info" class="orderTitle">商品名称</td><td colspan="5" class="orderContent">'+data.name+'</td></tr>';
|
||||
item += '</tr><tr><td class="info" class="orderTitle">订单金额</td><td colspan="5" class="orderContent">'+data.money+'</td></tr>';
|
||||
item += '</tr><tr><td class="info" class="orderTitle">实际支付金额</td><td colspan="5" class="orderContent">'+data.realmoney+'</td></tr>';
|
||||
item += '</tr><tr><td class="info" class="orderTitle">商户分成金额</td><td colspan="5" class="orderContent">'+data.realmoney+'</td></tr>';
|
||||
item += '</tr><tr><td class="info" class="orderTitle">创建时间</td><td colspan="5" class="orderContent">'+data.addtime+'</td></tr>';
|
||||
item += '</tr><tr><td class="info" class="orderTitle">完成时间</td><td colspan="5" class="orderContent">'+data.endtime+'</td></tr>';
|
||||
item += '</tr><tr><td class="info" class="orderTitle" title="只有在官方通道支付完成后才能显示">支付账号</td><td colspan="5" class="orderContent">'+data.buyer+'</td></tr>';
|
||||
item += '</tr><tr><td class="info" class="orderTitle">网站域名</td><td colspan="5" class="orderContent"><a href="http://'+data.domain+'" target="_blank" rel="noreferrer">'+data.domain+'</a></td></tr>';
|
||||
item += '</tr><tr><td class="info" class="orderTitle">支付IP</td><td colspan="5" class="orderContent"><a href="http://m.ip138.com/ip.asp?ip='+data.ip+'" target="_blank" rel="noreferrer">'+data.ip+'</a></td></tr>';
|
||||
item += '<tr><td class="info" class="orderTitle">订单状态</td><td colspan="5" class="orderContent">'+status[data.status]+'</td></tr>';
|
||||
if(data.status>0){
|
||||
item += '<tr><td class="info" class="orderTitle">通知状态</td><td colspan="5" class="orderContent">'+(data.notify==0?'<span class="label label-success">通知成功</span>':'<span class="label label-red">通知失败</span>')+'</td></tr>';
|
||||
}
|
||||
item += '<tr><td colspan="6" style="text-align:center" class="orderTitle"><b>订单操作</b></td></tr>';
|
||||
item += '<tr><td colspan="6"><a href="javascript:callnotify(\''+data.trade_no+'\')" class="btn btn-xs btn-default">重新通知(异步)</a> <a href="javascript:callreturn(\''+data.trade_no+'\')" class="btn btn-xs btn-default">重新通知(同步)</a></td></tr>';
|
||||
item += '</table>';
|
||||
var area = [$(window).width() > 480 ? '480px' : '100%'];
|
||||
layer.open({
|
||||
type: 1,
|
||||
area: area,
|
||||
title: '订单详细信息',
|
||||
skin: 'layui-layer-rim',
|
||||
content: item
|
||||
});
|
||||
}else{
|
||||
layer.alert(data.msg);
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
function callnotify(trade_no){
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : 'ajax.php?act=notify',
|
||||
data : {trade_no:trade_no},
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
$("#vurl").attr("href",data.url);
|
||||
document.getElementById("vurl").click();
|
||||
listTable();
|
||||
}else{
|
||||
layer.alert(data.msg);
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
function callreturn(trade_no){
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : 'ajax.php?act=notify',
|
||||
data : {trade_no:trade_no,isreturn:1},
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
$("#vurl").attr("href",data.url);
|
||||
document.getElementById("vurl").click();
|
||||
listTable();
|
||||
}else{
|
||||
layer.alert(data.msg);
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
function refund(trade_no) {
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : 'ajax.php?act=getmoney',
|
||||
data : {trade_no:trade_no},
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
var confirmobj = layer.confirm('此操作将从该商户扣除订单分成金额,你需要手动退款给购买者,是否确定?', {
|
||||
btn: ['确定','取消']
|
||||
}, function(){
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : 'ajax.php?act=refund',
|
||||
data : {trade_no:trade_no},
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
layer.alert(data.msg, {icon:1}, function(){ listTable() });
|
||||
}else{
|
||||
layer.alert(data.msg);
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}, function(){
|
||||
layer.close(confirmobj);
|
||||
});
|
||||
}else{
|
||||
layer.alert(data.msg);
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
function apirefund(trade_no) {
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : 'ajax.php?act=getmoney',
|
||||
data : {trade_no:trade_no,api:"1"},
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
layer.prompt({title: 'API退款'+data.money+'元 请输入支付密码', value: '', formType: 1}, function(text, index){
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : 'ajax.php?act=apirefund',
|
||||
data : {trade_no:trade_no,paypwd:text},
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
layer.alert(data.msg, {icon:1}, function(){ listTable() });
|
||||
}else{
|
||||
layer.alert(data.msg);
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
}else{
|
||||
layer.alert(data.msg);
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
function freeze(trade_no) {
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : 'ajax.php?act=freeze',
|
||||
data : {trade_no:trade_no},
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
layer.alert(data.msg, {icon:1}, function(){ listTable() });
|
||||
}else{
|
||||
layer.alert(data.msg);
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
function unfreeze(trade_no) {
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : 'ajax.php?act=unfreeze',
|
||||
data : {trade_no:trade_no},
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
layer.alert(data.msg, {icon:1}, function(){ listTable() });
|
||||
}else{
|
||||
layer.alert(data.msg);
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
function setStatus(trade_no, status) {
|
||||
if(status==5){
|
||||
var confirmobj = layer.confirm('你确实要删除此订单吗?', {
|
||||
btn: ['确定','取消']
|
||||
}, function(){
|
||||
setStatusDo(trade_no, status);
|
||||
});
|
||||
}else{
|
||||
setStatusDo(trade_no, status);
|
||||
}
|
||||
}
|
||||
function setStatusDo(trade_no, status) {
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'get',
|
||||
url : 'ajax.php',
|
||||
data : 'act=setStatus&trade_no=' + trade_no + '&status=' + status,
|
||||
dataType : 'json',
|
||||
success : function(ret) {
|
||||
layer.close(ii);
|
||||
if (ret['code'] != 200) {
|
||||
alert(ret['msg'] ? ret['msg'] : '操作失败');
|
||||
}
|
||||
listTable();
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
$(document).ready(function(){
|
||||
var items = $("select[default]");
|
||||
for (i = 0; i < items.length; i++) {
|
||||
$(items[i]).val($(items[i]).attr("default")||0);
|
||||
}
|
||||
listTable();
|
||||
$("#dstatus").change(function () {
|
||||
var val = $(this).val();
|
||||
dstatus = val;
|
||||
listTable();
|
||||
});
|
||||
})
|
||||
</script>
|
||||
123
admin/order_old.php
Normal file
@@ -0,0 +1,123 @@
|
||||
<?php
|
||||
/**
|
||||
* 订单列表
|
||||
**/
|
||||
include("../includes/common.php");
|
||||
$title='订单列表';
|
||||
include './head.php';
|
||||
if($islogin==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
?>
|
||||
<style>
|
||||
#orderItem .orderTitle{word-break:keep-all;}
|
||||
#orderItem .orderContent{word-break:break-all;}
|
||||
.form-inline .form-control {
|
||||
display: inline-block;
|
||||
width: auto;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.form-inline .form-group {
|
||||
display: inline-block;
|
||||
margin-bottom: 0;
|
||||
vertical-align: middle;
|
||||
}
|
||||
</style>
|
||||
<div class="container" style="padding-top:70px;">
|
||||
<div class="col-md-12 center-block" style="float: none;">
|
||||
<?php
|
||||
if(!$DB->getRow("SHOW TABLES LIKE 'pay_order_old'")){
|
||||
showmsg('历史订单表不存在');
|
||||
}
|
||||
|
||||
$my=isset($_GET['my'])?$_GET['my']:null;
|
||||
|
||||
echo '<form action="order_old.php" method="GET" class="form-inline"><input type="hidden" name="my" value="search">
|
||||
<div class="form-group">
|
||||
<label>搜索</label>
|
||||
<select name="column" class="form-control"><option value="trade_no">订单号</option><option value="out_trade_no">商户订单号</option><option value="pid">商户号</option><option value="name">商品名称</option><option value="money">金额</option></select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" name="value" placeholder="搜索内容">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">搜索</button>
|
||||
</form>';
|
||||
|
||||
if($my=='search') {
|
||||
if($_GET['column']=='name'){
|
||||
$sql=" `{$_GET['column']}` like '%{$_GET['value']}%'";
|
||||
}else{
|
||||
$sql=" `{$_GET['column']}`='{$_GET['value']}'";
|
||||
}
|
||||
$numrows=$DB->getColumn("SELECT count(*) from pay_order_old WHERE{$sql}");
|
||||
$con='包含 '.$_GET['value'].' 的共有 <b>'.$numrows.'</b> 条订单';
|
||||
$link='&my=search&column='.$_GET['column'].'&value='.$_GET['value'];
|
||||
}else{
|
||||
$numrows=$DB->getColumn("SELECT count(*) from pay_order_old WHERE 1");
|
||||
$sql=" 1";
|
||||
$con='共有 <b>'.$numrows.'</b> 条订单';
|
||||
}
|
||||
echo $con;
|
||||
?>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead><tr><th>订单号/商户订单号</th><th>商户号/网站域名</th><th>商品名称/金额</th><th>支付方式</th><th>创建时间/完成时间</th><th>支付状态</th></tr></thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$pagesize=30;
|
||||
$pages=intval($numrows/$pagesize);
|
||||
if ($numrows%$pagesize)
|
||||
{
|
||||
$pages++;
|
||||
}
|
||||
if (isset($_GET['page'])){
|
||||
$page=intval($_GET['page']);
|
||||
}
|
||||
else{
|
||||
$page=1;
|
||||
}
|
||||
$offset=$pagesize*($page - 1);
|
||||
|
||||
$rs=$DB->query("SELECT * FROM pay_order_old WHERE{$sql} order by trade_no desc limit $offset,$pagesize");
|
||||
while($res = $rs->fetch())
|
||||
{
|
||||
$url=creat_callback($res);
|
||||
echo '<tr><td><b><a href="'.$url['notify'].'" title="支付通知" target="_blank" rel="noreferrer">'.$res['trade_no'].'</a></b><br/>'.$res['out_trade_no'].'</td><td>'.$res['pid'].'<br/>'.$res['domain'].'</td><td>'.$res['name'].'<br/>¥'.$res['money'].'</td><td>'.$res['type'].'</td><td>'.$res['addtime'].'<br/>'.$res['endtime'].'</td><td>'.($res['status']==1?'<font color=green>已完成</font>':'<font color=blue>未完成</font>').'</td></tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php
|
||||
echo'<ul class="pagination">';
|
||||
$first=1;
|
||||
$prev=$page-1;
|
||||
$next=$page+1;
|
||||
$last=$pages;
|
||||
if ($page>1)
|
||||
{
|
||||
echo '<li><a href="order_old.php?page='.$first.$link.'">首页</a></li>';
|
||||
echo '<li><a href="order_old.php?page='.$prev.$link.'">«</a></li>';
|
||||
} else {
|
||||
echo '<li class="disabled"><a>首页</a></li>';
|
||||
echo '<li class="disabled"><a>«</a></li>';
|
||||
}
|
||||
for ($i=1;$i<$page;$i++)
|
||||
echo '<li><a href="order_old.php?page='.$i.$link.'">'.$i .'</a></li>';
|
||||
echo '<li class="disabled"><a>'.$page.'</a></li>';
|
||||
if($pages>=10)$s=10;
|
||||
else $s=$pages;
|
||||
for ($i=$page+1;$i<=$s;$i++)
|
||||
echo '<li><a href="order_old.php?page='.$i.$link.'">'.$i .'</a></li>';
|
||||
echo '';
|
||||
if ($page<$pages)
|
||||
{
|
||||
echo '<li><a href="order_old.php?page='.$next.$link.'">»</a></li>';
|
||||
echo '<li><a href="order_old.php?page='.$last.$link.'">尾页</a></li>';
|
||||
} else {
|
||||
echo '<li class="disabled"><a>»</a></li>';
|
||||
echo '<li class="disabled"><a>尾页</a></li>';
|
||||
}
|
||||
echo'</ul>';
|
||||
#分页
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
315
admin/pay_channel.php
Normal file
@@ -0,0 +1,315 @@
|
||||
<?php
|
||||
/**
|
||||
* 支付通道
|
||||
**/
|
||||
include("../includes/common.php");
|
||||
$title='支付通道';
|
||||
include './head.php';
|
||||
if($islogin==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
?>
|
||||
<div class="container" style="padding-top:70px;">
|
||||
<div class="col-md-10 center-block" style="float: none;">
|
||||
<?php
|
||||
|
||||
$paytype = [];
|
||||
$type_select = '';
|
||||
$rs = $DB->getAll("SELECT * FROM pre_type");
|
||||
foreach($rs as $row){
|
||||
$paytype[$row['id']] = $row['showname'];
|
||||
$type_select .= '<option value="'.$row['id'].'">'.$row['showname'].'</option>';
|
||||
}
|
||||
unset($rs);
|
||||
|
||||
$list = $DB->getAll("SELECT * FROM pre_channel");
|
||||
?>
|
||||
<div class="modal" id="modal-store" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content animated flipInX">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal"><span
|
||||
aria-hidden="true">×</span><span
|
||||
class="sr-only">Close</span></button>
|
||||
<h4 class="modal-title" id="modal-title">支付通道修改/添加</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form class="form-horizontal" id="form-store">
|
||||
<input type="hidden" name="action" id="action"/>
|
||||
<input type="hidden" name="id" id="id"/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label no-padding-right">显示名称</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" name="name" id="name" placeholder="仅显示使用,不要与其他通道名称重复">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label no-padding-right">分成比例</label>
|
||||
<div class="col-sm-10">
|
||||
<div class="input-group"><input type="text" class="form-control" name="rate" id="rate" placeholder="在没配置用户组的情况下以此费率为准"><span class="input-group-addon">%</span></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">支付方式</label>
|
||||
<div class="col-sm-10">
|
||||
<select name="type" id="type" class="form-control" onchange="changeType()">
|
||||
<option value="0">请选择支付方式</option><?php echo $type_select; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">支付插件</label>
|
||||
<div class="col-sm-10">
|
||||
<select name="plugin" id="plugin" class="form-control">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
|
||||
<button type="button" class="btn btn-primary" id="store" onclick="save()">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-info">
|
||||
<div class="panel-heading"><h3 class="panel-title">系统共有 <b><?php echo count($list);?></b> 个支付通道 <span class="pull-right"><a href="javascript:addframe()" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> 新增</a></span></h3></div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead><tr><th>ID</th><th>显示名称</th><th>分成比例</th><th>支付方式</th><th>支付插件</th><th>状态</th><th>操作</th></tr></thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach($list as $res)
|
||||
{
|
||||
echo '<tr><td><b>'.$res['id'].'</b></td><td>'.$res['name'].'</td><td>'.$res['rate'].'</td><td>'.$paytype[$res['type']].'</td><td><span onclick="showPlugin(\''.$res['plugin'].'\')" title="查看支付插件详情">'.$res['plugin'].'</span></td><td>'.($res['status']==1?'<a class="btn btn-xs btn-success" onclick="setStatus('.$res['id'].',0)">已开启</a>':'<a class="btn btn-xs btn-warning" onclick="setStatus('.$res['id'].',1)">已关闭</a>').'</td><td><a class="btn btn-xs btn-primary" onclick="editInfo('.$res['id'].')">配置密钥</a> <a class="btn btn-xs btn-info" onclick="editframe('.$res['id'].')">编辑</a> <a class="btn btn-xs btn-danger" onclick="delItem('.$res['id'].')">删除</a> <a href="./order.php?channel='.$res['id'].'" target="_blank" class="btn btn-xs btn-warning">订单</a></td></tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="//cdn.staticfile.org/layer/2.3/layer.js"></script>
|
||||
<script>
|
||||
function changeType(plugin){
|
||||
plugin = plugin || null;
|
||||
var typeid = $("#type").val();
|
||||
if(typeid==0)return;
|
||||
$("#plugin").empty();
|
||||
$.ajax({
|
||||
type : 'GET',
|
||||
url : 'ajax.php?act=getPlugins&typeid='+typeid,
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
if(data.code == 0){
|
||||
$.each(data.data, function (i, res) {
|
||||
$("#plugin").append('<option value="'+res.name+'">'+res.showname+'</option>');
|
||||
})
|
||||
if(plugin!=null)$("#plugin").val(plugin);
|
||||
}else{
|
||||
layer.msg(data.msg, {icon:2, time:1500})
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
function addframe(){
|
||||
$("#modal-store").modal('show');
|
||||
$("#modal-title").html("新增支付通道");
|
||||
$("#action").val("add");
|
||||
$("#id").val('');
|
||||
$("#name").val('');
|
||||
$("#rate").val('');
|
||||
$("#type").val(0);
|
||||
$("#plugin").empty();
|
||||
}
|
||||
function editframe(id){
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'GET',
|
||||
url : 'ajax.php?act=getChannel&id='+id,
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
$("#modal-store").modal('show');
|
||||
$("#modal-title").html("修改支付通道");
|
||||
$("#action").val("edit");
|
||||
$("#id").val(data.data.id);
|
||||
$("#name").val(data.data.name);
|
||||
$("#rate").val(data.data.rate);
|
||||
$("#type").val(data.data.type);
|
||||
changeType(data.data.plugin)
|
||||
}else{
|
||||
layer.alert(data.msg, {icon: 2})
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
function save(){
|
||||
if($("#name").val()==''||$("#rate").val()==''){
|
||||
layer.alert('请确保各项不能为空!');return false;
|
||||
}
|
||||
if($("#type").val()==0){
|
||||
layer.alert('请选择支付方式!');return false;
|
||||
}
|
||||
if($("#plugin").val()==0 || $("#plugin").val()==null){
|
||||
layer.alert('请选择支付插件!');return false;
|
||||
}
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : 'ajax.php?act=saveChannel',
|
||||
data : $("#form-store").serialize(),
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
layer.alert(data.msg,{
|
||||
icon: 1,
|
||||
closeBtn: false
|
||||
}, function(){
|
||||
window.location.reload()
|
||||
});
|
||||
}else{
|
||||
layer.alert(data.msg, {icon: 2})
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
function delItem(id) {
|
||||
var confirmobj = layer.confirm('你确实要删除此支付通道吗?', {
|
||||
btn: ['确定','取消']
|
||||
}, function(){
|
||||
$.ajax({
|
||||
type : 'GET',
|
||||
url : 'ajax.php?act=delChannel&id='+id,
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
if(data.code == 0){
|
||||
window.location.reload()
|
||||
}else{
|
||||
layer.alert(data.msg, {icon: 2});
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}, function(){
|
||||
layer.close(confirmobj);
|
||||
});
|
||||
}
|
||||
function setStatus(id,status) {
|
||||
$.ajax({
|
||||
type : 'GET',
|
||||
url : 'ajax.php?act=setChannel&id='+id+'&status='+status,
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
if(data.code == 0){
|
||||
window.location.reload()
|
||||
}else{
|
||||
layer.msg(data.msg, {icon:2, time:1500});
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
function editInfo(id){
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'GET',
|
||||
url : 'ajax.php?act=channelInfo&id='+id,
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
var area = [$(window).width() > 520 ? '520px' : '100%', ';max-height:100%'];
|
||||
layer.open({
|
||||
type: 1,
|
||||
area: area,
|
||||
title: '配置对接密钥',
|
||||
skin: 'layui-layer-rim',
|
||||
content: data.data
|
||||
});
|
||||
}else{
|
||||
layer.alert(data.msg, {icon: 2})
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
function saveInfo(id){
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : 'ajax.php?act=saveChannelInfo&id='+id,
|
||||
data : $("#form-info").serialize(),
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
layer.alert(data.msg,{
|
||||
icon: 1,
|
||||
closeBtn: false
|
||||
}, function(){
|
||||
window.location.reload()
|
||||
});
|
||||
}else{
|
||||
layer.alert(data.msg, {icon: 2})
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
function showPlugin(name){
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'GET',
|
||||
url : 'ajax.php?act=getPlugin&name='+name,
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
var item = '<table class="table table-condensed table-hover">';
|
||||
item += '<tr><td class="info">插件名称</td><td colspan="5">'+data.data.name+'</td></tr><tr><td class="info">插件描述</td><td colspan="5">'+data.data.showname+'</td></tr><tr><td class="info">插件网址</td><td colspan="5"><a href="'+data.data.link+'" target="_blank">'+data.data.author+'</a></td></tr><tr><td class="info">插件路径</td><td colspan="5">/plugins/'+data.data.name+'/</td></tr>';
|
||||
item += '</table>';
|
||||
layer.open({
|
||||
type: 1,
|
||||
shadeClose: true,
|
||||
title: '支付插件详情',
|
||||
content: item
|
||||
});
|
||||
}else{
|
||||
layer.alert(data.msg, {icon: 2})
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
42
admin/pay_plugin.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* 支付插件
|
||||
**/
|
||||
include("../includes/common.php");
|
||||
$title='支付插件';
|
||||
include './head.php';
|
||||
if($islogin==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
?>
|
||||
<div class="container" style="padding-top:70px;">
|
||||
<div class="col-md-8 center-block" style="float: none;">
|
||||
<?php
|
||||
$my=isset($_GET['my'])?$_GET['my']:null;
|
||||
if($my=='refresh') {
|
||||
\lib\Plugin::updateAll();
|
||||
exit("<script language='javascript'>alert('刷新插件列表成功!');history.go(-1);</script>");
|
||||
}else{
|
||||
$list = \lib\Plugin::getAll();
|
||||
?>
|
||||
<div class="panel panel-info">
|
||||
<div class="panel-heading"><h3 class="panel-title">系统共有 <b><?php echo count($list);?></b> 个支付插件 <span class="pull-right">【<a href="./pay_plugin.php?my=refresh">刷新插件列表</a>】</span></h3></div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead><tr><th>插件名称</th><th>插件描述</th><th>插件作者</th><th>包含的支付方式</th></tr></thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach($list as $res)
|
||||
{
|
||||
echo '<tr><td><b>'.$res['name'].'</b></td><td>'.$res['showname'].'</td><td><a href="'.$res['link'].'" target="_blank" rel="noreferrer">'.$res['author'].'
|
||||
</a></td><td>'.$res['types'].'</td></tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="panel-footer">
|
||||
<span class="glyphicon glyphicon-info-sign"></span> 支付插件目录:/plugins/,请将符合要求的支付插件源码解压到支付插件目录,然后点击 刷新插件列表 即可显示在该列表中。
|
||||
</div>
|
||||
</div>
|
||||
<?php }?>
|
||||
</div>
|
||||
</div>
|
||||
309
admin/pay_roll.php
Normal file
@@ -0,0 +1,309 @@
|
||||
<?php
|
||||
/**
|
||||
* 支付通道轮询设置
|
||||
**/
|
||||
include("../includes/common.php");
|
||||
$title='支付通道轮询设置';
|
||||
include './head.php';
|
||||
if($islogin==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
?>
|
||||
<style>
|
||||
.form-inline .form-control{display: inline-block;width: auto;vertical-align: middle;}</style>
|
||||
<div class="container" style="padding-top:70px;">
|
||||
<div class="col-md-10 center-block" style="float: none;">
|
||||
<?php
|
||||
|
||||
$paytype = [];
|
||||
$type_select = '';
|
||||
$rs = $DB->getAll("SELECT * FROM pre_type");
|
||||
foreach($rs as $row){
|
||||
$paytype[$row['id']] = $row['showname'];
|
||||
$type_select .= '<option value="'.$row['id'].'">'.$row['showname'].'</option>';
|
||||
}
|
||||
unset($rs);
|
||||
$rolltype = ['顺序轮询','随机轮询'];
|
||||
|
||||
$list = $DB->getAll("SELECT * FROM pre_roll");
|
||||
?>
|
||||
<div class="modal" id="modal-store" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content animated flipInX">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal"><span
|
||||
aria-hidden="true">×</span><span
|
||||
class="sr-only">Close</span></button>
|
||||
<h4 class="modal-title" id="modal-title">轮询组修改/添加</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form class="form-horizontal" id="form-store">
|
||||
<input type="hidden" name="action" id="action"/>
|
||||
<input type="hidden" name="id" id="id"/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label no-padding-right">显示名称</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" name="name" id="name" placeholder="仅显示使用,不要与其他轮询组名称重复">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">支付方式</label>
|
||||
<div class="col-sm-10">
|
||||
<select name="type" id="type" class="form-control">
|
||||
<option value="0">请选择支付方式</option><?php echo $type_select; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">轮询方式</label>
|
||||
<div class="col-sm-10">
|
||||
<select name="kind" id="kind" class="form-control">
|
||||
<option value="0">按顺序依次轮询</option><option value="1">按权重随机轮询</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group hide">
|
||||
<label class="col-sm-2 control-label">支付通道</label>
|
||||
<div class="col-sm-10">
|
||||
<select id="channel" class="form-control">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<!--div class="form-group">
|
||||
<label class="col-sm-2 control-label">通道配置</label>
|
||||
<div class="col-sm-10">
|
||||
<dl class="fieldlist" data-name="list" data-listidx="0">
|
||||
<dd class="form-inline">
|
||||
<select name="list[][channel]" class="form-control">
|
||||
</select>
|
||||
<input type="text" name="list[][weight]" class="form-control" value="" size="10" placeholder="权重(1-99)">
|
||||
<span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span>
|
||||
</dd>
|
||||
<dd>
|
||||
<a href="javascript:;" class="btn btn-sm btn-success pay-append"><i class="fa fa-plus"></i> 追加</a>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div-->
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
|
||||
<button type="button" class="btn btn-primary" id="store" onclick="save()">保存</button>
|
||||
</div>
|
||||
<div class="panel-footer">
|
||||
<span class="glyphicon glyphicon-info-sign"></span> 按顺序依次轮询不支持设置权重,按权重随机轮询支持设置每个通道的权重
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-info">
|
||||
<div class="panel-heading"><h3 class="panel-title">系统共有 <b><?php echo count($list);?></b> 个轮询组 <span class="pull-right"><a href="javascript:addframe()" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> 新增</a></span></h3></div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead><tr><th>ID</th><th>显示名称</th><th>支付方式</th><th>轮询方式</th><th>轮询规则</th><th>状态</th><th>操作</th></tr></thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach($list as $res)
|
||||
{
|
||||
echo '<tr><td><b>'.$res['id'].'</b></td><td>'.$res['name'].'</td><td>'.$paytype[$res['type']].'</td><td>'.$rolltype[$res['kind']].'</td><td>'.$res['info'].'</td><td>'.($res['status']==1?'<a class="btn btn-xs btn-success" onclick="setStatus('.$res['id'].',0)">已开启</a>':'<a class="btn btn-xs btn-warning" onclick="setStatus('.$res['id'].',1)">已关闭</a>').'</td><td><a class="btn btn-xs btn-primary" onclick="editInfo('.$res['id'].')">配置通道</a> <a class="btn btn-xs btn-info" onclick="editframe('.$res['id'].')">编辑</a> <a class="btn btn-xs btn-danger" onclick="delItem('.$res['id'].')">删除</a></td></tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="//cdn.staticfile.org/layer/2.3/layer.js"></script>
|
||||
<script>
|
||||
function addframe(){
|
||||
$("#modal-store").modal('show');
|
||||
$("#modal-title").html("新增轮询组");
|
||||
$("#action").val("add");
|
||||
$("#id").val('');
|
||||
$("#name").val('');
|
||||
$("#type").val(0);
|
||||
$("#kind").val(0);
|
||||
}
|
||||
function editframe(id){
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'GET',
|
||||
url : 'ajax.php?act=getRoll&id='+id,
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
$("#modal-store").modal('show');
|
||||
$("#modal-title").html("修改轮询组");
|
||||
$("#action").val("edit");
|
||||
$("#id").val(data.data.id);
|
||||
$("#name").val(data.data.name);
|
||||
$("#type").val(data.data.type);
|
||||
$("#kind").val(data.data.kind);
|
||||
}else{
|
||||
layer.alert(data.msg, {icon: 2})
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
function save(){
|
||||
if($("#name").val()==''){
|
||||
layer.alert('请确保各项不能为空!');return false;
|
||||
}
|
||||
if($("#type").val()==0){
|
||||
layer.alert('请选择支付方式!');return false;
|
||||
}
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : 'ajax.php?act=saveRoll',
|
||||
data : $("#form-store").serialize(),
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
layer.alert(data.msg,{
|
||||
icon: 1,
|
||||
closeBtn: false
|
||||
}, function(){
|
||||
window.location.reload()
|
||||
});
|
||||
}else{
|
||||
layer.alert(data.msg, {icon: 2})
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
function delItem(id) {
|
||||
var confirmobj = layer.confirm('你确实要删除此轮询组吗?', {
|
||||
btn: ['确定','取消']
|
||||
}, function(){
|
||||
$.ajax({
|
||||
type : 'GET',
|
||||
url : 'ajax.php?act=delRoll&id='+id,
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
if(data.code == 0){
|
||||
window.location.reload()
|
||||
}else{
|
||||
layer.alert(data.msg, {icon: 2});
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}, function(){
|
||||
layer.close(confirmobj);
|
||||
});
|
||||
}
|
||||
function setStatus(id,status) {
|
||||
$.ajax({
|
||||
type : 'GET',
|
||||
url : 'ajax.php?act=setRoll&id='+id+'&status='+status,
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
if(data.code == 0){
|
||||
window.location.reload()
|
||||
}else{
|
||||
layer.msg(data.msg, {icon:2, time:1500});
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
function editInfo(id){
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$("#channel").empty();
|
||||
$.ajax({
|
||||
type : 'GET',
|
||||
url : 'ajax.php?act=rollInfo&id='+id,
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
$.each(data.channels, function (i, res) {
|
||||
$("#channel").append('<option value="'+res.id+'">'+res.name+'</option>');
|
||||
})
|
||||
var item = '<div class="modal-body"><form class="form" id="form-info"><dl class="fieldlist" data-name="list" data-listidx="0">';
|
||||
item += '</dl><button type="button" id="save" onclick="saveInfo('+id+')" class="btn btn-primary btn-block">保存</button><br/>备注:顺序轮询设置权重值无效</form></div>';
|
||||
var area = [$(window).width() > 520 ? '520px' : '100%', '480px'];
|
||||
layer.open({
|
||||
type: 1,
|
||||
area: area,
|
||||
title: '配置轮询组',
|
||||
skin: 'layui-layer-rim',
|
||||
content: item,
|
||||
success: function(){
|
||||
if(data.info == null){
|
||||
$(".fieldlist").append('<dd class="form-inline"><select name="list[0][channel]" class="form-control">'+$("#channel").html()+'</select> <input type="text" name="list[0][weight]" class="form-control" value="" size="10" placeholder="权重(1-99)"> <span class="btn btn-sm btn-danger" disabled><i class="fa fa-times"></i></span> </dd>');
|
||||
}else{
|
||||
$.each(data.info, function (i, res) {
|
||||
var num = parseInt(Math.random()*(99999-10+1)+10,10);
|
||||
$(".fieldlist").append('<dd class="form-inline"><select name="list['+num+'][channel]" class="form-control" default="'+res.channel+'">'+$("#channel").html()+'</select> <input type="text" name="list['+num+'][weight]" class="form-control" value="'+res.weight+'" size="10" placeholder="权重(1-99)"> <span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span> </dd>');
|
||||
$("select[name='list["+num+"][channel]']").val(res.channel);
|
||||
})
|
||||
}
|
||||
$(".fieldlist").append('<dd><a href="javascript:;" class="btn btn-sm btn-success pay-append"><i class="fa fa-plus"></i> 追加</a></dd>');
|
||||
}
|
||||
});
|
||||
}else{
|
||||
layer.alert(data.msg, {icon: 2})
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
function saveInfo(id){
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : 'ajax.php?act=saveRollInfo&id='+id,
|
||||
data : $("#form-info").serialize(),
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
layer.alert(data.msg,{
|
||||
icon: 1,
|
||||
closeBtn: false
|
||||
}, function(){
|
||||
window.location.reload()
|
||||
});
|
||||
}else{
|
||||
layer.alert(data.msg, {icon: 2})
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
$(document).on("click", ".pay-append", function (e) {
|
||||
var select = $("#channel").html();
|
||||
var num = parseInt(Math.random()*(99999-10+1)+10,10);
|
||||
var html = '<dd class="form-inline"><select name="list['+num+'][channel]" class="form-control">'+select+'</select> <input type="text" name="list['+num+'][weight]" class="form-control" value="" size="10" placeholder="权重(1-99)"> <span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span> </dd>';
|
||||
$(this).parent().parent().find('dd[class="form-inline"]:last').append(html);
|
||||
});
|
||||
$(document).on("click", "dd .btn-remove", function () {
|
||||
var container = $(this).closest("dl");
|
||||
$(this).closest("dd").remove();
|
||||
});
|
||||
</script>
|
||||
207
admin/pay_type.php
Normal file
@@ -0,0 +1,207 @@
|
||||
<?php
|
||||
/**
|
||||
* 支付方式
|
||||
**/
|
||||
include("../includes/common.php");
|
||||
$title='支付方式';
|
||||
include './head.php';
|
||||
if($islogin==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
?>
|
||||
<div class="container" style="padding-top:70px;">
|
||||
<div class="col-md-8 center-block" style="float: none;">
|
||||
<?php
|
||||
function display_device($device){
|
||||
if($device==1)
|
||||
return 'PC';
|
||||
elseif($device==2)
|
||||
return 'Mobile';
|
||||
else
|
||||
return 'PC+Mobile';
|
||||
}
|
||||
|
||||
$list = $DB->getAll("SELECT * FROM pre_type");
|
||||
?>
|
||||
<div class="modal" id="modal-store" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content animated flipInX">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal"><span
|
||||
aria-hidden="true">×</span><span
|
||||
class="sr-only">Close</span></button>
|
||||
<h4 class="modal-title" id="modal-title">支付方式修改/添加</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form class="form-horizontal" id="form-store">
|
||||
<input type="hidden" name="action" id="action"/>
|
||||
<input type="hidden" name="id" id="id"/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label no-padding-right"></label>
|
||||
<div class="col-sm-10">
|
||||
<div class="alert alert-warning">
|
||||
注意:同一个调用值+支持设备不能重复
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label no-padding-right">调用值</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" name="name" id="name" placeholder="仅限英文,要与支付文档一致">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label no-padding-right">显示名称</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" name="showname" id="showname" placeholder="仅显示使用">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">支持设备</label>
|
||||
<div class="col-sm-10">
|
||||
<select name="device" id="device" class="form-control">
|
||||
<option value="0">PC+Mobile</option>
|
||||
<option value="1">PC</option>
|
||||
<option value="2">Mobile</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
|
||||
<button type="button" class="btn btn-primary" id="store" onclick="save()">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-info">
|
||||
<div class="panel-heading"><h3 class="panel-title">系统共有 <b><?php echo count($list);?></b> 个支付方式 <span class="pull-right"><a href="javascript:addframe()" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> 新增</a></span></h3></div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead><tr><th>调用值</th><th>名称</th><th>支持设备</th><th>状态</th><th>操作</th></tr></thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach($list as $res)
|
||||
{
|
||||
echo '<tr><td><b>'.$res['name'].'</b></td><td>'.$res['showname'].'</td><td>'.display_device($res['device']).'</td><td>'.($res['status']==1?'<a class="btn btn-xs btn-success" onclick="setStatus('.$res['id'].',0)">已开启</a>':'<a class="btn btn-xs btn-warning" onclick="setStatus('.$res['id'].',1)">已关闭</a>').'</td><td><a class="btn btn-xs btn-info" onclick="editframe('.$res['id'].')">编辑</a> <a class="btn btn-xs btn-danger" onclick="delItem('.$res['id'].')">删除</a></td></tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="//cdn.staticfile.org/layer/2.3/layer.js"></script>
|
||||
<script>
|
||||
function addframe(){
|
||||
$("#modal-store").modal('show');
|
||||
$("#modal-title").html("新增支付方式");
|
||||
$("#action").val("add");
|
||||
$("#id").val('');
|
||||
$("#name").val('');
|
||||
$("#showname").val('');
|
||||
$("#device").val(0);
|
||||
}
|
||||
function editframe(id){
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'GET',
|
||||
url : 'ajax.php?act=getPayType&id='+id,
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
$("#modal-store").modal('show');
|
||||
$("#modal-title").html("修改支付方式");
|
||||
$("#action").val("edit");
|
||||
$("#id").val(data.data.id);
|
||||
$("#name").val(data.data.name);
|
||||
$("#showname").val(data.data.showname);
|
||||
$("#device").val(data.data.device);
|
||||
}else{
|
||||
layer.alert(data.msg, {icon: 2})
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
function save(){
|
||||
if($("#name").val()==''||$("#showname").val()==''){
|
||||
layer.alert('请确保各项不能为空!');return false;
|
||||
}
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : 'ajax.php?act=savePayType',
|
||||
data : $("#form-store").serialize(),
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
layer.alert(data.msg,{
|
||||
icon: 1,
|
||||
closeBtn: false
|
||||
}, function(){
|
||||
window.location.reload()
|
||||
});
|
||||
}else{
|
||||
layer.alert(data.msg, {icon: 2})
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
function delItem(id) {
|
||||
if(id<4){
|
||||
layer.msg('系统自带支付方式暂不支持删除');
|
||||
return false;
|
||||
}
|
||||
var confirmobj = layer.confirm('你确实要删除此支付方式吗?', {
|
||||
btn: ['确定','取消']
|
||||
}, function(){
|
||||
$.ajax({
|
||||
type : 'GET',
|
||||
url : 'ajax.php?act=delPayType&id='+id,
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
if(data.code == 0){
|
||||
window.location.reload()
|
||||
}else{
|
||||
layer.alert(data.msg, {icon: 2});
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}, function(){
|
||||
layer.close(confirmobj);
|
||||
});
|
||||
}
|
||||
function setStatus(id,status) {
|
||||
$.ajax({
|
||||
type : 'GET',
|
||||
url : 'ajax.php?act=setPayType&id='+id+'&status='+status,
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
if(data.code == 0){
|
||||
window.location.reload()
|
||||
}else{
|
||||
layer.msg(data.msg, {icon:2, time:1500});
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
69
admin/record-table.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/**
|
||||
* 收支明细
|
||||
**/
|
||||
include("../includes/common.php");
|
||||
if($islogin==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
|
||||
|
||||
if(isset($_GET['value']) && !empty($_GET['value'])) {
|
||||
$sql=" `{$_GET['column']}`='{$_GET['value']}'";
|
||||
$numrows=$DB->getColumn("SELECT count(*) from pre_record WHERE{$sql}");
|
||||
$con='包含 '.$_GET['value'].' 的共有 <b>'.$numrows.'</b> 条记录';
|
||||
$link='&my=search&column='.$_GET['column'].'&value='.$_GET['value'];
|
||||
}else{
|
||||
$numrows=$DB->getColumn("SELECT count(*) from pre_record WHERE 1");
|
||||
$sql=" 1";
|
||||
$con='共有 <b>'.$numrows.'</b> 条记录';
|
||||
}
|
||||
?>
|
||||
<div class="table-responsive">
|
||||
<?php echo $con?>
|
||||
<table class="table table-striped table-bordered table-vcenter">
|
||||
<thead><tr><th>商户号</th><th>操作类型</th><th>变更金额</th><th>变更前金额</th><th>变更后金额</th><th>时间</th><th>关联订单号</th></tr></thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$pagesize=30;
|
||||
$pages=ceil($numrows/$pagesize);
|
||||
$page=isset($_GET['page'])?intval($_GET['page']):1;
|
||||
$offset=$pagesize*($page - 1);
|
||||
|
||||
$rs=$DB->query("SELECT * FROM pre_record WHERE{$sql} order by id desc limit $offset,$pagesize");
|
||||
while($res = $rs->fetch())
|
||||
{
|
||||
echo '<tr><td><b><a href="./ulist.php?column=uid&value='.$res['uid'].'" target="_blank">'.$res['uid'].'</a></b></td><td>'.($res['action']==2?'<font color="red">'.$res['type'].'</font>':'<font color="green">'.$res['type'].'</font>').'</td><td>'.($res['action']==2?'- ':'+ ').$res['money'].'</td><td>'.$res['oldmoney'].'</td><td>'.$res['newmoney'].'</td><td>'.$res['date'].'</td><td>'.($res['trade_no']?'<a href="./order.php?column=trade_no&value='.$res['trade_no'].'" target="_blank">'.$res['trade_no'].'</a>':'无').'</td></tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php
|
||||
echo'<div class="text-center"><ul class="pagination">';
|
||||
$first=1;
|
||||
$prev=$page-1;
|
||||
$next=$page+1;
|
||||
$last=$pages;
|
||||
if ($page>1)
|
||||
{
|
||||
echo '<li><a href="javascript:void(0)" onclick="listTable(\'page='.$first.$link.'\')">首页</a></li>';
|
||||
echo '<li><a href="javascript:void(0)" onclick="listTable(\'page='.$prev.$link.'\')">«</a></li>';
|
||||
} else {
|
||||
echo '<li class="disabled"><a>首页</a></li>';
|
||||
echo '<li class="disabled"><a>«</a></li>';
|
||||
}
|
||||
$start=$page-10>1?$page-10:1;
|
||||
$end=$page+10<$pages?$page+10:$pages;
|
||||
for ($i=$start;$i<$page;$i++)
|
||||
echo '<li><a href="javascript:void(0)" onclick="listTable(\'page='.$i.$link.'\')">'.$i .'</a></li>';
|
||||
echo '<li class="disabled"><a>'.$page.'</a></li>';
|
||||
for ($i=$page+1;$i<=$end;$i++)
|
||||
echo '<li><a href="javascript:void(0)" onclick="listTable(\'page='.$i.$link.'\')">'.$i .'</a></li>';
|
||||
if ($page<$pages)
|
||||
{
|
||||
echo '<li><a href="javascript:void(0)" onclick="listTable(\'page='.$next.$link.'\')">»</a></li>';
|
||||
echo '<li><a href="javascript:void(0)" onclick="listTable(\'page='.$last.$link.'\')">尾页</a></li>';
|
||||
} else {
|
||||
echo '<li class="disabled"><a>»</a></li>';
|
||||
echo '<li class="disabled"><a>尾页</a></li>';
|
||||
}
|
||||
echo'</ul></div>';
|
||||
69
admin/record.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/**
|
||||
* 资金明细
|
||||
**/
|
||||
include("../includes/common.php");
|
||||
$title='资金明细';
|
||||
include './head.php';
|
||||
if($islogin==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
?>
|
||||
<div class="container" style="padding-top:70px;">
|
||||
<div class="col-md-12 center-block" style="float: none;">
|
||||
<form onsubmit="return searchRecord()" method="GET" class="form-inline">
|
||||
<div class="form-group">
|
||||
<label>搜索</label>
|
||||
<select name="column" class="form-control"><option value="uid">商户号</option><option value="action">操作类型</option><option value="money">变更金额</option><option value="trade_no">关联订单号</option></select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" name="value" placeholder="搜索内容">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">搜索</button>
|
||||
<a href="javascript:listTable('start')" class="btn btn-default" title="刷新明细列表"><i class="fa fa-refresh"></i></a>
|
||||
</form>
|
||||
|
||||
<div id="listTable"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="//cdn.staticfile.org/layer/2.3/layer.js"></script>
|
||||
<script>
|
||||
function listTable(query){
|
||||
var url = window.document.location.href.toString();
|
||||
var queryString = url.split("?")[1];
|
||||
query = query || queryString;
|
||||
if(query == 'start' || query == undefined){
|
||||
query = '';
|
||||
history.replaceState({}, null, './record.php');
|
||||
}else if(query != undefined){
|
||||
history.replaceState({}, null, './record.php?'+query);
|
||||
}
|
||||
layer.closeAll();
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'GET',
|
||||
url : 'record-table.php?'+query,
|
||||
dataType : 'html',
|
||||
cache : false,
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
$("#listTable").html(data)
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
function searchRecord(){
|
||||
var column=$("select[name='column']").val();
|
||||
var value=$("input[name='value']").val();
|
||||
if(value==''){
|
||||
listTable();
|
||||
}else{
|
||||
listTable('column='+column+'&value='+value);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
$(document).ready(function(){
|
||||
listTable();
|
||||
})
|
||||
</script>
|
||||
69
admin/risk-table.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/**
|
||||
* 风控记录
|
||||
**/
|
||||
include("../includes/common.php");
|
||||
if($islogin==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
|
||||
|
||||
if(isset($_GET['value']) && !empty($_GET['value'])) {
|
||||
$sql=" `{$_GET['column']}`='{$_GET['value']}'";
|
||||
$numrows=$DB->getColumn("SELECT count(*) from pre_risk WHERE{$sql}");
|
||||
$con='包含 '.$_GET['value'].' 的共有 <b>'.$numrows.'</b> 条记录';
|
||||
$link='&my=search&column='.$_GET['column'].'&value='.$_GET['value'];
|
||||
}else{
|
||||
$numrows=$DB->getColumn("SELECT count(*) from pre_risk WHERE 1");
|
||||
$sql=" 1";
|
||||
$con='共有 <b>'.$numrows.'</b> 条记录';
|
||||
}
|
||||
?>
|
||||
<div class="table-responsive">
|
||||
<?php echo $con?>
|
||||
<table class="table table-striped table-bordered table-vcenter">
|
||||
<thead><tr><th>ID</th><th>商户号</th><th>风控类型</th><th>风控网址</th><th>风控内容</th><th>时间</th></tr></thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$pagesize=30;
|
||||
$pages=ceil($numrows/$pagesize);
|
||||
$page=isset($_GET['page'])?intval($_GET['page']):1;
|
||||
$offset=$pagesize*($page - 1);
|
||||
|
||||
$rs=$DB->query("SELECT * FROM pre_risk WHERE{$sql} order by id desc limit $offset,$pagesize");
|
||||
while($res = $rs->fetch())
|
||||
{
|
||||
echo '<tr><td><b>'.$res['id'].'</b></td><td><b><a href="./ulist.php?column=uid&value='.$res['uid'].'" target="_blank">'.$res['uid'].'</a></b></td><td>关键词屏蔽</td><td>'.$res['url'].'</td><td>'.$res['content'].'</td><td>'.$res['date'].'</td></tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php
|
||||
echo'<div class="text-center"><ul class="pagination">';
|
||||
$first=1;
|
||||
$prev=$page-1;
|
||||
$next=$page+1;
|
||||
$last=$pages;
|
||||
if ($page>1)
|
||||
{
|
||||
echo '<li><a href="javascript:void(0)" onclick="listTable(\'page='.$first.$link.'\')">首页</a></li>';
|
||||
echo '<li><a href="javascript:void(0)" onclick="listTable(\'page='.$prev.$link.'\')">«</a></li>';
|
||||
} else {
|
||||
echo '<li class="disabled"><a>首页</a></li>';
|
||||
echo '<li class="disabled"><a>«</a></li>';
|
||||
}
|
||||
$start=$page-10>1?$page-10:1;
|
||||
$end=$page+10<$pages?$page+10:$pages;
|
||||
for ($i=$start;$i<$page;$i++)
|
||||
echo '<li><a href="javascript:void(0)" onclick="listTable(\'page='.$i.$link.'\')">'.$i .'</a></li>';
|
||||
echo '<li class="disabled"><a>'.$page.'</a></li>';
|
||||
for ($i=$page+1;$i<=$end;$i++)
|
||||
echo '<li><a href="javascript:void(0)" onclick="listTable(\'page='.$i.$link.'\')">'.$i .'</a></li>';
|
||||
if ($page<$pages)
|
||||
{
|
||||
echo '<li><a href="javascript:void(0)" onclick="listTable(\'page='.$next.$link.'\')">»</a></li>';
|
||||
echo '<li><a href="javascript:void(0)" onclick="listTable(\'page='.$last.$link.'\')">尾页</a></li>';
|
||||
} else {
|
||||
echo '<li class="disabled"><a>»</a></li>';
|
||||
echo '<li class="disabled"><a>尾页</a></li>';
|
||||
}
|
||||
echo'</ul></div>';
|
||||
69
admin/risk.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/**
|
||||
* 风控记录
|
||||
**/
|
||||
include("../includes/common.php");
|
||||
$title='风控记录';
|
||||
include './head.php';
|
||||
if($islogin==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
?>
|
||||
<div class="container" style="padding-top:70px;">
|
||||
<div class="col-md-12 center-block" style="float: none;">
|
||||
<form onsubmit="return searchRecord()" method="GET" class="form-inline">
|
||||
<div class="form-group">
|
||||
<label>搜索</label>
|
||||
<select name="column" class="form-control"><option value="uid">商户号</option><option value="url">风控网址</option><option value="content">风控内容</option></select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" name="value" placeholder="搜索内容">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">搜索</button>
|
||||
<a href="javascript:listTable('start')" class="btn btn-default" title="刷新风控记录"><i class="fa fa-refresh"></i></a>
|
||||
</form>
|
||||
|
||||
<div id="listTable"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="//cdn.staticfile.org/layer/2.3/layer.js"></script>
|
||||
<script>
|
||||
function listTable(query){
|
||||
var url = window.document.location.href.toString();
|
||||
var queryString = url.split("?")[1];
|
||||
query = query || queryString;
|
||||
if(query == 'start' || query == undefined){
|
||||
query = '';
|
||||
history.replaceState({}, null, './risk.php');
|
||||
}else if(query != undefined){
|
||||
history.replaceState({}, null, './risk.php?'+query);
|
||||
}
|
||||
layer.closeAll();
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'GET',
|
||||
url : 'risk-table.php?'+query,
|
||||
dataType : 'html',
|
||||
cache : false,
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
$("#listTable").html(data)
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
function searchRecord(){
|
||||
var column=$("select[name='column']").val();
|
||||
var value=$("input[name='value']").val();
|
||||
if(value==''){
|
||||
listTable();
|
||||
}else{
|
||||
listTable('column='+column+'&value='+value);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
$(document).ready(function(){
|
||||
listTable();
|
||||
})
|
||||
</script>
|
||||
828
admin/set.php
Normal file
@@ -0,0 +1,828 @@
|
||||
<?php
|
||||
/**
|
||||
* 系统设置
|
||||
**/
|
||||
include("../includes/common.php");
|
||||
$title='系统设置';
|
||||
include './head.php';
|
||||
if($islogin==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
?>
|
||||
<div class="container" style="padding-top:70px;">
|
||||
<div class="col-xs-12 col-sm-10 col-lg-8 center-block" style="float: none;">
|
||||
<?php
|
||||
$mod=isset($_GET['mod'])?$_GET['mod']:null;
|
||||
$mods=['site'=>'网站信息','pay'=>'支付与结算','transfer'=>'企业付款','oauth'=>'快捷登录','certificate'=>'实名认证','template'=>'首页模板','gonggao'=>'公告与排版','mail'=>'邮箱与短信','upimg'=>'LOGO设置','iptype'=>'IP地址','cron'=>'计划任务','account'=>'修改密码'];
|
||||
?>
|
||||
<ul class="nav nav-pills">
|
||||
<?php foreach($mods as $key=>$name){echo '<li class="'.($key==$mod?'active':null).'"><a href="set.php?mod='.$key.'">'.$name.'</a></li>';} ?>
|
||||
</ul>
|
||||
<?php
|
||||
if($mod=='site'){
|
||||
?>
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading"><h3 class="panel-title">网站信息配置</h3></div>
|
||||
<div class="panel-body">
|
||||
<form onsubmit="return saveSetting(this)" method="post" class="form-horizontal" role="form">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">网站名称</label>
|
||||
<div class="col-sm-10"><input type="text" name="sitename" value="<?php echo $conf['sitename']; ?>" class="form-control" required/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">首页标题</label>
|
||||
<div class="col-sm-10"><input type="text" name="title" value="<?php echo $conf['title']; ?>" class="form-control" required/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">关键字</label>
|
||||
<div class="col-sm-10"><input type="text" name="keywords" value="<?php echo $conf['keywords']; ?>" class="form-control"/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">网站描述</label>
|
||||
<div class="col-sm-10"><input type="text" name="description" value="<?php echo $conf['description']; ?>" class="form-control"/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">公司/组织名称</label>
|
||||
<div class="col-sm-10"><input type="text" name="orgname" value="<?php echo $conf['orgname']; ?>" class="form-control"/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">本站网址</label>
|
||||
<div class="col-sm-10"><input type="text" name="localurl" value="<?php echo $conf['localurl']; ?>" class="form-control"/><font color="green">必须以http://或https://开头,以/结尾,填错会导致订单无法回调</font></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">联系邮箱</label>
|
||||
<div class="col-sm-10"><input type="text" name="email" value="<?php echo $conf['email']; ?>" class="form-control"/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">客服QQ</label>
|
||||
<div class="col-sm-10"><input type="text" name="kfqq" value="<?php echo $conf['kfqq']; ?>" class="form-control"/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">加群链接</label>
|
||||
<div class="col-sm-10"><input type="text" name="qqqun" value="<?php echo $conf['qqqun']; ?>" class="form-control"/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">APP下载链接</label>
|
||||
<div class="col-sm-10"><input type="text" name="appurl" value="<?php echo $conf['appurl']; ?>" class="form-control"/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">用户验证方式</label>
|
||||
<div class="col-sm-10"><select class="form-control" name="verifytype" default="<?php echo $conf['verifytype']?>"><option value="0">邮箱验证</option><option value="1">手机验证</option></select></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">开放注册</label>
|
||||
<div class="col-sm-10"><select class="form-control" name="reg_open" default="<?php echo $conf['reg_open']?>"><option value="1">开启</option><option value="0">关闭</option></select></div>
|
||||
</div><br/>
|
||||
<div id="setform1" style="<?php echo $conf['reg_open']==0?'display:none;':null; ?>">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">注册付费</label>
|
||||
<div class="col-sm-10"><select class="form-control" name="reg_pay" default="<?php echo $conf['reg_pay']?>"><option value="1">开启</option><option value="0">关闭</option></select></div>
|
||||
</div><br/>
|
||||
<div id="setform2" style="<?php echo $conf['reg_pay']==0?'display:none;':null; ?>">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">注册付费金额</label>
|
||||
<div class="col-sm-10"><input type="text" name="reg_pay_price" value="<?php echo $conf['reg_pay_price']; ?>" class="form-control"/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">注册付费收款商户ID</label>
|
||||
<div class="col-sm-10"><input type="text" name="reg_pay_uid" value="<?php echo $conf['reg_pay_uid']; ?>" class="form-control" placeholder="填写在本站注册的商户UID"/></div>
|
||||
</div><br/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">测试支付</label>
|
||||
<div class="col-sm-10"><select class="form-control" name="test_open" default="<?php echo $conf['test_open']?>"><option value="1">开启</option><option value="0">关闭</option></select></div>
|
||||
</div><br/>
|
||||
<div id="setform3" style="<?php echo $conf['test_open']==0?'display:none;':null; ?>">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">测试支付收款商户ID</label>
|
||||
<div class="col-sm-10"><input type="text" name="test_pay_uid" value="<?php echo $conf['test_pay_uid']; ?>" class="form-control" placeholder="填写在本站注册的商户UID"/></div>
|
||||
</div><br/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">极限验证码ID</label>
|
||||
<div class="col-sm-10"><input type="text" name="captcha_id" value="<?php echo $conf['captcha_id']; ?>" class="form-control"/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">极限验证码密钥</label>
|
||||
<div class="col-sm-10"><input type="text" name="captcha_key" value="<?php echo $conf['captcha_key']; ?>" class="form-control"/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">登录开启验证码</label>
|
||||
<div class="col-sm-10"><select class="form-control" name="captcha_open_login" default="<?php echo $conf['captcha_open_login']?>"><option value="0">关闭</option><option value="1">开启</option></select></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">用户中心风格</label>
|
||||
<div class="col-sm-10"><select class="form-control" name="user_style" default="<?php echo $conf['user_style']?>"><option value="0">黑色(1)</option><option value="1">黑色(2)</option><option value="2">棕色(1)</option><option value="3">棕色(2)</option><option value="4">蓝色(1)</option><option value="5">蓝色(2)</option><option value="6">紫色(1)</option><option value="7">紫色(2)</option></select></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10"><input type="submit" name="submit" value="修改" class="btn btn-primary form-control"/><br/>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$("select[name='reg_open']").change(function(){
|
||||
if($(this).val() == 1){
|
||||
$("#setform1").show();
|
||||
}else{
|
||||
$("#setform1").hide();
|
||||
}
|
||||
});
|
||||
$("select[name='reg_pay']").change(function(){
|
||||
if($(this).val() == 1){
|
||||
$("#setform2").show();
|
||||
}else{
|
||||
$("#setform2").hide();
|
||||
}
|
||||
});
|
||||
$("select[name='test_open']").change(function(){
|
||||
if($(this).val() == 1){
|
||||
$("#setform3").show();
|
||||
}else{
|
||||
$("#setform3").hide();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}elseif($mod=='paypwd_n' && $_POST['do']=='submit'){
|
||||
$oldpwd=$_POST['oldpwd'];
|
||||
$newpwd=$_POST['newpwd'];
|
||||
$newpwd2=$_POST['newpwd2'];
|
||||
if(!empty($newpwd) && !empty($newpwd2)){
|
||||
if($oldpwd!=$conf['admin_paypwd'])showmsg('旧密码不正确!',3);
|
||||
if($newpwd!=$newpwd2)showmsg('两次输入的密码不一致!',3);
|
||||
saveSetting('admin_paypwd',$newpwd);
|
||||
}else{
|
||||
showmsg('新密码不能为空',3);
|
||||
}
|
||||
$ad=$CACHE->clear();
|
||||
if($ad)showmsg('修改成功!',1);
|
||||
else showmsg('修改失败!<br/>'.$DB->error(),4);
|
||||
}elseif($mod=='account_n' && $_POST['do']=='submit'){
|
||||
$user=$_POST['user'];
|
||||
$oldpwd=$_POST['oldpwd'];
|
||||
$newpwd=$_POST['newpwd'];
|
||||
$newpwd2=$_POST['newpwd2'];
|
||||
if($user==null)showmsg('用户名不能为空!',3);
|
||||
saveSetting('admin_user',$user);
|
||||
if(!empty($newpwd) && !empty($newpwd2)){
|
||||
if($oldpwd!=$conf['admin_pwd'])showmsg('旧密码不正确!',3);
|
||||
if($newpwd!=$newpwd2)showmsg('两次输入的密码不一致!',3);
|
||||
saveSetting('admin_pwd',$newpwd);
|
||||
}
|
||||
$ad=$CACHE->clear();
|
||||
if($ad)showmsg('修改成功!请重新登录',1);
|
||||
else showmsg('修改失败!<br/>'.$DB->error(),4);
|
||||
}elseif($mod=='account'){
|
||||
?>
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading"><h3 class="panel-title">管理员账号配置</h3></div>
|
||||
<div class="panel-body">
|
||||
<form action="./set.php?mod=account_n" method="post" class="form-horizontal" role="form"><input type="hidden" name="do" value="submit"/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">用户名</label>
|
||||
<div class="col-sm-10"><input type="text" name="user" value="<?php echo $conf['admin_user']; ?>" class="form-control" required/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">旧密码</label>
|
||||
<div class="col-sm-10"><input type="password" name="oldpwd" value="" class="form-control" placeholder="请输入当前的管理员密码"/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">新密码</label>
|
||||
<div class="col-sm-10"><input type="password" name="newpwd" value="" class="form-control" placeholder="不修改请留空"/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">重输密码</label>
|
||||
<div class="col-sm-10"><input type="password" name="newpwd2" value="" class="form-control" placeholder="不修改请留空"/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10"><input type="submit" name="submit" value="修改" class="btn btn-primary form-control"/><br/>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading"><h3 class="panel-title">支付密码修改</h3></div>
|
||||
<div class="panel-body">
|
||||
<form action="./set.php?mod=paypwd_n" method="post" class="form-horizontal" role="form"><input type="hidden" name="do" value="submit"/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">旧密码</label>
|
||||
<div class="col-sm-10"><input type="password" name="oldpwd" value="" class="form-control" placeholder="请输入当前的支付密码"/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">新密码</label>
|
||||
<div class="col-sm-10"><input type="password" name="newpwd" value="" class="form-control" placeholder="不修改请留空"/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">重输密码</label>
|
||||
<div class="col-sm-10"><input type="password" name="newpwd2" value="" class="form-control" placeholder="不修改请留空"/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10"><input type="submit" name="submit" value="修改" class="btn btn-primary form-control"/><br/>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="panel-footer">
|
||||
<span class="glyphicon glyphicon-info-sign"></span> 支付密码用于转账接口以及API退款时使用,默认为123456
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}elseif($mod=='template'){
|
||||
$mblist = \lib\Template::getList();
|
||||
?>
|
||||
<style>.mblist{margin-bottom: 20px;} .mblist img{height: 110px;}</style>
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading"><h3 class="panel-title">首页模板设置</h3></div>
|
||||
<div class="panel-body">
|
||||
<h4>当前使用模板:</h4>
|
||||
<div class="row text-center">
|
||||
<div class="col-xs-6 col-sm-4">
|
||||
<img class="img-responsive img-thumbnail img-rounded" src="/template/<?php echo $conf['template']?>/preview.png" onerror="this.src='/assets/img/NoImg.png'">
|
||||
</div>
|
||||
<div class="col-xs-6 col-sm-4">
|
||||
<p>模板名称:<?php echo $conf['template']?></p>
|
||||
</div>
|
||||
</div>
|
||||
<hr/>
|
||||
<h4>更换模板:</h4>
|
||||
<div class="row text-center">
|
||||
<?php foreach($mblist as $template){?>
|
||||
<div class="col-xs-6 col-sm-4 mblist">
|
||||
<a href="javascript:changeTemplate('<?php echo $template?>')"><img class="img-responsive img-thumbnail img-rounded" src="/template/<?php echo $template?>/preview.png" onerror="this.src='/assets/img/NoImg.png'" title="点击更换到该模板"><br/><?php echo $template?></a>
|
||||
</div>
|
||||
<?php }?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}elseif($mod=='iptype'){
|
||||
?>
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading"><h3 class="panel-title">用户IP地址获取设置</h3></div>
|
||||
<div class="panel-body">
|
||||
<form onsubmit="return saveSetting(this)" method="post" class="form-horizontal" role="form">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">用户IP地址获取方式</label>
|
||||
<div class="col-sm-10"><select class="form-control" name="ip_type" default="<?php echo $conf['ip_type']?>"><option value="0">0_X_FORWARDED_FOR</option><option value="1">1_X_REAL_IP</option><option value="2">2_REMOTE_ADDR</option></select></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10"><input type="submit" name="submit" value="修改" class="btn btn-primary form-control"/><br/>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="panel-footer">
|
||||
<span class="glyphicon glyphicon-info-sign"></span>
|
||||
此功能设置用于防止用户伪造IP请求。<br/>
|
||||
X_FORWARDED_FOR:之前的获取真实IP方式,极易被伪造IP<br/>
|
||||
X_REAL_IP:在网站使用CDN的情况下选择此项,在不使用CDN的情况下也会被伪造<br/>
|
||||
REMOTE_ADDR:直接获取真实请求IP,无法被伪造,但可能获取到的是CDN节点IP<br/>
|
||||
<b>你可以从中选择一个能显示你真实地址的IP,优先选下方的选项。</b>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$.ajax({
|
||||
type : "GET",
|
||||
url : "ajax.php?act=iptype",
|
||||
dataType : 'json',
|
||||
async: true,
|
||||
success : function(data) {
|
||||
$("select[name='ip_type']").empty();
|
||||
var defaultv = $("select[name='ip_type']").attr('default');
|
||||
$.each(data, function(k, item){
|
||||
$("select[name='ip_type']").append('<option value="'+k+'" '+(defaultv==k?'selected':'')+'>'+ item.name +' - '+ item.ip +' '+ item.city +'</option>');
|
||||
})
|
||||
}
|
||||
});
|
||||
})
|
||||
</script>
|
||||
<?php
|
||||
}elseif($mod=='pay'){
|
||||
$wxpay_channel = $DB->getAll("SELECT * FROM pre_channel WHERE plugin='wxpay'");
|
||||
?>
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading"><h3 class="panel-title">支付与结算配置</h3></div>
|
||||
<div class="panel-body">
|
||||
<form onsubmit="return saveSetting(this)" method="post" class="form-horizontal" role="form">
|
||||
<h4 style="text-align: center;">支付配置</h4>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">最大支付金额</label>
|
||||
<div class="col-sm-9"><input type="text" name="pay_maxmoney" value="<?php echo $conf['pay_maxmoney']; ?>" class="form-control"/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">最小支付金额</label>
|
||||
<div class="col-sm-9"><input type="text" name="pay_minmoney" value="<?php echo $conf['pay_minmoney']; ?>" class="form-control"/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">商品屏蔽关键词</label>
|
||||
<div class="col-sm-9"><input type="text" name="blockname" value="<?php echo $conf['blockname']; ?>" class="form-control"/><font color="green">多个关键词用|隔开。如果触发屏蔽会在<a href="./risk.php">风控记录</a>里面显示</font></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">商品屏蔽显示内容</label>
|
||||
<div class="col-sm-9"><input type="text" name="blockalert" value="<?php echo $conf['blockalert']; ?>" class="form-control"/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">商品名称自定义</label>
|
||||
<div class="col-sm-9"><input type="text" name="ordername" value="<?php echo $conf['ordername']; ?>" class="form-control" placeholder="默认使用原商品名称"/><font color="green">支持变量值:[name]原商品名称,[time]时间戳,[qq]当前商户的联系QQ</font></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">本站网址(支付宝专用)</label>
|
||||
<div class="col-sm-9"><input type="text" name="localurl_alipay" value="<?php echo $conf['localurl_alipay']; ?>" class="form-control" placeholder="留空默认使用当前网址"/><font color="green">适用于网站有多个绑定域名,由于支付宝官方限制域名,使用未登记域名会有违约风险,填写指定网址后,使用支付宝支付都会跳转到该网址再跳转到支付宝。必须以http://或https://开头,以/结尾,留空则使用当前网址</font></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">本站网址(微信专用)</label>
|
||||
<div class="col-sm-9"><input type="text" name="localurl_wxpay" value="<?php echo $conf['localurl_wxpay']; ?>" class="form-control" placeholder="留空默认使用当前网址"/><font color="green">适用于网站有多个绑定域名,由于微信公众号只能授权一个域名,填写指定网址后,使用微信公众号支付或获取openid都会跳转到该网址再跳转到微信。必须以http://或https://开头,以/结尾,留空则使用当前网址</font></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">开启余额充值</label>
|
||||
<div class="col-sm-9"><select class="form-control" name="recharge" default="<?php echo $conf['recharge']?>"><option value="1">开启</option><option value="0">关闭</option></select></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">开启一码支付</label>
|
||||
<div class="col-sm-9"><select class="form-control" name="onecode" default="<?php echo $conf['onecode']?>"><option value="1">开启</option><option value="0">关闭</option></select></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">微信短网址生成通道</label>
|
||||
<div class="col-sm-9"><select class="form-control" name="wxurl" default="<?php echo $conf['wxurl']?>"><option value="0">关闭</option><?php foreach($wxpay_channel as $channel){echo '<option value="'.$channel['id'].'">'.$channel['name'].'</option>';} ?></select><font color="green">请先添加支付插件为wxpay的支付通道<br/>只需开通服务号即可使用(可以不开通微信支付)</font></div>
|
||||
</div><br/>
|
||||
<h4 style="text-align: center;">结算配置</h4>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">结算总开关</label>
|
||||
<div class="col-sm-9"><select class="form-control" name="settle_open" default="<?php echo $conf['settle_open']?>"><option value="0">关闭结算功能</option><option value="1">只开启每日自动结算</option><option value="2">只开启手动申请结算</option><option value="3">开启自动+手动结算</option></select></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">手动申请结算周期</label>
|
||||
<div class="col-sm-9"><select class="form-control" name="settle_type" default="<?php echo $conf['settle_type']?>"><option value="0">T+0(可提现全部余额)</option><option value="1">T+1(可提现1天前的余额)</option></select><font color="green">该选项只适用于手动申请结算</font></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">最低结算金额</label>
|
||||
<div class="col-sm-9"><input type="text" name="settle_money" value="<?php echo $conf['settle_money']; ?>" class="form-control"/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">结算手续费</label>
|
||||
<div class="col-sm-9"><div class="input-group"><input type="text" name="settle_rate" value="<?php echo $conf['settle_rate']; ?>" class="form-control"/><span class="input-group-addon">%</span></div></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">结算手续费最小</label>
|
||||
<div class="col-sm-9"><input type="text" name="settle_fee_min" value="<?php echo $conf['settle_fee_min']; ?>" class="form-control"/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">结算手续费最大</label>
|
||||
<div class="col-sm-9"><input type="text" name="settle_fee_max" value="<?php echo $conf['settle_fee_max']; ?>" class="form-control"/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">支付宝结算开关</label>
|
||||
<div class="col-sm-9"><select class="form-control" name="settle_alipay" default="<?php echo $conf['settle_alipay']?>"><option value="0">关闭</option><option value="1">开启</option></select></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">微信结算开关</label>
|
||||
<div class="col-sm-9"><select class="form-control" name="settle_wxpay" default="<?php echo $conf['settle_wxpay']?>"><option value="0">关闭</option><option value="1">开启</option></select></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">QQ钱包结算开关</label>
|
||||
<div class="col-sm-9"><select class="form-control" name="settle_qqpay" default="<?php echo $conf['settle_qqpay']?>"><option value="0">关闭</option><option value="1">开启</option></select></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">银行卡结算开关</label>
|
||||
<div class="col-sm-9"><select class="form-control" name="settle_bank" default="<?php echo $conf['settle_bank']?>"><option value="0">关闭</option><option value="1">开启</option></select></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-3 col-sm-9"><input type="submit" name="submit" value="修改" class="btn btn-primary form-control"/><br/>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}elseif($mod=='gonggao'){
|
||||
?>
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading"><h3 class="panel-title">其他公告与排版设置</h3></div>
|
||||
<div class="panel-body">
|
||||
<form onsubmit="return saveSetting(this)" method="post" class="form-horizontal" role="form">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">用户中心弹出公告</label>
|
||||
<div class="col-sm-10"><textarea class="form-control" name="modal" rows="5" placeholder="不填写则不显示弹出公告"><?php echo $conf['modal']?></textarea></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">首页底部排版</label>
|
||||
<div class="col-sm-10"><textarea class="form-control" name="footer" rows="3" placeholder="可填写备案号等"><?php echo $conf['footer']?></textarea></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10"><input type="submit" name="submit" value="修改" class="btn btn-primary form-control"/><br/><br/>
|
||||
<a href="./gonggao.php" class="btn btn-default btn-block">用户中心公告列表</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
}elseif($mod=='transfer'){
|
||||
$alipay_channel = $DB->getAll("SELECT * FROM pre_channel WHERE plugin='alipay'");
|
||||
$wxpay_channel = $DB->getAll("SELECT * FROM pre_channel WHERE plugin='wxpay'");
|
||||
$qqpay_channel = $DB->getAll("SELECT * FROM pre_channel WHERE plugin='qqpay'");
|
||||
?>
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading"><h3 class="panel-title">企业付款配置</h3></div>
|
||||
<div class="panel-body">
|
||||
<form onsubmit="return saveSetting(this)" method="post" class="form-horizontal" role="form">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">付款方显示名称</label>
|
||||
<div class="col-sm-9"><input type="text" name="transfer_name" value="<?php echo $conf['transfer_name']; ?>" class="form-control"/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">付款默认备注</label>
|
||||
<div class="col-sm-9"><input type="text" name="transfer_desc" value="<?php echo $conf['transfer_desc']; ?>" class="form-control"/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">支付宝转账接口通道</label>
|
||||
<div class="col-sm-9"><select class="form-control" name="transfer_alipay" default="<?php echo $conf['transfer_alipay']?>"><option value="0">关闭</option><?php foreach($alipay_channel as $channel){echo '<option value="'.$channel['id'].'">'.$channel['name'].'</option>';} ?></select><font color="green">请先添加支付插件为alipay的支付通道</font></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">微信企业付款通道</label>
|
||||
<div class="col-sm-9"><select class="form-control" name="transfer_wxpay" default="<?php echo $conf['transfer_wxpay']?>"><option value="0">关闭</option><?php foreach($wxpay_channel as $channel){echo '<option value="'.$channel['id'].'">'.$channel['name'].'</option>';} ?></select><font color="green">请先添加支付插件为wxpay的支付通道<br/>请将<a href="https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay.php?chapter=4_3" target="_blank" rel="noreferrer">API证书</a>放置于/plugins/wxpay/cert/文件夹</font></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">QQ钱包企业付款通道</label>
|
||||
<div class="col-sm-9"><select class="form-control" name="transfer_qqpay" default="<?php echo $conf['transfer_qqpay']?>"><option value="0">关闭</option><?php foreach($qqpay_channel as $channel){echo '<option value="'.$channel['id'].'">'.$channel['name'].'</option>';} ?></select><font color="green">请先添加支付插件为qqpay的支付通道<br/>请将<a href="https://qpay.qq.com/buss/wiki/206/1213" target="_blank" rel="noreferrer">API证书</a>放置于/plugins/qqpay/cert/文件夹</font></div>
|
||||
</div><br/>
|
||||
<div id="setform1" style="<?php echo $conf['transfer_qqpay']==0?'display:none;':null; ?>">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">QQ钱包操作员账号</label>
|
||||
<div class="col-sm-9"><input type="text" name="qq_op_userid" value="<?php echo $conf['qq_op_userid']; ?>" class="form-control"/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">QQ钱包操作员密码</label>
|
||||
<div class="col-sm-9"><input type="text" name="qq_op_userpwd" value="<?php echo $conf['qq_op_userpwd']; ?>" class="form-control"/></div>
|
||||
</div><br/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-3 col-sm-9"><input type="submit" name="submit" value="修改" class="btn btn-primary form-control"/><br/>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$("select[name='transfer_qqpay']").change(function(){
|
||||
if($(this).val() > 0){
|
||||
$("#setform1").show();
|
||||
}else{
|
||||
$("#setform1").hide();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}elseif($mod=='certificate'){
|
||||
$alipay_channel = $DB->getAll("SELECT * FROM pre_channel WHERE plugin='alipay'");
|
||||
?>
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading"><h3 class="panel-title">实名认证接口配置</h3></div>
|
||||
<div class="panel-body">
|
||||
<form onsubmit="return saveSetting(this)" method="post" class="form-horizontal" role="form">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">实名认证接口通道</label>
|
||||
<div class="col-sm-9"><select class="form-control" name="cert_channel" default="<?php echo $conf['cert_channel']?>"><option value="0">关闭</option><?php foreach($alipay_channel as $channel){echo '<option value="'.$channel['id'].'">'.$channel['name'].'</option>';} ?></select><font color="green">请先添加支付插件为alipay的支付通道,需要申请支付宝身份验证接口</font></div>
|
||||
</div><br/>
|
||||
<div id="setform1" style="<?php echo $conf['cert_channel']==0?'display:none;':null; ?>">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">商户强制认证</label>
|
||||
<div class="col-sm-9"><select class="form-control" name="cert_force" default="<?php echo $conf['cert_force']?>"><option value="0">关闭</option><option value="1">开启</option></select><font color="green">开启后商户必须实名认证,才能正常使用支付接口收款</font></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">实名认证费用</label>
|
||||
<div class="col-sm-9"><input type="text" name="cert_money" value="<?php echo $conf['cert_money']; ?>" class="form-control" placeholder="留空或0为免认证费用"/><font color="green">由于支付宝身份验证接口是1元/次,所以你可以设置实名认证收费,认证成功从商户余额扣除,如果是付费注册商户建议改为免认证费</font></div>
|
||||
</div><br/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-3 col-sm-9"><input type="submit" name="submit" value="修改" class="btn btn-primary form-control"/><br/>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$("select[name='cert_channel']").change(function(){
|
||||
if($(this).val() > 0){
|
||||
$("#setform1").show();
|
||||
}else{
|
||||
$("#setform1").hide();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}elseif($mod=='oauth'){
|
||||
$alipay_channel = $DB->getAll("SELECT * FROM pre_channel WHERE plugin='alipay'");
|
||||
$wxpay_channel = $DB->getAll("SELECT * FROM pre_channel WHERE plugin='wxpay'");
|
||||
?>
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading"><h3 class="panel-title">快捷登录配置</h3></div>
|
||||
<div class="panel-body">
|
||||
<form onsubmit="return saveSetting(this)" method="post" class="form-horizontal" role="form">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">QQ快捷登录</label>
|
||||
<div class="col-sm-9"><select class="form-control" name="login_qq" default="<?php echo $conf['login_qq']?>"><option value="0">关闭</option><option value="1">QQ互联官方快捷登录</option><option value="2">QQ扫码快捷登录(有异地风险)</option></select><a href="https://connect.qq.com" target="_blank" rel="noreferrer">申请地址</a>,回调地址填写:<?php echo $siteurl.'user/connect.php';?></div>
|
||||
</div><br/>
|
||||
<div id="setform1" style="<?php echo $conf['login_qq']!=1?'display:none;':null; ?>">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">QQ快捷登录Appid</label>
|
||||
<div class="col-sm-9"><input type="text" name="login_qq_appid" value="<?php echo $conf['login_qq_appid']; ?>" class="form-control"/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">QQ快捷登录Appkey</label>
|
||||
<div class="col-sm-9"><input type="text" name="login_qq_appkey" value="<?php echo $conf['login_qq_appkey']; ?>" class="form-control"/></div>
|
||||
</div><br/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">支付宝快捷登录</label>
|
||||
<div class="col-sm-9"><select class="form-control" name="login_alipay" default="<?php echo $conf['login_alipay']?>"><option value="0">关闭</option><?php foreach($alipay_channel as $channel){echo '<option value="'.$channel['id'].'">'.$channel['name'].'</option>';} ?></select><font color="green">请先添加支付插件为alipay的支付通道</font><br/><a href="https://openhome.alipay.com/platform/appManage.htm" target="_blank" rel="noreferrer">申请地址</a>,应用内添加功能"获取会员信息",授权回调地址填写:<?php echo $siteurl.'user/oauth.php';?></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">微信快捷登录</label>
|
||||
<div class="col-sm-9"><select class="form-control" name="login_wx" default="<?php echo $conf['login_wx']?>"><option value="0">关闭</option><?php foreach($wxpay_channel as $channel){echo '<option value="'.$channel['id'].'">'.$channel['name'].'</option>';} ?></select><font color="green">请先添加支付插件为wxpay的支付通道</font><br/>需要有服务号,在公众号后台配置网页授权域名:<?php echo $_SERVER['HTTP_HOST'];?></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-3 col-sm-9"><input type="submit" name="submit" value="修改" class="btn btn-primary form-control"/><br/>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$("select[name='login_qq']").change(function(){
|
||||
if($(this).val() == 1){
|
||||
$("#setform1").show();
|
||||
}else{
|
||||
$("#setform1").hide();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}elseif($mod=='mailtest'){
|
||||
$mail_name = $conf['mail_recv']?$conf['mail_recv']:$conf['mail_name'];
|
||||
if(!empty($mail_name)){
|
||||
$result=send_mail($mail_name,'邮件发送测试。','这是一封测试邮件!<br/><br/>来自:'.$siteurl);
|
||||
if($result==1)
|
||||
showmsg('邮件发送成功!',1);
|
||||
else
|
||||
showmsg('邮件发送失败!'.$result,3);
|
||||
}
|
||||
else
|
||||
showmsg('您还未设置邮箱!',3);
|
||||
}elseif($mod=='mail'){
|
||||
?>
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading"><h3 class="panel-title">发信邮箱设置</h3></div>
|
||||
<div class="panel-body">
|
||||
<form onsubmit="return saveSetting(this)" method="post" class="form-horizontal" role="form">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">发信模式</label>
|
||||
<div class="col-sm-10"><select class="form-control" name="mail_cloud" default="<?php echo $conf['mail_cloud']?>"><option value="0">SMTP发信</option><option value="1">搜狐Sendcloud</option><option value="2">阿里云邮件推送</option></select></div>
|
||||
</div><br/>
|
||||
<div id="frame_set1" style="<?php echo $conf['mail_cloud']>1?'display:none;':null; ?>">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">SMTP服务器</label>
|
||||
<div class="col-sm-10"><input type="text" name="mail_smtp" value="<?php echo $conf['mail_smtp']; ?>" class="form-control"/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">SMTP端口</label>
|
||||
<div class="col-sm-10"><input type="text" name="mail_port" value="<?php echo $conf['mail_port']; ?>" class="form-control"/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">邮箱账号</label>
|
||||
<div class="col-sm-10"><input type="text" name="mail_name" value="<?php echo $conf['mail_name']; ?>" class="form-control"/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">邮箱密码</label>
|
||||
<div class="col-sm-10"><input type="text" name="mail_pwd" value="<?php echo $conf['mail_pwd']; ?>" class="form-control"/></div>
|
||||
</div><br/>
|
||||
</div>
|
||||
<div id="frame_set2" style="<?php echo $conf['mail_cloud']==0?'display:none;':null; ?>">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">API_USER</label>
|
||||
<div class="col-sm-10"><input type="text" name="mail_apiuser" value="<?php echo $conf['mail_apiuser']; ?>" class="form-control"/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">API_KEY</label>
|
||||
<div class="col-sm-10"><input type="text" name="mail_apikey" value="<?php echo $conf['mail_apikey']; ?>" class="form-control"/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">发信邮箱</label>
|
||||
<div class="col-sm-10"><input type="text" name="mail_name2" value="<?php echo $conf['mail_name2']; ?>" class="form-control"/></div>
|
||||
</div><br/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">收信邮箱</label>
|
||||
<div class="col-sm-10"><input type="text" name="mail_recv" value="<?php echo $conf['mail_recv']; ?>" class="form-control" placeholder="不填默认为发信邮箱"/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10"><input type="submit" name="submit" value="修改" class="btn btn-primary form-control"/><br/><?php if($conf['mail_name']){?>[<a href="set.php?mod=mailtest">给 <?php echo $conf['mail_recv']?$conf['mail_recv']:$conf['mail_name']?> 发一封测试邮件</a>]<?php }?>
|
||||
</div><br/>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="panel-footer">
|
||||
<span class="glyphicon glyphicon-info-sign"></span>
|
||||
使用普通模式发信时,建议使用QQ邮箱,SMTP服务器smtp.qq.com,端口465,密码不是QQ密码也不是邮箱独立密码,是QQ邮箱设置界面生成的<a href="https://service.mail.qq.com/cgi-bin/help?subtype=1&&no=1001256&&id=28" target="_blank" rel="noreferrer">授权码</a>。<br/>阿里云邮件推送:<a href="https://www.aliyun.com/product/directmail" target="_blank" rel="noreferrer">点此进入</a>|<a href="https://usercenter.console.aliyun.com/#/manage/ak" target="_blank" rel="noreferrer">获取AK/SK</a>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$("select[name='mail_cloud']").change(function(){
|
||||
if($(this).val() == 0){
|
||||
$("#frame_set1").show();
|
||||
$("#frame_set2").hide();
|
||||
}else{
|
||||
$("#frame_set1").hide();
|
||||
$("#frame_set2").show();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading"><h3 class="panel-title">短信接口设置</h3></div>
|
||||
<div class="panel-body">
|
||||
<form onsubmit="return saveSetting(this)" method="post" class="form-horizontal" role="form">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">接口选择</label>
|
||||
<div class="col-sm-10"><select class="form-control" name="sms_api" default="<?php echo $conf['sms_api']?>"><option value="0">978W短信接口</option><option value="1">腾讯云短信接口</option><option value="2">阿里云短信接口</option></select></div>
|
||||
</div><br/>
|
||||
<div class="form-group" id="showAppId" style="<?php echo $conf['sms_api']==0?'display:none;':null; ?>">
|
||||
<label class="col-sm-2 control-label">AppId</label>
|
||||
<div class="col-sm-10"><input type="text" name="sms_appid" value="<?php echo $conf['sms_appid']; ?>" class="form-control"/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">AppKey</label>
|
||||
<div class="col-sm-10"><input type="text" name="sms_appkey" value="<?php echo $conf['sms_appkey']; ?>" class="form-control"/></div>
|
||||
</div><br/>
|
||||
<div class="form-group" id="showSign" style="<?php echo $conf['sms_api']==0?'display:none;':null; ?>">
|
||||
<label class="col-sm-2 control-label">短信签名内容</label>
|
||||
<div class="col-sm-10"><input type="text" name="sms_sign" value="<?php echo $conf['sms_sign']; ?>" class="form-control"/><font color="green">必须是已添加、并通过审核的短信签名。</font></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">商户注册模板ID</label>
|
||||
<div class="col-sm-10"><input type="text" name="sms_tpl_reg" value="<?php echo $conf['sms_tpl_reg']; ?>" class="form-control"/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">找回密码模板ID</label>
|
||||
<div class="col-sm-10"><input type="text" name="sms_tpl_find" value="<?php echo $conf['sms_tpl_find']; ?>" class="form-control"/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">修改结算账号模板ID</label>
|
||||
<div class="col-sm-10"><input type="text" name="sms_tpl_edit" value="<?php echo $conf['sms_tpl_edit']; ?>" class="form-control"/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10"><input type="submit" name="submit" value="修改" class="btn btn-primary form-control"/><br/>
|
||||
</div><br/>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="panel-footer">
|
||||
<span class="glyphicon glyphicon-info-sign"></span>
|
||||
978W短信接口:<a href="http://admin.978w.cn" target="_blank" rel="noreferrer">点此进入</a><br/>腾讯云短信接口:<a href="https://console.cloud.tencent.com/sms/smslist" target="_blank" rel="noreferrer">点此进入</a><br/>阿里云短信接口:<a href="https://dysms.console.aliyun.com/dysms.htm" target="_blank" rel="noreferrer">点此进入</a>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$("select[name='sms_api']").change(function(){
|
||||
if($(this).val() == 0){
|
||||
$("#showAppId").hide();
|
||||
$("#showSign").hide();
|
||||
}else{
|
||||
$("#showAppId").show();
|
||||
$("#showSign").show();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}elseif($mod=='cron'){
|
||||
?>
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading"><h3 class="panel-title">计划任务设置</h3></div>
|
||||
<div class="panel-body">
|
||||
<form onsubmit="return saveSetting(this)" method="post" class="form-horizontal" role="form">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">计划任务访问密钥</label>
|
||||
<div class="col-sm-10"><input type="text" name="cronkey" value="<?php echo $conf['cronkey']; ?>" class="form-control"/></div>
|
||||
</div><br/>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10"><input type="submit" name="submit" value="修改" class="btn btn-primary form-control"/><br/>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading"><h3 class="panel-title">计划任务列表</h3></div>
|
||||
<div class="panel-body">
|
||||
<p>以下网址每天0点定时访问一次即可,也可以设置1分钟一次的定时任务。</p>
|
||||
<p>订单统计任务</p>
|
||||
<li class="list-group-item"><?php echo $siteurl?>cron.php?do=order&key=<?php echo $conf['cronkey']; ?></li>
|
||||
<br/>
|
||||
<p>自动生成结算任务</p>
|
||||
<li class="list-group-item"><?php echo $siteurl?>cron.php?do=settle&key=<?php echo $conf['cronkey']; ?></li>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
elseif($mod=='upimg'){
|
||||
echo '<div class="panel panel-primary">
|
||||
<div class="panel-heading"><h3 class="panel-title">更改首页LOGO</h3></div>
|
||||
<div class="panel-body">';
|
||||
if($_POST['s']==1){
|
||||
if(copy($_FILES['file']['tmp_name'], ROOT.'assets/img/logo.png')){
|
||||
echo "成功上传文件!<br>(可能需要清空浏览器缓存才能看到效果,按Ctrl+F5即可一键刷新缓存)";
|
||||
}else{
|
||||
echo "上传失败,可能没有文件写入权限";
|
||||
}
|
||||
}
|
||||
echo '<form action="set.php?mod=upimg" method="POST" enctype="multipart/form-data"><label for="file"></label><input type="file" name="file" id="file" /><input type="hidden" name="s" value="1" /><br><input type="submit" class="btn btn-primary btn-block" value="确认上传" /></form><br>现在的图片:<br><img src="../assets/img/logo.png?r='.rand(10000,99999).'" style="max-width:100%">';
|
||||
echo '</div></div>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<script src="//cdn.staticfile.org/layer/2.3/layer.js"></script>
|
||||
<script>
|
||||
var items = $("select[default]");
|
||||
for (i = 0; i < items.length; i++) {
|
||||
$(items[i]).val($(items[i]).attr("default")||0);
|
||||
}
|
||||
function checkURL(obj)
|
||||
{
|
||||
var url = $(obj).val();
|
||||
|
||||
if (url.indexOf(" ")>=0){
|
||||
url = url.replace(/ /g,"");
|
||||
}
|
||||
if (url.toLowerCase().indexOf("http://")<0 && url.toLowerCase().indexOf("https://")<0){
|
||||
url = "http://"+url;
|
||||
}
|
||||
if (url.slice(url.length-1)!="/"){
|
||||
url = url+"/";
|
||||
}
|
||||
$(obj).val(url);
|
||||
}
|
||||
function saveSetting(obj){
|
||||
if($("input[name='localurl_alipay']").length>0 && $("input[name='localurl_alipay']").val()!=''){
|
||||
checkURL("input[name='localurl_alipay']");
|
||||
}
|
||||
if($("input[name='localurl_wxpay']").length>0 && $("input[name='localurl_wxpay']").val()!=''){
|
||||
checkURL("input[name='localurl_wxpay']");
|
||||
}
|
||||
if($("input[name='localurl']").length>0 && $("input[name='localurl']").val()!=''){
|
||||
checkURL("input[name='localurl']");
|
||||
}
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : 'ajax.php?act=set',
|
||||
data : $(obj).serialize(),
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
layer.alert('设置保存成功!', {
|
||||
icon: 1,
|
||||
closeBtn: false
|
||||
}, function(){
|
||||
window.location.reload()
|
||||
});
|
||||
}else{
|
||||
layer.alert(data.msg, {icon: 2})
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
function changeTemplate(template){
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : 'ajax.php?act=set',
|
||||
data : {template:template},
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
layer.alert('更换模板成功!', {
|
||||
icon: 1,
|
||||
closeBtn: false
|
||||
}, function(){
|
||||
window.location.reload()
|
||||
});
|
||||
}else{
|
||||
layer.alert(data.msg, {icon: 2})
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
179
admin/settle.php
Normal file
@@ -0,0 +1,179 @@
|
||||
<?php
|
||||
/**
|
||||
* 批量结算
|
||||
**/
|
||||
include("../includes/common.php");
|
||||
$title='批量结算';
|
||||
include './head.php';
|
||||
if($islogin==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
?>
|
||||
<style>
|
||||
img.logo{width:14px;height:14px;margin:0 5px 0 3px;}
|
||||
</style>
|
||||
<div class="container" style="padding-top:70px;">
|
||||
<div class="col-xs-12 col-sm-10 col-lg-8 center-block" style="float: none;">
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading"><h3 class="panel-title">批量结算操作<span class="pull-right"><a href="javascript:createBatch()" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> 生成结算批次</a></span></h3></div>
|
||||
<table class="table table-striped">
|
||||
<thead><tr><th>批次号</th><th>总金额</th><th>总数量</th><th>生成时间</th><th>操作</th></thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$pagesize=15;
|
||||
$pages=ceil($numrows/$pagesize);
|
||||
$page=isset($_GET['page'])?intval($_GET['page']):1;
|
||||
$offset=$pagesize*($page - 1);
|
||||
|
||||
$rs=$DB->query("SELECT * FROM pre_batch order by time desc limit $offset,$pagesize");
|
||||
while($res = $rs->fetch())
|
||||
{
|
||||
echo '<tr><td><b>'.$res['batch'].'</b></td><td>'.$res['allmoney'].'</td><td>'.$res['count'].'</td><td>'.$res['time'].'</td><td><a href="./slist.php?batch='.$res['batch'].'" class="btn btn-xs btn-info">结算列表</a> <a href="./download.php?batch='.$res['batch'].'&allmoney='.$res['allmoney'].'" class="btn btn-xs btn-warning">下载CSV</a> <a href="javascript:transfer(\''.$res['batch'].'\')" class="btn btn-xs btn-success">批量转账</a> <a href="javascript:completeBatch(\''.$res['batch'].'\')" class="btn btn-xs btn-primary">改为完成</a></td></tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php
|
||||
echo'<div class="text-center"><ul class="pagination">';
|
||||
$first=1;
|
||||
$prev=$page-1;
|
||||
$next=$page+1;
|
||||
$last=$pages;
|
||||
if ($page>1)
|
||||
{
|
||||
echo '<li><a href="settle.php?page='.$first.$link.'">首页</a></li>';
|
||||
echo '<li><a href="settle.php?page='.$prev.$link.'">«</a></li>';
|
||||
} else {
|
||||
echo '<li class="disabled"><a>首页</a></li>';
|
||||
echo '<li class="disabled"><a>«</a></li>';
|
||||
}
|
||||
for ($i=1;$i<$page;$i++)
|
||||
echo '<li><a href="settle.php?page='.$i.$link.'">'.$i .'</a></li>';
|
||||
echo '<li class="disabled"><a>'.$page.'</a></li>';
|
||||
if($pages>=10)$sss=$page+10;else $sss=$pages;
|
||||
for ($i=$page+1;$i<=$sss;$i++)
|
||||
echo '<li><a href="settle.php?page='.$i.$link.'">'.$i .'</a></li>';
|
||||
echo '';
|
||||
if ($page<$pages)
|
||||
{
|
||||
echo '<li><a href="settle.php?page='.$next.$link.'">»</a></li>';
|
||||
echo '<li><a href="settle.php?page='.$last.$link.'">尾页</a></li>';
|
||||
} else {
|
||||
echo '<li class="disabled"><a>»</a></li>';
|
||||
echo '<li class="disabled"><a>尾页</a></li>';
|
||||
}
|
||||
echo'</ul></div>';
|
||||
#分页
|
||||
?>
|
||||
<div class="panel-footer">
|
||||
<span class="glyphicon glyphicon-info-sign"></span> 结算标准:金额大于<?php echo $conf['settle_money']?>元,或主动申请的<br/><span class="glyphicon glyphicon-info-sign"></span> 点击 生成结算批次 之后会将所有"<font color="blue">待结算</font>"状态的记录更改为"<font color="orange">正在结算</font>",通过转账接口转账之后会将状态更改为"<font color="green">已完成</font>",如果是手动转账,需要手动将状态更改为"<font color="green">已完成</font>"
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="//cdn.staticfile.org/layer/2.3/layer.js"></script>
|
||||
<script>
|
||||
function createBatch(){
|
||||
var confirmobj = layer.confirm('你确定要生成结算批次吗?', {
|
||||
btn: ['确定','取消']
|
||||
}, function(){
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'GET',
|
||||
url : 'ajax.php?act=create_batch',
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
layer.alert('生成结算批次成功!该批次总数量:'+data.count+',总金额:'+data.allmoney, {
|
||||
icon: 1,
|
||||
closeBtn: false
|
||||
},function(){
|
||||
window.location.reload();
|
||||
});
|
||||
}else{
|
||||
layer.alert(data.msg, {icon: 0})
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}, function(){
|
||||
layer.close(confirmobj);
|
||||
});
|
||||
}
|
||||
function transfer(batch){
|
||||
$.ajax({
|
||||
type : 'GET',
|
||||
url : 'ajax.php?act=paypwd_check',
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
if(data.code == 0){
|
||||
var paymsg = '';
|
||||
paymsg+='<a class="btn btn-default btn-block" href="transfer_alipay.php?batch='+batch+'" style="margin-top:10px;"><img width="20" src="../assets/icon/alipay.ico" class="logo">支付宝接口转账</a>';
|
||||
paymsg+='<a class="btn btn-default btn-block" href="transfer_wx.php?batch='+batch+'" style="margin-top:10px;"><img width="20" src="../assets/icon/wechat.ico" class="logo">微信企业付款</a>';
|
||||
paymsg+='<a class="btn btn-default btn-block" href="transfer_qq.php?batch='+batch+'" style="margin-top:10px;"><img width="20" src="../assets/icon/qqpay.ico" class="logo">QQ钱包企业付款</a>';
|
||||
layer.alert('<center>'+paymsg+'<hr><a class="btn btn-default btn-block" onclick="layer.closeAll()">关闭</a></center>',{
|
||||
btn:[],
|
||||
title:'请选择批量转账方式',
|
||||
closeBtn: false
|
||||
});
|
||||
}else{
|
||||
layer.prompt({title: '请输入支付密码', value: '', formType: 1}, function(text, index){
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : 'ajax.php?act=paypwd_input',
|
||||
data : {paypwd:text},
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
if(data.code == 0){
|
||||
transfer(batch);
|
||||
}else{
|
||||
layer.alert(data.msg, {icon: 2})
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
function completeBatch(batch){
|
||||
var confirmobj = layer.confirm('是否将该批次所有结算记录状态改为已完成?', {
|
||||
btn: ['确定','取消']
|
||||
}, function(){
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : 'ajax.php?act=complete_batch',
|
||||
data : {batch: batch},
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
layer.alert(data.msg, {
|
||||
icon: 1,
|
||||
closeBtn: false
|
||||
});
|
||||
}else{
|
||||
layer.alert(data.msg, {icon: 0})
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}, function(){
|
||||
layer.close(confirmobj);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
102
admin/slist-table.php
Normal file
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
/**
|
||||
* 结算列表
|
||||
**/
|
||||
include("../includes/common.php");
|
||||
if($islogin==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
|
||||
function display_type($type){
|
||||
if($type==1)
|
||||
return '支付宝';
|
||||
elseif($type==2)
|
||||
return '微信';
|
||||
elseif($type==3)
|
||||
return 'QQ钱包';
|
||||
elseif($type==4)
|
||||
return '银行卡';
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
function display_status($status, $id){
|
||||
if($status==1)
|
||||
return '<font color=green>已完成</font>';
|
||||
elseif($status==2)
|
||||
return '<font color=orange>正在结算</font>';
|
||||
elseif($status==3)
|
||||
return '<a href="javascript:setResult('.$id.')" title="点此填写失败原因"><font color=red>结算失败</font></a>';
|
||||
else
|
||||
return '<font color=blue>待结算</font>';
|
||||
}
|
||||
|
||||
if(isset($_GET['batch']) && !empty($_GET['batch'])) {
|
||||
$sql=" `batch`='{$_GET['batch']}'";
|
||||
$numrows=$DB->getColumn("SELECT count(*) from pre_settle WHERE{$sql}");
|
||||
$con='批次号 '.$_GET['batch'].' 共有 <b>'.$numrows.'</b> 条结算记录';
|
||||
$link='&my=search&column='.$_GET['column'].'&value='.$_GET['value'];
|
||||
}elseif(isset($_GET['value']) && !empty($_GET['value'])) {
|
||||
$sql=" `{$_GET['column']}`='{$_GET['value']}'";
|
||||
$numrows=$DB->getColumn("SELECT count(*) from pre_settle WHERE{$sql}");
|
||||
$con='包含 '.$_GET['value'].' 的共有 <b>'.$numrows.'</b> 条结算记录';
|
||||
$link='&my=search&column='.$_GET['column'].'&value='.$_GET['value'];
|
||||
}else{
|
||||
$numrows=$DB->getColumn("SELECT count(*) from pre_settle WHERE 1");
|
||||
$sql=" 1";
|
||||
$con='共有 <b>'.$numrows.'</b> 条结算记录';
|
||||
}
|
||||
?>
|
||||
<form name="form1" id="form1">
|
||||
<div class="table-responsive">
|
||||
<?php echo $con?>
|
||||
<table class="table table-striped table-bordered table-vcenter">
|
||||
<thead><tr><th>ID</th><th>商户号</th><th>结算方式</th><th>结算账号/姓名</th><th>结算金额/实际到账</th><th>添加时间</th><th>完成时间</th><th>状态</th><th>操作</th></tr></thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$pagesize=30;
|
||||
$pages=ceil($numrows/$pagesize);
|
||||
$page=isset($_GET['page'])?intval($_GET['page']):1;
|
||||
$offset=$pagesize*($page - 1);
|
||||
|
||||
$rs=$DB->query("SELECT * FROM pre_settle WHERE{$sql} order by id desc limit $offset,$pagesize");
|
||||
while($res = $rs->fetch())
|
||||
{
|
||||
echo '<tr><td><input type="checkbox" name="checkbox[]" id="list1" value="'.$res['id'].'" onClick="unselectall1()"><b>'.$res['id'].'</b></td><td><a href="./ulist.php?column=uid&value='.$res['uid'].'" target="_blank">'.$res['uid'].'</a></td><td>'.display_type($res['type']).($res['auto']!=1?'<small>[手动]</small>':null).'</td><td><span onclick="inputInfo('.$res['id'].')">'.$res['account'].' '.$res['username'].'</span></td><td><b>'.$res['money'].'</b> / <b>'.$res['realmoney'].'</b></td><td>'.$res['addtime'].'</td><td>'.$res['endtime'].'</td><td>'.display_status($res['status'],$res['id']).'</td><td><select onChange="javascript:setStatus(\''.$res['id'].'\',this.value)" class=""><option selected>变更状态</option><option value="0">待结算</option><option value="1">已完成</option><option value="2">正在结算</option><option value="3">结算失败</option><option value="4">删除记录</option></select></td></tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<input name="chkAll1" type="checkbox" id="chkAll1" onClick="this.value=check1(this.form.list1)" value="checkbox"> 全选
|
||||
<select name="status"><option selected>批量修改</option><option value="0">待结算</option><option value="1">已完成</option><option value="2">正在结算</option><option value="3">结算失败</option><option value="4">删除记录</option></select>
|
||||
<button type="button" onclick="operation()">确定</button>
|
||||
</div>
|
||||
</form>
|
||||
<?php
|
||||
echo'<div class="text-center"><ul class="pagination">';
|
||||
$first=1;
|
||||
$prev=$page-1;
|
||||
$next=$page+1;
|
||||
$last=$pages;
|
||||
if ($page>1)
|
||||
{
|
||||
echo '<li><a href="javascript:void(0)" onclick="listTable(\'page='.$first.$link.'\')">首页</a></li>';
|
||||
echo '<li><a href="javascript:void(0)" onclick="listTable(\'page='.$prev.$link.'\')">«</a></li>';
|
||||
} else {
|
||||
echo '<li class="disabled"><a>首页</a></li>';
|
||||
echo '<li class="disabled"><a>«</a></li>';
|
||||
}
|
||||
$start=$page-10>1?$page-10:1;
|
||||
$end=$page+10<$pages?$page+10:$pages;
|
||||
for ($i=$start;$i<$page;$i++)
|
||||
echo '<li><a href="javascript:void(0)" onclick="listTable(\'page='.$i.$link.'\')">'.$i .'</a></li>';
|
||||
echo '<li class="disabled"><a>'.$page.'</a></li>';
|
||||
for ($i=$page+1;$i<=$end;$i++)
|
||||
echo '<li><a href="javascript:void(0)" onclick="listTable(\'page='.$i.$link.'\')">'.$i .'</a></li>';
|
||||
if ($page<$pages)
|
||||
{
|
||||
echo '<li><a href="javascript:void(0)" onclick="listTable(\'page='.$next.$link.'\')">»</a></li>';
|
||||
echo '<li><a href="javascript:void(0)" onclick="listTable(\'page='.$last.$link.'\')">尾页</a></li>';
|
||||
} else {
|
||||
echo '<li class="disabled"><a>»</a></li>';
|
||||
echo '<li class="disabled"><a>尾页</a></li>';
|
||||
}
|
||||
echo'</ul></div>';
|
||||
252
admin/slist.php
Normal file
@@ -0,0 +1,252 @@
|
||||
<?php
|
||||
/**
|
||||
* 结算列表
|
||||
**/
|
||||
include("../includes/common.php");
|
||||
$title='结算列表';
|
||||
include './head.php';
|
||||
if($islogin==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
?>
|
||||
<style>
|
||||
.form-inline .form-control {
|
||||
display: inline-block;
|
||||
width: auto;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.form-inline .form-group {
|
||||
display: inline-block;
|
||||
margin-bottom: 0;
|
||||
vertical-align: middle;
|
||||
}
|
||||
</style>
|
||||
<div class="container" style="padding-top:70px;">
|
||||
<div class="col-md-12 center-block" style="float: none;">
|
||||
|
||||
<form onsubmit="return searchSettle()" method="GET" class="form-inline">
|
||||
<div class="form-group">
|
||||
<label>搜索</label>
|
||||
<select name="column" class="form-control"><option value="uid">商户号</option><option value="type">结算方式</option><option value="account">结算账号</option><option value="username">姓名</option><option value="batch">批次号</option></select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" name="value" placeholder="搜索内容">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">搜索</button>
|
||||
<a href="settle.php" class="btn btn-success">批量结算</a>
|
||||
<a href="javascript:listTable('start')" class="btn btn-default" title="刷新明细列表"><i class="fa fa-refresh"></i></a>
|
||||
</form>
|
||||
|
||||
<div id="listTable"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="//cdn.staticfile.org/layer/2.3/layer.js"></script>
|
||||
<script>
|
||||
var checkflag1 = "false";
|
||||
function check1(field) {
|
||||
if (checkflag1 == "false") {
|
||||
for (i = 0; i < field.length; i++) {
|
||||
field[i].checked = true;}
|
||||
checkflag1 = "true";
|
||||
return "false"; }
|
||||
else {
|
||||
for (i = 0; i < field.length; i++) {
|
||||
field[i].checked = false; }
|
||||
checkflag1 = "false";
|
||||
return "true"; }
|
||||
}
|
||||
|
||||
function unselectall1()
|
||||
{
|
||||
if(document.form1.chkAll1.checked){
|
||||
document.form1.chkAll1.checked = document.form1.chkAll1.checked&0;
|
||||
checkflag1 = "false";
|
||||
}
|
||||
}
|
||||
|
||||
function listTable(query){
|
||||
var url = window.document.location.href.toString();
|
||||
var queryString = url.split("?")[1];
|
||||
query = query || queryString;
|
||||
if(query == 'start' || query == undefined){
|
||||
query = '';
|
||||
history.replaceState({}, null, './slist.php');
|
||||
}else if(query != undefined){
|
||||
history.replaceState({}, null, './slist.php?'+query);
|
||||
}
|
||||
layer.closeAll();
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'GET',
|
||||
url : 'slist-table.php?'+query,
|
||||
dataType : 'html',
|
||||
cache : false,
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
$("#listTable").html(data)
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
function searchSettle(){
|
||||
var column=$("select[name='column']").val();
|
||||
var value=$("input[name='value']").val();
|
||||
if(value==''){
|
||||
listTable();
|
||||
}else{
|
||||
listTable('column='+column+'&value='+value);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function operation(){
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : 'ajax.php?act=opslist',
|
||||
data : $('#form1').serialize(),
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
listTable();
|
||||
layer.alert(data.msg);
|
||||
}else{
|
||||
layer.alert(data.msg);
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('请求超时');
|
||||
listTable();
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
function setStatusDo(id, status) {
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'get',
|
||||
url : 'ajax.php',
|
||||
data : 'act=setSettleStatus&id=' + id + '&status=' + status,
|
||||
dataType : 'json',
|
||||
success : function(ret) {
|
||||
layer.close(ii);
|
||||
if (ret['code'] != 200) {
|
||||
alert(ret['msg'] ? ret['msg'] : '操作失败');
|
||||
}
|
||||
listTable();
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
function setStatus(id, status) {
|
||||
if(status==4){
|
||||
var confirmobj = layer.confirm('你确实要删除此记录吗?删除记录并不会退回余额', {
|
||||
btn: ['确定','取消']
|
||||
}, function(){
|
||||
setStatusDo(id, status);
|
||||
});
|
||||
}else{
|
||||
setStatusDo(id, status);
|
||||
}
|
||||
}
|
||||
function setResult(id) {
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : 'ajax.php?act=settle_result',
|
||||
data : {id:id},
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
layer.prompt({title: '填写失败原因', value: data.result, formType: 2}, function(text, index){
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : 'ajax.php?act=settle_setresult',
|
||||
data : {id:id,result:text},
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
layer.msg('填写失败原因成功');
|
||||
}else{
|
||||
layer.alert(data.msg);
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
}else{
|
||||
layer.alert(data.msg);
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
function inputInfo(id) {
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'GET',
|
||||
url : 'ajax.php?act=settle_info&id='+id,
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: '修改数据',
|
||||
skin: 'layui-layer-rim',
|
||||
content: data.data,
|
||||
success: function(){
|
||||
$("#pay_type").val(data.pay_type);
|
||||
}
|
||||
});
|
||||
}else{
|
||||
layer.alert(data.msg);
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
function saveInfo(id) {
|
||||
var pay_type=$("#pay_type").val();
|
||||
var pay_account=$("#pay_account").val();
|
||||
var pay_name=$("#pay_name").val();
|
||||
if(pay_account=='' || pay_name==''){layer.alert('请确保每项不能为空!');return false;}
|
||||
$('#save').val('Loading');
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
url : "ajax.php?act=settle_save",
|
||||
data : {id:id,pay_type:pay_type,pay_account:pay_account,pay_name:pay_name},
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
layer.msg('保存成功!');
|
||||
listTable();
|
||||
}else{
|
||||
layer.alert(data.msg);
|
||||
}
|
||||
$('#save').val('保存');
|
||||
}
|
||||
});
|
||||
}
|
||||
$(document).ready(function(){
|
||||
listTable();
|
||||
})
|
||||
</script>
|
||||
16
admin/sso.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
include("../includes/common.php");
|
||||
|
||||
if($islogin==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
|
||||
$uid=intval($_GET['uid']);
|
||||
|
||||
$userrow=$DB->getRow("select * from pre_user where uid='$uid' limit 1");
|
||||
if(!$userrow)sysmsg('µ±Ç°Óû§²»´æÔÚ£¡');
|
||||
|
||||
$session=md5($uid.$userrow['key'].$password_hash);
|
||||
$expiretime=time()+604800;
|
||||
$token=authcode("{$uid}\t{$session}\t{$expiretime}", 'ENCODE', SYS_KEY);
|
||||
setcookie("user_token", $token, time() + 604800, '/user');
|
||||
|
||||
exit("<script language='javascript'>window.location.href='../user/';</script>");
|
||||
159
admin/transfer.php
Normal file
@@ -0,0 +1,159 @@
|
||||
<?php
|
||||
include("../includes/common.php");
|
||||
$title='企业付款';
|
||||
include './head.php';
|
||||
if($islogin==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
?>
|
||||
<div class="container" style="padding-top:70px;">
|
||||
<div class="col-xs-12 col-sm-10 col-lg-8 center-block" style="float: none;">
|
||||
<?php
|
||||
$app = isset($_GET['app'])?$_GET['app']:'alipay';
|
||||
|
||||
if(isset($_POST['submit'])){
|
||||
$out_biz_no = trim($_POST['out_biz_no']);
|
||||
if(!isset($_POST['paypwd']) || $_POST['paypwd']!==$conf['admin_paypwd'])showmsg('支付密码错误',3);
|
||||
if($app=='alipay'){
|
||||
$payee_account = trim($_POST['payee_account']);
|
||||
$payee_real_name = trim($_POST['payee_real_name']);
|
||||
$money = trim($_POST['money']);
|
||||
$payer_show_name = trim($_POST['payer_show_name']);
|
||||
if(!empty($payer_show_name))$conf['transfer_name']=$payer_show_name;
|
||||
$channel = \lib\Channel::get($conf['transfer_alipay']);
|
||||
if(!$channel)showmsg('当前支付通道信息不存在',4);
|
||||
$result = transferToAlipay($channel, $out_biz_no, $payee_account, $payee_real_name, $money);
|
||||
}elseif($app=='wxpay'){
|
||||
$openid = trim($_POST['openid']);
|
||||
$name = trim($_POST['name']);
|
||||
$money = trim($_POST['money']);
|
||||
$desc = trim($_POST['desc']);
|
||||
if(!empty($desc))$conf['transfer_desc']=$desc;
|
||||
$channel = \lib\Channel::get($conf['transfer_wxpay']);
|
||||
if(!$channel)showmsg('当前支付通道信息不存在',4);
|
||||
$result = transferToWeixin($channel, $out_biz_no, $openid, $name, $money);
|
||||
}elseif($app=='qqpay'){
|
||||
$qq = trim($_POST['qq']);
|
||||
if (!is_numeric($qq) || strlen($qq)<6 || strlen($qq)>10)showmsg('QQ号码格式错误',3);
|
||||
$name = trim($_POST['name']);
|
||||
$money = trim($_POST['money']);
|
||||
$desc = trim($_POST['desc']);
|
||||
if(!empty($desc))$conf['transfer_desc']=$desc;
|
||||
$channel = \lib\Channel::get($conf['transfer_qqpay']);
|
||||
if(!$channel)showmsg('当前支付通道信息不存在',4);
|
||||
$result = transferToQQ($channel, $out_biz_no, $qq, $name, $money);
|
||||
}else{
|
||||
showmsg('参数错误',4);
|
||||
}
|
||||
|
||||
if($result['code']==0 && $result['ret']==1){
|
||||
$result='转账成功!转账单据号:'.$result['orderid'].' 支付时间:'.$result['paydate'];
|
||||
showmsg($result,1);
|
||||
}else{
|
||||
$result='转账失败 '.$result['msg'];
|
||||
showmsg($result,4);
|
||||
}
|
||||
}
|
||||
|
||||
$out_biz_no = date("YmdHis").rand(11111,99999);
|
||||
?>
|
||||
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading"><h3 class="panel-title">企业付款</h3></div>
|
||||
<div class="panel-body">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="<?php echo $app=='alipay'?'active':null;?>"><a href="?app=alipay">支付宝</a></li><li class="<?php echo $app=='wxpay'?'active':null;?>"><a href="?app=wxpay">微信</a></li><li class="<?php echo $app=='qqpay'?'active':null;?>"><a href="?app=qqpay">QQ钱包</a></li>
|
||||
</ul>
|
||||
<div class="tab-pane active" id="alipay">
|
||||
<?php if($app=='alipay'){?>
|
||||
<form action="?app=alipay" method="POST" role="form">
|
||||
<div class="form-group">
|
||||
<div class="input-group"><div class="input-group-addon">交易号</div>
|
||||
<input type="text" name="out_biz_no" value="<?php echo $out_biz_no?>" class="form-control" required/>
|
||||
</div></div>
|
||||
<div class="form-group">
|
||||
<div class="input-group"><div class="input-group-addon">支付宝账号</div>
|
||||
<input type="text" name="payee_account" value="" class="form-control" required placeholder="支付宝登录账号或支付宝UID"/>
|
||||
</div></div>
|
||||
<div class="form-group">
|
||||
<div class="input-group"><div class="input-group-addon">支付宝姓名</div>
|
||||
<input type="text" name="payee_real_name" value="" class="form-control" placeholder="不填写则不校验真实姓名"/>
|
||||
</div></div>
|
||||
<div class="form-group">
|
||||
<div class="input-group"><div class="input-group-addon">转账金额</div>
|
||||
<input type="text" name="money" value="" class="form-control" placeholder="RMB/元" required/>
|
||||
</div></div>
|
||||
<div class="form-group">
|
||||
<div class="input-group"><div class="input-group-addon">付款方姓名</div>
|
||||
<input type="text" name="payer_show_name" value="" class="form-control" placeholder="可留空"/>
|
||||
</div></div>
|
||||
<div class="form-group">
|
||||
<div class="input-group"><div class="input-group-addon">支付密码</div>
|
||||
<input type="text" name="paypwd" value="" class="form-control" required/>
|
||||
</div></div>
|
||||
<p><input type="submit" name="submit" value="立即转账" class="btn btn-primary form-control"/></p>
|
||||
</form>
|
||||
<?php }elseif($app=='wxpay'){?>
|
||||
<form action="?app=wxpay" method="POST" role="form">
|
||||
<div class="form-group">
|
||||
<div class="input-group"><div class="input-group-addon">交易号</div>
|
||||
<input type="text" name="out_biz_no" value="<?php echo $out_biz_no?>" class="form-control" required/>
|
||||
</div></div>
|
||||
<div class="form-group">
|
||||
<div class="input-group"><div class="input-group-addon">Openid</div>
|
||||
<input type="text" name="openid" value="" class="form-control" required placeholder="微信Openid"/>
|
||||
</div></div>
|
||||
<div class="form-group">
|
||||
<div class="input-group"><div class="input-group-addon">真实姓名</div>
|
||||
<input type="text" name="name" value="" class="form-control" placeholder="不填写则不校验真实姓名"/>
|
||||
</div></div>
|
||||
<div class="form-group">
|
||||
<div class="input-group"><div class="input-group-addon">转账金额</div>
|
||||
<input type="text" name="money" value="" class="form-control" placeholder="RMB/元" required/>
|
||||
</div></div>
|
||||
<div class="form-group">
|
||||
<div class="input-group"><div class="input-group-addon">转账备注</div>
|
||||
<input type="text" name="desc" value="" class="form-control" placeholder="可留空"/>
|
||||
</div></div>
|
||||
<div class="form-group">
|
||||
<div class="input-group"><div class="input-group-addon">支付密码</div>
|
||||
<input type="text" name="paypwd" value="" class="form-control" required/>
|
||||
</div></div>
|
||||
<p><input type="submit" name="submit" value="立即转账" class="btn btn-primary form-control"/></p>
|
||||
</form>
|
||||
<font color="green">Openid获取地址,在微信打开:<?php echo $siteurl?>user/openid.php</font>
|
||||
<?php }elseif($app=='qqpay'){?>
|
||||
<form action="?app=qqpay" method="POST" role="form">
|
||||
<div class="form-group">
|
||||
<div class="input-group"><div class="input-group-addon">交易号</div>
|
||||
<input type="text" name="out_biz_no" value="<?php echo $out_biz_no?>" class="form-control" required/>
|
||||
</div></div>
|
||||
<div class="form-group">
|
||||
<div class="input-group"><div class="input-group-addon">收款方QQ</div>
|
||||
<input type="text" name="qq" value="" class="form-control" required/>
|
||||
</div></div>
|
||||
<div class="form-group">
|
||||
<div class="input-group"><div class="input-group-addon">真实姓名</div>
|
||||
<input type="text" name="name" value="" class="form-control" placeholder="不填写则不校验真实姓名"/>
|
||||
</div></div>
|
||||
<div class="form-group">
|
||||
<div class="input-group"><div class="input-group-addon">转账金额</div>
|
||||
<input type="text" name="money" value="" class="form-control" placeholder="RMB/元" required/>
|
||||
</div></div>
|
||||
<div class="form-group">
|
||||
<div class="input-group"><div class="input-group-addon">转账备注</div>
|
||||
<input type="text" name="desc" value="" class="form-control" placeholder="可留空"/>
|
||||
</div></div>
|
||||
<div class="form-group">
|
||||
<div class="input-group"><div class="input-group-addon">支付密码</div>
|
||||
<input type="text" name="paypwd" value="" class="form-control" required/>
|
||||
</div></div>
|
||||
<p><input type="submit" name="submit" value="立即转账" class="btn btn-primary form-control"/></p>
|
||||
</form>
|
||||
<?php }?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-footer">
|
||||
<span class="glyphicon glyphicon-info-sign"></span> 交易号可以防止重复转账,同一个交易号只能提交同一次转账。
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
170
admin/transfer_alipay.php
Normal file
@@ -0,0 +1,170 @@
|
||||
<?php
|
||||
/**
|
||||
* 转账到支付宝操作
|
||||
**/
|
||||
include("../includes/common.php");
|
||||
$title='转账到支付宝操作';
|
||||
include './head.php';
|
||||
if($islogin==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
?>
|
||||
<div class="container" style="padding-top:70px;">
|
||||
<?php
|
||||
if(!isset($_SESSION['paypwd']) || $_SESSION['paypwd']!==$conf['admin_paypwd'])showmsg('支付密码错误,请返回重新进入该页面');
|
||||
|
||||
if(isset($_GET['batch'])){
|
||||
$batch=$_GET['batch'];
|
||||
$row=$DB->getRow("SELECT * from pre_batch where batch='$batch'");
|
||||
if(!$row)showmsg('批次号不存在');
|
||||
$list=$DB->getAll("SELECT * FROM pre_settle WHERE batch='{$batch}' and type=1");
|
||||
|
||||
?>
|
||||
<script>
|
||||
function SelectAll(chkAll) {
|
||||
var items = $('.uins');
|
||||
for (i = 0; i < items.length; i++) {
|
||||
if (items[i].id.indexOf("uins") != -1) {
|
||||
if (items[i].type == "checkbox") {
|
||||
items[i].checked = chkAll.checked;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function Transfer(){
|
||||
var url="transfer_alipay_do.php";
|
||||
$("input[name=uins]:checked:first").each(function(){
|
||||
var checkself=$(this);
|
||||
var id=checkself.val();
|
||||
var statusself=$('#id'+id);
|
||||
statusself.html("<img src='../assets/img/load.gif' height=22>");
|
||||
xiha.postData(url,'id='+id, function(d) {
|
||||
if(d.code==0){
|
||||
transnum++;
|
||||
var num = $('#hydx').text();
|
||||
num=parseInt(num);
|
||||
num++;
|
||||
$('#hydx').text(num);
|
||||
if(d.ret==1){
|
||||
statusself.html('<font color="green">成功</font>');
|
||||
}else if(d.ret==2){
|
||||
statusself.html('<font color="green">已完成</font>');
|
||||
}else{
|
||||
statusself.html('<font color="red">失败</font>');
|
||||
}
|
||||
$('#res'+id).html('<font color="blue">'+d.result+'</font>');
|
||||
checkself.attr('checked',false);
|
||||
Transfer();
|
||||
}else if(d.code==-1){
|
||||
statusself.html('<font color="red">失败</font>');
|
||||
alert(d.msg);
|
||||
}else{
|
||||
statusself.html('<font color="red">失败</font>');
|
||||
}
|
||||
});
|
||||
return true;
|
||||
});
|
||||
}
|
||||
var transnum = 0;
|
||||
$(document).ready(function(){
|
||||
var allmoney = 0;
|
||||
var items = $('.money');
|
||||
for (i = 0; i < items.length; i++) {
|
||||
allmoney+=parseFloat(items[i].innerHTML);
|
||||
}
|
||||
$('#allmoney').html('总金额:'+allmoney.toFixed(2));
|
||||
$('#startsend').click(function(){
|
||||
var self=$(this);
|
||||
if (self.attr("data-lock") === "true") return;
|
||||
else self.attr("data-lock", "true");
|
||||
self.html('正在转账中');
|
||||
Transfer();
|
||||
if(transnum<1) self.html('没有待转账的记录');
|
||||
else self.html('转账处理完成');
|
||||
self.attr("data-lock", "false");
|
||||
});
|
||||
$('.recheck').click(function(){
|
||||
var self=$(this),
|
||||
id=self.attr('uin');
|
||||
var url="transfer_alipay_do.php";
|
||||
self.html("<img src='../assets/img/load.gif' height=22>");
|
||||
xiha.postData(url,'id='+id, function(d) {
|
||||
if(d.code==0){
|
||||
if(d.ret==1){
|
||||
self.html('<font color="green">成功</font>');
|
||||
}else if(d.ret==2){
|
||||
self.html('<font color="green">已完成</font>');
|
||||
}else{
|
||||
self.html('<font color="red">失败</font>');
|
||||
}
|
||||
$('#res'+id).html('<font color="blue">'+d.result+'</font>');
|
||||
$('.uins[value='+id+']').attr('checked',false);
|
||||
self.removeClass('nocheck');
|
||||
}else if(d.code==-1){
|
||||
self.html('<font color="red">失败</font>');
|
||||
alert(d.msg);
|
||||
}else{
|
||||
self.html('<font color="red">失败</font>');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
var xiha={
|
||||
postData: function(url, parameter, callback, dataType, ajaxType) {
|
||||
if(!dataType) dataType='json';
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: url,
|
||||
async: true,
|
||||
dataType: dataType,
|
||||
json: "callback",
|
||||
data: parameter,
|
||||
success: function(data,status) {
|
||||
if (callback == null) {
|
||||
return;
|
||||
}
|
||||
callback(data);
|
||||
},
|
||||
error: function(error) {
|
||||
//alert('创建连接失败');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<div class="col-md-12 center-block" style="float: none;">
|
||||
<div class="panel panel-warning">
|
||||
<div class="panel-heading">
|
||||
<div class="panel-title">
|
||||
<div class="input-group" style="padding:8px 0;">
|
||||
<div class="input-group-addon btn">全选<input type="checkbox" onclick="SelectAll(this)" /></div>
|
||||
<div class="input-group-addon btn" id="startsend">点此开始转账</div>
|
||||
<div class="input-group-addon btn"><span id="allmoney">总金额</span></div>
|
||||
</div>
|
||||
<div id="result"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-primary">
|
||||
<table class="table table-bordered table-condensed">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td align="center"><span style="color:silver;"><b>ID</b></span></td>
|
||||
<td align="center"><span style="color:silver;"><b>商户ID</b></span></td>
|
||||
<td align="center"><span style="color:silver;"><b>结算账号</b></span></td>
|
||||
<td align="center"><span style="color:silver;"><b>结算姓名</b></span></td>
|
||||
<td align="center"><span style="color:silver;"><b>金额</b></span></td>
|
||||
<td align="center"><span style="color:silver;"><b>操作</b></span></td>
|
||||
</tr>
|
||||
<?php
|
||||
echo '<tr><td colspan="6" align="center">总共<span id="hyall">'.count($list).'<span>个记录,已经处理<span id="hydx">0</span>个记录!</td></tr>';
|
||||
foreach($list as $row) {
|
||||
echo '<tr><td uin="'.$row['id'].'"><input name="uins" type="checkbox" id="uins" class="uins" value="'.$row['id'].'" '.($row['transfer_status']!=1?'checked':null).'>'.$row['id'].'</td><td>'.$row['pid'].'</td><td>'.$row['account'].'</td><td>'.$row['username'].'</td><td class="money">'.$row['money'].'</td><td id="id'.$row['id'].'" uin="'.$row['id'].'" class="nocheck recheck" align="center">'.($row['transfer_status']!=1?'<span class="btn btn-xs btn-block btn-primary">立即转账</span>':'<font color="green">已完成</font>').'</td></tr><tr><td><span style="color:silver;">结果</span></td><td colspan="5" id="res'.$row['id'].'"><font color="blue">'.($row['transfer_status']==1?'支付宝转账单据号:'.$row['transfer_result'].' 支付时间:'.$row['transfer_date']:$row['transfer_result']).'</font></td></tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php }?>
|
||||
</div>
|
||||
45
admin/transfer_alipay_do.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
include("../includes/common.php");
|
||||
if($islogin==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
|
||||
$channel = \lib\Channel::get($conf['transfer_alipay']);
|
||||
if(!$channel)exit('{"code":-1,"msg":"当前支付通道信息不存在"}');
|
||||
|
||||
|
||||
$id = isset($_POST['id'])?intval($_POST['id']):exit('{"code":-1,"msg":"ID不能为空"}');
|
||||
|
||||
if(!isset($_SESSION['paypwd']) || $_SESSION['paypwd']!==$conf['admin_paypwd'])exit('{"code":-1,"msg":"支付密码错误,请返回重新进入该页面"}');
|
||||
|
||||
$row=$DB->getRow("SELECT * FROM pre_settle WHERE id='{$id}' limit 1");
|
||||
|
||||
if(!$row)exit('{"code":-1,"msg":"记录不存在"}');
|
||||
|
||||
if($row['type']!=1)exit('{"code":-1,"msg":"该记录不是支付宝结算"}');
|
||||
|
||||
if($row['transfer_status']==1)exit('{"code":0,"ret":2,"result":"支付宝转账单据号:'.$row['transfer_result'].' 支付时间:'.$row['transfer_date'].'"}');
|
||||
|
||||
$out_biz_no = date("Ymd").'000'.$id;
|
||||
|
||||
$result = transferToAlipay($channel, $out_biz_no, $row['account'], $row['username'], $row['money']);
|
||||
|
||||
if($result['code']==0 && $result['ret']==1){
|
||||
$data['code']=0;
|
||||
$data['ret']=1;
|
||||
$data['msg']='success';
|
||||
$data['result']='支付宝转账单据号:'.$result['orderid'].' 支付时间:'.$result['paydate'];
|
||||
$DB->exec("update `pre_settle` set `status`='1',`endtime`='$date',`transfer_status`='1',`transfer_result`='".$result['orderid']."',`transfer_date`='".$result['paydate']."' where `id`='$id'");
|
||||
} elseif($result['code']==0 && $result['ret']==0) {
|
||||
$data['code']=0;
|
||||
$data['ret']=0;
|
||||
$data['msg']='fail';
|
||||
$data['result']='转账失败 ['.$result['sub_code'].']'.$result['sub_msg'];
|
||||
$DB->exec("update `pre_settle` set `transfer_status`='2',`transfer_result`='".$data['result']."' where `id`='$id'");
|
||||
if($result['sub_code'] == 'PAYEE_NOT_EXIST' || $result['sub_code'] == 'PERM_AML_NOT_REALNAME_REV' || $result['sub_code'] == 'PAYEE_USER_INFO_ERROR' || $result['sub_code'] == 'PAYEE_ACC_OCUPIED' || $result['sub_code'] == 'PERMIT_NON_BANK_LIMIT_PAYEE'){
|
||||
$DB->exec("update `pre_settle` set `status`='3',`result`='".$result['sub_msg']."' where `id`='$id'");
|
||||
}
|
||||
} else {
|
||||
$data['code']=-1;
|
||||
$data['msg']=$result['msg'];
|
||||
}
|
||||
echo json_encode($data);
|
||||
172
admin/transfer_qq.php
Normal file
@@ -0,0 +1,172 @@
|
||||
<?php
|
||||
/**
|
||||
* QQ企业付款
|
||||
**/
|
||||
include("../includes/common.php");
|
||||
$title='QQ企业付款';
|
||||
include './head.php';
|
||||
if($islogin==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
?>
|
||||
<div class="container" style="padding-top:70px;">
|
||||
<?php
|
||||
if(!isset($_SESSION['paypwd']) || $_SESSION['paypwd']!==$conf['admin_paypwd'])showmsg('支付密码错误,请返回重新进入该页面');
|
||||
|
||||
if(isset($_GET['batch'])){
|
||||
$batch=$_GET['batch'];
|
||||
$row=$DB->getRow("SELECT * from pre_batch where batch='$batch'");
|
||||
if(!$row)showmsg('批次号不存在');
|
||||
$list=$DB->getAll("SELECT * FROM pre_settle WHERE batch='{$batch}' and type=3");
|
||||
|
||||
?>
|
||||
<script>
|
||||
function SelectAll(chkAll) {
|
||||
var items = $('.uins');
|
||||
for (i = 0; i < items.length; i++) {
|
||||
if (items[i].id.indexOf("uins") != -1) {
|
||||
if (items[i].type == "checkbox") {
|
||||
items[i].checked = chkAll.checked;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function Transfer(){
|
||||
var url="transfer_qq_do.php";
|
||||
$("input[name=uins]:checked:first").each(function(){
|
||||
var checkself=$(this);
|
||||
var id=checkself.val();
|
||||
var statusself=$('#id'+id);
|
||||
statusself.html("<img src='../assets/img/load.gif' height=22>");
|
||||
xiha.postData(url,'id='+id, function(d) {
|
||||
if(d.code==0){
|
||||
transnum++;
|
||||
var num = $('#hydx').text();
|
||||
num=parseInt(num);
|
||||
num++;
|
||||
$('#hydx').text(num);
|
||||
if(d.ret==1){
|
||||
statusself.html('<font color="green">成功</font>');
|
||||
}else if(d.ret==2){
|
||||
statusself.html('<font color="green">已完成</font>');
|
||||
}else{
|
||||
statusself.html('<font color="red">失败</font>');
|
||||
}
|
||||
$('#res'+id).html('<font color="blue">'+d.result+'</font>');
|
||||
checkself.attr('checked',false);
|
||||
Transfer();
|
||||
}else if(d.code==-1){
|
||||
statusself.html('<font color="red">失败</font>');
|
||||
alert(d.msg);
|
||||
}else{
|
||||
statusself.html('<font color="red">失败</font>');
|
||||
}
|
||||
});
|
||||
return true;
|
||||
});
|
||||
}
|
||||
var transnum = 0;
|
||||
$(document).ready(function(){
|
||||
var allmoney = 0;
|
||||
var items = $('.money');
|
||||
for (i = 0; i < items.length; i++) {
|
||||
allmoney+=parseFloat(items[i].innerHTML);
|
||||
}
|
||||
$('#allmoney').html('总金额:'+allmoney.toFixed(2));
|
||||
$('#startsend').click(function(){
|
||||
var self=$(this);
|
||||
if (self.attr("data-lock") === "true") return;
|
||||
else self.attr("data-lock", "true");
|
||||
self.html('正在转账中');
|
||||
Transfer();
|
||||
if(transnum<1) self.html('没有待转账的记录');
|
||||
else self.html('转账处理完成');
|
||||
self.attr("data-lock", "false");
|
||||
});
|
||||
$('.recheck').click(function(){
|
||||
var self=$(this),
|
||||
id=self.attr('uin');
|
||||
var url="transfer_qq_do.php";
|
||||
self.html("<img src='../assets/img/load.gif' height=22>");
|
||||
xiha.postData(url,'id='+id, function(d) {
|
||||
if(d.code==0){
|
||||
if(d.ret==1){
|
||||
self.html('<font color="green">成功</font>');
|
||||
}else if(d.ret==2){
|
||||
self.html('<font color="green">已完成</font>');
|
||||
}else{
|
||||
self.html('<font color="red">失败</font>');
|
||||
}
|
||||
$('#res'+id).html('<font color="blue">'+d.result+'</font>');
|
||||
$('.uins[value='+id+']').attr('checked',false);
|
||||
self.removeClass('nocheck');
|
||||
}else if(d.code==-1){
|
||||
self.html('<font color="red">失败</font>');
|
||||
alert(d.msg);
|
||||
}else{
|
||||
self.html('<font color="red">失败</font>');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
var xiha={
|
||||
postData: function(url, parameter, callback, dataType, ajaxType) {
|
||||
if(!dataType) dataType='json';
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: url,
|
||||
async: true,
|
||||
dataType: dataType,
|
||||
json: "callback",
|
||||
data: parameter,
|
||||
success: function(data,status) {
|
||||
if (callback == null) {
|
||||
return;
|
||||
}
|
||||
callback(data);
|
||||
},
|
||||
error: function(error) {
|
||||
//alert('创建连接失败');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<div class="col-md-12 center-block" style="float: none;">
|
||||
<div class="panel panel-warning">
|
||||
<div class="panel-heading">
|
||||
<div class="panel-title">
|
||||
<div class="input-group" style="padding:8px 0;">
|
||||
<div class="input-group-addon btn">全选<input type="checkbox" onclick="SelectAll(this)" /></div>
|
||||
<div class="input-group-addon btn" id="startsend">点此开始转账</div>
|
||||
<div class="input-group-addon btn"><span id="allmoney">总金额</span></div>
|
||||
</div>
|
||||
<div id="result"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-primary">
|
||||
<table class="table table-bordered table-condensed">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td align="center"><span style="color:silver;"><b>ID</b></span></td>
|
||||
<td align="center"><span style="color:silver;"><b>商户ID</b></span></td>
|
||||
<td align="center"><span style="color:silver;"><b>QQ号码</b></span></td>
|
||||
<td align="center"><span style="color:silver;"><b>姓名</b></span></td>
|
||||
<td align="center"><span style="color:silver;"><b>金额</b></span></td>
|
||||
<td align="center"><span style="color:silver;"><b>操作</b></span></td>
|
||||
</tr>
|
||||
<?php
|
||||
echo '<tr><td colspan="6" align="center">总共<span id="hyall">'.count($list).'<span>个记录,已经处理<span id="hydx">0</span>个记录!</td></tr>';
|
||||
foreach($list as $row) {
|
||||
echo '<tr><td uin="'.$row['id'].'"><input name="uins" type="checkbox" id="uins" class="uins" value="'.$row['id'].'" '.($row['transfer_status']!=1?'checked':null).'>'.$row['id'].'</td><td>'.$row['pid'].'</td><td>'.$row['account'].'</td><td>'.$row['username'].'</td><td class="money">'.$row['money'].'</td><td id="id'.$row['id'].'" uin="'.$row['id'].'" class="nocheck recheck" align="center">'.($row['transfer_status']!=1?'<span class="btn btn-xs btn-block btn-primary">立即转账</span>':'<font color="green">已完成</font>').'</td></tr><tr><td><span style="color:silver;">结果</span></td><td colspan="5" id="res'.$row['id'].'"><font color="blue">'.($row['transfer_status']==1?'QQ订单号:'.$row['transfer_result'].' 支付时间:'.$row['transfer_date']:$row['transfer_result']).'</font></td></tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php }?>
|
||||
</div>
|
||||
53
admin/transfer_qq_do.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
include("../includes/common.php");
|
||||
if($islogin==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
|
||||
$channel = \lib\Channel::get($conf['transfer_qqpay']);
|
||||
if(!$channel)exit('{"code":-1,"msg":"当前支付通道信息不存在"}');
|
||||
|
||||
$id = isset($_POST['id'])?intval($_POST['id']):exit('{"code":-1,"msg":"ID不能为空"}');
|
||||
|
||||
if(!isset($_SESSION['paypwd']) || $_SESSION['paypwd']!==$conf['admin_paypwd'])exit('{"code":-1,"msg":"支付密码错误,请返回重新进入该页面"}');
|
||||
|
||||
$row=$DB->getRow("SELECT * FROM pre_settle WHERE id='{$id}' limit 1");
|
||||
|
||||
if(!$row)exit('{"code":-1,"msg":"记录不存在"}');
|
||||
|
||||
if($row['type']!=3)exit('{"code":-1,"msg":"该记录不是QQ结算"}');
|
||||
|
||||
if($row['transfer_status']==1)exit('{"code":0,"ret":2,"result":"QQ订单号:'.$row['transfer_result'].' 支付时间:'.$row['transfer_date'].'"}');
|
||||
|
||||
if (!is_numeric($row['account']) || strlen($row['account'])<6 || strlen($row['account'])>10) {
|
||||
$a = array();
|
||||
$a['code']=0;
|
||||
$a['ret']=0;
|
||||
$a['msg']='fail';
|
||||
$a['result']='QQ号格式错误';
|
||||
exit(json_encode($a));
|
||||
}
|
||||
|
||||
$out_biz_no = date("Ymd").'000'.$id;
|
||||
|
||||
$result = transferToQQ($channel, $out_biz_no, $row['account'], $row['username'], $row['money']);
|
||||
|
||||
if($result['code']==0 && $result['ret']==1){
|
||||
$data['code']=0;
|
||||
$data['ret']=1;
|
||||
$data['msg']='success';
|
||||
$data['result']='QQ订单号:'.$result["orderid"].' 支付时间:'.$result["paydate"];
|
||||
$DB->exec("update `pre_settle` set `status`='1',`endtime`='$date',`transfer_status`='1',`transfer_result`='".$result["orderid"]."',`transfer_date`='".$result["paydate"]."' where `id`='$id'");
|
||||
} elseif($result['code']==0 && $result['ret']==0) {
|
||||
$data['code']=0;
|
||||
$data['ret']=0;
|
||||
$data['msg']='fail';
|
||||
$data['result']='转账失败 ['.$result["sub_code"].']'.$result["sub_msg"];
|
||||
$DB->exec("update `pre_settle` set `transfer_status`='2',`transfer_result`='".$data['result']."' where `id`='$id'");
|
||||
if($result["sub_code"]=='REALNAME_CHECK_ERROR' || $result["sub_code"]=='RE_USER_NAME_CHECK_ERROR' || $result["sub_code"]=='TRANSFER_FAIL' || $result["sub_code"]=='TRANSFER_FEE_LIMIT_ERROR'){
|
||||
$DB->exec("update `pre_settle` set `status`='3',`result`='".$result["sub_msg"]."' where `id`='$id'");
|
||||
}
|
||||
}else{
|
||||
$data['code']=-1;
|
||||
$data['result']=$result["msg"];
|
||||
}
|
||||
|
||||
echo json_encode($data);
|
||||
170
admin/transfer_wx.php
Normal file
@@ -0,0 +1,170 @@
|
||||
<?php
|
||||
/**
|
||||
* 微信企业付款
|
||||
**/
|
||||
include("../includes/common.php");
|
||||
$title='微信企业付款';
|
||||
include './head.php';
|
||||
if($islogin==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
?>
|
||||
<div class="container" style="padding-top:70px;">
|
||||
<?php
|
||||
if(!isset($_SESSION['paypwd']) || $_SESSION['paypwd']!==$conf['admin_paypwd'])showmsg('支付密码错误,请返回重新进入该页面');
|
||||
|
||||
if(isset($_GET['batch'])){
|
||||
$batch=$_GET['batch'];
|
||||
$row=$DB->getRow("SELECT * from pre_batch where batch='$batch' limit 1");
|
||||
if(!$row)showmsg('批次号不存在');
|
||||
$list=$DB->getAll("SELECT * FROM pre_settle WHERE batch='{$batch}' and type=2");
|
||||
|
||||
?>
|
||||
<script>
|
||||
function SelectAll(chkAll) {
|
||||
var items = $('.uins');
|
||||
for (i = 0; i < items.length; i++) {
|
||||
if (items[i].id.indexOf("uins") != -1) {
|
||||
if (items[i].type == "checkbox") {
|
||||
items[i].checked = chkAll.checked;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function Transfer(){
|
||||
var url="transfer_wx_do.php";
|
||||
$("input[name=uins]:checked:first").each(function(){
|
||||
var checkself=$(this);
|
||||
var id=checkself.val();
|
||||
var statusself=$('#id'+id);
|
||||
statusself.html("<img src='../assets/img/load.gif' height=22>");
|
||||
xiha.postData(url,'id='+id, function(d) {
|
||||
if(d.code==0){
|
||||
transnum++;
|
||||
var num = $('#hydx').text();
|
||||
num=parseInt(num);
|
||||
num++;
|
||||
$('#hydx').text(num);
|
||||
if(d.ret==1){
|
||||
statusself.html('<font color="green">成功</font>');
|
||||
}else if(d.ret==2){
|
||||
statusself.html('<font color="green">已完成</font>');
|
||||
}else{
|
||||
statusself.html('<font color="red">失败</font>');
|
||||
}
|
||||
$('#res'+id).html('<font color="blue">'+d.result+'</font>');
|
||||
checkself.attr('checked',false);
|
||||
Transfer();
|
||||
}else if(d.code==-1){
|
||||
statusself.html('<font color="red">失败</font>');
|
||||
alert(d.msg);
|
||||
}else{
|
||||
statusself.html('<font color="red">失败</font>');
|
||||
}
|
||||
});
|
||||
return true;
|
||||
});
|
||||
}
|
||||
var transnum = 0;
|
||||
$(document).ready(function(){
|
||||
var allmoney = 0;
|
||||
var items = $('.money');
|
||||
for (i = 0; i < items.length; i++) {
|
||||
allmoney+=parseFloat(items[i].innerHTML);
|
||||
}
|
||||
$('#allmoney').html('总金额:'+allmoney.toFixed(2));
|
||||
$('#startsend').click(function(){
|
||||
var self=$(this);
|
||||
if (self.attr("data-lock") === "true") return;
|
||||
else self.attr("data-lock", "true");
|
||||
self.html('正在转账中');
|
||||
Transfer();
|
||||
if(transnum<1) self.html('没有待转账的记录');
|
||||
else self.html('转账处理完成');
|
||||
self.attr("data-lock", "false");
|
||||
});
|
||||
$('.recheck').click(function(){
|
||||
var self=$(this),
|
||||
id=self.attr('uin');
|
||||
var url="transfer_wx_do.php";
|
||||
self.html("<img src='../assets/img/load.gif' height=22>");
|
||||
xiha.postData(url,'id='+id, function(d) {
|
||||
if(d.code==0){
|
||||
if(d.ret==1){
|
||||
self.html('<font color="green">成功</font>');
|
||||
}else if(d.ret==2){
|
||||
self.html('<font color="green">已完成</font>');
|
||||
}else{
|
||||
self.html('<font color="red">失败</font>');
|
||||
}
|
||||
$('#res'+id).html('<font color="blue">'+d.result+'</font>');
|
||||
$('.uins[value='+id+']').attr('checked',false);
|
||||
self.removeClass('nocheck');
|
||||
}else if(d.code==-1){
|
||||
self.html('<font color="red">失败</font>');
|
||||
alert(d.msg);
|
||||
}else{
|
||||
self.html('<font color="red">失败</font>');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
var xiha={
|
||||
postData: function(url, parameter, callback, dataType, ajaxType) {
|
||||
if(!dataType) dataType='json';
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: url,
|
||||
async: true,
|
||||
dataType: dataType,
|
||||
json: "callback",
|
||||
data: parameter,
|
||||
success: function(data,status) {
|
||||
if (callback == null) {
|
||||
return;
|
||||
}
|
||||
callback(data);
|
||||
},
|
||||
error: function(error) {
|
||||
//alert('创建连接失败');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<div class="col-md-12 center-block" style="float: none;">
|
||||
<div class="panel panel-warning">
|
||||
<div class="panel-heading">
|
||||
<div class="panel-title">
|
||||
<div class="input-group" style="padding:8px 0;">
|
||||
<div class="input-group-addon btn">全选<input type="checkbox" onclick="SelectAll(this)" /></div>
|
||||
<div class="input-group-addon btn" id="startsend">点此开始转账</div>
|
||||
<div class="input-group-addon btn"><span id="allmoney">总金额</span></div>
|
||||
</div>
|
||||
<div id="result"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-primary">
|
||||
<table class="table table-bordered table-condensed">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td align="center"><span style="color:silver;"><b>ID</b></span></td>
|
||||
<td align="center"><span style="color:silver;"><b>商户ID</b></span></td>
|
||||
<td align="center"><span style="color:silver;"><b>OpenId</b></span></td>
|
||||
<td align="center"><span style="color:silver;"><b>姓名</b></span></td>
|
||||
<td align="center"><span style="color:silver;"><b>金额</b></span></td>
|
||||
<td align="center"><span style="color:silver;"><b>操作</b></span></td>
|
||||
</tr>
|
||||
<?php
|
||||
echo '<tr><td colspan="6" align="center">总共<span id="hyall">'.count($list).'<span>个记录,已经处理<span id="hydx">0</span>个记录!</td></tr>';
|
||||
foreach($list as $row) {
|
||||
echo '<tr><td uin="'.$row['id'].'"><input name="uins" type="checkbox" id="uins" class="uins" value="'.$row['id'].'" '.($row['transfer_status']!=1?'checked':null).'>'.$row['id'].'</td><td>'.$row['pid'].'</td><td>'.$row['account'].'</td><td>'.$row['username'].'</td><td class="money">'.$row['money'].'</td><td id="id'.$row['id'].'" uin="'.$row['id'].'" class="nocheck recheck" align="center">'.($row['transfer_status']!=1?'<span class="btn btn-xs btn-block btn-primary">立即转账</span>':'<font color="green">已完成</font>').'</td></tr><tr><td><span style="color:silver;">结果</span></td><td colspan="5" id="res'.$row['id'].'"><font color="blue">'.($row['transfer_status']==1?'微信订单号:'.$row['transfer_result'].' 支付时间:'.$row['transfer_date']:$row['transfer_result']).'</font></td></tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php }?>
|
||||
</div>
|
||||
45
admin/transfer_wx_do.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
include("../includes/common.php");
|
||||
if($islogin==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
|
||||
$channel = \lib\Channel::get($conf['transfer_wxpay']);
|
||||
if(!$channel)exit('{"code":-1,"msg":"当前支付通道信息不存在"}');
|
||||
|
||||
|
||||
$id = isset($_POST['id'])?intval($_POST['id']):exit('{"code":-1,"msg":"ID不能为空"}');
|
||||
|
||||
if(!isset($_SESSION['paypwd']) || $_SESSION['paypwd']!==$conf['admin_paypwd'])exit('{"code":-1,"msg":"支付密码错误,请返回重新进入该页面"}');
|
||||
|
||||
$row=$DB->getRow("SELECT * FROM pre_settle WHERE id='{$id}' limit 1");
|
||||
|
||||
if(!$row)exit('{"code":-1,"msg":"记录不存在"}');
|
||||
|
||||
if($row['type']!=2)exit('{"code":-1,"msg":"该记录不是微信结算"}');
|
||||
|
||||
if($row['transfer_status']==1)exit('{"code":0,"ret":2,"result":"微信订单号:'.$row['transfer_result'].' 支付时间:'.$row['transfer_date'].'"}');
|
||||
|
||||
$out_biz_no = date("Ymd").'000'.$id;
|
||||
|
||||
$result = transferToWeixin($channel, $out_biz_no, $row['account'], $row['username'], $row['money']);
|
||||
|
||||
if($result['code']==0 && $result['ret']==1){
|
||||
$data['code']=0;
|
||||
$data['ret']=1;
|
||||
$data['msg']='success';
|
||||
$data['result']='微信订单号:'.$result["orderid"].' 支付时间:'.$result["paydate"];
|
||||
$DB->exec("update `pre_settle` set `status`='1',`endtime`='$date',`transfer_status`='1',`transfer_result`='".$result["orderid"]."',`transfer_date`='".$result["paydate"]."' where `id`='$id'");
|
||||
} elseif($result['code']==0 && $result['ret']==0) {
|
||||
$data['code']=0;
|
||||
$data['ret']=0;
|
||||
$data['msg']='fail';
|
||||
$data['result']='转账失败 ['.$result['sub_code'].']'.$result['sub_msg'];
|
||||
$DB->exec("update `pre_settle` set `transfer_status`='2',`transfer_result`='".$data['result']."' where `id`='$id'");
|
||||
if($result["sub_code"]=='OPENID_ERROR' || $result["sub_code"]=='NAME_MISMATCH' || $result["sub_code"]=='V2_ACCOUNT_SIMPLE_BAN'){
|
||||
$DB->exec("update `pre_settle` set `status`='3',`result`='".$result["sub_msg"]."' where `id`='$id'");
|
||||
}
|
||||
} else {
|
||||
$data['code']=-1;
|
||||
$data['msg']=$result['msg'];
|
||||
}
|
||||
echo json_encode($data);
|
||||
76
admin/ulist-table.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
/**
|
||||
* 商户列表
|
||||
**/
|
||||
include("../includes/common.php");
|
||||
if($islogin==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
|
||||
|
||||
$usergroup = [0=>'默认用户组'];
|
||||
$rs = $DB->getAll("SELECT * FROM pre_group");
|
||||
foreach($rs as $row){
|
||||
$usergroup[$row['gid']] = $row['name'];
|
||||
}
|
||||
unset($rs);
|
||||
|
||||
if(isset($_GET['value']) && !empty($_GET['value'])) {
|
||||
$sql=" `{$_GET['column']}`='{$_GET['value']}'";
|
||||
$numrows=$DB->getColumn("SELECT count(*) from pre_user WHERE{$sql}");
|
||||
$con='包含 '.$_GET['value'].' 的共有 <b>'.$numrows.'</b> 个商户';
|
||||
$link='&my=search&column='.$_GET['column'].'&value='.$_GET['value'];
|
||||
}else{
|
||||
$numrows=$DB->getColumn("SELECT count(*) from pre_user WHERE 1");
|
||||
$sql=" 1";
|
||||
$con='共有 <b>'.$numrows.'</b> 个商户';
|
||||
}
|
||||
?>
|
||||
<div class="table-responsive">
|
||||
<?php echo $con?>
|
||||
<table class="table table-striped table-bordered table-vcenter">
|
||||
<thead><tr><th>商户号/用户组</th><th>余额</th><th>结算账号/姓名</th><th>联系方式</th><th>域名/添加时间</th><th>状态</th><th>操作</th></tr></thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$pagesize=30;
|
||||
$pages=ceil($numrows/$pagesize);
|
||||
$page=isset($_GET['page'])?intval($_GET['page']):1;
|
||||
$offset=$pagesize*($page - 1);
|
||||
|
||||
$rs=$DB->query("SELECT * FROM pre_user WHERE{$sql} order by uid desc limit $offset,$pagesize");
|
||||
while($res = $rs->fetch())
|
||||
{
|
||||
echo '<tr><td><b>'.$res['uid'].'</b>[<a href="javascript:showKey('.$res['uid'].',\''.$res['key'].'\')">查看密钥</a>]<br/><span onclick="editGroup('.$res['uid'].','.$res['gid'].')" style="color:blue">'.$usergroup[$res['gid']].'</span></td><td class="money"><b><a href="javascript:showRecharge('.$res['uid'].')">'.$res['money'].'</a></b></td><td><span onclick="inputInfo('.$res['uid'].')">'.($res['settle_id']==2?'<font color="green">WX:</font>':null).($res['settle_id']==3?'<font color="green">QQ:</font>':null).$res['account'].'<br/>'.$res['username'].'</span></td><td>QQ:<a href="tencent://message/?uin='.$res['qq'].'&Site=Epay&Menu=yes">'.$res['qq'].'</a><br/>'.($res['phone']?$res['phone']:$res['email']).'</td><td>'.$res['url'].'<br/>'.$res['addtime'].'</td><td>'.($res['status']==1?'<a href="javascript:setStatus('.$res['uid'].',\'user\',0)"><font color=green><i class="fa fa-check-circle"></i>正常</font></a>':'<a href="javascript:setStatus('.$res['uid'].',\'user\',1)"><font color=red><i class="fa fa-times-circle"></i>封禁</font></a>').' '.($res['cert']==1?'<a href="javascript:showCert('.$res['uid'].')" title="查看实名认证信息"><font color=green><i class="fa fa-check-circle-o"></i>已实名</font></a>':'<a href="javascript:showCert('.$res['uid'].')" title="查看实名认证信息"><font color=grey><i class="fa fa-times-circle"></i>未实名</font></a>').'<br/>'.($res['pay']==1?'<a href="javascript:setStatus('.$res['uid'].',\'pay\',0)"><font color=green><i class="fa fa-check-circle"></i>支付</font></a>':'<a href="javascript:setStatus('.$res['uid'].',\'pay\',1)"><font color=red><i class="fa fa-times-circle"></i>支付</font></a>').' '.($res['settle']==1?'<a href="javascript:setStatus('.$res['uid'].',\'settle\',0)"><font color=green><i class="fa fa-check-circle"></i>结算</font></a>':'<a href="javascript:setStatus('.$res['uid'].',\'settle\',1)"><font color=red><i class="fa fa-times-circle"></i>结算</font></a>').'</td><td><a href="./uset.php?my=edit&uid='.$res['uid'].'" class="btn btn-xs btn-info">编辑</a> <a href="./sso.php?uid='.$res['uid'].'" target="_blank" class="btn btn-xs btn-success">登录</a> <a href="./uset.php?my=delete&uid='.$res['uid'].'" class="btn btn-xs btn-danger" onclick="return confirm(\'你确实要删除此商户吗?\');">删除</a><br/><a href="./order.php?uid='.$res['uid'].'" target="_blank" class="btn btn-xs btn-default">订单</a> <a href="./slist.php?column=uid&value='.$res['uid'].'" target="_blank" class="btn btn-xs btn-default">结算</a> <a href="./record.php?column=uid&value='.$res['uid'].'" target="_blank" class="btn btn-xs btn-default">明细</a></td></tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php
|
||||
echo'<div class="text-center"><ul class="pagination">';
|
||||
$first=1;
|
||||
$prev=$page-1;
|
||||
$next=$page+1;
|
||||
$last=$pages;
|
||||
if ($page>1)
|
||||
{
|
||||
echo '<li><a href="javascript:void(0)" onclick="listTable(\'page='.$first.$link.'\')">首页</a></li>';
|
||||
echo '<li><a href="javascript:void(0)" onclick="listTable(\'page='.$prev.$link.'\')">«</a></li>';
|
||||
} else {
|
||||
echo '<li class="disabled"><a>首页</a></li>';
|
||||
echo '<li class="disabled"><a>«</a></li>';
|
||||
}
|
||||
$start=$page-10>1?$page-10:1;
|
||||
$end=$page+10<$pages?$page+10:$pages;
|
||||
for ($i=$start;$i<$page;$i++)
|
||||
echo '<li><a href="javascript:void(0)" onclick="listTable(\'page='.$i.$link.'\')">'.$i .'</a></li>';
|
||||
echo '<li class="disabled"><a>'.$page.'</a></li>';
|
||||
for ($i=$page+1;$i<=$end;$i++)
|
||||
echo '<li><a href="javascript:void(0)" onclick="listTable(\'page='.$i.$link.'\')">'.$i .'</a></li>';
|
||||
if ($page<$pages)
|
||||
{
|
||||
echo '<li><a href="javascript:void(0)" onclick="listTable(\'page='.$next.$link.'\')">»</a></li>';
|
||||
echo '<li><a href="javascript:void(0)" onclick="listTable(\'page='.$last.$link.'\')">尾页</a></li>';
|
||||
} else {
|
||||
echo '<li class="disabled"><a>»</a></li>';
|
||||
echo '<li class="disabled"><a>尾页</a></li>';
|
||||
}
|
||||
echo'</ul></div>';
|
||||
329
admin/ulist.php
Normal file
@@ -0,0 +1,329 @@
|
||||
<?php
|
||||
/**
|
||||
* 商户列表
|
||||
**/
|
||||
include("../includes/common.php");
|
||||
$title='商户列表';
|
||||
include './head.php';
|
||||
if($islogin==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
|
||||
$select = '';
|
||||
$rs = $DB->getAll("SELECT * FROM pre_group");
|
||||
foreach($rs as $row){
|
||||
$select .= '<option value="'.$row['gid'].'">'.$row['name'].'</option>';
|
||||
}
|
||||
unset($rs);
|
||||
?>
|
||||
<style>
|
||||
#orderItem .orderTitle{word-break:keep-all;}
|
||||
#orderItem .orderContent{word-break:break-all;}
|
||||
.form-inline .form-control {
|
||||
display: inline-block;
|
||||
width: auto;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.form-inline .form-group {
|
||||
display: inline-block;
|
||||
margin-bottom: 0;
|
||||
vertical-align: middle;
|
||||
}
|
||||
</style>
|
||||
<div class="container" style="padding-top:70px;">
|
||||
<div class="col-md-12 center-block" style="float: none;">
|
||||
<div class="modal" id="modal-rmb">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<h4 class="modal-title">余额充值与扣除</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="form-rmb" onsubmit="return false;">
|
||||
<input type="hidden" name="uid" value="">
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon p-0">
|
||||
<select name="do"
|
||||
style="-webkit-border-radius: 0;height:20px;border: 0;outline: none !important;border-radius: 5px 0 0 5px;padding: 0 5px 0 5px;">
|
||||
<option value="0">充值</option>
|
||||
<option value="1">扣除</option>
|
||||
</select>
|
||||
</span>
|
||||
<input type="number" class="form-control" name="rmb" placeholder="输入金额">
|
||||
<span class="input-group-addon">元</span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-outline-info" data-dismiss="modal">取消</button>
|
||||
<button type="button" class="btn btn-primary" id="recharge">确定</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<form onsubmit="return searchUser()" method="GET" class="form-inline">
|
||||
<div class="form-group">
|
||||
<label>搜索</label>
|
||||
<select name="column" class="form-control"><option value="uid">商户号</option><option value="key">密钥</option><option value="account">结算账号</option><option value="username">结算姓名</option><option value="url">域名</option><option value="qq">QQ</option><option value="phone">手机号码</option><option value="email">邮箱</option></select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" name="value" placeholder="搜索内容">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">搜索</button> <a href="./uset.php?my=add" class="btn btn-success">添加商户</a>
|
||||
<a href="javascript:listTable('start')" class="btn btn-default" title="刷新订单列表"><i class="fa fa-refresh"></i></a>
|
||||
</form>
|
||||
|
||||
<div id="listTable"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="//cdn.staticfile.org/layer/2.3/layer.js"></script>
|
||||
<script src="//cdn.staticfile.org/clipboard.js/1.7.1/clipboard.min.js"></script>
|
||||
<script>
|
||||
function listTable(query){
|
||||
var url = window.document.location.href.toString();
|
||||
var queryString = url.split("?")[1];
|
||||
query = query || queryString;
|
||||
if(query == 'start' || query == undefined){
|
||||
query = '';
|
||||
history.replaceState({}, null, './ulist.php');
|
||||
}else if(query != undefined){
|
||||
history.replaceState({}, null, './ulist.php?'+query);
|
||||
}
|
||||
layer.closeAll();
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'GET',
|
||||
url : 'ulist-table.php?'+query,
|
||||
dataType : 'html',
|
||||
cache : false,
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
$("#listTable").html(data)
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
function searchUser(){
|
||||
var column=$("select[name='column']").val();
|
||||
var value=$("input[name='value']").val();
|
||||
if(value==''){
|
||||
listTable();
|
||||
}else{
|
||||
listTable('column='+column+'&value='+value);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function showKey(uid,key){
|
||||
var clipboard;
|
||||
var confirmobj = layer.confirm(key+'<input type="hidden" id="copyContent" value="'+key+'"/>', {
|
||||
title:'查看密钥',shadeClose:true,btn: ['复制','重置','关闭'], success: function(){
|
||||
clipboard = new Clipboard('.layui-layer-btn0',{text: function() {return key;}});
|
||||
clipboard.on('success', function (e) {
|
||||
alert('复制成功!');
|
||||
});
|
||||
clipboard.on('error', function (e) {
|
||||
alert('复制失败,请长按链接后手动复制');
|
||||
});
|
||||
}
|
||||
,end: function(){
|
||||
clipboard.destroy();
|
||||
}
|
||||
}, function(){
|
||||
}, function(){
|
||||
$.ajax({
|
||||
type : 'GET',
|
||||
url : 'ajax.php?act=resetUser&uid='+uid,
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
if(data.code == 0){
|
||||
alert('重置密钥成功!');
|
||||
showKey(uid,data.key);
|
||||
}else{
|
||||
layer.alert(data.msg, {icon:2});
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}, function(){
|
||||
layer.close(confirmobj);
|
||||
});
|
||||
}
|
||||
function setStatus(uid,type,status) {
|
||||
$.ajax({
|
||||
type : 'GET',
|
||||
url : 'ajax.php?act=setUser&uid='+uid+'&type='+type+'&status='+status,
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
if(data.code == 0){
|
||||
listTable();
|
||||
}else{
|
||||
layer.msg(data.msg, {icon:2, time:1500});
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
function editGroup(uid, gid){
|
||||
layer.open({
|
||||
type: 1,
|
||||
shadeClose: true,
|
||||
title: '修改用户组',
|
||||
content: '<div class="modal-body"><form class="form" id="form-info"><div class="form-group"><select class="form-control" id="gid"><?php echo $select?></select><button type="button" id="save" onclick="saveGroup('+uid+')" class="btn btn-primary btn-block">保存</button></div></form></div>',
|
||||
success: function(){
|
||||
$("#gid").val(gid)
|
||||
}
|
||||
});
|
||||
}
|
||||
function saveGroup(uid){
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
var gid = $("#gid").val();
|
||||
$.ajax({
|
||||
type : 'GET',
|
||||
url : 'ajax.php?act=setUser&uid='+uid+'&type=group&status='+gid,
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
layer.alert(data.msg,{
|
||||
icon: 1,
|
||||
closeBtn: false
|
||||
});
|
||||
listTable();
|
||||
}else{
|
||||
layer.alert(data.msg, {icon: 2})
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
function showRecharge(uid) {
|
||||
$("input[name='uid']").val(uid);
|
||||
$('#modal-rmb').modal('show');
|
||||
}
|
||||
function inputInfo(uid) {
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'GET',
|
||||
url : 'ajax.php?act=user_settle_info&uid='+uid,
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: '修改数据',
|
||||
skin: 'layui-layer-rim',
|
||||
content: data.data,
|
||||
success: function(){
|
||||
$("#pay_type").val(data.pay_type);
|
||||
}
|
||||
});
|
||||
}else{
|
||||
layer.alert(data.msg);
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
function saveInfo(uid) {
|
||||
var pay_type=$("#pay_type").val();
|
||||
var pay_account=$("#pay_account").val();
|
||||
var pay_name=$("#pay_name").val();
|
||||
if(pay_account=='' || pay_name==''){layer.alert('请确保每项不能为空!');return false;}
|
||||
$('#save').val('Loading');
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
url : "ajax.php?act=user_settle_save",
|
||||
data : {uid:uid,pay_type:pay_type,pay_account:pay_account,pay_name:pay_name},
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
layer.msg('保存成功!');
|
||||
listTable();
|
||||
}else{
|
||||
layer.alert(data.msg);
|
||||
}
|
||||
$('#save').val('保存');
|
||||
}
|
||||
});
|
||||
}
|
||||
function showCert(uid) {
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'GET',
|
||||
url : 'ajax.php?act=user_cert&uid='+uid,
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
var item = '<table class="table table-condensed table-hover">';
|
||||
item += '<tr><td class="info">认证途径</td><td colspan="5">'+(data.cert==1?'支付宝快捷认证':'未实名认证')+'</td></tr><tr><td class="info">真实姓名</td><td colspan="5">'+data.certname+'</td></tr><tr><td class="info">身份证号</td><td colspan="5">'+data.certno+'</td></tr><tr><td class="info">认证时间</td><td colspan="5">'+data.certtime+'</td></tr>';
|
||||
item += '</table>';
|
||||
layer.open({
|
||||
type: 1,
|
||||
shadeClose: true,
|
||||
title: '查看实名认证信息',
|
||||
skin: 'layui-layer-rim',
|
||||
content: item
|
||||
});
|
||||
}else{
|
||||
layer.alert(data.msg);
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
$(document).ready(function(){
|
||||
$("#recharge").click(function(){
|
||||
var uid=$("input[name='uid']").val();
|
||||
var actdo=$("select[name='do']").val();
|
||||
var rmb=$("input[name='rmb']").val();
|
||||
if(rmb==''){layer.alert('请输入金额');return false;}
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
url : "ajax.php?act=recharge",
|
||||
data : {uid:uid,actdo:actdo,rmb:rmb},
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
layer.msg('修改余额成功');
|
||||
$('#modal-rmb').modal('hide');
|
||||
listTable();
|
||||
}else{
|
||||
layer.alert(data.msg);
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
listTable();
|
||||
})
|
||||
</script>
|
||||
267
admin/uset.php
Normal file
@@ -0,0 +1,267 @@
|
||||
<?php
|
||||
/**
|
||||
* 商户信息
|
||||
**/
|
||||
include("../includes/common.php");
|
||||
$title='商户信息';
|
||||
include './head.php';
|
||||
if($islogin==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
?>
|
||||
<div class="container" style="padding-top:70px;">
|
||||
<div class="col-xs-12 col-sm-10 col-lg-8 center-block" style="float: none;">
|
||||
<?php
|
||||
|
||||
$usergroup = [];
|
||||
$select = '';
|
||||
$rs = $DB->getAll("SELECT * FROM pre_group");
|
||||
foreach($rs as $row){
|
||||
$usergroup[$row['gid']] = $row['name'];
|
||||
$select.='<option value="'.$row['gid'].'">'.$row['name'].'</option>';
|
||||
}
|
||||
unset($rs);
|
||||
|
||||
$my=isset($_GET['my'])?$_GET['my']:null;
|
||||
|
||||
if($my=='add')
|
||||
{
|
||||
echo '<div class="panel panel-primary">
|
||||
<div class="panel-heading"><h3 class="panel-title">添加商户</h3></div>';
|
||||
echo '<div class="panel-body">';
|
||||
echo '<form action="./uset.php?my=add_submit" method="POST">
|
||||
<div class="form-group">
|
||||
<label>结算方式:</label><br><select class="form-control" name="settle_id">
|
||||
'.($conf['settle_alipay']?'<option value="1">支付宝</option>':null).'
|
||||
'.($conf['settle_wxpay']?'<option value="2">微信</option>':null).'
|
||||
'.($conf['settle_qqpay']?'<option value="3">QQ钱包</option>':null).'
|
||||
'.($conf['settle_bank']?'<option value="4">银行卡</option>':null).'
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>结算账号:</label><br>
|
||||
<input type="text" class="form-control" name="account" value="" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>结算账号姓名:</label><br>
|
||||
<input type="text" class="form-control" name="username" value="" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>手机号(登录账号):</label><br>
|
||||
<input type="text" class="form-control" name="phone" value="" placeholder="可留空">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>邮箱(登录账号):</label><br>
|
||||
<input type="text" class="form-control" name="email" value="" placeholder="可留空">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>登录密码:</label><br>
|
||||
<input type="text" class="form-control" name="pwd" value="" placeholder="留空则只能使用密钥登录">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>QQ:</label><br>
|
||||
<input type="text" class="form-control" name="qq" value="" placeholder="可留空">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>网站域名:</label><br>
|
||||
<input type="text" class="form-control" name="url" value="" placeholder="可留空">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>用户组:</label><br>
|
||||
<select class="form-control" name="gid">'.$select.'</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>真实姓名:</label><br>
|
||||
<input type="text" class="form-control" name="certname" value="" placeholder="可留空">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>身份证号:</label><br>
|
||||
<input type="text" class="form-control" name="certno" value="" placeholder="可留空" maxlength="18">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>是否实名认证:</label><br><select class="form-control" name="cert"><option value="0">0_未实名</option><option value="1">1_已实名</option></select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>手续费扣除模式:</label><br><select class="form-control" name="mode"><option value="0">余额扣费</option><option value="1">订单加费</option></select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>支付权限:</label><br><select class="form-control" name="pay"><option value="1">1_开启</option><option value="0">0_关闭</option></select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>结算权限:</label><br><select class="form-control" name="settle"><option value="1">1_开启</option><option value="0">0_关闭</option></select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>商户状态:</label><br><select class="form-control" name="status"><option value="1">1_正常</option><option value="0">0_封禁</option></select>
|
||||
</div>
|
||||
<input type="submit" class="btn btn-primary btn-block"
|
||||
value="确定添加"></form>';
|
||||
echo '<br/><a href="./ulist.php">>>返回商户列表</a>';
|
||||
echo '</div></div>';
|
||||
}
|
||||
elseif($my=='edit')
|
||||
{
|
||||
$uid=intval($_GET['uid']);
|
||||
$row=$DB->getRow("select * from pre_user where uid='$uid' limit 1");
|
||||
if(!$row)showmsg('该商户不存在',4);
|
||||
echo '<div class="panel panel-primary">
|
||||
<div class="panel-heading"><h3 class="panel-title">修改商户信息</h3></div>';
|
||||
echo '<div class="panel-body">';
|
||||
echo '<form action="./uset.php?my=edit_submit&uid='.$uid.'" method="POST">
|
||||
<div class="form-group">
|
||||
<label>结算方式:</label><br><select class="form-control" name="settle_id" default="'.$row['settle_id'].'">
|
||||
'.($conf['settle_alipay']?'<option value="1">支付宝</option>':null).'
|
||||
'.($conf['settle_wxpay']?'<option value="2">微信</option>':null).'
|
||||
'.($conf['settle_qqpay']?'<option value="3">QQ钱包</option>':null).'
|
||||
'.($conf['settle_bank']?'<option value="4">银行卡</option>':null).'
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>结算账号:</label><br>
|
||||
<input type="text" class="form-control" name="account" value="'.$row['account'].'" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>结算账号姓名:</label><br>
|
||||
<input type="text" class="form-control" name="username" value="'.$row['username'].'" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>商户余额:</label><br>
|
||||
<input type="text" class="form-control" name="money" value="'.$row['money'].'" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>手机号(登录账号):</label><br>
|
||||
<input type="text" class="form-control" name="phone" value="'.$row['phone'].'" placeholder="可留空">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>邮箱(登录账号):</label><br>
|
||||
<input type="text" class="form-control" name="email" value="'.$row['email'].'" placeholder="可留空">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>QQ:</label><br>
|
||||
<input type="text" class="form-control" name="qq" value="'.$row['qq'].'" placeholder="可留空">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>网站域名:</label><br>
|
||||
<input type="text" class="form-control" name="url" value="'.$row['url'].'" placeholder="可留空">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>用户组:</label><br>
|
||||
<select class="form-control" name="gid" default="'.$row['gid'].'">'.$select.'</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>真实姓名:</label><br>
|
||||
<input type="text" class="form-control" name="certname" value="'.$row['certname'].'" placeholder="可留空">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>身份证号:</label><br>
|
||||
<input type="text" class="form-control" name="certno" value="'.$row['certno'].'" placeholder="可留空" maxlength="18">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>是否实名认证:</label><br><select class="form-control" name="cert" default="'.$row['cert'].'"><option value="0">0_未实名</option><option value="1">1_已实名</option></select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>手续费扣除模式:</label><br><select class="form-control" name="mode" default="'.$row['mode'].'"><option value="0">余额扣费</option><option value="1">订单加费</option></select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>支付权限:</label><br><select class="form-control" name="pay" default="'.$row['pay'].'"><option value="1">1_开启</option><option value="0">0_关闭</option></select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>结算权限:</label><br><select class="form-control" name="settle" default="'.$row['settle'].'"><option value="1">1_开启</option><option value="0">0_关闭</option></select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>商户状态:</label><br><select class="form-control" name="status" default="'.$row['status'].'"><option value="1">1_正常</option><option value="0">0_封禁</option></select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>重置登录密码:</label><br>
|
||||
<input type="text" class="form-control" name="pwd" value="" placeholder="不重置密码请留空">
|
||||
</div>
|
||||
<input type="submit" class="btn btn-primary btn-block" value="确定修改"></form>
|
||||
';
|
||||
echo '<br/><a href="./ulist.php">>>返回商户列表</a>';
|
||||
echo '</div></div>
|
||||
<script>
|
||||
var items = $("select[default]");
|
||||
for (i = 0; i < items.length; i++) {
|
||||
$(items[i]).val($(items[i]).attr("default")||0);
|
||||
}
|
||||
</script>';
|
||||
}
|
||||
elseif($my=='add_submit')
|
||||
{
|
||||
$gid=$_POST['gid'];
|
||||
$settle_id=$_POST['settle_id'];
|
||||
$account=$_POST['account'];
|
||||
$username=$_POST['username'];
|
||||
$money='0.00';
|
||||
$url=$_POST['url'];
|
||||
$email=$_POST['email'];
|
||||
$qq=$_POST['qq'];
|
||||
$phone=$_POST['phone'];
|
||||
$certno=$_POST['certno'];
|
||||
$certname=$_POST['certname'];
|
||||
$cert=$_POST['cert'];
|
||||
$mode=$_POST['mode'];
|
||||
$pay=$_POST['pay'];
|
||||
$settle=$_POST['settle'];
|
||||
$status=$_POST['status'];
|
||||
if($account==NULL or $username==NULL){
|
||||
showmsg('保存错误,请确保加*项都不为空!',3);
|
||||
} else {
|
||||
$key = random(32);
|
||||
$sds=$DB->exec("INSERT INTO `pre_user` (`gid`, `key`, `account`, `username`, `money`, `url`, `addtime`, `settle_id`, `phone`, `email`, `qq`, `certno`, `certname`, `cert`, `mode`, `pay`, `settle`, `status`) VALUES ('{$gid}', '{$key}', '{$account}', '{$username}', '{$money}', '{$url}', '{$date}', '{$settle_id}', '{$phone}', '{$email}', '{$qq}', '{$certno}', '{$certname}', '{$cert}', '{$mode}', '{$pay}', '{$settle}', '{$status}')");
|
||||
$uid=$DB->lastInsertId();
|
||||
if($sds){
|
||||
if(!empty($_POST['pwd'])){
|
||||
$pwd = getMd5Pwd(trim($_POST['pwd']), $uid);
|
||||
$DB->exec("update `pre_user` set `pwd` ='{$pwd}' where `uid`='$uid'");
|
||||
}
|
||||
showmsg('添加商户成功!商户ID:'.$uid.'<br/>密钥:'.$key.'<br/><br/><a href="./ulist.php">>>返回商户列表</a>',1);
|
||||
}else
|
||||
showmsg('添加商户失败!<br/>错误信息:'.$DB->error(),4);
|
||||
}
|
||||
}
|
||||
elseif($my=='edit_submit')
|
||||
{
|
||||
$uid=$_GET['uid'];
|
||||
$rows=$DB->getRow("select * from pre_user where uid='$uid' limit 1");
|
||||
if(!$rows)
|
||||
showmsg('当前商户不存在!',3);
|
||||
$gid=$_POST['gid'];
|
||||
$settle_id=$_POST['settle_id'];
|
||||
$account=$_POST['account'];
|
||||
$username=$_POST['username'];
|
||||
$money=$_POST['money'];
|
||||
$url=$_POST['url'];
|
||||
$email=$_POST['email'];
|
||||
$qq=$_POST['qq'];
|
||||
$phone=$_POST['phone'];
|
||||
$certno=$_POST['certno'];
|
||||
$certname=$_POST['certname'];
|
||||
$cert=$_POST['cert'];
|
||||
$mode=$_POST['mode'];
|
||||
$pay=$_POST['pay'];
|
||||
$settle=$_POST['settle'];
|
||||
$status=$_POST['status'];
|
||||
if($account==NULL or $username==NULL){
|
||||
showmsg('保存错误,请确保加*项都不为空!',3);
|
||||
} else {
|
||||
$sql="update `pre_user` set `gid` ='$gid',`account` ='{$account}',`username` ='{$username}',`settle_id` ='$settle_id',`money` ='{$money}',`url` ='{$url}',`email` ='$email',`qq` ='$qq',`phone` ='$phone',`certno` ='$certno',`certname` ='$certname',`cert` ='$cert',`mode` ='$mode',`pay` ='$pay',`settle` ='$settle',`status` ='$status' where `uid`='$uid'";
|
||||
if(!empty($_POST['pwd'])){
|
||||
$pwd = getMd5Pwd(trim($_POST['pwd']), $uid);
|
||||
$sqs=$DB->exec("update `pre_user` set `pwd` ='{$pwd}' where `uid`='$uid'");
|
||||
}
|
||||
if($DB->exec($sql)!==false||$sqs)
|
||||
showmsg('修改商户信息成功!<br/><br/><a href="./ulist.php">>>返回商户列表</a>',1);
|
||||
else
|
||||
showmsg('修改商户信息失败!'.$DB->error(),4);
|
||||
}
|
||||
}
|
||||
elseif($my=='delete')
|
||||
{
|
||||
$uid=$_GET['uid'];
|
||||
$sql="DELETE FROM pre_user WHERE uid='$uid'";
|
||||
if($DB->exec($sql))
|
||||
exit("<script language='javascript'>alert('删除商户成功!');history.go(-1);</script>");
|
||||
else
|
||||
exit("<script language='javascript'>alert(''删除商户失败!".$DB->error()."');history.go(-1);</script>");
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
168
api.php
Normal file
@@ -0,0 +1,168 @@
|
||||
<?php
|
||||
$nosession = true;
|
||||
require './includes/common.php';
|
||||
$act=isset($_GET['act'])?daddslashes($_GET['act']):null;
|
||||
$url=daddslashes($_GET['url']);
|
||||
$authcode=daddslashes($_GET['authcode']);
|
||||
|
||||
|
||||
if($act=='apply')
|
||||
{
|
||||
$pid=intval($_GET['pid']);
|
||||
$key=daddslashes($_GET['key']);
|
||||
$row=$DB->getRow("SELECT * FROM pre_user WHERE uid='{$pid}' limit 1");
|
||||
if($row && $row['status']==1 && $row['apply']==1){
|
||||
$type=0;
|
||||
$key = random(32);
|
||||
$sds=$DB->exec("INSERT INTO `pre_user` (`key`, `url`, `addtime`, `pay`, `settle`, `status`, `upuid`) VALUES ('{$key}', '{$url}', '{$date}', '1', '1', '1', '{$row['uid']}')");
|
||||
$pid=$DB->lastInsertId();
|
||||
|
||||
if($sds){
|
||||
$result=array("code"=>1,"msg"=>"添加支付商户成功!","pid"=>$pid,"key"=>$key,"type"=>$type);
|
||||
}else{
|
||||
$result=array("code"=>-1,"msg"=>"添加支付商户失败!");
|
||||
}
|
||||
}else{
|
||||
$result=array("code"=>-1,"msg"=>"当前商户没有权限");
|
||||
}
|
||||
}
|
||||
elseif($act=='query')
|
||||
{
|
||||
$pid=intval($_GET['pid']);
|
||||
$key=daddslashes($_GET['key']);
|
||||
$row=$DB->getRow("SELECT * FROM pre_user WHERE uid='{$pid}' limit 1");
|
||||
if($row){
|
||||
if($key==$row['key']){
|
||||
$orders=$DB->getColumn("SELECT count(*) from pre_order WHERE uid={$pid}");
|
||||
|
||||
$lastday=date("Y-m-d",strtotime("-1 day")).' 00:00:00';
|
||||
$today=date("Y-m-d").' 00:00:00';
|
||||
$order_today=$DB->query("SELECT sum(money) from pre_order where uid={$pid} and status=1 and endtime>='$today'")->fetchColumn();
|
||||
|
||||
$order_lastday=$DB->query("SELECT sum(money) from pre_order where uid={$pid} and status=1 and endtime>='$lastday' and endtime<'$today'")->fetchColumn();
|
||||
|
||||
//$settle_money=$DB->query("SELECT sum(money) from pre_settle where uid={$pid} and status=1")->fetchColumn();
|
||||
|
||||
$result=array("code"=>1,"pid"=>$pid,"key"=>$key,"type"=>$row['settle_id'],"active"=>$row['status'],"money"=>$row['money'],"account"=>$row['account'],"username"=>$row['username'],"settle_money"=>$conf['settle_money'],"settle_fee"=>$conf['settle_fee'],"money_rate"=>$conf['money_rate'],"orders"=>$orders,"order_today"=>$order_today,"order_lastday"=>$order_lastday);
|
||||
}else{
|
||||
$result=array("code"=>-2,"msg"=>"KEY校验失败");
|
||||
}
|
||||
}else{
|
||||
$result=array("code"=>-3,"msg"=>"PID不存在");
|
||||
}
|
||||
}
|
||||
elseif($act=='change')
|
||||
{
|
||||
$pid=intval($_GET['pid']);
|
||||
$key=daddslashes($_GET['key']);
|
||||
$stype=daddslashes($_GET['type']);
|
||||
$account=daddslashes($_GET['account']);
|
||||
$username=daddslashes($_GET['username']);
|
||||
$row=$DB->query("SELECT * FROM pre_user WHERE uid='{$pid}' limit 1")->fetch();
|
||||
if($row){
|
||||
if($key==$row['key']){
|
||||
if($account==null || $username==null){
|
||||
$result=array("code"=>-1,"msg"=>"保存错误,请确保每项都不为空!");
|
||||
}elseif($row['settle']!=2 && !empty($row['account']) && !empty($row['username']) && $row['account']!=$account){
|
||||
$result=array("code"=>-1,"msg"=>"为保障您的资金安全,暂不支持直接修改结算账号信息,如需修改请进入商户中心".$siteurl);
|
||||
}else{
|
||||
$sds=$DB->exec("update `pre_user` set `account`='{$account}',`username`='{$username}',`settle_id`='{$stype}',`url`='{$url}' where uid='{$pid}' limit 1");
|
||||
if($sds>=0){
|
||||
$result=array("code"=>1,"msg"=>"修改收款账号成功!","pid"=>$pid,"key"=>$key,"type"=>$type);
|
||||
}else{
|
||||
$result=array("code"=>-1,"msg"=>"修改收款账号失败!");
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$result=array("code"=>-2,"msg"=>"KEY校验失败");
|
||||
}
|
||||
}else{
|
||||
$result=array("code"=>-3,"msg"=>"PID不存在");
|
||||
}
|
||||
}
|
||||
elseif($act=='settle')
|
||||
{
|
||||
$pid=intval($_GET['pid']);
|
||||
$key=daddslashes($_GET['key']);
|
||||
$limit=$_GET['limit']?intval($_GET['limit']):10;
|
||||
if($limit>50)$limit=50;
|
||||
$row=$DB->query("SELECT * FROM pre_user WHERE uid='{$pid}' limit 1")->fetch();
|
||||
if($row){
|
||||
if($key==$row['key']){
|
||||
$rs=$DB->query("SELECT * FROM pre_settle WHERE uid='{$pid}' order by id desc limit {$limit}");
|
||||
while($row=$rs->fetch()){
|
||||
$data[]=$row;
|
||||
}
|
||||
if($rs){
|
||||
$result=array("code"=>1,"msg"=>"查询结算记录成功!","pid"=>$pid,"key"=>$key,"type"=>$type,"data"=>$data);
|
||||
}else{
|
||||
$result=array("code"=>-1,"msg"=>"查询结算记录失败!");
|
||||
}
|
||||
}else{
|
||||
$result=array("code"=>-2,"msg"=>"KEY校验失败");
|
||||
}
|
||||
}else{
|
||||
$result=array("code"=>-3,"msg"=>"PID不存在");
|
||||
}
|
||||
}
|
||||
elseif($act=='order')
|
||||
{
|
||||
$pid=intval($_GET['pid']);
|
||||
$key=daddslashes($_GET['key']);
|
||||
$row=$DB->query("SELECT * FROM pre_user WHERE uid='{$pid}' limit 1")->fetch();
|
||||
if($row){
|
||||
if($key==$row['key']){
|
||||
if(isset($_GET['trade_no'])){
|
||||
$trade_no=daddslashes($_GET['trade_no']);
|
||||
$row=$DB->query("SELECT * FROM pre_order WHERE uid='{$pid}' and trade_no='{$trade_no}' limit 1")->fetch();
|
||||
}elseif(isset($_GET['out_trade_no'])){
|
||||
$out_trade_no=daddslashes($_GET['out_trade_no']);
|
||||
$row=$DB->query("SELECT * FROM pre_order WHERE uid='{$pid}' and out_trade_no='{$out_trade_no}' limit 1")->fetch();
|
||||
}else{
|
||||
exit('{"code":-4,"msg":"参数不完整"}');
|
||||
}
|
||||
if($row){
|
||||
$result=array("code"=>1,"msg"=>"查询订单号成功!","trade_no"=>$row['trade_no'],"out_trade_no"=>$row['out_trade_no'],"type"=>$row['type'],"pid"=>$row['pid'],"addtime"=>$row['addtime'],"endtime"=>$row['endtime'],"name"=>$row['name'],"money"=>$row['money'],"status"=>$row['status']);
|
||||
}else{
|
||||
$result=array("code"=>-1,"msg"=>"订单号不存在");
|
||||
}
|
||||
}else{
|
||||
$result=array("code"=>-2,"msg"=>"KEY校验失败");
|
||||
}
|
||||
}else{
|
||||
$result=array("code"=>-3,"msg"=>"PID不存在");
|
||||
}
|
||||
}
|
||||
elseif($act=='orders')
|
||||
{
|
||||
$pid=intval($_GET['pid']);
|
||||
$key=daddslashes($_GET['key']);
|
||||
$limit=$_GET['limit']?intval($_GET['limit']):10;
|
||||
if($limit>50)$limit=50;
|
||||
$row=$DB->query("SELECT * FROM pre_user WHERE uid='{$pid}' limit 1")->fetch();
|
||||
if($row){
|
||||
if($key==$row['key']){
|
||||
$rs=$DB->query("SELECT * FROM pre_order WHERE uid='{$pid}' order by trade_no desc limit {$limit}");
|
||||
while($row=$rs->fetch()){
|
||||
$data[]=$row;
|
||||
}
|
||||
if($rs){
|
||||
$result=array("code"=>1,"msg"=>"查询订单记录成功!","data"=>$data);
|
||||
}else{
|
||||
$result=array("code"=>-1,"msg"=>"查询订单记录失败!");
|
||||
}
|
||||
}else{
|
||||
$result=array("code"=>-2,"msg"=>"KEY校验失败");
|
||||
}
|
||||
}else{
|
||||
$result=array("code"=>-3,"msg"=>"PID不存在");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$result=array("code"=>-5,"msg"=>"No Act!");
|
||||
}
|
||||
|
||||
echo json_encode($result);
|
||||
|
||||
?>
|
||||
BIN
assets/css/alipay-pay.png
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
1
assets/css/alipay_pay.css
Normal file
@@ -0,0 +1 @@
|
||||
@charset "UTF-8";html{font-size:62.5%;font-family:'helvetica neue',tahoma,arial,'hiragino sans gb','microsoft yahei','Simsun',sans-serif}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote,th,td,hr{margin:0;padding:0}body{line-height:1.333;font-size:12px}h1,h2,h3,h4,h5,h6{font-size:100%;font-family:arial,'hiragino sans gb','microsoft yahei','Simsun',sans-serif}input,textarea,select,button{font-size:12px;font-weight:normal}input[type="button"],input[type="submit"],select,button{cursor:pointer}table{border-collapse:collapse;border-spacing:0}address,caption,cite,code,dfn,em,th,var{font-style:normal;font-weight:normal}li{list-style:none}caption,th{text-align:left}q:before,q:after{content:''}abbr,acronym{border:0;font-variant:normal}sup{vertical-align:text-top}sub{vertical-align:text-bottom}fieldset,img,a img,iframe{border-width:0;border-style:none}img{-ms-interpolation-mode:bicubic}textarea{overflow-y:auto}legend{color:#000}a:link,a:visited{text-decoration:none}hr{height:0}label{cursor:pointer}.clearfix:after{content:"\200B";display:block;height:0;clear:both}.clearfix{*zoom:1}a{color:#328CE5}a:hover{color:#2b8ae8;text-decoration:none}a.hit{color:#C06C6C}a:focus{outline:none}.hit{color:#8DC27E}.txt_auxiliary{color:#A2A2A2}.clear{*zoom:1}.clear:before,.clear:after{content:"";display:table}.clear:after{clear:both}body,.body{background:#f7f7f7;height:100%}.mod-title{height:60px;line-height:60px;text-align:center;border-bottom:1px solid #ddd;background:#fff}.mod-title .ico-wechat{display:inline-block;width:41px;height:36px;background:url("./alipay-pay.png") 0 -115px no-repeat;vertical-align:middle;margin-right:7px}.mod-title .text{font-size:20px;color:#333;font-weight:normal;vertical-align:middle}.mod-ct{width:610px;padding:0 135px;margin:0 auto;margin-top:15px;background:#fff url("./wave.png") top center repeat-x;text-align:center;color:#333;border:1px solid #e5e5e5;border-top:none}.mod-ct .order{font-size:20px;padding-top:30px}.mod-ct .amount{font-size:48px;margin-top:20px}.mod-ct .qr-image{margin-top:30px}.mod-ct .qr-image img{width:230px;height:230px}.mod-ct .detail{margin-top:60px;padding-top:25px}.mod-ct .detail .arrow .ico-arrow{display:inline-block;width:20px;height:11px;background:url("./alipay-pay.png") -25px -100px no-repeat}.mod-ct .detail .detail-ct{display:none;font-size:14px;text-align:right;line-height:28px}.mod-ct .detail .detail-ct dt{float:left}.mod-ct .detail-open{border-top:1px solid #e5e5e5}.mod-ct .detail .arrow{padding:6px 34px;border:1px solid #e5e5e5}.mod-ct .detail .arrow .ico-arrow{display:inline-block;width:20px;height:11px;background:url("./alipay-pay.png") -25px -100px no-repeat}.mod-ct .detail-open .arrow .ico-arrow{display:inline-block;width:20px;height:11px;background:url("./alipay-pay.png") 0 -100px no-repeat}.mod-ct .detail-open .detail-ct{display:block}.mod-ct .tip{margin-top:40px;border-top:1px dashed #e5e5e5;padding:30px 0;position:relative}.mod-ct .tip .ico-scan{display:inline-block;width:56px;height:55px;background:url("./alipay-pay.png") 0 0 no-repeat;vertical-align:middle;*display:inline;*zoom:1}.mod-ct .tip .tip-text{display:inline-block;vertical-align:middle;text-align:left;margin-left:23px;font-size:16px;line-height:28px;*display:inline;*zoom:1}.mod-ct .tip .dec{display:inline-block;width:22px;height:45px;background:url("./alipay-pay.png") 0 -55px no-repeat;position:absolute;top:-23px}.mod-ct .tip .dec-left{background-position:0 -55px;left:-136px}.mod-ct .tip .dec-right{background-position:-25px -55px;right:-136px}.foot{text-align:center;margin:30px auto;color:#888888;font-size:12px;line-height:20px;font-family:"simsun"}.foot .link{color:#0071ce}
|
||||
11
assets/css/bootstrap.min.css
vendored
Normal file
BIN
assets/css/jd-pay.png
Normal file
|
After Width: | Height: | Size: 7.7 KiB |
1
assets/css/jd_pay.css
Normal file
@@ -0,0 +1 @@
|
||||
@charset "UTF-8";html{font-size:62.5%;font-family:'helvetica neue',tahoma,arial,'hiragino sans gb','microsoft yahei','Simsun',sans-serif}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote,th,td,hr{margin:0;padding:0}body{line-height:1.333;font-size:12px}h1,h2,h3,h4,h5,h6{font-size:100%;font-family:arial,'hiragino sans gb','microsoft yahei','Simsun',sans-serif}input,textarea,select,button{font-size:12px;font-weight:normal}input[type="button"],input[type="submit"],select,button{cursor:pointer}table{border-collapse:collapse;border-spacing:0}address,caption,cite,code,dfn,em,th,var{font-style:normal;font-weight:normal}li{list-style:none}caption,th{text-align:left}q:before,q:after{content:''}abbr,acronym{border:0;font-variant:normal}sup{vertical-align:text-top}sub{vertical-align:text-bottom}fieldset,img,a img,iframe{border-width:0;border-style:none}img{-ms-interpolation-mode:bicubic}textarea{overflow-y:auto}legend{color:#000}a:link,a:visited{text-decoration:none}hr{height:0}label{cursor:pointer}.clearfix:after{content:"\200B";display:block;height:0;clear:both}.clearfix{*zoom:1}a{color:#328CE5}a:hover{color:#2b8ae8;text-decoration:none}a.hit{color:#C06C6C}a:focus{outline:none}.hit{color:#8DC27E}.txt_auxiliary{color:#A2A2A2}.clear{*zoom:1}.clear:before,.clear:after{content:"";display:table}.clear:after{clear:both}body,.body{background:#f7f7f7;height:100%}.mod-title{height:60px;line-height:60px;text-align:center;border-bottom:1px solid #ddd;background:#fff}.mod-title .ico-wechat{display:inline-block;width:41px;height:36px;background:url("./jd-pay.png") 0 -115px no-repeat;vertical-align:middle;margin-right:7px}.mod-title .text{font-size:20px;color:#333;font-weight:normal;vertical-align:middle}.mod-ct{width:610px;padding:0 135px;margin:0 auto;margin-top:15px;background:#fff url("./wave.png") top center repeat-x;text-align:center;color:#333;border:1px solid #e5e5e5;border-top:none}.mod-ct .order{font-size:20px;padding-top:30px}.mod-ct .amount{font-size:48px;margin-top:20px}.mod-ct .qr-image{margin-top:30px}.mod-ct .qr-image img{width:230px;height:230px}.mod-ct .detail{margin-top:60px;padding-top:25px}.mod-ct .detail .arrow .ico-arrow{display:inline-block;width:20px;height:11px;background:url("./jd-pay.png") -25px -100px no-repeat}.mod-ct .detail .detail-ct{display:none;font-size:14px;text-align:right;line-height:28px}.mod-ct .detail .detail-ct dt{float:left}.mod-ct .detail-open{border-top:1px solid #e5e5e5}.mod-ct .detail .arrow{padding:6px 34px;border:1px solid #e5e5e5}.mod-ct .detail .arrow .ico-arrow{display:inline-block;width:20px;height:11px;background:url("./jd-pay.png") -25px -100px no-repeat}.mod-ct .detail-open .arrow .ico-arrow{display:inline-block;width:20px;height:11px;background:url("./jd-pay.png") 0 -100px no-repeat}.mod-ct .detail-open .detail-ct{display:block}.mod-ct .tip{margin-top:40px;border-top:1px dashed #e5e5e5;padding:30px 0;position:relative}.mod-ct .tip .ico-scan{display:inline-block;width:56px;height:55px;background:url("./jd-pay.png") 0 0 no-repeat;vertical-align:middle;*display:inline;*zoom:1}.mod-ct .tip .tip-text{display:inline-block;vertical-align:middle;text-align:left;margin-left:23px;font-size:16px;line-height:28px;*display:inline;*zoom:1}.mod-ct .tip .dec{display:inline-block;width:22px;height:45px;background:url("./jd-pay.png") 0 -55px no-repeat;position:absolute;top:-23px}.mod-ct .tip .dec-left{background-position:0 -55px;left:-136px}.mod-ct .tip .dec-right{background-position:-25px -55px;right:-136px}.foot{text-align:center;margin:30px auto;color:#888888;font-size:12px;line-height:20px;font-family:"simsun"}.foot .link{color:#0071ce}
|
||||
235
assets/css/main12.css
Normal file
@@ -0,0 +1,235 @@
|
||||
@charset "utf-8";
|
||||
|
||||
/* 导航 */
|
||||
.navBD12{ border-bottom:1px solid #89c1ed;}
|
||||
.nav12{ height:60px; padding-top:14px;}
|
||||
.nav12-left{ float:left;}
|
||||
.nav12-right{ float:right;}
|
||||
.show-xs{ display:none;}
|
||||
|
||||
/* 订单金额 */
|
||||
.order-amount12{ width:1010px; height:88px; padding:20px 35px; background:#fff; margin-top:35px;}
|
||||
.order-amount12 span{ font-size:16px; color:#434343;}
|
||||
.order-amount12-left{ float:left;}
|
||||
.order-amount12-left span{ line-height:30px;}
|
||||
.order-amount12-right{ float:right; line-height:50px;}
|
||||
.order-amount12-right strong{ font-size:30px; color:#e94832; font-weight:normal;}
|
||||
|
||||
|
||||
|
||||
|
||||
/*支付方式*/
|
||||
.PayMethod12{ width:1010px; padding:35px 35px; background:#fff; margin-top:36px;}
|
||||
.PayMethod12 h2{ font-size:16px; height:30px; line-height:30px; margin-bottom:20px;}
|
||||
.PayMethod12 ul{ overflow:hidden;}
|
||||
.PayMethod12 ul li{ width:120px; height:38px; padding: 20px 0 0 30px; margin-bottom:35px; margin-right:60px; float:left; cursor:pointer; border:1px solid #d8d8d8;}
|
||||
.PayMethod12 ul li.active{ border-color:#1a8ae1;}
|
||||
.PayMethod12 ul li img{ float:left; margin-right:16px; width:20px; height:20px; }
|
||||
.PayMethod12 ul li span{ float:left; position:relative; color:#323232;}
|
||||
.immediate_pay{ display:block;
|
||||
width:165px;
|
||||
height:54px;
|
||||
line-height:54px;
|
||||
background:#1a8ae1;
|
||||
font-size:18px;
|
||||
color:#fff;
|
||||
text-align:center;
|
||||
cursor:pointer;
|
||||
}
|
||||
.immediate_button{ display:block;
|
||||
width:165px;
|
||||
height:54px;
|
||||
line-height:54px;
|
||||
background:#1a8ae1;
|
||||
font-size:18px;
|
||||
color:#fff;
|
||||
text-align:center;
|
||||
cursor:pointer;
|
||||
}
|
||||
/*立即支付*/
|
||||
.immediate-pay12{ height:54px; background:#fff; margin-top:40px;}
|
||||
.immediate-pay12-left{ float:left; line-height:50px; margin-left:35px;}
|
||||
.immediate-pay12-left a { font-size: 18px;color: #1a8ae1;cursor: pointer;}
|
||||
.immediate-pay12-right{ float:right;}
|
||||
.immediate-pay12-right span{ float:left; margin:14px 24px 0 0;}
|
||||
.immediate-pay12-right span strong{ font-size:18px; color:#e94832;}
|
||||
.immediate-pay12-right .immediate_pay{ float:right;}
|
||||
|
||||
/*充值卡*/
|
||||
.card12{ padding:24px 35px; width:1010px; background:#fff; margin-top:36px;}
|
||||
.card12-type{ overflow:hidden; height:74px; border-bottom:1px solid #dedede;}
|
||||
.card12-type li{ width:141px; height:46px; line-height:46px; text-align:center; border:1px solid #dedede; float:left; margin-right:48px; cursor:pointer;}
|
||||
.card12-type li.active{ border-color:#1a8ae1;}
|
||||
.card12-money{ overflow:hidden; margin-top:22px; height:74px; border-bottom:1px solid #dedede;}
|
||||
.card12-money li{ width:76px; height:46px; line-height:46px; text-align:center; border:1px solid #dedede; float:left; margin-right:48px; cursor:pointer;}
|
||||
.card12-money li.active02{ border-color:#1a8ae1;}
|
||||
.card12-tips{ font-size:14px; line-height:50px;}
|
||||
.card12-tips span{ color:#cc2023;}
|
||||
.card12-input{ margin-top:10px;}
|
||||
.card12-input li{ overflow:hidden; margin-bottom:25px;}
|
||||
.card12-input li span{ float:left; font-size:20px; width:80px; line-height:36px;}
|
||||
.card12-input li input{ float:left; width:260px; padding-left:13px; height:36px; line-height:36px; border:1px solid #d8d8d8;}
|
||||
|
||||
/*微信支付*/
|
||||
.wechart-pay12{ padding:35px 318px; width:444px; overflow:hidden;}
|
||||
.wechart-pay12 dl{ float:left;}
|
||||
.wechart-pay12 dl p{ font-size:14px; color:#989898; text-align:center; height:20px}
|
||||
.wechart-pay12-moblie{ float:right; width:170px; margin-top:16px;}
|
||||
.wechart-pay12-moblie img{ width:100%;}
|
||||
|
||||
/* 产品体验首页 */
|
||||
.product_experience12 header{ background:url(../images/indexbg12.jpg) no-repeat; height:282px; padding-top:7rem; background-size:100%;}
|
||||
.product_experience12 .opTit01{ font-size:32px; color:#fff; margin-top:0;}
|
||||
.product_experience12 .Internet_increment_service10{ position:absolute; top:220px; left:50%; margin-left:-540px;}
|
||||
.product_experience12-menu{ height:140px; margin-bottom:70px;}
|
||||
.product_experience12-menu ol li{ height:140px;}
|
||||
.product_experience12-menu ol li dl{ width:245px; margin:0 auto; overflow:hidden;}
|
||||
.product_experience12-menu ol li dl dt{ float:left;}
|
||||
.product_experience12-menu ol li dl dd{ float:right; line-height:140px;}
|
||||
.product_experience12-menu ol li .dt01{ width:50px; height:57px; margin-top:42px; background:url(../images/product_experience12-h5.png) no-repeat;}
|
||||
.product_experience12-menu ol li .dt02{ width:56px; height:49px; margin-top:42px; background:url(../images/product_experience12-pc.png) no-repeat;}
|
||||
.product_experience12-menu ol li .dt03{ width:57px; height:57px; margin-top:42px; background:url(../images/product_experience12-app.png) no-repeat;}
|
||||
.product_experience12-menu ol li.active .dt01{ width:50px; height:57px; background:url(../images/product_experience12-h5color.png) no-repeat;}
|
||||
.product_experience12-menu ol li.active .dt02{ width:56px; height:49px; background:url(../images/product_experience12-pccolor.png) no-repeat;}
|
||||
.product_experience12-menu ol li.active .dt03{ width:57px; height:57px; background:url(../images/product_experience12-appcolor.png) no-repeat;}
|
||||
.product_experience12-menu{ box-shadow:0 5px 4px 1px #ebe9e9;}
|
||||
.product_experience12-menu ol li.active dd{ color:#1a8ae1;}
|
||||
.product_experience12-menu ol li.active{ background-color:transparent;}
|
||||
.product_experience12-main01{ width:625px; margin:0 auto; display:none;}
|
||||
.product_experience12-main01 dl{ overflow:hidden;}
|
||||
.product_experience12-main01 dl dt{ float:left;}
|
||||
.product_experience12-main01 dl dd{ float:right;}
|
||||
.product_experience12-main01 dl dd h2{ font-size:22px; margin-bottom:12px;}
|
||||
.product_experience12-main01 dl dd h3{ font-size:24px;}
|
||||
.product_experience12-main01 dl dd p{ font-size:14px; color:#a1a1a1;}
|
||||
.product_experience12-main01 .immediate_pay{ width:135px; height:42px; line-height:42px; color:#fff;}
|
||||
.product_experience12-main01 .immediate_button{ width:135px; height:42px; line-height:42px;}
|
||||
.product_experience12-main01 .immediate_pay:hover{ color:#fff;}
|
||||
.product_experience12-main01 .immediate_button:hover{ color:#fff;}
|
||||
.product_experience12-main02{ width:710px; text-align:center;}
|
||||
.product_experience12-main02 dl{ width:345px;}
|
||||
.product_experience12-main02 dl.andr{ float:left;}
|
||||
.product_experience12-main02 dl.ios{ float:right;}
|
||||
.product_experience12-main02 dl dt{ float:none;}
|
||||
.product_experience12-main02 dl dd{ float:none; font-size:18px; color:#a1a1a1; line-height:60px;}
|
||||
.product_experience12-main03{ width:320px; margin:0 auto; text-align:center;}
|
||||
.product_experience12-main03 dl dt{ float:none;}
|
||||
.product_experience12-main03 dl dd{ float:none;}
|
||||
|
||||
/*支付成功&&失败*/
|
||||
.paystument12{ padding:25px 360px; width:360px; background:#fff; text-align:center; display:none;}
|
||||
.paystument12 h3{ font-size:18px; margin-top:20px;}
|
||||
.paystument12 h3 span{ font-size:18px;}
|
||||
.paystument12 h3 a{ font-size:18px; color:#e84832;}
|
||||
|
||||
.paystument13{ padding:1px 360px; width:360px; background:#fff; text-align:left; display:none;}
|
||||
.paystument12 h4{ font-size:16px; margin-top:20px;}
|
||||
.paystument12 h4 span{ font-size:16px;}
|
||||
.paystument12 h4 a{ font-size:16px; color:#e84832;}
|
||||
|
||||
.Return_experienceBtn{width:150px;height:45px;line-height:45px; margin:195px auto 270px;font-size:16px;}
|
||||
|
||||
/*弹窗*/
|
||||
.pay_sure12{ width:100%; height:100%; position:fixed; left:0; top:0; z-index:99999; background:rgba(0%,0%,0%,0.3); display:none;}
|
||||
.pay_sure12 .pay_sure12-main{width:400px;
|
||||
height:220px;
|
||||
position:absolute;
|
||||
left:50%;
|
||||
margin-left:-200px;
|
||||
top:15%;
|
||||
background:#fff;
|
||||
box-sizing:border-box;
|
||||
text-align:center;
|
||||
}
|
||||
.pay_sure12-main h2{ height:45px; line-height:45px; margin-bottom:20px; text-align:center; background:#f4f4f4; font-size:18px;}
|
||||
.pay_sure12-main h3,.pay_sure12-main p{ font-size:12px; color:#989898;}
|
||||
.pay_sure12-main .h3-01{ font-size:15px; color:#323232;}
|
||||
.pay_sure12-main h3 strong{ color:#989898;font-size:12px;font-weight:normal;}
|
||||
.pay_sure12-btngroup{ width:250px; margin:20px auto 10px; overflow:hidden;}
|
||||
.pay_sure12-btngroup a.immediate_pay{ float:left;}
|
||||
.pay_sure12-btngroup a.immediate_button{ float:left;}
|
||||
.pay_sure12-btngroup a.immediate_payComplate{ margin-right:50px; width:100px; height:34px; line-height:34px;font-size:13px;}
|
||||
.pay_sure12-btngroup a.immediate_payChange{ background-color:#f4f4f4; color:#323232; width:100px; height:34px; line-height:34px;font-size:13px;}
|
||||
|
||||
/*底部*/
|
||||
.footer12{ text-align:center; color:#cbcbcb; margin-top:50px; margin-bottom:50px;clear:both;}
|
||||
|
||||
|
||||
/*首页弹窗*/
|
||||
.mt_agree{ width:100%; height:100%; position:fixed; left:0; top:0; z-index:99999; background:rgba(0%,0%,0%,0.3); display:none;}
|
||||
.mt_agree .mt_agree_main{width:500px;
|
||||
margin-left:-250px;
|
||||
height:auto;
|
||||
position:absolute;
|
||||
left:50%;
|
||||
top:15%;
|
||||
background:#fff;
|
||||
padding:2%;
|
||||
box-sizing:border-box; }
|
||||
.mt_agree h2{ text-align:center; font-size:20px; line-height:50px; border-bottom:1px solid #0568a4;}
|
||||
.mt_agree p{ font-size:16px; text-align:center; line-height:50px;}
|
||||
.mt_agree a.close_btn{ display:block;
|
||||
width:30%;
|
||||
height:50px;
|
||||
line-height:50px;
|
||||
margin:20px auto;
|
||||
background:#0568a4;
|
||||
color:#fff;
|
||||
font-size:18px;
|
||||
text-align:center;
|
||||
text-decoration:none;
|
||||
border-radius:30px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@media screen and (max-height:900px){
|
||||
.navBD12{ margin-bottom:16px;}
|
||||
.card12{ margin-top:0; padding:20px 35px;}
|
||||
.immediate-pay12{ margin-top:16px;}
|
||||
.order-amount12{ padding:16px 35px; margin-top:16px;}
|
||||
.card12-input .card12-input-password{ margin-bottom:0;}
|
||||
.PayMethod12{ margin-top:16px;}
|
||||
.product_experience12-menu{ height:120px;}
|
||||
.product_experience12-menu ol li{ height:120px;}
|
||||
.product_experience12-menu ol li .dt01{ margin-top:32px;}
|
||||
.product_experience12-menu ol li .dt02{ margin-top:32px;}
|
||||
.product_experience12-menu ol li .dt03{ margin-top:32px;}
|
||||
.product_experience12-menu ol li dl dd{ line-height:120px;}
|
||||
.product_experience12 .Internet_increment_service10{ top:200px;}
|
||||
.product_experience12 .opTit01{ margin-top:-10px;}
|
||||
.product_experience12-menu{ margin-bottom:60px;}
|
||||
.Return_experienceBtn{ margin:120px auto;}
|
||||
}
|
||||
|
||||
@media screen and (max-width:768px){
|
||||
.w1080{width:100%;}
|
||||
.order-amount12{width:auto;}
|
||||
.PayMethod12{width:auto;margin-top:0;}
|
||||
.PayMethod12 ul li{margin-bottom:20px;}
|
||||
.nav12-left{margin-left:16px;}
|
||||
.nav12-left .hidden-xs{display:none;}
|
||||
.nav12-right{float:left;margin-left:16px;}
|
||||
.order-amount12-right{float:left;}
|
||||
.PayMethod12 ul li{width:87%;float:none;}
|
||||
.immediate-pay12-right{float:left;padding-left:15px;}
|
||||
.PayMethod12 h2{clear:both;}
|
||||
.show-lg{ display:none;}
|
||||
.show-xs{ display:block;}
|
||||
.wechart-pay12{width:100%; padding:16px;box-sizing:border-box;}
|
||||
.wechart-pay12 dl{transform:scale(0.7)}
|
||||
.wechart-pay12-moblie{width: 40%;margin-top: 50px;float:left;}
|
||||
.card12{width:auto;clear:both;}
|
||||
.card12-type{width:100%;}
|
||||
.card12-type li{width:30%;margin-right:6px;font-size:14px;}
|
||||
.card12-money{width:100%;height:150px;}
|
||||
.card12-money li{ width:28%;margin:5px;}
|
||||
.card12-tips{line-height:30px;}
|
||||
.card12-input li input{width:90%;}
|
||||
.immediate-pay12-right{margin:24px;}
|
||||
.immediate_pay{width:120px;}
|
||||
.immediate-pay12{height:auto;overflow:hidden;}
|
||||
.paystument12{width:auto;padding:20px;box-sizing:border-box;}
|
||||
.order-amount12{height:130px;margin-bottom:12px;}
|
||||
.PayMethod12 ul li{ height:28px; padding: 10px 0 0 30px;}
|
||||
}
|
||||
BIN
assets/css/mqq-pay.png
Normal file
|
After Width: | Height: | Size: 5.0 KiB |
1
assets/css/mqq_pay.css
Normal file
@@ -0,0 +1 @@
|
||||
@charset "UTF-8";html{font-size:62.5%;font-family:'helvetica neue',tahoma,arial,'hiragino sans gb','microsoft yahei','Simsun',sans-serif}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote,th,td,hr{margin:0;padding:0}body{line-height:1.333;font-size:12px}h1,h2,h3,h4,h5,h6{font-size:100%;font-family:arial,'hiragino sans gb','microsoft yahei','Simsun',sans-serif}input,textarea,select,button{font-size:12px;font-weight:normal}input[type="button"],input[type="submit"],select,button{cursor:pointer}table{border-collapse:collapse;border-spacing:0}address,caption,cite,code,dfn,em,th,var{font-style:normal;font-weight:normal}li{list-style:none}caption,th{text-align:left}q:before,q:after{content:''}abbr,acronym{border:0;font-variant:normal}sup{vertical-align:text-top}sub{vertical-align:text-bottom}fieldset,img,a img,iframe{border-width:0;border-style:none}img{-ms-interpolation-mode:bicubic}textarea{overflow-y:auto}legend{color:#000}a:link,a:visited{text-decoration:none}hr{height:0}label{cursor:pointer}.clearfix:after{content:"\200B";display:block;height:0;clear:both}.clearfix{*zoom:1}a{color:#328CE5}a:hover{color:#2b8ae8;text-decoration:none}a.hit{color:#C06C6C}a:focus{outline:none}.hit{color:#8DC27E}.txt_auxiliary{color:#A2A2A2}.clear{*zoom:1}.clear:before,.clear:after{content:"";display:table}.clear:after{clear:both}body,.body{background:#f7f7f7;height:100%}.mod-title{height:60px;line-height:60px;text-align:center;border-bottom:1px solid #ddd;background:#fff}.mod-title .ico-wechat{display:inline-block;width:41px;height:36px;background:url("./mqq-pay.png") 0 -115px no-repeat;vertical-align:middle;margin-right:7px}.mod-title .text{font-size:20px;color:#333;font-weight:normal;vertical-align:middle}.mod-ct{width:610px;padding:0 135px;margin:0 auto;margin-top:15px;background:#fff url("./wave.png") top center repeat-x;text-align:center;color:#333;border:1px solid #e5e5e5;border-top:none}.mod-ct .order{font-size:20px;padding-top:30px}.mod-ct .amount{font-size:48px;margin-top:20px}.mod-ct .qr-image{margin-top:30px}.mod-ct .qr-image img{width:230px;height:230px}.mod-ct .detail{margin-top:60px;padding-top:25px}.mod-ct .detail .arrow .ico-arrow{display:inline-block;width:20px;height:11px;background:url("./mqq-pay.png") -25px -100px no-repeat}.mod-ct .detail .detail-ct{display:none;font-size:14px;text-align:right;line-height:28px}.mod-ct .detail .detail-ct dt{float:left}.mod-ct .detail-open{border-top:1px solid #e5e5e5}.mod-ct .detail .arrow{padding:6px 34px;border:1px solid #e5e5e5}.mod-ct .detail .arrow .ico-arrow{display:inline-block;width:20px;height:11px;background:url("./mqq-pay.png") -25px -100px no-repeat}.mod-ct .detail-open .arrow .ico-arrow{display:inline-block;width:20px;height:11px;background:url("./mqq-pay.png") 0 -100px no-repeat}.mod-ct .detail-open .detail-ct{display:block}.mod-ct .tip{margin-top:40px;border-top:1px dashed #e5e5e5;padding:30px 0;position:relative}.mod-ct .tip .ico-scan{display:inline-block;width:56px;height:55px;background:url("./mqq-pay.png") 0 0 no-repeat;vertical-align:middle;*display:inline;*zoom:1}.mod-ct .tip .tip-text{display:inline-block;vertical-align:middle;text-align:left;margin-left:23px;font-size:16px;line-height:28px;*display:inline;*zoom:1}.mod-ct .tip .dec{display:inline-block;width:22px;height:45px;background:url("./mqq-pay.png") 0 -55px no-repeat;position:absolute;top:-23px}.mod-ct .tip .dec-left{background-position:0 -55px;left:-136px}.mod-ct .tip .dec-right{background-position:-25px -55px;right:-136px}.foot{text-align:center;margin:30px auto;color:#888888;font-size:12px;line-height:20px;font-family:"simsun"}.foot .link{color:#0071ce}
|
||||
116
assets/css/reset.css
Normal file
@@ -0,0 +1,116 @@
|
||||
@charset "utf-8";
|
||||
/* CSS Document */
|
||||
|
||||
body, h1, h2, h3, h4, h5, h6, hr, p, blockquote, /* structural elements 结构元素 */ dl, dt, dd, ul, ol, li, /* list elements 列表元素 */ pre, /* text formatting elements 文本格式元素 */ fieldset, lengend, button, input, textarea, /* form elements 表单元素 */ th, td { /* table elements 表格元素 */ margin: 0; padding: 0; }
|
||||
html,body{ width:100%; height:100%; color:#6e6e6e; font-family:'微软雅黑'}
|
||||
/* 设置默认字体 */
|
||||
body, button, input, select, textarea { /* for ie */ /*font: 12px/1 Tahoma, Helvetica, Arial, "宋体", sans-serif;*/
|
||||
font: 14px/1 Tahoma, Helvetica, Arial, "微软雅黑", sans-serif,; /* 用 ascii 字符表示,使得在任何编码下都无问题 */ }
|
||||
h1 { font-size: 18px; /* 18px / 12px = 1.5 */ font-family:'微软雅黑'}
|
||||
h2 { font-size: 24px; font-weight:normal; color:#323232; font-family:'微软雅黑'}
|
||||
h3 { font-size: 14px; font-weight:normal; font-family:'微软雅黑' }
|
||||
h4, h5, h6 { font-size: 100%; font-weight:normal; font-family:'微软雅黑' }
|
||||
p{ font-size:14px; line-height:34px; font-family:'微软雅黑'}/* 段落默认字号和行高 */
|
||||
address, cite, dfn, em, var { font-style: normal; } /* 将斜体扶正 */
|
||||
code, kbd, pre, samp, tt { font-family: "Courier New", Courier, monospace; } /* 统一等宽字体 */
|
||||
small { font-size: 12px; } /* 小于 12px 的中文很难阅读,让 small 正常化 */
|
||||
/* 重置列表元素 */
|
||||
ul, ol { list-style: none; font-family:'微软雅黑' }
|
||||
select{ border-style:none;}
|
||||
/* 重置文本格式元素 */
|
||||
a { text-decoration: none; color:#6e6e6e; font-size:14px; outline:none; font-family:'微软雅黑'}
|
||||
span{ font-size:14px; font-family:'微软雅黑'}
|
||||
a:hover { text-decoration: none; }
|
||||
abbr[title], acronym[title] { /* 注:1.ie6 不支持 abbr; 2.这里用了属性选择符,ie6 下无效果 */ border-bottom: 1px dotted; cursor: help; }
|
||||
q:before, q:after { content: ''; }
|
||||
/* 重置表单元素 */
|
||||
input{ border:none;}
|
||||
legend { color: #000; } /* for ie6 */
|
||||
fieldset, img { border: none; } /* img 搭车:让链接里的 img 无边框 */
|
||||
/* 注:optgroup 无法扶正 */
|
||||
button, input, select, textarea { font-size: 100%; /* 使得表单元素在 ie 下能继承字体大小 */ }
|
||||
/* 重置表格元素 */
|
||||
table { border-collapse: collapse; border-spacing: 0; width:100%;}
|
||||
/* 重置 hr */
|
||||
hr { border: none; height: 1px; }
|
||||
/* 让非ie浏览器默认也显示垂直滚动条,防止因滚动条引起的闪烁 */
|
||||
html { overflow-y: scroll;}
|
||||
*:focus {outline: none;}
|
||||
/* 版心 */
|
||||
.w100{ width:100%; /*min-width:1080px;*/ clear:both;}
|
||||
.w1200{ width:1200px; margin:0 auto;}
|
||||
.w1300{ width:1300px; margin:0 auto;}
|
||||
.w1000{ width:1000px; margin:0 auto;}
|
||||
.w1080{ width:1080px; margin:0 auto;}
|
||||
/*常用样式*/
|
||||
.fl{ float:left;}
|
||||
.fr{ float:right;}
|
||||
.tc{ text-align:center;}
|
||||
.tr{ text-align:right;}
|
||||
.tl{ text-align:left;}
|
||||
.f12{ font-size:12px;}
|
||||
.f14{ font-size:14px;}
|
||||
.f15{ font-size:15px;}
|
||||
.f16{ font-size:16px;}
|
||||
.f18{ font-size:18px;}
|
||||
.f20{ font-size:20px; color:#323232;}
|
||||
.f22{ font-size:22px;}
|
||||
.f24{ font-size:24px; color:#323232;}
|
||||
.f36{ font-size:36px; color:#323232;}
|
||||
.fc{ color:#d2151a;}
|
||||
.l24{ line-height:24px;}
|
||||
.f30{ font-size:30px; color:#323232;}
|
||||
.f32{ font-size:32px; color:#323232;}
|
||||
.l36{ line-height:36px;}
|
||||
.t2{ text-indent:2em;}
|
||||
.mt14{ margin-top:14px;}
|
||||
.mt20{ margin-top:20px;}
|
||||
.t_ul{ text-decoration:underline;}
|
||||
.lh24{ line-height:24px;}
|
||||
.lh32{ line-height:32px;}
|
||||
.blue{ color:#0568a4;}
|
||||
.blue_ul{ color:#0568a4; font-size:16px; text-decoration:underline;}
|
||||
.blue_ul02{ color:#fff; font-size:16px; text-decoration:underline;}
|
||||
.red{ color:#e20000; font-size:14px;}
|
||||
.ma{ margin:0 auto;}
|
||||
select {
|
||||
/*Chrome和Firefox里面的边框是不一样的,所以复写了一下*/
|
||||
border: solid 1px #f8f9fb;
|
||||
|
||||
/*很关键:将默认的select选择框样式清除*/
|
||||
appearance:none;
|
||||
-moz-appearance:none;
|
||||
-webkit-appearance:none;
|
||||
|
||||
/*在选择框的最右侧中间显示小箭头图片*/
|
||||
background:url(../images/arrawdown.png) no-repeat scroll 90% center;
|
||||
|
||||
|
||||
/*为下拉小箭头留出一点位置,避免被文字覆盖*/
|
||||
padding-right: 14px;
|
||||
}/* 重置文本格式元素 */
|
||||
.mt_userMessage select{ background:url(../images/arrawdown02.png) no-repeat scroll right center;}
|
||||
|
||||
/*定义滚动条高宽及背景 高宽分别对应横竖滚动条的尺寸*/
|
||||
::-webkit-scrollbar
|
||||
{
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
background-color: #F5F5F5;
|
||||
}
|
||||
|
||||
/*定义滚动条轨道 内阴影+圆角*/
|
||||
::-webkit-scrollbar-track
|
||||
{
|
||||
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
|
||||
border-radius: 10px;
|
||||
background-color: #F5F5F5;
|
||||
}
|
||||
|
||||
/*定义滑块 内阴影+圆角*/
|
||||
::-webkit-scrollbar-thumb
|
||||
{
|
||||
border-radius: 10px;
|
||||
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,.3);
|
||||
background-color: #ccc;
|
||||
}
|
||||
BIN
assets/css/wave.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/css/wechat-pay.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
1
assets/css/wechat_pay.css
Normal file
@@ -0,0 +1 @@
|
||||
@charset "UTF-8";html{font-size:62.5%;font-family:'helvetica neue',tahoma,arial,'hiragino sans gb','microsoft yahei','Simsun',sans-serif}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote,th,td,hr{margin:0;padding:0}body{line-height:1.333;font-size:12px}h1,h2,h3,h4,h5,h6{font-size:100%;font-family:arial,'hiragino sans gb','microsoft yahei','Simsun',sans-serif}input,textarea,select,button{font-size:12px;font-weight:normal}input[type="button"],input[type="submit"],select,button{cursor:pointer}table{border-collapse:collapse;border-spacing:0}address,caption,cite,code,dfn,em,th,var{font-style:normal;font-weight:normal}li{list-style:none}caption,th{text-align:left}q:before,q:after{content:''}abbr,acronym{border:0;font-variant:normal}sup{vertical-align:text-top}sub{vertical-align:text-bottom}fieldset,img,a img,iframe{border-width:0;border-style:none}img{-ms-interpolation-mode:bicubic}textarea{overflow-y:auto}legend{color:#000}a:link,a:visited{text-decoration:none}hr{height:0}label{cursor:pointer}.clearfix:after{content:"\200B";display:block;height:0;clear:both}.clearfix{*zoom:1}a{color:#328CE5}a:hover{color:#2b8ae8;text-decoration:none}a.hit{color:#C06C6C}a:focus{outline:none}.hit{color:#8DC27E}.txt_auxiliary{color:#A2A2A2}.clear{*zoom:1}.clear:before,.clear:after{content:"";display:table}.clear:after{clear:both}body,.body{background:#f7f7f7;height:100%}.mod-title{height:60px;line-height:60px;text-align:center;border-bottom:1px solid #ddd;background:#fff}.mod-title .ico-wechat{display:inline-block;width:41px;height:36px;background:url("./wechat-pay.png") 0 -115px no-repeat;vertical-align:middle;margin-right:7px}.mod-title .text{font-size:20px;color:#333;font-weight:normal;vertical-align:middle}.mod-ct{width:610px;padding:0 135px;margin:0 auto;margin-top:15px;background:#fff url("./wave.png") top center repeat-x;text-align:center;color:#333;border:1px solid #e5e5e5;border-top:none}.mod-ct .order{font-size:20px;padding-top:30px}.mod-ct .amount{font-size:48px;margin-top:20px}.mod-ct .qr-image{margin-top:30px}.mod-ct .qr-image img{width:230px;height:230px}.mod-ct .detail{margin-top:60px;padding-top:25px}.mod-ct .detail .arrow .ico-arrow{display:inline-block;width:20px;height:11px;background:url("./wechat-pay.png") -25px -100px no-repeat}.mod-ct .detail .detail-ct{display:none;font-size:14px;text-align:right;line-height:28px}.mod-ct .detail .detail-ct dt{float:left}.mod-ct .detail-open{border-top:1px solid #e5e5e5}.mod-ct .detail .arrow{padding:6px 34px;border:1px solid #e5e5e5}.mod-ct .detail .arrow .ico-arrow{display:inline-block;width:20px;height:11px;background:url("./wechat-pay.png") -25px -100px no-repeat}.mod-ct .detail-open .arrow .ico-arrow{display:inline-block;width:20px;height:11px;background:url("./wechat-pay.png") 0 -100px no-repeat}.mod-ct .detail-open .detail-ct{display:block}.mod-ct .tip{margin-top:40px;border-top:1px dashed #e5e5e5;padding:30px 0;position:relative}.mod-ct .tip .ico-scan{display:inline-block;width:56px;height:55px;background:url("./wechat-pay.png") 0 0 no-repeat;vertical-align:middle;*display:inline;*zoom:1}.mod-ct .tip .tip-text{display:inline-block;vertical-align:middle;text-align:left;margin-left:23px;font-size:16px;line-height:28px;*display:inline;*zoom:1}.mod-ct .tip .dec{display:inline-block;width:22px;height:45px;background:url("./wechat-pay.png") 0 -55px no-repeat;position:absolute;top:-23px}.mod-ct .tip .dec-left{background-position:0 -55px;left:-136px}.mod-ct .tip .dec-right{background-position:-25px -55px;right:-136px}.foot{text-align:center;margin:30px auto;color:#888888;font-size:12px;line-height:20px;font-family:"simsun"}.foot .link{color:#0071ce}
|
||||
BIN
assets/font/elephant.ttf
Normal file
BIN
assets/icon/alipay.ico
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
BIN
assets/icon/bank.ico
Normal file
|
After Width: | Height: | Size: 66 KiB |
BIN
assets/icon/jdpay.ico
Normal file
|
After Width: | Height: | Size: 25 KiB |
BIN
assets/icon/qqpay.ico
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/icon/tenpay.ico
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/icon/wechat.ico
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/icon/wxpay.ico
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/img/NoImg.png
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
assets/img/alipay.gif
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
assets/img/load.gif
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
assets/img/loading.gif
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
assets/img/logo.png
Normal file
|
After Width: | Height: | Size: 7.9 KiB |
BIN
assets/img/mqq_logo.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
assets/img/qq.png
Normal file
|
After Width: | Height: | Size: 919 B |
BIN
assets/img/qqpay.jpg
Normal file
|
After Width: | Height: | Size: 7.3 KiB |
BIN
assets/img/tenpay.gif
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
assets/img/user.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
assets/img/weixin.gif
Normal file
|
After Width: | Height: | Size: 7.5 KiB |
BIN
assets/img/wx.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/img/wxwappay.png
Normal file
|
After Width: | Height: | Size: 50 KiB |
2
assets/js/jquery-qrcode.min.js
vendored
Normal file
197
assets/js/qcloud_util.js
Normal file
2
assets/layer/layer.js
Normal file
2
assets/layer/mobile/layer.js
Normal file
@@ -0,0 +1,2 @@
|
||||
/*! layer mobile-v2.0.0 Web弹层组件 MIT License http://layer.layui.com/mobile By 贤心 */
|
||||
;!function(e){"use strict";var t=document,n="querySelectorAll",i="getElementsByClassName",a=function(e){return t[n](e)},s={type:0,shade:!0,shadeClose:!0,fixed:!0,anim:"scale"},l={extend:function(e){var t=JSON.parse(JSON.stringify(s));for(var n in e)t[n]=e[n];return t},timer:{},end:{}};l.touch=function(e,t){e.addEventListener("click",function(e){t.call(this,e)},!1)};var r=0,o=["layui-m-layer"],c=function(e){var t=this;t.config=l.extend(e),t.view()};c.prototype.view=function(){var e=this,n=e.config,s=t.createElement("div");e.id=s.id=o[0]+r,s.setAttribute("class",o[0]+" "+o[0]+(n.type||0)),s.setAttribute("index",r);var l=function(){var e="object"==typeof n.title;return n.title?'<h3 style="'+(e?n.title[1]:"")+'">'+(e?n.title[0]:n.title)+"</h3>":""}(),c=function(){"string"==typeof n.btn&&(n.btn=[n.btn]);var e,t=(n.btn||[]).length;return 0!==t&&n.btn?(e='<span yes type="1">'+n.btn[0]+"</span>",2===t&&(e='<span no type="0">'+n.btn[1]+"</span>"+e),'<div class="layui-m-layerbtn">'+e+"</div>"):""}();if(n.fixed||(n.top=n.hasOwnProperty("top")?n.top:100,n.style=n.style||"",n.style+=" top:"+(t.body.scrollTop+n.top)+"px"),2===n.type&&(n.content='<i></i><i class="layui-m-layerload"></i><i></i><p>'+(n.content||"")+"</p>"),n.skin&&(n.anim="up"),"msg"===n.skin&&(n.shade=!1),s.innerHTML=(n.shade?"<div "+("string"==typeof n.shade?'style="'+n.shade+'"':"")+' class="layui-m-layershade"></div>':"")+'<div class="layui-m-layermain" '+(n.fixed?"":'style="position:static;"')+'><div class="layui-m-layersection"><div class="layui-m-layerchild '+(n.skin?"layui-m-layer-"+n.skin+" ":"")+(n.className?n.className:"")+" "+(n.anim?"layui-m-anim-"+n.anim:"")+'" '+(n.style?'style="'+n.style+'"':"")+">"+l+'<div class="layui-m-layercont">'+n.content+"</div>"+c+"</div></div></div>",!n.type||2===n.type){var d=t[i](o[0]+n.type),y=d.length;y>=1&&layer.close(d[0].getAttribute("index"))}document.body.appendChild(s);var u=e.elem=a("#"+e.id)[0];n.success&&n.success(u),e.index=r++,e.action(n,u)},c.prototype.action=function(e,t){var n=this;e.time&&(l.timer[n.index]=setTimeout(function(){layer.close(n.index)},1e3*e.time));var a=function(){var t=this.getAttribute("type");0==t?(e.no&&e.no(),layer.close(n.index)):e.yes?e.yes(n.index):layer.close(n.index)};if(e.btn)for(var s=t[i]("layui-m-layerbtn")[0].children,r=s.length,o=0;o<r;o++)l.touch(s[o],a);if(e.shade&&e.shadeClose){var c=t[i]("layui-m-layershade")[0];l.touch(c,function(){layer.close(n.index,e.end)})}e.end&&(l.end[n.index]=e.end)},e.layer={v:"2.0",index:r,open:function(e){var t=new c(e||{});return t.index},close:function(e){var n=a("#"+o[0]+e)[0];n&&(n.innerHTML="",t.body.removeChild(n),clearTimeout(l.timer[e]),delete l.timer[e],"function"==typeof l.end[e]&&l.end[e](),delete l.end[e])},closeAll:function(){for(var e=t[i](o[0]),n=0,a=e.length;n<a;n++)layer.close(0|e[0].getAttribute("index"))}},"function"==typeof define?define(function(){return layer}):function(){var e=document.scripts,n=e[e.length-1],i=n.src,a=i.substring(0,i.lastIndexOf("/")+1);n.getAttribute("merge")||document.head.appendChild(function(){var e=t.createElement("link");return e.href=a+"need/layer.css?2.0",e.type="text/css",e.rel="styleSheet",e.id="layermcss",e}())}()}(window);
|
||||
1
assets/layer/mobile/need/layer.css
Normal file
BIN
assets/layer/theme/default/icon-ext.png
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
assets/layer/theme/default/icon.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
1
assets/layer/theme/default/layer.css
Normal file
BIN
assets/layer/theme/default/loading-0.gif
Normal file
|
After Width: | Height: | Size: 5.7 KiB |
BIN
assets/layer/theme/default/loading-1.gif
Normal file
|
After Width: | Height: | Size: 701 B |
BIN
assets/layer/theme/default/loading-2.gif
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
115
cashier.php
Normal file
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
$is_defend=true;
|
||||
$nosession = true;
|
||||
require './includes/common.php';
|
||||
|
||||
@header('Content-Type: text/html; charset=UTF-8');
|
||||
|
||||
$other=isset($_GET['other'])?true:false;
|
||||
$trade_no=daddslashes($_GET['trade_no']);
|
||||
$sitename=base64_decode(daddslashes($_GET['sitename']));
|
||||
$row=$DB->getRow("SELECT * FROM pre_order WHERE trade_no='{$trade_no}' limit 1");
|
||||
if(!$row)sysmsg('该订单号不存在,请返回来源地重新发起请求!');
|
||||
if($row['status']==1)sysmsg('该订单已完成支付,请勿重复支付');
|
||||
$gid = $DB->getColumn("SELECT gid FROM pre_user WHERE uid='{$row['uid']}' limit 1");
|
||||
$paytype = \lib\Channel::getTypes($gid);
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=0" name="viewport">
|
||||
<title>收银台 | <?php echo $sitename?$sitename:$conf['sitename']?> </title>
|
||||
<link href="/assets/css/reset.css" rel="stylesheet" type="text/css">
|
||||
<link href="/assets/css/main12.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body style="background-color:#f9f9f9">
|
||||
<!--导航-->
|
||||
<div class="w100 navBD12">
|
||||
<div class="w1080 nav12">
|
||||
<div class="nav12-left">
|
||||
<a href="javascript:;"><img src="/assets/img/logo.png"></a>
|
||||
|收银台
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="trade_no" value="<?php echo $trade_no?>"/>
|
||||
<!--订单金额-->
|
||||
<?php if($other){?>
|
||||
<div class="w1080 order-amount12" style="height: auto;">
|
||||
<h2><font style="color: red">当前支付方式暂时关闭维护,请更换其他方式支付</font></h2>
|
||||
</div>
|
||||
<?php }else{?>
|
||||
<div class="w1080 order-amount12">
|
||||
<ul class="order-amount12-left">
|
||||
<li>
|
||||
<span>商品名称:</span>
|
||||
<span><?php echo $row['name']?></span>
|
||||
</li>
|
||||
<li>
|
||||
<span>订单号:</span>
|
||||
<span><?php echo $trade_no?></span>
|
||||
</li>
|
||||
<li>
|
||||
<span>创建时间:</span>
|
||||
<span><?php echo $row['addtime']?></span>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="order-amount12-right">
|
||||
<span>订单金额:</span>
|
||||
<strong><?php echo $row['money']?></strong>
|
||||
<span>元</span>
|
||||
</div>
|
||||
</div>
|
||||
<?php }?>
|
||||
<!--支付方式-->
|
||||
<div class="w1080 PayMethod12">
|
||||
<div class="row">
|
||||
<h2>支付方式</h2>
|
||||
<ul class="types">
|
||||
<?php foreach($paytype as $rows){?>
|
||||
<li class="pay_li" value="<?php echo $rows['id']?>">
|
||||
<img src="/assets/icon/<?php echo $rows['name']?>.ico">
|
||||
<span><?php echo $rows['showname']?></span>
|
||||
</li>
|
||||
<?php }?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<!--立即支付-->
|
||||
<div class="w1080 immediate-pay12">
|
||||
<div class="immediate-pay12-right">
|
||||
<span>需支付:<strong><?php echo $row['realmoney']?></strong>元<?php if($row['realmoney'] && $row['realmoney']!=$row['money'])echo '(包含'.($row['realmoney']-$row['money']).'元手续费)';?></span>
|
||||
<a class="immediate_pay">立即支付</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt_agree">
|
||||
<div class="mt_agree_main">
|
||||
<h2>提示信息</h2>
|
||||
<p id="errorContent" style="text-align:center;line-height:36px;"></p>
|
||||
<a class="close_btn">确定</a>
|
||||
</div>
|
||||
</div>
|
||||
<!--底部-->
|
||||
<div class="w1080 footer12">
|
||||
<p> <?php echo $sitename?$sitename:$conf['sitename']?></p>
|
||||
</div>
|
||||
|
||||
<script src="//cdn.staticfile.org/jquery/1.12.4/jquery.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$(".types li").click(function(){
|
||||
$(".types li").each(function(){
|
||||
$(this).attr('class','');
|
||||
});
|
||||
$(this).attr('class','active');
|
||||
});
|
||||
$(document).on("click", ".immediate_pay", function () {
|
||||
var value = $(".types").find('.active').attr('value');
|
||||
var trade_no = $("input[name='trade_no']").val();
|
||||
window.location.href='./submit2.php?typeid='+value+'&trade_no='+trade_no;
|
||||
});
|
||||
$(".types li:first").click();
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
108
cron.php
Normal file
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
if(preg_match('/Baiduspider/', $_SERVER['HTTP_USER_AGENT']))exit;
|
||||
$nosession = true;
|
||||
require './includes/common.php';
|
||||
|
||||
if (function_exists("set_time_limit"))
|
||||
{
|
||||
@set_time_limit(0);
|
||||
}
|
||||
if (function_exists("ignore_user_abort"))
|
||||
{
|
||||
@ignore_user_abort(true);
|
||||
}
|
||||
|
||||
@header('Content-Type: text/html; charset=UTF-8');
|
||||
|
||||
if(empty($conf['cronkey']))exit("请先设置好监控密钥");
|
||||
if($conf['cronkey']!=$_GET['key'])exit("监控密钥不正确");
|
||||
|
||||
if($_GET['do']=='settle'){
|
||||
if($conf['settle_open']==1 || $conf['settle_open']==3){
|
||||
$settle_time=getSetting('settle_time', true);
|
||||
if(strtotime($settle_time)>=strtotime(date("Y-m-d").' 00:00:00'))exit('自动生成结算列表今日已完成');
|
||||
$rs=$DB->query("SELECT * from pre_user where money>={$conf['settle_money']} and account is not null and username is not null and settle=1 and status=1");
|
||||
$i=0;
|
||||
$allmoney=0;
|
||||
while($row = $rs->fetch())
|
||||
{
|
||||
$i++;
|
||||
if($conf['settle_rate']>0){
|
||||
$fee=round($row['money']*$conf['settle_rate']/100,2);
|
||||
if($fee<$conf['settle_fee_min'])$fee=$conf['settle_fee_min'];
|
||||
if($fee>$conf['settle_fee_max'])$fee=$conf['settle_fee_max'];
|
||||
$realmoney=$row['money']-$fee;
|
||||
}else{
|
||||
$realmoney=$row['money'];
|
||||
}
|
||||
if($DB->exec("INSERT INTO `pre_settle` (`uid`, `type`, `username`, `account`, `money`, `realmoney`, `addtime`, `status`) VALUES ('{$row['uid']}', '{$row['settle_id']}', '{$row['username']}', '{$row['account']}', '{$row['money']}', '{$realmoney}', '{$date}', '0')")){
|
||||
changeUserMoney($row['uid'], $row['money'], false, '自动结算');
|
||||
$allmoney+=$realmoney;
|
||||
}
|
||||
}
|
||||
saveSetting('settle_time', $date);
|
||||
exit('自动生成结算列表成功 allmony='.$allmoney.' num='.$i);
|
||||
}else{
|
||||
exit('自动生成结算列表未开启');
|
||||
}
|
||||
}
|
||||
elseif($_GET['do']=='order'){
|
||||
$order_time=getSetting('order_time', true);
|
||||
if(strtotime($order_time)>=strtotime(date("Y-m-d").' 00:00:00'))exit('订单统计与清理任务今日已完成');
|
||||
|
||||
$thtime=date("Y-m-d H:i:s",time()-3600*24);
|
||||
|
||||
$CACHE->clean();
|
||||
$DB->exec("delete from pre_order where status=0 and addtime<'{$thtime}'");
|
||||
|
||||
$day = date("Ymd", strtotime("-1 day"));
|
||||
|
||||
$paytype = [];
|
||||
$rs = $DB->getAll("SELECT id,name,showname FROM pre_type WHERE status=1");
|
||||
foreach($rs as $row){
|
||||
$paytype[$row['id']] = $row['showname'];
|
||||
}
|
||||
unset($rs);
|
||||
|
||||
$channel = [];
|
||||
$rs = $DB->getAll("SELECT id,name FROM pre_channel WHERE status=1");
|
||||
foreach($rs as $row){
|
||||
$channel[$row['id']] = $row['name'];
|
||||
}
|
||||
unset($rs);
|
||||
|
||||
$lastday=date("Y-m-d",strtotime("-1 day"));
|
||||
$today=date("Y-m-d");
|
||||
|
||||
$rs=$DB->query("SELECT type,channel,money from pre_order where status=1 and date>='$lastday' and date<'$today'");
|
||||
foreach($paytype as $id=>$type){
|
||||
$order_paytype[$id]=0;
|
||||
}
|
||||
foreach($channel as $id=>$type){
|
||||
$order_channel[$id]=0;
|
||||
}
|
||||
while($row = $rs->fetch())
|
||||
{
|
||||
$order_paytype[$row['type']]+=$row['money'];
|
||||
$order_channel[$row['channel']]+=$row['money'];
|
||||
}
|
||||
foreach($order_paytype as $k=>$v){
|
||||
$order_paytype[$k] = round($v,2);
|
||||
}
|
||||
foreach($order_channel as $k=>$v){
|
||||
$order_channel[$k] = round($v,2);
|
||||
}
|
||||
$allmoney=0;
|
||||
foreach($order_paytype as $money){
|
||||
$allmoney+=$money;
|
||||
}
|
||||
|
||||
$order_lastday['all']=$allmoney;
|
||||
$order_lastday['paytype']=$order_paytype;
|
||||
$order_lastday['channel']=$order_channel;
|
||||
|
||||
$CACHE->save('order_'.$day, serialize($order_lastday));
|
||||
|
||||
saveSetting('order_time', $date);
|
||||
exit($day.'订单统计与清理任务执行成功');
|
||||
}
|
||||
BIN
favicon.ico
Normal file
|
After Width: | Height: | Size: 17 KiB |
18
getshop.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
$nosession = true;
|
||||
require './includes/common.php';
|
||||
|
||||
$type=isset($_GET['type'])?daddslashes($_GET['type']):exit('No type!');
|
||||
$trade_no=isset($_GET['trade_no'])?daddslashes($_GET['trade_no']):exit('No trade_no!');
|
||||
|
||||
@header('Content-Type: text/html; charset=UTF-8');
|
||||
|
||||
$row=$DB->getRow("SELECT * FROM ".DBQZ."_order WHERE trade_no='{$trade_no}' limit 1");
|
||||
if($row['status']>=1){
|
||||
$url=creat_callback($row);
|
||||
exit('{"code":1,"msg":"付款成功","backurl":"'.$url['return'].'"}');
|
||||
}else{
|
||||
exit('{"code":-1,"msg":"未付款"}');
|
||||
}
|
||||
|
||||
?>
|
||||
1
includes/.htaccess
Normal file
@@ -0,0 +1 @@
|
||||
deny from all
|
||||
152
includes/360safe/360webscan.php
Normal file
@@ -0,0 +1,152 @@
|
||||
<?php
|
||||
webscan_error();
|
||||
//引用配置文件
|
||||
require_once('webscan_cache.php');
|
||||
//get拦截规则
|
||||
$getfilter = "\\<.+javascript:window\\[.{1}\\\\x|<.*=(&#\\d+?;?)+?>|<.*(data|src)=data:text\\/html.*>|\\b(alert\\(|confirm\\(|expression\\(|prompt\\(|benchmark\s*?\(.*\)|sleep\s*?\(.*\)|\\b(group_)?concat[\\s\\/\\*]*?\\([^\\)]+?\\)|\bcase[\s\/\*]*?when[\s\/\*]*?\([^\)]+?\)|load_file\s*?\\()|<[a-z]+?\\b[^>]*?\\bon([a-z]{4,})\s*?=|^\\+\\/v(8|9)|\\b(and|or)\\b\\s*?([\\(\\)'\"\\d]+?=[\\(\\)'\"\\d]+?|[\\(\\)'\"a-zA-Z]+?=[\\(\\)'\"a-zA-Z]+?|>|<|\s+?[\\w]+?\\s+?\\bin\\b\\s*?\(|\\blike\\b\\s+?[\"'])|\\/\\*.*\\*\\/|<\\s*script\\b|\\bEXEC\\b|UNION.+?SELECT\s*(\(.+\)\s*|@{1,2}.+?\s*|\s+?.+?|(`|'|\").*?(`|'|\")\s*)|UPDATE\s*(\(.+\)\s*|@{1,2}.+?\s*|\s+?.+?|(`|'|\").*?(`|'|\")\s*)SET|INSERT\\s+INTO.+?VALUES|(SELECT|DELETE)@{0,2}(\\(.+\\)|\\s+?.+?\\s+?|(`|'|\").*?(`|'|\"))FROM(\\(.+\\)|\\s+?.+?|(`|'|\").*?(`|'|\"))|(CREATE|ALTER|DROP|TRUNCATE)\\s+(TABLE|DATABASE)|<.*(iframe|frame|style|embed|object|frameset|meta|xml)";
|
||||
//post拦截规则
|
||||
$postfilter = "<.*=(&#\\d+?;?)+?>|<.*data=data:text\\/html.*>|\\b(alert\\(|confirm\\(|expression\\(|prompt\\(|benchmark\s*?\(.*\)|sleep\s*?\(.*\)|\\b(group_)?concat[\\s\\/\\*]*?\\([^\\)]+?\\)|\bcase[\s\/\*]*?when[\s\/\*]*?\([^\)]+?\)|load_file\s*?\\()|<[^>]*?\\b(onerror|onmousemove|onload|onclick|onmouseover)\\b|\\b(and|or)\\b\\s*?([\\(\\)'\"\\d]+?=[\\(\\)'\"\\d]+?|[\\(\\)'\"a-zA-Z]+?=[\\(\\)'\"a-zA-Z]+?|>|<|\s+?[\\w]+?\\s+?\\bin\\b\\s*?\(|\\blike\\b\\s+?[\"'])|\\/\\*.*\\*\\/|<\\s*script\\b|\\bEXEC\\b|UNION.+?SELECT\s*(\(.+\)\s*|@{1,2}.+?\s*|\s+?.+?|(`|'|\").*?(`|'|\")\s*)|UPDATE\s*(\(.+\)\s*|@{1,2}.+?\s*|\s+?.+?|(`|'|\").*?(`|'|\")\s*)SET|INSERT\\s+INTO.+?VALUES|(SELECT|DELETE)(\\(.+\\)|\\s+?.+?\\s+?|(`|'|\").*?(`|'|\"))FROM(\\(.+\\)|\\s+?.+?|(`|'|\").*?(`|'|\"))|(CREATE|ALTER|DROP|TRUNCATE)\\s+(TABLE|DATABASE)|<.*(iframe|frame|style|embed|object|frameset|meta|xml)";
|
||||
//cookie拦截规则
|
||||
$cookiefilter = "benchmark\s*?\(.*\)|sleep\s*?\(.*\)|load_file\s*?\\(|\\b(and|or)\\b\\s*?([\\(\\)'\"\\d]+?=[\\(\\)'\"\\d]+?|[\\(\\)'\"a-zA-Z]+?=[\\(\\)'\"a-zA-Z]+?|>|<|\s+?[\\w]+?\\s+?\\bin\\b\\s*?\(|\\blike\\b\\s+?[\"'])|\\/\\*.*\\*\\/|<\\s*script\\b|\\bEXEC\\b|UNION.+?SELECT\s*(\(.+\)\s*|@{1,2}.+?\s*|\s+?.+?|(`|'|\").*?(`|'|\")\s*)|UPDATE\s*(\(.+\)\s*|@{1,2}.+?\s*|\s+?.+?|(`|'|\").*?(`|'|\")\s*)SET|INSERT\\s+INTO.+?VALUES|(SELECT|DELETE)@{0,2}(\\(.+\\)|\\s+?.+?\\s+?|(`|'|\").*?(`|'|\"))FROM(\\(.+\\)|\\s+?.+?|(`|'|\").*?(`|'|\"))|(CREATE|ALTER|DROP|TRUNCATE)\\s+(TABLE|DATABASE)";
|
||||
//referer获取
|
||||
$webscan_referer = empty($_SERVER['HTTP_REFERER']) ? array() : array('HTTP_REFERER'=>$_SERVER['HTTP_REFERER']);
|
||||
|
||||
/**
|
||||
* 关闭用户错误提示
|
||||
*/
|
||||
function webscan_error() {
|
||||
if (ini_get('display_errors')) {
|
||||
ini_set('display_errors', '0');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据统计回传
|
||||
*/
|
||||
function webscan_slog($logs) {
|
||||
//日志记录
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* 参数拆分
|
||||
*/
|
||||
function webscan_arr_foreach($arr) {
|
||||
static $str;
|
||||
static $keystr;
|
||||
if (!is_array($arr)) {
|
||||
return $arr;
|
||||
}
|
||||
foreach ($arr as $key => $val ) {
|
||||
$keystr=$keystr.$key;
|
||||
if (is_array($val)) {
|
||||
|
||||
webscan_arr_foreach($val);
|
||||
} else {
|
||||
|
||||
$str[] = $val.$keystr;
|
||||
}
|
||||
}
|
||||
return implode($str);
|
||||
}
|
||||
|
||||
/**
|
||||
* 防护提示页
|
||||
*/
|
||||
function webscan_pape(){
|
||||
$pape=<<<HTML
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
|
||||
<title>输入内容存在危险字符,安全起见,已被本站拦截</title>
|
||||
<style>
|
||||
body, h1, h2, p,dl,dd,dt{margin: 0;padding: 0;font: 12px/1.5 微软雅黑,tahoma,arial;}
|
||||
body{background:#efefef;}
|
||||
h1, h2, h3, h4, h5, h6 {font-size: 100%;cursor:default;}
|
||||
ul, ol {list-style: none outside none;}
|
||||
a {text-decoration: none;color:#447BC4}
|
||||
a:hover {text-decoration: underline;}
|
||||
.ip-attack{width:600px; margin:200px auto 0;}
|
||||
.ip-attack dl{ background:#fff; padding:30px; border-radius:10px;border: 1px solid #CDCDCD;-webkit-box-shadow: 0 0 8px #CDCDCD;-moz-box-shadow: 0 0 8px #cdcdcd;box-shadow: 0 0 8px #CDCDCD;}
|
||||
.ip-attack dt{text-align:center;}
|
||||
.ip-attack dd{font-size:16px; color:#333; text-align:center;}
|
||||
.tips{text-align:center; font-size:14px; line-height:50px; color:#999;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="ip-attack">
|
||||
<dl>
|
||||
<dt><img src='http://p2.qhimg.com/t016dd70ac04d942b1b.png' /></dt>
|
||||
<dt><a href="javascript:history.go(-1)">返回上一页</a></dt>
|
||||
</dl>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
HTML;
|
||||
echo $pape;
|
||||
}
|
||||
|
||||
/**
|
||||
* 攻击检查拦截
|
||||
*/
|
||||
function webscan_StopAttack($StrFiltKey,$StrFiltValue,$ArrFiltReq,$method) {
|
||||
$StrFiltValue=webscan_arr_foreach($StrFiltValue);
|
||||
if (preg_match("/".$ArrFiltReq."/is",$StrFiltValue)==1){
|
||||
webscan_slog(array('ip' => $_SERVER["REMOTE_ADDR"],'time'=>strftime("%Y-%m-%d %H:%M:%S"),'page'=>$_SERVER["PHP_SELF"],'method'=>$method,'rkey'=>$StrFiltKey,'rdata'=>$StrFiltValue,'user_agent'=>$_SERVER['HTTP_USER_AGENT'],'request_url'=>$_SERVER["REQUEST_URI"]));
|
||||
exit(webscan_pape());
|
||||
}
|
||||
if (preg_match("/".$ArrFiltReq."/is",$StrFiltKey)==1){
|
||||
webscan_slog(array('ip' => $_SERVER["REMOTE_ADDR"],'time'=>strftime("%Y-%m-%d %H:%M:%S"),'page'=>$_SERVER["PHP_SELF"],'method'=>$method,'rkey'=>$StrFiltKey,'rdata'=>$StrFiltKey,'user_agent'=>$_SERVER['HTTP_USER_AGENT'],'request_url'=>$_SERVER["REQUEST_URI"]));
|
||||
exit(webscan_pape());
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* 拦截目录白名单
|
||||
*/
|
||||
function webscan_white($webscan_white_name,$webscan_white_url=array()) {
|
||||
$url_path=$_SERVER['SCRIPT_NAME'];
|
||||
$url_var=$_SERVER['QUERY_STRING'];
|
||||
if (preg_match("/".$webscan_white_name."/is",$url_path)==1&&!empty($webscan_white_name)) {
|
||||
return false;
|
||||
}
|
||||
foreach ($webscan_white_url as $key => $value) {
|
||||
if(!empty($url_var)&&!empty($value)){
|
||||
if (stristr($url_path,$key)&&stristr($url_var,$value)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
elseif (empty($url_var)&&empty($value)) {
|
||||
if (stristr($url_path,$key)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($webscan_switch&&webscan_white($webscan_white_directory,$webscan_white_url)) {
|
||||
if ($webscan_get) {
|
||||
foreach($_GET as $key=>$value) {
|
||||
webscan_StopAttack($key,$value,$getfilter,"GET");
|
||||
}
|
||||
}
|
||||
if ($webscan_post) {
|
||||
foreach($_POST as $key=>$value) {
|
||||
webscan_StopAttack($key,$value,$postfilter,"POST");
|
||||
}
|
||||
}
|
||||
if ($webscan_cookie) {
|
||||
foreach($_COOKIE as $key=>$value) {
|
||||
webscan_StopAttack($key,$value,$cookiefilter,"COOKIE");
|
||||
}
|
||||
}
|
||||
if ($webscan_referre) {
|
||||
foreach($webscan_referer as $key=>$value) {
|
||||
webscan_StopAttack($key,$value,$postfilter,"REFERRER");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
14
includes/360safe/webscan_cache.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
//拦截开关(1为开启,0关闭)
|
||||
$webscan_switch=1;
|
||||
//提交方式拦截(1开启拦截,0关闭拦截,post,get,cookie,referre选择需要拦截的方式)
|
||||
$webscan_post=1;
|
||||
$webscan_get=1;
|
||||
$webscan_cookie=1;
|
||||
$webscan_referre=1;
|
||||
//后台白名单,后台操作将不会拦截,添加"|"隔开白名单目录下面默认是网址带 admin /dede/ 放行
|
||||
$webscan_white_directory='';
|
||||
//url白名单,可以自定义添加url白名单,默认是对phpcms的后台url放行
|
||||
//写法:比如phpcms 后台操作url index.php?m=admin php168的文章提交链接post.php?job=postnew&step=post ,dedecms 空间设置edit_space_info.php
|
||||
$webscan_white_url = array('index.php' => 'mod=admin-set');
|
||||
?>
|
||||
75
includes/ValidateCode.class.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
//验证码类
|
||||
class ValidateCode {
|
||||
private $charset = 'abcdefghkmnprstuvwxyzABCDEFGHKMNPRSTUVWXYZ23456789'; //随机因子
|
||||
private $code; //验证码
|
||||
private $codelen = 4; //验证码长度
|
||||
private $width = 130; //宽度
|
||||
private $height = 50; //高度
|
||||
private $img; //图形资源句柄
|
||||
private $font; //指定的字体
|
||||
private $fontsize = 20; //指定字体大小
|
||||
private $fontcolor; //指定字体颜色
|
||||
|
||||
//构造方法初始化
|
||||
public function __construct() {
|
||||
$this->font = ROOT_PATH.'/../assets/font/elephant.ttf';
|
||||
}
|
||||
|
||||
//生成随机码
|
||||
private function createCode() {
|
||||
$_len = strlen($this->charset)-1;
|
||||
for ($i=0;$i<$this->codelen;$i++) {
|
||||
$this->code .= $this->charset[mt_rand(0,$_len)];
|
||||
}
|
||||
}
|
||||
|
||||
//生成背景
|
||||
private function createBg() {
|
||||
$this->img = imagecreatetruecolor($this->width, $this->height);
|
||||
$color = imagecolorallocate($this->img, mt_rand(157,255), mt_rand(157,255), mt_rand(157,255));
|
||||
imagefilledrectangle($this->img,0,$this->height,$this->width,0,$color);
|
||||
}
|
||||
|
||||
//生成文字
|
||||
private function createFont() {
|
||||
$_x = $this->width / $this->codelen;
|
||||
for ($i=0;$i<$this->codelen;$i++) {
|
||||
$this->fontcolor = imagecolorallocate($this->img,mt_rand(0,156),mt_rand(0,156),mt_rand(0,156));
|
||||
imagettftext($this->img,$this->fontsize,mt_rand(-30,30),$_x*$i+mt_rand(1,5),$this->height / 1.4,$this->fontcolor,$this->font,$this->code[$i]);
|
||||
}
|
||||
}
|
||||
|
||||
//生成线条、雪花
|
||||
private function createLine() {
|
||||
for ($i=0;$i<6;$i++) {
|
||||
$color = imagecolorallocate($this->img,mt_rand(0,156),mt_rand(0,156),mt_rand(0,156));
|
||||
imageline($this->img,mt_rand(0,$this->width),mt_rand(0,$this->height),mt_rand(0,$this->width),mt_rand(0,$this->height),$color);
|
||||
}
|
||||
for ($i=0;$i<100;$i++) {
|
||||
$color = imagecolorallocate($this->img,mt_rand(200,255),mt_rand(200,255),mt_rand(200,255));
|
||||
imagestring($this->img,mt_rand(1,5),mt_rand(0,$this->width),mt_rand(0,$this->height),'*',$color);
|
||||
}
|
||||
}
|
||||
|
||||
//输出
|
||||
private function outPut() {
|
||||
header('Content-type:image/png');
|
||||
imagepng($this->img);
|
||||
imagedestroy($this->img);
|
||||
}
|
||||
|
||||
//对外生成
|
||||
public function doimg() {
|
||||
$this->createBg();
|
||||
$this->createCode();
|
||||
$this->createLine();
|
||||
$this->createFont();
|
||||
$this->outPut();
|
||||
}
|
||||
|
||||
//获取验证码
|
||||
public function getCode() {
|
||||
return strtolower($this->code);
|
||||
}
|
||||
}
|
||||
37
includes/autoloader.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* 自动载入函数
|
||||
*/
|
||||
class Autoloader
|
||||
{
|
||||
/**
|
||||
* 向PHP注册在自动载入函数
|
||||
*/
|
||||
public static function register()
|
||||
{
|
||||
spl_autoload_register(array(new self, 'autoload'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据类名载入所在文件
|
||||
*/
|
||||
public static function autoload($className)
|
||||
{
|
||||
|
||||
// DIRECTORY_SEPARATOR:目录分隔符,linux上就是’/’ windows上是’\’
|
||||
$filePath = __DIR__ . DIRECTORY_SEPARATOR . $className;
|
||||
$filePath = str_replace('\\', DIRECTORY_SEPARATOR, $filePath) . '.php';
|
||||
if (file_exists($filePath)) {
|
||||
require_once $filePath;
|
||||
return;
|
||||
// if(method_exists($className, "init")) {
|
||||
// call_user_func(array($className, "init"), $params);
|
||||
// }
|
||||
} else {
|
||||
echo "无法加载" . $filePath;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
57
includes/common.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
error_reporting(E_ERROR | E_WARNING | E_PARSE);
|
||||
if(defined('IN_CRONLITE'))return;
|
||||
define('IN_CRONLITE', true);
|
||||
define('SYSTEM_ROOT', dirname(__FILE__).'/');
|
||||
define('ROOT', dirname(SYSTEM_ROOT).'/');
|
||||
define('TEMPLATE_ROOT', ROOT.'template/');
|
||||
define('PLUGIN_ROOT', ROOT.'plugins/');
|
||||
date_default_timezone_set('Asia/Shanghai');
|
||||
$date = date("Y-m-d H:i:s");
|
||||
|
||||
if(!$nosession)session_start();
|
||||
|
||||
$siteurl = ($_SERVER['SERVER_PORT'] == '443' ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].'/';
|
||||
|
||||
if(is_file(SYSTEM_ROOT.'360safe/360webscan.php')){//360网站卫士
|
||||
// require_once(SYSTEM_ROOT.'360safe/360webscan.php');
|
||||
}
|
||||
|
||||
include_once(SYSTEM_ROOT."autoloader.php");
|
||||
Autoloader::register();
|
||||
|
||||
include_once(SYSTEM_ROOT."security.php");
|
||||
|
||||
require ROOT.'config.php';
|
||||
define('DBQZ', $dbconfig['dbqz']);
|
||||
|
||||
if(!$dbconfig['user']||!$dbconfig['pwd']||!$dbconfig['dbname'])//检测安装1
|
||||
{
|
||||
header('Content-type:text/html;charset=utf-8');
|
||||
echo '你还没安装!<a href="/install/">点此安装</a>';
|
||||
exit();
|
||||
}
|
||||
|
||||
$DB = new \lib\PdoHelper($dbconfig);
|
||||
|
||||
if($DB->query("select * from pre_config where 1")==FALSE)//检测安装2
|
||||
{
|
||||
header('Content-type:text/html;charset=utf-8');
|
||||
echo '你还没安装!<a href="/install/">点此安装</a>';
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
$CACHE=new \lib\Cache();
|
||||
$conf=$CACHE->pre_fetch();
|
||||
define('SYS_KEY', $conf['syskey']);
|
||||
if(!$conf['localurl'])$conf['localurl'] = $siteurl;
|
||||
$password_hash='!@#%!s!0';
|
||||
|
||||
include_once(SYSTEM_ROOT."functions.php");
|
||||
include_once(SYSTEM_ROOT."member.php");
|
||||
|
||||
if (!file_exists(ROOT.'install/install.lock') && file_exists(ROOT.'install/index.php')) {
|
||||
sysmsg('<h2>检测到无 install.lock 文件</h2><ul><li><font size="4">如果您尚未安装本程序,请<a href="./install/">前往安装</a></font></li><li><font size="4">如果您已经安装本程序,请手动放置一个空的 install.lock 文件到 /install 文件夹下,<b>为了您站点安全,在您完成它之前我们不会工作。</b></font></li></ul><br/><h4>为什么必须建立 install.lock 文件?</h4>它是安装保护文件,如果检测不到它,就会认为站点还没安装,此时任何人都可以安装/重装你的网站。<br/><br/>');exit;
|
||||
}
|
||||
?>
|
||||
763
includes/functions.php
Normal file
@@ -0,0 +1,763 @@
|
||||
<?php
|
||||
function curl_get($url)
|
||||
{
|
||||
$ch=curl_init($url);
|
||||
$httpheader[] = "Accept: */*";
|
||||
$httpheader[] = "Accept-Language: zh-CN,zh;q=0.8";
|
||||
$httpheader[] = "Connection: close";
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Linux; U; Android 4.4.1; zh-cn; R815T Build/JOP40D) AppleWebKit/533.1 (KHTML, like Gecko)Version/4.0 MQQBrowser/4.5 Mobile Safari/533.1');
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
|
||||
$content=curl_exec($ch);
|
||||
curl_close($ch);
|
||||
return($content);
|
||||
}
|
||||
function get_curl($url, $post=0, $referer=0, $cookie=0, $header=0, $ua=0, $nobaody=0)
|
||||
{
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||
$httpheader[] = "Accept: */*";
|
||||
$httpheader[] = "Accept-Encoding: gzip,deflate,sdch";
|
||||
$httpheader[] = "Accept-Language: zh-CN,zh;q=0.8";
|
||||
$httpheader[] = "Connection: close";
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader);
|
||||
if ($post) {
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
|
||||
}
|
||||
if ($header) {
|
||||
curl_setopt($ch, CURLOPT_HEADER, true);
|
||||
}
|
||||
if ($cookie) {
|
||||
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
|
||||
}
|
||||
if($referer){
|
||||
if($referer==1){
|
||||
curl_setopt($ch, CURLOPT_REFERER, 'http://m.qzone.com/infocenter?g_f=');
|
||||
}else{
|
||||
curl_setopt($ch, CURLOPT_REFERER, $referer);
|
||||
}
|
||||
}
|
||||
if ($ua) {
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, $ua);
|
||||
}
|
||||
else {
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Linux; U; Android 4.0.4; es-mx; HTC_One_X Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0");
|
||||
}
|
||||
if ($nobaody) {
|
||||
curl_setopt($ch, CURLOPT_NOBODY, 1);
|
||||
}
|
||||
curl_setopt($ch, CURLOPT_ENCODING, "gzip");
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
$ret = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
return $ret;
|
||||
}
|
||||
function real_ip($type=0){
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
if($type<=0 && isset($_SERVER['HTTP_X_FORWARDED_FOR']) && preg_match_all('#\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}#s', $_SERVER['HTTP_X_FORWARDED_FOR'], $matches)) {
|
||||
foreach ($matches[0] AS $xip) {
|
||||
if (filter_var($xip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
|
||||
$ip = $xip;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} elseif ($type<=0 && isset($_SERVER['HTTP_CLIENT_IP']) && filter_var($_SERVER['HTTP_CLIENT_IP'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
|
||||
$ip = $_SERVER['HTTP_CLIENT_IP'];
|
||||
} elseif ($type<=1 && isset($_SERVER['HTTP_CF_CONNECTING_IP']) && filter_var($_SERVER['HTTP_CF_CONNECTING_IP'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
|
||||
$ip = $_SERVER['HTTP_CF_CONNECTING_IP'];
|
||||
} elseif ($type<=1 && isset($_SERVER['HTTP_X_REAL_IP']) && filter_var($_SERVER['HTTP_X_REAL_IP'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
|
||||
$ip = $_SERVER['HTTP_X_REAL_IP'];
|
||||
}
|
||||
return $ip;
|
||||
}
|
||||
function get_ip_city($ip)
|
||||
{
|
||||
$url = 'http://whois.pconline.com.cn/ipJson.jsp?json=true&ip=';
|
||||
$city = get_curl($url . $ip);
|
||||
$city = mb_convert_encoding($city, "UTF-8", "GB2312");
|
||||
$city = json_decode($city, true);
|
||||
if ($city['city']) {
|
||||
$location = $city['pro'].$city['city'];
|
||||
} else {
|
||||
$location = $city['pro'];
|
||||
}
|
||||
if($location){
|
||||
return $location;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
function send_mail($to, $sub, $msg) {
|
||||
global $conf;
|
||||
if($conf['mail_cloud']==1){
|
||||
$mail = new \lib\mail\Sendcloud($conf['mail_apiuser'], $conf['mail_apikey']);
|
||||
return $mail->send($to, $sub, $msg, $conf['mail_name2'], $conf['sitename']);
|
||||
}elseif($conf['mail_cloud']==2){
|
||||
$mail = new \lib\mail\Aliyun($conf['mail_apiuser'], $conf['mail_apikey']);
|
||||
return $mail->send($to, $sub, $msg, $conf['mail_name2'], $conf['sitename']);
|
||||
}else{
|
||||
if(!$conf['mail_name'] || !$conf['mail_smtp'] || !$conf['mail_pwd'])return false;
|
||||
$From = $conf['mail_name'];
|
||||
$Host = $conf['mail_smtp'];
|
||||
$Port = $conf['mail_port'];
|
||||
$SMTPAuth = 1;
|
||||
$Username = $conf['mail_name'];
|
||||
$Password = $conf['mail_pwd'];
|
||||
$Nickname = $conf['sitename'];
|
||||
$SSL = $conf['mail_port']==465?1:0;
|
||||
$mail = new \lib\mail\SMTP($Host , $Port , $SMTPAuth , $Username , $Password , $SSL);
|
||||
$mail->att = array();
|
||||
if($mail->send($to , $From , $sub , $msg, $Nickname)) {
|
||||
return true;
|
||||
} else {
|
||||
return $mail->log;
|
||||
}
|
||||
}
|
||||
}
|
||||
function send_sms($phone, $code, $scope='reg'){
|
||||
global $conf;
|
||||
if($scope == 'reg'){
|
||||
$moban = $conf['sms_tpl_reg'];
|
||||
}elseif($scope == 'login'){
|
||||
$moban = $conf['sms_tpl_login'];
|
||||
}elseif($scope == 'find'){
|
||||
$moban = $conf['sms_tpl_find'];
|
||||
}elseif($scope == 'edit'){
|
||||
$moban = $conf['sms_tpl_edit'];
|
||||
}
|
||||
if($conf['sms_api']==1){
|
||||
$ssender = new \lib\sms\TencentSms($conf['sms_appid'], $conf['sms_appkey']);
|
||||
$params = array($code, $conf['sitename']);
|
||||
$smsSign = $conf['sms_sign'];
|
||||
$result = $ssender->sendWithParam("86", $phone, $moban, $params, $smsSign, "", "");
|
||||
$arr = json_decode($result,true);
|
||||
if(array_key_exists('result',$arr) && $arr['result']==0){
|
||||
return true;
|
||||
}else{
|
||||
return $arr['errmsg'];
|
||||
}
|
||||
}elseif($conf['sms_api']==2){
|
||||
$sms = new \lib\sms\Aliyun($conf['sms_appid'], $conf['sms_appkey']);
|
||||
$arr = $sms->send($phone, $code, $moban, $conf['sms_sign'], $conf['sitename']);
|
||||
if(array_key_exists('Code',$arr) && $arr['Code']=='OK'){
|
||||
return true;
|
||||
}else{
|
||||
return $arr['Message'];
|
||||
}
|
||||
}else{
|
||||
$app=$conf['sitename'];
|
||||
$url = 'http://api.978w.cn/yzmsms/index/appkey/'.$conf['sms_appkey'].'/phone/'.$phone.'/moban/'.$moban.'/app/'.$app.'/code/'.$code;
|
||||
$data=get_curl($url);
|
||||
$arr=json_decode($data,true);
|
||||
if($arr['status']=='200'){
|
||||
return true;
|
||||
}else{
|
||||
return $arr['error_msg_zh'];
|
||||
}
|
||||
}
|
||||
}
|
||||
function daddslashes($string, $force = 0, $strip = FALSE) {
|
||||
!defined('MAGIC_QUOTES_GPC') && define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc());
|
||||
if(!MAGIC_QUOTES_GPC || $force) {
|
||||
if(is_array($string)) {
|
||||
foreach($string as $key => $val) {
|
||||
$string[$key] = daddslashes($val, $force, $strip);
|
||||
}
|
||||
} else {
|
||||
$string = addslashes($strip ? stripslashes($string) : $string);
|
||||
}
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
|
||||
function strexists($string, $find) {
|
||||
return !(strpos($string, $find) === FALSE);
|
||||
}
|
||||
|
||||
function dstrpos($string, $arr) {
|
||||
if(empty($string)) return false;
|
||||
foreach((array)$arr as $v) {
|
||||
if(strpos($string, $v) !== false) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function checkmobile() {
|
||||
$useragent = strtolower($_SERVER['HTTP_USER_AGENT']);
|
||||
$ualist = array('android', 'midp', 'nokia', 'mobile', 'iphone', 'ipod', 'blackberry', 'windows phone');
|
||||
if((dstrpos($useragent, $ualist) || strexists($_SERVER['HTTP_ACCEPT'], "VND.WAP") || strexists($_SERVER['HTTP_VIA'],"wap")))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
function authcode($string, $operation = 'DECODE', $key = '', $expiry = 0) {
|
||||
$ckey_length = 4;
|
||||
$key = md5($key ? $key : ENCRYPT_KEY);
|
||||
$keya = md5(substr($key, 0, 16));
|
||||
$keyb = md5(substr($key, 16, 16));
|
||||
$keyc = $ckey_length ? ($operation == 'DECODE' ? substr($string, 0, $ckey_length): substr(md5(microtime()), -$ckey_length)) : '';
|
||||
$cryptkey = $keya.md5($keya.$keyc);
|
||||
$key_length = strlen($cryptkey);
|
||||
$string = $operation == 'DECODE' ? base64_decode(substr($string, $ckey_length)) : sprintf('%010d', $expiry ? $expiry + time() : 0).substr(md5($string.$keyb), 0, 16).$string;
|
||||
$string_length = strlen($string);
|
||||
$result = '';
|
||||
$box = range(0, 255);
|
||||
$rndkey = array();
|
||||
for($i = 0; $i <= 255; $i++) {
|
||||
$rndkey[$i] = ord($cryptkey[$i % $key_length]);
|
||||
}
|
||||
for($j = $i = 0; $i < 256; $i++) {
|
||||
$j = ($j + $box[$i] + $rndkey[$i]) % 256;
|
||||
$tmp = $box[$i];
|
||||
$box[$i] = $box[$j];
|
||||
$box[$j] = $tmp;
|
||||
}
|
||||
for($a = $j = $i = 0; $i < $string_length; $i++) {
|
||||
$a = ($a + 1) % 256;
|
||||
$j = ($j + $box[$a]) % 256;
|
||||
$tmp = $box[$a];
|
||||
$box[$a] = $box[$j];
|
||||
$box[$j] = $tmp;
|
||||
$result .= chr(ord($string[$i]) ^ ($box[($box[$a] + $box[$j]) % 256]));
|
||||
}
|
||||
if($operation == 'DECODE') {
|
||||
if((substr($result, 0, 10) == 0 || substr($result, 0, 10) - time() > 0) && substr($result, 10, 16) == substr(md5(substr($result, 26).$keyb), 0, 16)) {
|
||||
return substr($result, 26);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
return $keyc.str_replace('=', '', base64_encode($result));
|
||||
}
|
||||
}
|
||||
|
||||
function random($length, $numeric = 0) {
|
||||
$seed = base_convert(md5(microtime().$_SERVER['DOCUMENT_ROOT']), 16, $numeric ? 10 : 35);
|
||||
$seed = $numeric ? (str_replace('0', '', $seed).'012340567890') : ($seed.'zZ'.strtoupper($seed));
|
||||
$hash = '';
|
||||
$max = strlen($seed) - 1;
|
||||
for($i = 0; $i < $length; $i++) {
|
||||
$hash .= $seed{mt_rand(0, $max)};
|
||||
}
|
||||
return $hash;
|
||||
}
|
||||
function showmsg($content = '未知的异常',$type = 4,$back = false)
|
||||
{
|
||||
switch($type)
|
||||
{
|
||||
case 1:
|
||||
$panel="success";
|
||||
break;
|
||||
case 2:
|
||||
$panel="info";
|
||||
break;
|
||||
case 3:
|
||||
$panel="warning";
|
||||
break;
|
||||
case 4:
|
||||
$panel="danger";
|
||||
break;
|
||||
}
|
||||
|
||||
echo '<div class="panel panel-'.$panel.'">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">提示信息</h3>
|
||||
</div>
|
||||
<div class="panel-body">';
|
||||
echo $content;
|
||||
|
||||
if ($back) {
|
||||
echo '<hr/><a href="'.$back.'"><< 返回上一页</a>';
|
||||
}
|
||||
else
|
||||
echo '<hr/><a href="javascript:history.back(-1)"><< 返回上一页</a>';
|
||||
|
||||
echo '</div>
|
||||
</div>';
|
||||
exit;
|
||||
}
|
||||
function sysmsg($msg = '未知的异常',$title = '站点提示信息') {
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title><?php echo $title?></title>
|
||||
<style type="text/css">
|
||||
html{background:#eee}body{background:#fff;color:#333;font-family:"微软雅黑","Microsoft YaHei",sans-serif;margin:2em auto;padding:1em 2em;max-width:700px;-webkit-box-shadow:10px 10px 10px rgba(0,0,0,.13);box-shadow:10px 10px 10px rgba(0,0,0,.13);opacity:.8}h1{border-bottom:1px solid #dadada;clear:both;color:#666;font:24px "微软雅黑","Microsoft YaHei",,sans-serif;margin:30px 0 0 0;padding:0;padding-bottom:7px}#error-page{margin-top:50px}h3{text-align:center}#error-page p{font-size:9px;line-height:1.5;margin:25px 0 20px}#error-page code{font-family:Consolas,Monaco,monospace}ul li{margin-bottom:10px;font-size:9px}a{color:#21759B;text-decoration:none;margin-top:-10px}a:hover{color:#D54E21}.button{background:#f7f7f7;border:1px solid #ccc;color:#555;display:inline-block;text-decoration:none;font-size:9px;line-height:26px;height:28px;margin:0;padding:0 10px 1px;cursor:pointer;-webkit-border-radius:3px;-webkit-appearance:none;border-radius:3px;white-space:nowrap;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-box-shadow:inset 0 1px 0 #fff,0 1px 0 rgba(0,0,0,.08);box-shadow:inset 0 1px 0 #fff,0 1px 0 rgba(0,0,0,.08);vertical-align:top}.button.button-large{height:29px;line-height:28px;padding:0 12px}.button:focus,.button:hover{background:#fafafa;border-color:#999;color:#222}.button:focus{-webkit-box-shadow:1px 1px 1px rgba(0,0,0,.2);box-shadow:1px 1px 1px rgba(0,0,0,.2)}.button:active{background:#eee;border-color:#999;color:#333;-webkit-box-shadow:inset 0 2px 5px -3px rgba(0,0,0,.5);box-shadow:inset 0 2px 5px -3px rgba(0,0,0,.5)}table{table-layout:auto;border:1px solid #333;empty-cells:show;border-collapse:collapse}th{padding:4px;border:1px solid #333;overflow:hidden;color:#333;background:#eee}td{padding:4px;border:1px solid #333;overflow:hidden;color:#333}
|
||||
</style>
|
||||
</head>
|
||||
<body id="error-page">
|
||||
<?php echo '<h3>'.$title.'</h3>';
|
||||
echo $msg; ?>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
exit;
|
||||
}
|
||||
function getSid() {
|
||||
return md5(uniqid(mt_rand(), true) . microtime());
|
||||
}
|
||||
function getMd5Pwd($pwd, $salt=null) {
|
||||
return md5(md5($pwd) . md5('1277180438'.$salt));
|
||||
}
|
||||
|
||||
function getSetting($k, $force = false){
|
||||
global $DB,$CACHE;
|
||||
if($force) return $DB->getColumn("SELECT v FROM pre_config WHERE k=:k LIMIT 1", [':k'=>$k]);
|
||||
$cache = $CACHE->get($k);
|
||||
return $cache[$k];
|
||||
}
|
||||
function saveSetting($k, $v){
|
||||
global $DB;
|
||||
return $DB->exec("REPLACE INTO pre_config SET v=:v,k=:k", [':v'=>$v, ':k'=>$k]);
|
||||
}
|
||||
|
||||
function creat_callback($data){
|
||||
global $DB;
|
||||
$key=$DB->getColumn("SELECT `key` FROM pre_user WHERE uid='{$data['uid']}' LIMIT 1");
|
||||
$type=$DB->getColumn("SELECT name FROM pre_type WHERE id='{$data['type']}' LIMIT 1");
|
||||
$array=array('pid'=>$data['uid'],'trade_no'=>$data['trade_no'],'out_trade_no'=>$data['out_trade_no'],'type'=>$type,'name'=>$data['name'],'money'=>$data['money'],'money'=>$data['money'],'trade_status'=>'TRADE_SUCCESS');
|
||||
$arg=\lib\PayUtils::argSort(\lib\PayUtils::paraFilter($array));
|
||||
$prestr=\lib\PayUtils::createLinkstring($arg);
|
||||
$urlstr=\lib\PayUtils::createLinkstringUrlencode($arg);
|
||||
$sign=\lib\PayUtils::md5Sign($prestr, $key);
|
||||
if(strpos($data['notify_url'],'?'))
|
||||
$url['notify']=$data['notify_url'].'&'.$urlstr.'&sign='.$sign.'&sign_type=MD5';
|
||||
else
|
||||
$url['notify']=$data['notify_url'].'?'.$urlstr.'&sign='.$sign.'&sign_type=MD5';
|
||||
if(strpos($data['return_url'],'?'))
|
||||
$url['return']=$data['return_url'].'&'.$urlstr.'&sign='.$sign.'&sign_type=MD5';
|
||||
else
|
||||
$url['return']=$data['return_url'].'?'.$urlstr.'&sign='.$sign.'&sign_type=MD5';
|
||||
if($data['tid']>0){
|
||||
$url['return']=$data['return_url'];
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
||||
function creat_callback_user($data, $key=null){
|
||||
global $DB;
|
||||
if(!$key)$key=$DB->getColumn("SELECT `key` FROM pre_user WHERE uid='{$data['uid']}' LIMIT 1");
|
||||
$type=$DB->getColumn("SELECT name FROM pre_type WHERE id='{$data['type']}' LIMIT 1");
|
||||
$array=array('pid'=>$data['uid'],'trade_no'=>$data['trade_no'],'out_trade_no'=>$data['out_trade_no'],'type'=>$type,'name'=>$data['name'],'money'=>$data['money'],'money'=>$data['money'],'trade_status'=>$data['type']>0?'TRADE_SUCCESS':'TRADE_CLOSED');
|
||||
$arg=\lib\PayUtils::argSort(\lib\PayUtils::paraFilter($array));
|
||||
$prestr=\lib\PayUtils::createLinkstring($arg);
|
||||
$urlstr=\lib\PayUtils::createLinkstringUrlencode($arg);
|
||||
$sign=\lib\PayUtils::md5Sign($prestr, $key);
|
||||
if(strpos($data['notify_url'],'?'))
|
||||
$url['notify']=$data['notify_url'].'&'.$urlstr.'&sign='.$sign.'&sign_type=MD5';
|
||||
else
|
||||
$url['notify']=$data['notify_url'].'?'.$urlstr.'&sign='.$sign.'&sign_type=MD5';
|
||||
if(strpos($data['return_url'],'?'))
|
||||
$url['return']=$data['return_url'].'&'.$urlstr.'&sign='.$sign.'&sign_type=MD5';
|
||||
else
|
||||
$url['return']=$data['return_url'].'?'.$urlstr.'&sign='.$sign.'&sign_type=MD5';
|
||||
if($data['tid']>0){
|
||||
$url['return']=$data['return_url'];
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
||||
function getdomain($url){
|
||||
$arr=parse_url($url);
|
||||
return $arr['host'];
|
||||
}
|
||||
|
||||
function do_notify($url){
|
||||
$return = curl_get($url);
|
||||
if(strpos($return,'success')!==false || strpos($return,'SUCCESS')!==false || strpos($return,'Success')!==false){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function processOrder($srow,$notify=true){
|
||||
global $DB,$CACHE,$conf;
|
||||
$addmoney = $srow['getmoney'];
|
||||
if($srow['tid']==1){ //商户注册
|
||||
changeUserMoney($srow['uid'], $addmoney, true, '订单收入', $srow['trade_no']);
|
||||
$info = unserialize($CACHE->read('reg_'.$srow['trade_no']));
|
||||
if($info){
|
||||
$DB->exec("UPDATE `pre_regcode` SET `status` ='1' WHERE `id`=:codeid", [':codeid'=>$info['codeid']]);
|
||||
$key = random(32);
|
||||
$sds=$DB->exec("INSERT INTO `pre_user` (`key`, `money`, `email`, `phone`, `addtime`, `pay`, `settle`, `keylogin`, `apply`, `status`) VALUES (:key, '0.00', :email, :phone, :addtime, 1, 1, 0, 0, 1)", [':key'=>$key, ':email'=>$info['email'], ':phone'=>$info['phone'], ':addtime'=>$info['addtime']]);
|
||||
$uid=$DB->lastInsertId();
|
||||
$pwd = getMd5Pwd($info['pwd'], $uid);
|
||||
$DB->exec("UPDATE `pre_user` SET `pwd` ='{$pwd}' WHERE `uid`='$uid'");
|
||||
if($sds && !empty($info['email'])){
|
||||
$sub = $conf['sitename'].' - 注册成功通知';
|
||||
$msg = '<h2>商户注册成功通知</h2>感谢您注册'.$conf['sitename'].'!<br/>您的登录账号:'.$info['email'].'<br/>您的商户ID:'.$uid.'<br/>您的商户秘钥:'.$key.'<br/>'.$conf['sitename'].'官网:<a href="http://'.$_SERVER['HTTP_HOST'].'/" target="_blank">'.$_SERVER['HTTP_HOST'].'</a><br/>【<a href="http://'.$_SERVER['HTTP_HOST'].'/user/" target="_blank">商户管理后台</a>】';
|
||||
$result = send_mail($info['email'], $sub, $msg);
|
||||
}
|
||||
}
|
||||
}else if($srow['tid']==2){ //充值余额
|
||||
changeUserMoney($srow['uid'], $addmoney, true, '余额充值', $srow['trade_no']);
|
||||
}else if($srow['tid']==3){ //一码支付
|
||||
changeUserMoney($srow['uid'], $addmoney, true, '在线收款', $srow['trade_no']);
|
||||
}else if($srow['tid']==4){ //购买用户组
|
||||
$start = strpos($srow['name'],'#')+1;
|
||||
$end = strrpos($srow['name'],'#');
|
||||
$gid=intval(substr($srow['name'],$start,$end-$start));
|
||||
changeUserGroup($srow['uid'],$gid);
|
||||
}else{
|
||||
changeUserMoney($srow['uid'], $addmoney, true, '订单收入', $srow['trade_no']);
|
||||
if($notify==true){
|
||||
$url=creat_callback($srow);
|
||||
if(do_notify($url['notify'])){
|
||||
$DB->exec("UPDATE pre_order SET notify=0 WHERE trade_no='{$srow['trade_no']}'");
|
||||
}else{
|
||||
$DB->exec("UPDATE pre_order SET notify=1 WHERE trade_no='{$srow['trade_no']}'");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function changeUserMoney($uid, $money, $add=true, $type=null, $orderid=null){
|
||||
global $DB;
|
||||
if($money<=0)return;
|
||||
if($type=='订单退款'){
|
||||
$isrefund = $DB->getColumn("SELECT id FROM pre_record WHERE type='订单退款' AND trade_no='{$orderid}' LIMIT 1");
|
||||
if($isrefund)return;
|
||||
}
|
||||
$oldmoney = $DB->getColumn("SELECT money FROM pre_user WHERE uid='{$uid}' LIMIT 1");
|
||||
if($add == true){
|
||||
$action = 1;
|
||||
$newmoney = round($oldmoney+$money, 2);
|
||||
}else{
|
||||
$action = 2;
|
||||
$newmoney = round($oldmoney-$money, 2);
|
||||
}
|
||||
$res = $DB->exec("UPDATE pre_user SET money='{$newmoney}' WHERE uid='{$uid}'");
|
||||
$DB->exec("INSERT INTO `pre_record` (`uid`, `action`, `money`, `oldmoney`, `newmoney`, `type`, `trade_no`, `date`) VALUES (:uid, :action, :money, :oldmoney, :newmoney, :type, :orderid, NOW())", [':uid'=>$uid, ':action'=>$action, ':money'=>$money, ':oldmoney'=>$oldmoney, ':newmoney'=>$newmoney, ':type'=>$type, ':orderid'=>$orderid]);
|
||||
return $res;
|
||||
}
|
||||
|
||||
function changeUserGroup($uid, $gid){
|
||||
global $DB;
|
||||
return $DB->exec("UPDATE pre_user SET gid='{$gid}' WHERE uid='{$uid}'");
|
||||
}
|
||||
|
||||
function checkIfActive($string) {
|
||||
$array=explode(',',$string);
|
||||
$php_self=substr($_SERVER['REQUEST_URI'],strrpos($_SERVER['REQUEST_URI'],'/')+1,strrpos($_SERVER['REQUEST_URI'],'.')-strrpos($_SERVER['REQUEST_URI'],'/')-1);
|
||||
if (in_array($php_self,$array)){
|
||||
return 'active';
|
||||
}else
|
||||
return null;
|
||||
}
|
||||
|
||||
function api_refund($trade_no, &$message){
|
||||
global $DB,$conf;
|
||||
$order = $DB->getRow("SELECT * FROM pre_order WHERE trade_no='$trade_no' LIMIT 1");
|
||||
if(!$order){
|
||||
$message = '该订单号不存在';
|
||||
return false;
|
||||
}
|
||||
$channel = \lib\Channel::get($order['channel']);
|
||||
if(!$channel){
|
||||
$message = '当前支付通道信息不存在';
|
||||
return false;
|
||||
}
|
||||
$loadfile = \lib\Plugin::refund($channel['plugin'], $trade_no);
|
||||
if(!$loadfile){
|
||||
$message = '当前支付通道不支持API退款';
|
||||
return false;
|
||||
}
|
||||
$result = include($loadfile);
|
||||
if($result && $result['code']==0){
|
||||
return true;
|
||||
}else{
|
||||
$message = $result['msg'];
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function transferToAlipay($channel, $out_trade_no, $payee_account, $payee_real_name, $money){
|
||||
global $conf;
|
||||
define("IN_PLUGIN", true);
|
||||
define("PAY_ROOT", PLUGIN_ROOT.'alipay/');
|
||||
require_once PAY_ROOT."inc/lib/AopClient.php";
|
||||
require_once PAY_ROOT."inc/model/request/AlipayFundTransToaccountTransferRequest.php";
|
||||
|
||||
if(is_numeric($payee_account) && substr($payee_account,0,4)=='2088' && strlen($payee_account)==16)$payee_type = 'ALIPAY_USERID';
|
||||
else $payee_type = 'ALIPAY_LOGONID';
|
||||
$BizContent = array(
|
||||
'out_biz_no' => $out_trade_no, //商户转账唯一订单号
|
||||
'payee_type' => $payee_type, //收款方账户类型
|
||||
'payee_account' => $payee_account, //收款方账户
|
||||
'amount' => $money, //转账金额
|
||||
'payer_show_name' => $conf['transfer_name'], //付款方显示姓名
|
||||
);
|
||||
if(!empty($payee_real_name))$BizContent['payee_real_name'] = $payee_real_name; //收款方真实姓名
|
||||
|
||||
$aop = new AopClient ();
|
||||
$aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do';
|
||||
$aop->appId = $channel['appid'];
|
||||
$aop->rsaPrivateKey = $channel['appsecret'];
|
||||
$aop->alipayrsaPublicKey = $channel['appkey'];
|
||||
$aop->apiVersion = '1.0';
|
||||
$aop->signType = 'RSA2';
|
||||
$aop->postCharset='UTF-8';
|
||||
$aop->format='json';
|
||||
$request = new AlipayFundTransToaccountTransferRequest ();
|
||||
$request->setBizContent(json_encode($BizContent));
|
||||
$result = $aop->execute ( $request);
|
||||
|
||||
$data = array();
|
||||
$responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
|
||||
$resultCode = $result->$responseNode->code;
|
||||
if(!empty($resultCode)&&$resultCode == 10000){
|
||||
$data['code']=0;
|
||||
$data['ret']=1;
|
||||
$data['msg']='success';
|
||||
$data['orderid']=$result->$responseNode->order_id;
|
||||
$data['paydate']=$result->$responseNode->pay_date;
|
||||
} elseif($resultCode == 40004) {
|
||||
$data['code']=0;
|
||||
$data['ret']=0;
|
||||
$data['msg']='['.$result->$responseNode->sub_code.']'.$result->$responseNode->sub_msg;
|
||||
$data['sub_code']=$result->$responseNode->sub_code;
|
||||
$data['sub_msg']=$result->$responseNode->sub_msg;
|
||||
} elseif(!empty($resultCode)){
|
||||
$data['code']=-1;
|
||||
$data['msg']='['.$result->$responseNode->sub_code.']'.$result->$responseNode->sub_msg;
|
||||
$data['sub_code']=$result->$responseNode->sub_code;
|
||||
$data['sub_msg']=$result->$responseNode->sub_msg;
|
||||
} else {
|
||||
$data['code']=-1;
|
||||
$data['msg']='未知错误';
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
function transferToWeixin($channel, $out_trade_no, $payee_account, $payee_real_name, $money){
|
||||
global $conf;
|
||||
define("IN_PLUGIN", true);
|
||||
define("PAY_ROOT", PLUGIN_ROOT.'wxpay/');
|
||||
require_once PAY_ROOT."inc/WxPay.Api.php";
|
||||
$input = new WxPayTransfer();
|
||||
$input->SetPartner_trade_no($out_trade_no);
|
||||
$input->SetOpenid($payee_account);
|
||||
if(!empty($payee_real_name)){
|
||||
$input->SetCheck_name('FORCE_CHECK');
|
||||
$input->SetRe_user_name($payee_real_name);
|
||||
}else{
|
||||
$input->SetCheck_name('NO_CHECK');
|
||||
}
|
||||
$input->SetAmount($money*100);
|
||||
$input->SetDesc($conf['transfer_desc']);
|
||||
$input->SetSpbill_create_ip($_SERVER['SERVER_ADDR']);
|
||||
$result = WxPayApi::transfer($input);
|
||||
|
||||
$data = array();
|
||||
if($result["result_code"]=='SUCCESS'){
|
||||
$data['code']=0;
|
||||
$data['ret']=1;
|
||||
$data['msg']='success';
|
||||
$data['orderid']=$result["payment_no"];
|
||||
$data['paydate']=$result["payment_time"];
|
||||
} elseif($result["result_code"]=='FAIL' && ($result["err_code"]=='OPENID_ERROR'||$result["err_code"]=='NAME_MISMATCH'||$result["err_code"]=='MONEY_LIMIT'||$result["err_code"]=='V2_ACCOUNT_SIMPLE_BAN')) {
|
||||
$data['code']=0;
|
||||
$data['ret']=0;
|
||||
$data['msg']='['.$result["err_code"].']'.$result["err_code_des"];
|
||||
$data['sub_code']=$result["err_code"];
|
||||
$data['sub_msg']=$result["err_code_des"];
|
||||
} elseif(!empty($result["result_code"])){
|
||||
$data['code']=-1;
|
||||
$data['msg']='['.$result["err_code"].']'.$result["err_code_des"];
|
||||
$data['sub_code']=$result["err_code"];
|
||||
$data['sub_msg']=$result["err_code_des"];
|
||||
} else {
|
||||
$data['code']=-1;
|
||||
$data['msg']='未知错误 '.$result["return_msg"];
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
function transferToQQ($channel, $out_trade_no, $payee_account, $payee_real_name, $money){
|
||||
global $conf;
|
||||
define("IN_PLUGIN", true);
|
||||
define("PAY_ROOT", PLUGIN_ROOT.'qqpay/');
|
||||
require_once (PAY_ROOT.'inc/qpayMchAPI.class.php');
|
||||
//入参
|
||||
$params = array();
|
||||
$params["input_charset"] = 'UTF-8';
|
||||
$params["uin"] = $payee_account;
|
||||
$params["out_trade_no"] = $out_trade_no;
|
||||
$params["fee_type"] = "CNY";
|
||||
$params["total_fee"] = $money*100;
|
||||
$params["memo"] = $conf['transfer_desc']; //付款备注
|
||||
if(!empty($payee_real_name)){
|
||||
$params["check_name"] = 'FORCE_CHECK'; //校验用户姓名,"FORCE_CHECK"校验实名
|
||||
}else{
|
||||
$params["check_name"] = 'false'; //校验用户姓名,"FORCE_CHECK"校验实名
|
||||
}
|
||||
$params["re_user_name"] = $payee_real_name; //收款用户真实姓名
|
||||
$params["check_real_name"] = "0"; //校验用户是否实名
|
||||
$params["op_user_id"] = QpayMchConf::OP_USERID;
|
||||
$params["op_user_passwd"] = md5(QpayMchConf::OP_USERPWD);
|
||||
$params["spbill_create_ip"] = $_SERVER['SERVER_ADDR'];
|
||||
|
||||
//api调用
|
||||
$qpayApi = new QpayMchAPI('https://api.qpay.qq.com/cgi-bin/epay/qpay_epay_b2c.cgi', true, 10);
|
||||
$ret = $qpayApi->reqQpay($params);
|
||||
$result = QpayMchUtil::xmlToArray($ret);
|
||||
|
||||
$data = array();
|
||||
if ($result['return_code']=='SUCCESS' && $result['result_code']=='SUCCESS') {
|
||||
$data['code']=0;
|
||||
$data['ret']=1;
|
||||
$data['msg']='success';
|
||||
$data['orderid']=$result["transaction_id"];
|
||||
$data['paydate']=date('Y-m-d H:i:s',time());
|
||||
}elseif ($result['err_code']=='TRANSFER_FEE_LIMIT_ERROR' || $result['err_code']=='TRANSFER_FAIL' || $result['err_code']=='NOTENOUGH' || $result['err_code']=='APPID_OR_OPENID_ERR' || $result['err_code']=='TOTAL_FEE_OUT_OF_LIMIT' || $result['err_code']=='REALNAME_CHECK_ERROR' || $result['err_code']=='RE_USER_NAME_CHECK_ERROR') {
|
||||
$data['code']=0;
|
||||
$data['ret']=0;
|
||||
$data['msg']='['.$result["err_code"].']'.$result["err_code_des"];
|
||||
$data['sub_code']=$result["err_code"];
|
||||
$data['sub_msg']=$result["err_code_des"];
|
||||
}elseif(isset($result['result_code'])){
|
||||
$data['code']=-1;
|
||||
$data['msg']='['.$result["err_code"].']'.$result["err_code_des"];
|
||||
$data['sub_code']=$result["err_code"];
|
||||
$data['sub_msg']=$result["err_code_des"];
|
||||
}else{
|
||||
$data['code']=-1;
|
||||
$data['msg']='未知错误 '.$result["return_msg"];
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
function ordername_replace($name,$oldname,$uid){
|
||||
global $DB;
|
||||
if(strpos($name,'[name]')!==false){
|
||||
$name = str_replace('[name]', $oldname, $name);
|
||||
}
|
||||
if(strpos($name,'[qq]')!==false){
|
||||
$qq = $DB->getColumn("SELECT qq FROM pre_user WHERE uid='{$uid}' limit 1");
|
||||
$name = str_replace('[qq]', $qq, $name);
|
||||
}
|
||||
if(strpos($name,'[time]')!==false){
|
||||
$name = str_replace('[time]', time(), $name);
|
||||
}
|
||||
return $name;
|
||||
}
|
||||
|
||||
function is_idcard( $id )
|
||||
{
|
||||
$id = strtoupper($id);
|
||||
$regx = "/(^\d{17}([0-9]|X)$)/";
|
||||
$arr_split = array();
|
||||
if(strlen($id)!=18 || !preg_match($regx, $id))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
$regx = "/^(\d{6})+(\d{4})+(\d{2})+(\d{2})+(\d{3})([0-9]|X)$/";
|
||||
@preg_match($regx, $id, $arr_split);
|
||||
$dtm_birth = $arr_split[2] . '/' . $arr_split[3]. '/' .$arr_split[4];
|
||||
if(!strtotime($dtm_birth)) //检查生日日期是否正确
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
//检验18位身份证的校验码是否正确。
|
||||
//校验位按照ISO 7064:1983.MOD 11-2的规定生成,X可以认为是数字10。
|
||||
$arr_int = array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);
|
||||
$arr_ch = array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2');
|
||||
$sign = 0;
|
||||
for ( $i = 0; $i < 17; $i++ )
|
||||
{
|
||||
$b = (int) $id{$i};
|
||||
$w = $arr_int[$i];
|
||||
$sign += $b * $w;
|
||||
}
|
||||
$n = $sign % 11;
|
||||
$val_num = $arr_ch[$n];
|
||||
if ($val_num != substr($id,17, 1))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getwxdwz($channel,$longurl) {
|
||||
$id = $channel['appid'];
|
||||
$secret = $channel['appsecret'];
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=".$id."&secret=".$secret;
|
||||
$token = getAccessToken($url);
|
||||
|
||||
$arr = array('action'=>'long2short', 'long_url'=>$longurl);
|
||||
$post = json_encode($arr);
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/shorturl?access_token=".$token."";
|
||||
$result = get_curl($url, $post);
|
||||
$arr = json_decode($result, true);
|
||||
if(@array_key_exists('errcode',$arr) && $arr['errcode']==0){
|
||||
return $arr['short_url'];
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
function getAccessToken($url) {
|
||||
// access_token 应该全局存储与更新,以下代码以写入到文件中做示例
|
||||
$data = json_decode(@file_get_contents(SYSTEM_ROOT."access_token.json"), true);
|
||||
if ($data['expire_time'] < time()) {
|
||||
// 如果是企业号用以下URL获取access_token
|
||||
$output = get_curl($url);
|
||||
$res = json_decode($output, true);
|
||||
$access_token = $res['access_token'];
|
||||
if ($access_token) {
|
||||
$data['expire_time'] = time() + 600;
|
||||
$data['access_token'] = $access_token;
|
||||
file_put_contents(SYSTEM_ROOT."access_token.json", $data);
|
||||
}
|
||||
} else {
|
||||
$access_token = $data['access_token'];
|
||||
}
|
||||
return $access_token;
|
||||
}
|
||||
function getdwz($longurl){
|
||||
$url = preg_replace('/^(http|https|thunder|qqdl|ed2k|Flashget|qbrowser):\/\//i', '', $longurl);
|
||||
$url = 'https://buluo.qq.com/cgi-bin/bar/extra/gen_short_url?urls=[%22'.urlencode($url).'%22]&r=0.9179819480050355';
|
||||
$cookie = 'BULUO_TICKET=VcvoIeiMSTp1KfAJmdHdrhk87ypMYF3oykq9YIxprKLZBFoZtsNFkbm-LePkqkL1hKRqtUpBTV-eqF_4hSqOpBO3sB0; BL_ID=o3ztss1vi1w-QaMZ2MTlJveJZjNA';
|
||||
$data = get_curl($url,0,'https://buluo.qq.com/',$cookie);
|
||||
$arr = json_decode($data,true);
|
||||
$short = $arr['result']['ls'][0]['url_code'];
|
||||
if(!$short){
|
||||
return false;
|
||||
}else{
|
||||
return($short);
|
||||
}
|
||||
}
|
||||
|
||||
function qrcodelogin($image){
|
||||
$url='http://api.cccyun.cc/api/qrcode_noauth.php';
|
||||
$post='image='.urlencode($image);
|
||||
$data = get_curl($url,$post);
|
||||
$arr=json_decode($data,true);
|
||||
if(array_key_exists('code',$arr) && $arr['code']==1){
|
||||
$result=array("code"=>0,"msg"=>"succ","url"=>$arr['url']);
|
||||
}elseif(array_key_exists('msg',$arr)){
|
||||
$result=array("code"=>-1,"msg"=>$arr['msg']);
|
||||
}else{
|
||||
$result=array("code"=>-1,"msg"=>$data);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
?>
|
||||
45
includes/lib/Cache.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
namespace lib;
|
||||
|
||||
class Cache {
|
||||
public function get($key) {
|
||||
global $_CACHE;
|
||||
return $_CACHE[$key];
|
||||
}
|
||||
public function read($key = 'config') {
|
||||
global $DB;
|
||||
$value = $DB->getColumn("SELECT v FROM pre_cache WHERE k=:key LIMIT 1", [':key'=>$key]);
|
||||
return $value;
|
||||
}
|
||||
public function save($key ,$value, $expire=0) {
|
||||
if (is_array($value)) $value = serialize($value);
|
||||
global $DB;
|
||||
return $DB->exec("REPLACE INTO pre_cache VALUES (:key, :value, :expire)", [':key'=>$key, ':value'=>$value, ':expire'=>$expire]);
|
||||
}
|
||||
public function pre_fetch(){
|
||||
global $_CACHE;
|
||||
$_CACHE=array();
|
||||
$cache = $this->read('config');
|
||||
$_CACHE = @unserialize($cache);
|
||||
if(empty($_CACHE['version']))$_CACHE = $this->update();
|
||||
return $_CACHE;
|
||||
}
|
||||
public function update() {
|
||||
global $DB;
|
||||
$cache = array();
|
||||
$result = $DB->getAll("SELECT * FROM pre_config");
|
||||
foreach($result as $row){
|
||||
$cache[ $row['k'] ] = $row['v'];
|
||||
}
|
||||
$this->save('config', $cache);
|
||||
return $cache;
|
||||
}
|
||||
public function clear($key = 'config') {
|
||||
global $DB;
|
||||
return $DB->exec("UPDATE pre_cache SET v='' WHERE k=:key", [':key'=>$key]);
|
||||
}
|
||||
public function clean() {
|
||||
global $DB;
|
||||
return $DB->exec("DELETE FROM pre_cache WHERE expire>0 AND expire<'".time()."'");
|
||||
}
|
||||
}
|
||||
191
includes/lib/Channel.php
Normal file
@@ -0,0 +1,191 @@
|
||||
<?php
|
||||
namespace lib;
|
||||
|
||||
class Channel {
|
||||
|
||||
static public function get($id){
|
||||
global $DB;
|
||||
$value=$DB->getRow("SELECT * FROM pre_channel WHERE id='$id' LIMIT 1");
|
||||
return $value;
|
||||
}
|
||||
|
||||
// 支付提交处理(输入支付方式名称)
|
||||
static public function submit($type, $gid=0){
|
||||
global $DB;
|
||||
if(checkmobile()==true){
|
||||
$sqls = " AND (device=0 OR device=2)";
|
||||
}else{
|
||||
$sqls = " AND (device=0 OR device=1)";
|
||||
}
|
||||
$paytype=$DB->getRow("SELECT id,name,status FROM pre_type WHERE name='$type'{$sqls} LIMIT 1");
|
||||
if(!$paytype || $paytype['status']==0)sysmsg('支付方式(type)不存在');
|
||||
$typeid = $paytype['id'];
|
||||
$typename = $paytype['name'];
|
||||
|
||||
return self::getSubmitInfo($typeid, $typename, $gid);
|
||||
}
|
||||
|
||||
// 支付提交处理2(输入支付方式ID)
|
||||
static public function submit2($typeid, $gid=0){
|
||||
global $DB;
|
||||
$paytype=$DB->getRow("SELECT id,name,status FROM pre_type WHERE id='$typeid' LIMIT 1");
|
||||
if(!$paytype || $paytype['status']==0)sysmsg('支付方式(type)不存在');
|
||||
$typename = $paytype['name'];
|
||||
|
||||
return self::getSubmitInfo($typeid, $typename, $gid);
|
||||
}
|
||||
|
||||
//获取通道、插件、费率信息
|
||||
static public function getSubmitInfo($typeid, $typename, $gid){
|
||||
global $DB;
|
||||
if($gid>0)$groupinfo=$DB->getColumn("SELECT info FROM pre_group WHERE gid='$gid' LIMIT 1");
|
||||
if(!$groupinfo)$groupinfo=$DB->getColumn("SELECT info FROM pre_group WHERE gid=0 LIMIT 1");
|
||||
if($groupinfo){
|
||||
$info = json_decode($groupinfo,true);
|
||||
$groupinfo = $info[$typeid];
|
||||
if(is_array($groupinfo)){
|
||||
$channel = $groupinfo['channel'];
|
||||
$money_rate = $groupinfo['rate'];
|
||||
}
|
||||
else{
|
||||
$channel = -1;
|
||||
$money_rate = null;
|
||||
}
|
||||
if($channel==0){ //当前商户关闭该通道
|
||||
return false;
|
||||
}
|
||||
elseif($channel==-1){ //随机可用通道
|
||||
$row=$DB->getRow("SELECT id,plugin,status,rate,apptype FROM pre_channel WHERE type='$typeid' AND status=1 ORDER BY rand() LIMIT 1");
|
||||
if($row){
|
||||
$channel = $row['id'];
|
||||
$plugin = $row['plugin'];
|
||||
$apptype = $row['apptype'];
|
||||
if(empty($money_rate))$money_rate = $row['rate'];
|
||||
}
|
||||
}
|
||||
else{
|
||||
if($groupinfo['type']=='roll'){ //解析轮询组
|
||||
$channel = self::getChannelFromRoll($channel);
|
||||
if($channel==0){ //当前轮询组未开启
|
||||
return false;
|
||||
}
|
||||
}
|
||||
$row=$DB->getRow("SELECT plugin,status,rate,apptype FROM pre_channel WHERE id='$channel' LIMIT 1");
|
||||
if($row['status']==1){
|
||||
$plugin = $row['plugin'];
|
||||
$apptype = $row['apptype'];
|
||||
if(empty($money_rate))$money_rate = $row['rate'];
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$row=$DB->getRow("SELECT id,plugin,status,rate,apptype FROM pre_channel WHERE type='$typeid' AND status=1 ORDER BY rand() LIMIT 1");
|
||||
if($row){
|
||||
$channel = $row['id'];
|
||||
$plugin = $row['plugin'];
|
||||
$apptype = $row['apptype'];
|
||||
$money_rate = $row['rate'];
|
||||
}
|
||||
}
|
||||
if(!$plugin || !$channel){ //通道已关闭
|
||||
return false;
|
||||
}
|
||||
return ['typeid'=>$typeid, 'typename'=>$typename, 'plugin'=>$plugin, 'channel'=>$channel, 'rate'=>$money_rate, 'apptype'=>$apptype];
|
||||
}
|
||||
|
||||
// 获取当前商户可用支付方式
|
||||
static public function getTypes($gid=0){
|
||||
global $DB;
|
||||
if(checkmobile()==true){
|
||||
$sqls = " AND (device=0 OR device=2)";
|
||||
}else{
|
||||
$sqls = " AND (device=0 OR device=1)";
|
||||
}
|
||||
$rows = $DB->getAll("SELECT * FROM pre_type WHERE status=1{$sqls}");
|
||||
$paytype = [];
|
||||
foreach($rows as $row){
|
||||
$paytype[$row['id']] = $row;
|
||||
}
|
||||
if($gid>0)$groupinfo=$DB->getColumn("SELECT info FROM pre_group WHERE gid='$gid' LIMIT 1");
|
||||
if(!$groupinfo)$groupinfo=$DB->getColumn("SELECT info FROM pre_group WHERE gid=0 LIMIT 1");
|
||||
if($groupinfo){
|
||||
$info = json_decode($groupinfo,true);
|
||||
foreach($info as $id=>$row){
|
||||
if(!isset($paytype[$id]))continue;
|
||||
if($row['channel']==0){
|
||||
unset($paytype[$id]);
|
||||
}elseif($row['channel']==-1){
|
||||
$status=$DB->getColumn("SELECT status FROM pre_channel WHERE type='$id' AND status=1 LIMIT 1");
|
||||
if(!$status || $status==0){
|
||||
unset($paytype[$id]);
|
||||
}elseif(empty($row['rate'])){
|
||||
$paytype[$id]['rate']=$DB->getColumn("SELECT rate FROM pre_channel WHERE type='$id' AND status=1 LIMIT 1");
|
||||
}else{
|
||||
$paytype[$id]['rate']=$row['rate'];
|
||||
}
|
||||
}else{
|
||||
if($row['type']=='roll'){
|
||||
$status=$DB->getColumn("SELECT status FROM pre_roll WHERE id='{$row['channel']}' LIMIT 1");
|
||||
}else{
|
||||
$status=$DB->getColumn("SELECT status FROM pre_channel WHERE id='{$row['channel']}' LIMIT 1");
|
||||
}
|
||||
if(!$status || $status==0)unset($paytype[$id]);
|
||||
else $paytype[$id]['rate']=$row['rate'];
|
||||
}
|
||||
}
|
||||
}else{
|
||||
foreach($paytype as $id=>$row){
|
||||
$status=$DB->getColumn("SELECT status FROM pre_channel WHERE type='$id' AND status=1 limit 1");
|
||||
if(!$status || $status==0)unset($paytype[$id]);
|
||||
else{
|
||||
$paytype[$id]['rate']=$DB->getColumn("SELECT rate FROM pre_channel WHERE type='$id' AND status=1 limit 1");
|
||||
}
|
||||
}
|
||||
}
|
||||
return $paytype;
|
||||
}
|
||||
|
||||
//根据轮询组ID获取支付通道ID
|
||||
static private function getChannelFromRoll($channel){
|
||||
global $DB;
|
||||
$row=$DB->getRow("SELECT * FROM pre_roll WHERE id='$channel' LIMIT 1");
|
||||
if($row['status']==1){
|
||||
$info = self::rollinfo_decode($row['info'],true);
|
||||
if($row['kind']==1){
|
||||
$channel = self::random_weight($info);
|
||||
}else{
|
||||
$channel = $info[$row['index']]['name'];
|
||||
$index = ($row['index'] + 1) % count($info);
|
||||
$DB->exec("UPDATE pre_roll SET `index`='$index' WHERE id='{$row['id']}'");
|
||||
}
|
||||
return $channel;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//解析轮询组info
|
||||
static private function rollinfo_decode($content){
|
||||
$result = [];
|
||||
$arr = explode(',',$content);
|
||||
foreach($arr as $row){
|
||||
$a = explode(':',$row);
|
||||
$result[] = ['name'=>$a[0], 'weight'=>$a[1]];
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
//加权随机
|
||||
static private function random_weight($arr){
|
||||
$weightSum = 0;
|
||||
foreach ($arr as $value) {
|
||||
$weightSum += $value['weight'];
|
||||
}
|
||||
if($weightSum<=0)return false;
|
||||
$randNum = rand(1, $weightSum);
|
||||
foreach ($arr as $k => $v) {
|
||||
if ($randNum <= $v['weight']) {
|
||||
return $v['name'];
|
||||
}
|
||||
$randNum -=$v['weight'];
|
||||
}
|
||||
}
|
||||
}
|
||||
273
includes/lib/GeetestLib.php
Normal file
@@ -0,0 +1,273 @@
|
||||
<?php
|
||||
namespace lib;
|
||||
/**
|
||||
* 极验行为式验证安全平台,php 网站主后台包含的库文件
|
||||
*
|
||||
* @author Tanxu
|
||||
*/
|
||||
class GeetestLib {
|
||||
const GT_SDK_VERSION = 'php_3.0.0';
|
||||
|
||||
public static $connectTimeout = 1;
|
||||
public static $socketTimeout = 1;
|
||||
|
||||
private $response;
|
||||
private $captcha_id;
|
||||
private $private_key;
|
||||
|
||||
public function __construct($captcha_id, $private_key) {
|
||||
$this->captcha_id = $captcha_id;
|
||||
$this->private_key = $private_key;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断极验服务器是否down机
|
||||
*
|
||||
* @param array $data
|
||||
* @return int
|
||||
*/
|
||||
public function pre_process($param, $new_captcha=1) {
|
||||
if(!empty($this->captcha_id) && !empty($this->private_key)){
|
||||
$data = array('gt'=>$this->captcha_id,
|
||||
'new_captcha'=>$new_captcha
|
||||
);
|
||||
$data = array_merge($data,$param);
|
||||
$query = http_build_query($data);
|
||||
$url = "http://api.geetest.com/register.php?" . $query;
|
||||
$challenge = $this->send_request($url);
|
||||
if (strlen($challenge) != 32) {
|
||||
$this->failback_process();
|
||||
return 0;
|
||||
}
|
||||
$this->success_process($challenge);
|
||||
return 1;
|
||||
}else{
|
||||
$url = "https://www.geetest.com/demo/gt/register-slide?t=" . time() . "123";
|
||||
$data = get_curl($url,0,'https://www.geetest.com/demo/slide-popup.html');
|
||||
$this->response = json_decode($data, true);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $challenge
|
||||
*/
|
||||
private function success_process($challenge) {
|
||||
$challenge = md5($challenge . $this->private_key);
|
||||
$result = array(
|
||||
'success' => 1,
|
||||
'gt' => $this->captcha_id,
|
||||
'challenge' => $challenge,
|
||||
'new_captcha'=>1
|
||||
);
|
||||
$this->response = $result;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function failback_process() {
|
||||
$rnd1 = md5(rand(0, 100));
|
||||
$rnd2 = md5(rand(0, 100));
|
||||
$challenge = $rnd1 . substr($rnd2, 0, 2);
|
||||
$result = array(
|
||||
'success' => 0,
|
||||
'gt' => $this->captcha_id,
|
||||
'challenge' => $challenge,
|
||||
'new_captcha'=>1
|
||||
);
|
||||
$this->response = $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_response_str() {
|
||||
return json_encode($this->response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回数组方便扩展
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_response() {
|
||||
return $this->response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 正常模式获取验证结果
|
||||
*
|
||||
* @param string $challenge
|
||||
* @param string $validate
|
||||
* @param string $seccode
|
||||
* @param array $param
|
||||
* @return int
|
||||
*/
|
||||
public function success_validate($challenge, $validate, $seccode,$param, $json_format=1) {
|
||||
if(!empty($this->captcha_id) && !empty($this->private_key)){
|
||||
if (!$this->check_validate($challenge, $validate)) {
|
||||
return 0;
|
||||
}
|
||||
$query = array(
|
||||
"seccode" => $seccode,
|
||||
"timestamp"=>time(),
|
||||
"challenge"=>$challenge,
|
||||
"captchaid"=>$this->captcha_id,
|
||||
"json_format"=>$json_format,
|
||||
"sdk" => self::GT_SDK_VERSION
|
||||
);
|
||||
$query = array_merge($query,$param);
|
||||
$url = "http://api.geetest.com/validate.php";
|
||||
$codevalidate = $this->post_request($url, $query);
|
||||
$obj = json_decode($codevalidate,true);
|
||||
if ($obj === false){
|
||||
return 0;
|
||||
}
|
||||
if ($obj['seccode'] == md5($seccode)) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}else{
|
||||
$url = "https://www.geetest.com/demo/gt/validate-slide";
|
||||
$post = "geetest_challenge=".$challenge."&geetest_validate=".$validate."&geetest_seccode=".$seccode;
|
||||
$data = get_curl($url,$post,'https://www.geetest.com/demo/slide-popup.html');
|
||||
$arr = json_decode($data, true);
|
||||
if($arr['status'] == 'success')return 1;
|
||||
else return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 宕机模式获取验证结果
|
||||
*
|
||||
* @param $challenge
|
||||
* @param $validate
|
||||
* @param $seccode
|
||||
* @return int
|
||||
*/
|
||||
public function fail_validate($challenge, $validate, $seccode) {
|
||||
if(md5($challenge) == $validate){
|
||||
return 1;
|
||||
}else{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $challenge
|
||||
* @param $validate
|
||||
* @return bool
|
||||
*/
|
||||
private function check_validate($challenge, $validate) {
|
||||
if (strlen($validate) != 32) {
|
||||
return false;
|
||||
}
|
||||
if (md5($this->private_key . 'geetest' . $challenge) != $validate) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* GET 请求
|
||||
*
|
||||
* @param $url
|
||||
* @return mixed|string
|
||||
*/
|
||||
private function send_request($url) {
|
||||
|
||||
if (function_exists('curl_exec')) {
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, self::$connectTimeout);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, self::$socketTimeout);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
$curl_errno = curl_errno($ch);
|
||||
$data = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
if ($curl_errno >0) {
|
||||
return 0;
|
||||
}else{
|
||||
return $data;
|
||||
}
|
||||
} else {
|
||||
$opts = array(
|
||||
'http' => array(
|
||||
'method' => "GET",
|
||||
'timeout' => self::$connectTimeout + self::$socketTimeout,
|
||||
)
|
||||
);
|
||||
$context = stream_context_create($opts);
|
||||
$data = @file_get_contents($url, false, $context);
|
||||
if($data){
|
||||
return $data;
|
||||
}else{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param $url
|
||||
* @param array $postdata
|
||||
* @return mixed|string
|
||||
*/
|
||||
private function post_request($url, $postdata = '') {
|
||||
if (!$postdata) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$data = http_build_query($postdata);
|
||||
if (function_exists('curl_exec')) {
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, self::$connectTimeout);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, self::$socketTimeout);
|
||||
|
||||
//不可能执行到的代码
|
||||
if (!$postdata) {
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
|
||||
} else {
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
|
||||
}
|
||||
$data = curl_exec($ch);
|
||||
|
||||
if (curl_errno($ch)) {
|
||||
$err = sprintf("curl[%s] error[%s]", $url, curl_errno($ch) . ':' . curl_error($ch));
|
||||
$this->triggerError($err);
|
||||
}
|
||||
|
||||
curl_close($ch);
|
||||
} else {
|
||||
if ($postdata) {
|
||||
$opts = array(
|
||||
'http' => array(
|
||||
'method' => 'POST',
|
||||
'header' => "Content-type: application/x-www-form-urlencoded\r\n" . "Content-Length: " . strlen($data) . "\r\n",
|
||||
'content' => $data,
|
||||
'timeout' => self::$connectTimeout + self::$socketTimeout
|
||||
)
|
||||
);
|
||||
$context = stream_context_create($opts);
|
||||
$data = file_get_contents($url, false, $context);
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param $err
|
||||
*/
|
||||
private function triggerError($err) {
|
||||
trigger_error($err);
|
||||
}
|
||||
}
|
||||
88
includes/lib/PayUtils.php
Normal file
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
namespace lib;
|
||||
|
||||
class PayUtils {
|
||||
|
||||
/**
|
||||
* 把数组所有元素,按照“参数=参数值”的模式用“&”字符拼接成字符串
|
||||
* @param $para 需要拼接的数组
|
||||
* return 拼接完成以后的字符串
|
||||
*/
|
||||
static public function createLinkstring($para) {
|
||||
$arg = "";
|
||||
foreach ($para as $key=>$val) {
|
||||
$arg.=$key."=".$val."&";
|
||||
}
|
||||
//去掉最后一个&字符
|
||||
$arg = substr($arg,0,-1);
|
||||
|
||||
return $arg;
|
||||
}
|
||||
/**
|
||||
* 把数组所有元素,按照“参数=参数值”的模式用“&”字符拼接成字符串,并对字符串做urlencode编码
|
||||
* @param $para 需要拼接的数组
|
||||
* return 拼接完成以后的字符串
|
||||
*/
|
||||
static public function createLinkstringUrlencode($para) {
|
||||
$arg = "";
|
||||
foreach ($para as $key=>$val) {
|
||||
$arg.=$key."=".urlencode($val)."&";
|
||||
}
|
||||
//去掉最后一个&字符
|
||||
$arg = substr($arg,0,-1);
|
||||
|
||||
return $arg;
|
||||
}
|
||||
/**
|
||||
* 除去数组中的空值和签名参数
|
||||
* @param $para 签名参数组
|
||||
* return 去掉空值与签名参数后的新签名参数组
|
||||
*/
|
||||
static public function paraFilter($para) {
|
||||
$para_filter = array();
|
||||
foreach ($para as $key=>$val) {
|
||||
if($key == "sign" || $key == "sign_type" || $val == "")continue;
|
||||
else $para_filter[$key] = $para[$key];
|
||||
}
|
||||
return $para_filter;
|
||||
}
|
||||
/**
|
||||
* 对数组排序
|
||||
* @param $para 排序前的数组
|
||||
* return 排序后的数组
|
||||
*/
|
||||
static public function argSort($para) {
|
||||
ksort($para);
|
||||
reset($para);
|
||||
return $para;
|
||||
}
|
||||
/**
|
||||
* 签名字符串
|
||||
* @param $prestr 需要签名的字符串
|
||||
* @param $key 私钥
|
||||
* return 签名结果
|
||||
*/
|
||||
static public function md5Sign($prestr, $key) {
|
||||
$prestr = $prestr . $key;
|
||||
return md5($prestr);
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证签名
|
||||
* @param $prestr 需要签名的字符串
|
||||
* @param $sign 签名结果
|
||||
* @param $key 私钥
|
||||
* return 签名结果
|
||||
*/
|
||||
static public function md5Verify($prestr, $sign, $key) {
|
||||
$prestr = $prestr . $key;
|
||||
$mysgin = md5($prestr);
|
||||
|
||||
if($mysgin == $sign) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||