2020.02新版
465
user/ajax.php
Normal file
@@ -0,0 +1,465 @@
|
||||
<?php
|
||||
include("../includes/common.php");
|
||||
$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 'testpay':
|
||||
if(!$conf['test_open'])exit('{"code":-1,"msg":"未开启测试支付"}');
|
||||
$money=trim(daddslashes($_POST['money']));
|
||||
$typeid=intval($_POST['typeid']);
|
||||
$name = '支付测试';
|
||||
if(!$_POST['csrf_token'] || $_POST['csrf_token']!=$_SESSION['csrf_token'])exit('{"code":-1,"msg":"CSRF TOKEN ERROR"}');
|
||||
if($money<=0 || !is_numeric($money) || !preg_match('/^[0-9.]+$/', $money))exit('{"code":-1,"msg":"金额不合法"}');
|
||||
if($conf['pay_maxmoney']>0 && $money>$conf['pay_maxmoney'])exit('{"code":-1,"msg":"最大支付金额是'.$conf['pay_maxmoney'].'元"}');
|
||||
if($conf['pay_minmoney']>0 && $money<$conf['pay_minmoney'])exit('{"code":-1,"msg":"最小支付金额是'.$conf['pay_minmoney'].'元"}');
|
||||
$trade_no=date("YmdHis").rand(11111,99999);
|
||||
$return_url=$siteurl.'user/test.php?ok=1&trade_no='.$trade_no;
|
||||
$domain=getdomain($return_url);
|
||||
if(!$DB->exec("INSERT INTO `pre_order` (`trade_no`,`out_trade_no`,`uid`,`tid`,`addtime`,`name`,`money`,`notify_url`,`return_url`,`domain`,`ip`,`status`) VALUES (:trade_no, :out_trade_no, :uid, 3, NOW(), :name, :money, :notify_url, :return_url, :domain, :clientip, 0)", [':trade_no'=>$trade_no, ':out_trade_no'=>$trade_no, ':uid'=>$conf['test_pay_uid'], ':name'=>$name, ':money'=>$money, ':notify_url'=>$return_url, ':return_url'=>$return_url, ':domain'=>$domain, ':clientip'=>$clientip]))exit('{"code":-1,"msg":"创建订单失败,请返回重试!"}');
|
||||
$result = ['code'=>0, 'msg'=>'succ', 'url'=>'../submit2.php?typeid='.$typeid.'&trade_no='.$trade_no];
|
||||
exit(json_encode($result));
|
||||
break;
|
||||
case 'login':
|
||||
$type=intval($_POST['type']);
|
||||
$user=trim(daddslashes($_POST['user']));
|
||||
$pass=trim(daddslashes($_POST['pass']));
|
||||
if(empty($user) || empty($pass))exit('{"code":-1,"msg":"请确保各项不能为空"}');
|
||||
if(!$_POST['csrf_token'] || $_POST['csrf_token']!=$_SESSION['csrf_token'])exit('{"code":-1,"msg":"CSRF TOKEN ERROR"}');
|
||||
|
||||
if($conf['captcha_open_login']==1){
|
||||
$GtSdk = new \lib\GeetestLib($conf['CAPTCHA_ID'], $conf['PRIVATE_KEY']);
|
||||
$data = array(
|
||||
'user_id' => 'public', # 网站用户id
|
||||
'client_type' => "web", # web:电脑上的浏览器;h5:手机上的浏览器,包括移动应用内完全内置的web_view;native:通过原生SDK植入APP应用的方式
|
||||
'ip_address' => $clientip # 请在此处传输用户请求验证时所携带的IP
|
||||
);
|
||||
if ($_SESSION['gtserver'] == 1) { //服务器正常
|
||||
$result = $GtSdk->success_validate($_POST['geetest_challenge'], $_POST['geetest_validate'], $_POST['geetest_seccode'], $data);
|
||||
if ($result) {
|
||||
//echo '{"status":"success"}';
|
||||
} else{
|
||||
exit('{"code":-1,"msg":"验证失败,请重新验证"}');
|
||||
}
|
||||
}else{ //服务器宕机,走failback模式
|
||||
if ($GtSdk->fail_validate($_POST['geetest_challenge'],$_POST['geetest_validate'],$_POST['geetest_seccode'])) {
|
||||
//echo '{"status":"success"}';
|
||||
}else{
|
||||
exit('{"code":-1,"msg":"验证失败,请重新验证"}');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($type==1 && is_numeric($user) && strlen($user)<=6)$type=0;
|
||||
if($type==1){
|
||||
$userrow=$DB->getRow("SELECT * FROM pre_user WHERE email='{$user}' OR phone='{$user}' limit 1");
|
||||
$pass=getMd5Pwd($pass, $userrow['uid']);
|
||||
}else{
|
||||
$userrow=$DB->getRow("SELECT * FROM pre_user WHERE uid='{$user}' limit 1");
|
||||
if($userrow && $userrow['keylogin']==0){
|
||||
exit('{"code":-1,"msg":"该商户未开启密钥登录,请使用账号密码登录!"}');
|
||||
}
|
||||
}
|
||||
if($userrow && ($type==0 && $pass==$userrow['key'] || $type==1 && $pass==$userrow['pwd'])) {
|
||||
$uid = $userrow['uid'];
|
||||
if($user_id=$_SESSION['Oauth_alipay_uid']){
|
||||
$DB->exec("update `pre_user` set `alipay_uid` ='$user_id' where `uid`='$uid'");
|
||||
unset($_SESSION['Oauth_alipay_uid']);
|
||||
}
|
||||
if($qq_uid=$_SESSION['Oauth_qq_uid']){
|
||||
$DB->exec("update `pre_user` set `qq_uid` ='$qq_uid' where `uid`='$uid'");
|
||||
unset($_SESSION['Oauth_qq_uid']);
|
||||
}
|
||||
$city=get_ip_city($clientip);
|
||||
$DB->exec("insert into `pre_log` (`uid`,`type`,`date`,`ip`,`city`) values ('".$uid."','普通登录','".$date."','".$clientip."','".$city."')");
|
||||
$session=md5($uid.$userrow['key'].$password_hash);
|
||||
$expiretime=time()+604800;
|
||||
$token=authcode("{$uid}\t{$session}\t{$expiretime}", 'ENCODE', SYS_KEY);
|
||||
ob_clean();
|
||||
setcookie("user_token", $token, time() + 604800);
|
||||
$DB->exec("update `pre_user` set `lasttime` ='$date' where `uid`='$uid'");
|
||||
if(empty($userrow['account']) || empty($userrow['username'])){
|
||||
$result=array("code"=>0,"msg"=>"登录成功!正在跳转到收款账号设置","url"=>"./editinfo.php?start=1");
|
||||
}else{
|
||||
$result=array("code"=>0,"msg"=>"登录成功!正在跳转到用户中心","url"=>"./");
|
||||
}
|
||||
unset($_SESSION['csrf_token']);
|
||||
}else {
|
||||
$result=array("code"=>-1,"msg"=>"用户名或密码不正确!");
|
||||
}
|
||||
exit(json_encode($result));
|
||||
break;
|
||||
case 'captcha':
|
||||
$GtSdk = new \lib\GeetestLib($conf['CAPTCHA_ID'], $conf['PRIVATE_KEY']);
|
||||
$data = array(
|
||||
'user_id' => isset($uid)?$uid:'public', # 网站用户id
|
||||
'client_type' => "web", # web:电脑上的浏览器;h5:手机上的浏览器,包括移动应用内完全内置的web_view;native:通过原生SDK植入APP应用的方式
|
||||
'ip_address' => $clientip # 请在此处传输用户请求验证时所携带的IP
|
||||
);
|
||||
$status = $GtSdk->pre_process($data, 1);
|
||||
$_SESSION['gtserver'] = $status;
|
||||
$_SESSION['user_id'] = isset($uid)?$uid:'public';
|
||||
echo $GtSdk->get_response_str();
|
||||
break;
|
||||
case 'sendcode':
|
||||
$sendto=daddslashes(htmlspecialchars(strip_tags(trim($_POST['sendto']))));
|
||||
if($conf['reg_open']==0)exit('{"code":-1,"msg":"未开放商户申请"}');
|
||||
if(isset($_SESSION['send_mail']) && $_SESSION['send_mail']>time()-10){
|
||||
exit('{"code":-1,"msg":"请勿频繁发送验证码"}');
|
||||
}
|
||||
|
||||
$GtSdk = new \lib\GeetestLib($conf['CAPTCHA_ID'], $conf['PRIVATE_KEY']);
|
||||
|
||||
$data = array(
|
||||
'user_id' => 'public', # 网站用户id
|
||||
'client_type' => "web", # web:电脑上的浏览器;h5:手机上的浏览器,包括移动应用内完全内置的web_view;native:通过原生SDK植入APP应用的方式
|
||||
'ip_address' => $clientip # 请在此处传输用户请求验证时所携带的IP
|
||||
);
|
||||
|
||||
if ($_SESSION['gtserver'] == 1) { //服务器正常
|
||||
$result = $GtSdk->success_validate($_POST['geetest_challenge'], $_POST['geetest_validate'], $_POST['geetest_seccode'], $data);
|
||||
if ($result) {
|
||||
//echo '{"status":"success"}';
|
||||
} else{
|
||||
exit('{"code":-1,"msg":"验证失败,请重新验证"}');
|
||||
}
|
||||
}else{ //服务器宕机,走failback模式
|
||||
if ($GtSdk->fail_validate($_POST['geetest_challenge'],$_POST['geetest_validate'],$_POST['geetest_seccode'])) {
|
||||
//echo '{"status":"success"}';
|
||||
}else{
|
||||
exit('{"code":-1,"msg":"验证失败,请重新验证"}');
|
||||
}
|
||||
}
|
||||
|
||||
if($conf['verifytype']==1){
|
||||
$phone = $sendto;
|
||||
$row=$DB->getRow("select * from pre_user where phone='$phone' limit 1");
|
||||
if($row){
|
||||
exit('{"code":-1,"msg":"该手机号已经注册过商户,如需找回商户信息,请返回登录页面点击找回商户"}');
|
||||
}
|
||||
$row=$DB->getRow("select * from pre_regcode where `to`='$phone' order by id desc limit 1");
|
||||
if($row['time']>time()-60){
|
||||
exit('{"code":-1,"msg":"两次发送短信之间需要相隔60秒!"}');
|
||||
}
|
||||
$count=$DB->getColumn("select count(*) from pre_regcode where `to`='$phone' and time>'".(time()-3600*24)."'");
|
||||
if($count>2){
|
||||
exit('{"code":-1,"msg":"该手机号码发送次数过多,请更换号码!"}');
|
||||
}
|
||||
$count=$DB->getColumn("select count(*) from pre_regcode where ip='$clientip' and time>'".(time()-3600*24)."'");
|
||||
if($count>5){
|
||||
exit('{"code":-1,"msg":"你今天发送次数过多,已被禁止注册"}');
|
||||
}
|
||||
$code = rand(111111,999999);
|
||||
$result = send_sms($phone, $code, 'reg');
|
||||
if($result===true){
|
||||
if($DB->exec("insert into `pre_regcode` (`type`,`code`,`to`,`time`,`ip`,`status`) values ('1','".$code."','".$phone."','".time()."','".$clientip."','0')")){
|
||||
$_SESSION['send_mail']=time();
|
||||
exit('{"code":0,"msg":"succ"}');
|
||||
}else{
|
||||
exit('{"code":-1,"msg":"写入数据库失败。'.$DB->error().'"}');
|
||||
}
|
||||
}else{
|
||||
exit('{"code":-1,"msg":"短信发送失败 '.$result.'"}');
|
||||
}
|
||||
}else{
|
||||
$email = $sendto;
|
||||
$row=$DB->getRow("select * from pre_user where email='$email' limit 1");
|
||||
if($row){
|
||||
exit('{"code":-1,"msg":"该邮箱已经注册过商户,如需找回商户信息,请返回登录页面点击找回商户"}');
|
||||
}
|
||||
$row=$DB->getRow("select * from pre_regcode where `to`='$email' order by id desc limit 1");
|
||||
if($row['time']>time()-60){
|
||||
exit('{"code":-1,"msg":"两次发送邮件之间需要相隔60秒!"}');
|
||||
}
|
||||
$count=$DB->getColumn("select count(*) from pre_regcode where `to`='$email' and time>'".(time()-3600*24)."'");
|
||||
if($count>6){
|
||||
exit('{"code":-1,"msg":"该邮箱发送次数过多,请更换邮箱!"}');
|
||||
}
|
||||
$count=$DB->getColumn("select count(*) from pre_regcode where ip='$clientip' and time>'".(time()-3600*24)."'");
|
||||
if($count>10){
|
||||
exit('{"code":-1,"msg":"你今天发送次数过多,已被禁止注册"}');
|
||||
}
|
||||
$sub = $conf['sitename'].' - 验证码获取';
|
||||
$code = rand(1111111,9999999);
|
||||
$msg = '您的验证码是:'.$code;
|
||||
$result = send_mail($email, $sub, $msg);
|
||||
if($result===true){
|
||||
if($DB->exec("insert into `pre_regcode` (`type`,`code`,`to`,`time`,`ip`,`status`) values ('0','".$code."','".$email."','".time()."','".$clientip."','0')")){
|
||||
$_SESSION['send_mail']=time();
|
||||
exit('{"code":0,"msg":"succ"}');
|
||||
}else{
|
||||
exit('{"code":-1,"msg":"写入数据库失败。'.$DB->error().'"}');
|
||||
}
|
||||
}else{
|
||||
file_put_contents('mail.log',$result);
|
||||
exit('{"code":-1,"msg":"邮件发送失败"}');
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'reg':
|
||||
if($conf['reg_open']==0)exit('{"code":-1,"msg":"未开放商户申请"}');
|
||||
$email=daddslashes(htmlspecialchars(strip_tags(trim($_POST['email']))));
|
||||
$phone=daddslashes(htmlspecialchars(strip_tags(trim($_POST['phone']))));
|
||||
$code=trim(daddslashes($_POST['code']));
|
||||
$pwd=trim(daddslashes($_POST['pwd']));
|
||||
|
||||
if(isset($_SESSION['reg_submit']) && $_SESSION['reg_submit']>time()-600){
|
||||
exit('{"code":-1,"msg":"请勿频繁注册"}');
|
||||
}
|
||||
if($conf['verifytype']==1 && empty($phone) || $conf['verifytype']==0 && empty($email) || empty($code) || empty($pwd)){
|
||||
exit('{"code":-1,"msg":"请确保各项不能为空"}');
|
||||
}
|
||||
if(!$_POST['csrf_token'] || $_POST['csrf_token']!=$_SESSION['csrf_token'])exit('{"code":-1,"msg":"CSRF TOKEN ERROR"}');
|
||||
if (strlen($pwd) < 6) {
|
||||
exit('{"code":-1,"msg":"密码不能低于6位"}');
|
||||
}elseif ($pwd == $email) {
|
||||
exit('{"code":-1,"msg":"密码不能和邮箱相同"}');
|
||||
}elseif ($pwd == $phone) {
|
||||
exit('{"code":-1,"msg":"密码不能和手机号码相同"}');
|
||||
}elseif (is_numeric($pwd)) {
|
||||
exit('{"code":-1,"msg":"密码不能为纯数字"}');
|
||||
}
|
||||
if($conf['verifytype']==1){
|
||||
if(!is_numeric($phone) || strlen($phone)!=11){
|
||||
exit('{"code":-1,"msg":"手机号码不正确"}');
|
||||
}
|
||||
$row=$DB->getRow("select * from pre_user where phone='$phone' limit 1");
|
||||
if($row){
|
||||
exit('{"code":-1,"msg":"该手机号已经注册过商户,如需找回商户信息,请返回登录页面点击找回商户"}');
|
||||
}
|
||||
}else{
|
||||
if(!preg_match('/^[A-z0-9._-]+@[A-z0-9._-]+\.[A-z0-9._-]+$/', $email)){
|
||||
exit('{"code":-1,"msg":"邮箱格式不正确"}');
|
||||
}
|
||||
$row=$DB->getRow("select * from pre_user where email='$email' limit 1");
|
||||
if($row){
|
||||
exit('{"code":-1,"msg":"该邮箱已经注册过商户,如需找回商户信息,请返回登录页面点击找回商户"}');
|
||||
}
|
||||
}
|
||||
if($conf['verifytype']==1){
|
||||
$row=$DB->getRow("select * from pre_regcode where type=1 and code='$code' and `to`='$phone' order by id desc limit 1");
|
||||
}else{
|
||||
$row=$DB->getRow("select * from pre_regcode where type=0 and code='$code' and `to`='$email' order by id desc limit 1");
|
||||
}
|
||||
if(!$row){
|
||||
exit('{"code":-1,"msg":"验证码不正确!"}');
|
||||
}
|
||||
if($row['time']<time()-3600 || $row['status']>0){
|
||||
exit('{"code":-1,"msg":"验证码已失效,请重新获取"}');
|
||||
}
|
||||
if($conf['reg_pay']==1){
|
||||
$gid = $DB->getColumn("SELECT gid FROM pre_user WHERE uid='{$conf['reg_pay_uid']}' limit 1");
|
||||
if($gid===false)exit('{"code":-1,"msg":"注册收款商户ID不存在"}');
|
||||
$return_url = $siteurl.'user/reg.php?regok=1';
|
||||
$trade_no=date("YmdHis").rand(11111,99999);
|
||||
$domain=getdomain($return_url);
|
||||
if(!$DB->exec("INSERT INTO `pre_order` (`trade_no`,`out_trade_no`,`uid`,`tid`,`addtime`,`name`,`money`,`notify_url`,`return_url`,`domain`,`ip`,`status`) VALUES (:trade_no, :out_trade_no, :uid, 1, NOW(), :name, :money, :notify_url, :return_url, :domain, :clientip, 0)", [':trade_no'=>$trade_no, ':out_trade_no'=>$trade_no, ':uid'=>$conf['reg_pay_uid'], ':name'=>'商户申请', ':money'=>$conf['reg_pay_price'], ':notify_url'=>$return_url, ':return_url'=>$return_url, ':domain'=>$domain, ':clientip'=>$clientip]))
|
||||
exit('{"code":-1,"msg":"创建订单失败,请返回重试!"}');
|
||||
|
||||
$cacheData = ['verifytype'=>$conf['verifytype'], 'email'=>$email, 'phone'=>$phone, 'pwd'=>$pwd, 'addtime'=>$date, 'codeid'=>$row['id']];
|
||||
$sds = $CACHE->save('reg_'.$trade_no ,$cacheData, time()+3600);
|
||||
if($sds){
|
||||
$paytype = \lib\Channel::getTypes($gid);
|
||||
$result=array("code"=>2,"msg"=>"订单创建成功!","trade_no"=>$trade_no,"need"=>$conf['reg_pay_price'],"paytype"=>$paytype);
|
||||
unset($_SESSION['csrf_token']);
|
||||
}else{
|
||||
$result=array("code"=>-1,"msg"=>"订单创建失败!".$DB->error());
|
||||
}
|
||||
}else{
|
||||
$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, NOW(), 1, 1, 0, 0, 1)", [':key'=>$key, ':email'=>$email, ':phone'=>$phone]);
|
||||
$uid=$DB->lastInsertId();
|
||||
if($sds){
|
||||
$pwd = getMd5Pwd($pwd, $uid);
|
||||
$DB->exec("update `pre_user` set `pwd` ='{$pwd}' where `uid`='$uid'");
|
||||
if(!empty($email)){
|
||||
$sub = $conf['sitename'].' - 注册成功通知';
|
||||
$msg = '<h2>商户注册成功通知</h2>感谢您注册'.$conf['sitename'].'!<br/>您的登录账号:'.($info['email']?$info['email']:$info['phone']).'<br/>您的商户ID:'.$uid.'<br/>您的商户秘钥:'.$key.'<br/>'.$conf['sitename'].'官网:<a href="http://'.$_SERVER['HTTP_HOST'].'/" target="_blank">'.$_SERVER['HTTP_HOST'].'</a><br/>【<a href="'.$siteurl.'user/" target="_blank">商户管理后台</a>】';
|
||||
$result = send_mail($email, $sub, $msg);
|
||||
}
|
||||
$DB->exec("update `pre_regcode` set `status` ='1' where `id`='{$row['id']}'");
|
||||
$_SESSION['reg_submit']=time();
|
||||
$result=array("code"=>1,"msg"=>"申请商户成功!","uid"=>$uid,"key"=>$key);
|
||||
unset($_SESSION['csrf_token']);
|
||||
}else{
|
||||
$result=array("code"=>-1,"msg"=>"申请商户失败!".$DB->error());
|
||||
}
|
||||
}
|
||||
exit(json_encode($result));
|
||||
break;
|
||||
case 'sendcode2':
|
||||
$verifytype=$_POST['type'];
|
||||
$sendto=daddslashes(htmlspecialchars(strip_tags(trim($_POST['sendto']))));
|
||||
if(isset($_SESSION['send_mail']) && $_SESSION['send_mail']>time()-10){
|
||||
exit('{"code":-1,"msg":"请勿频繁发送验证码"}');
|
||||
}
|
||||
|
||||
$GtSdk = new \lib\GeetestLib($conf['CAPTCHA_ID'], $conf['PRIVATE_KEY']);
|
||||
|
||||
$data = array(
|
||||
'user_id' => 'public', # 网站用户id
|
||||
'client_type' => "web", # web:电脑上的浏览器;h5:手机上的浏览器,包括移动应用内完全内置的web_view;native:通过原生SDK植入APP应用的方式
|
||||
'ip_address' => $clientip # 请在此处传输用户请求验证时所携带的IP
|
||||
);
|
||||
|
||||
if ($_SESSION['gtserver'] == 1) { //服务器正常
|
||||
$result = $GtSdk->success_validate($_POST['geetest_challenge'], $_POST['geetest_validate'], $_POST['geetest_seccode'], $data);
|
||||
if ($result) {
|
||||
//echo '{"status":"success"}';
|
||||
} else{
|
||||
exit('{"code":-1,"msg":"验证失败,请重新验证"}');
|
||||
}
|
||||
}else{ //服务器宕机,走failback模式
|
||||
if ($GtSdk->fail_validate($_POST['geetest_challenge'],$_POST['geetest_validate'],$_POST['geetest_seccode'])) {
|
||||
//echo '{"status":"success"}';
|
||||
}else{
|
||||
exit('{"code":-1,"msg":"验证失败,请重新验证"}');
|
||||
}
|
||||
}
|
||||
|
||||
if($verifytype=='phone'){
|
||||
$phone = $sendto;
|
||||
$userrow=$DB->getRow("select * from pre_user where phone='$phone' limit 1");
|
||||
if(!$userrow){
|
||||
exit('{"code":-1,"msg":"该手机号未找到注册商户"}');
|
||||
}
|
||||
$row=$DB->getRow("select * from pre_regcode where `to`='$phone' order by id desc limit 1");
|
||||
if($row['time']>time()-60){
|
||||
exit('{"code":-1,"msg":"两次发送短信之间需要相隔60秒!"}');
|
||||
}
|
||||
$count=$DB->getColumn("select count(*) from pre_regcode where `to`='$phone' and time>'".(time()-3600*24)."'");
|
||||
if($count>2){
|
||||
exit('{"code":-1,"msg":"该手机号码发送次数过多,请更换号码!"}');
|
||||
}
|
||||
$count=$DB->getColumn("select count(*) from pre_regcode where ip='$clientip' and time>'".(time()-3600*24)."'");
|
||||
if($count>5){
|
||||
exit('{"code":-1,"msg":"你今天发送次数过多,已被禁止找回密码"}');
|
||||
}
|
||||
$code = rand(111111,999999);
|
||||
$result = send_sms($phone, $code, 'find');
|
||||
if($result===true){
|
||||
if($DB->exec("insert into `pre_regcode` (`uid`,`type`,`code`,`to`,`time`,`ip`,`status`) values ('".$userrow['uid']."','5','".$code."','".$phone."','".time()."','".$clientip."','0')")){
|
||||
$_SESSION['send_mail']=time();
|
||||
exit('{"code":0,"msg":"succ"}');
|
||||
}else{
|
||||
exit('{"code":-1,"msg":"写入数据库失败。'.$DB->error().'"}');
|
||||
}
|
||||
}else{
|
||||
exit('{"code":-1,"msg":"短信发送失败 '.$result.'"}');
|
||||
}
|
||||
}else{
|
||||
$email = $sendto;
|
||||
$userrow=$DB->getRow("select * from pre_user where email='$email' limit 1");
|
||||
if(!$userrow){
|
||||
exit('{"code":-1,"msg":"该邮箱未找到注册商户"}');
|
||||
}
|
||||
$row=$DB->getRow("select * from pre_regcode where `to`='$email' order by id desc limit 1");
|
||||
if($row['time']>time()-60){
|
||||
exit('{"code":-1,"msg":"两次发送邮件之间需要相隔60秒!"}');
|
||||
}
|
||||
$count=$DB->getColumn("select count(*) from pre_regcode where `to`='$email' and time>'".(time()-3600*24)."'");
|
||||
if($count>6){
|
||||
exit('{"code":-1,"msg":"该邮箱发送次数过多,请更换邮箱!"}');
|
||||
}
|
||||
$count=$DB->getColumn("select count(*) from pre_regcode where ip='$clientip' and time>'".(time()-3600*24)."'");
|
||||
if($count>10){
|
||||
exit('{"code":-1,"msg":"你今天发送次数过多,已被禁止找回密码"}');
|
||||
}
|
||||
$sub = $conf['sitename'].' - 重置密码验证';
|
||||
$code = rand(1111111,9999999);
|
||||
$msg = '您的验证码是:'.$code.',用于'.$conf['sitename'].'重置密码,请勿泄露验证码,如非本人操作请忽略。';
|
||||
$result = send_mail($email, $sub, $msg);
|
||||
if($result===true){
|
||||
if($DB->exec("insert into `pre_regcode` (`uid`,`type`,`code`,`to`,`time`,`ip`,`status`) values ('".$userrow['uid']."','4','".$code."','".$email."','".time()."','".$clientip."','0')")){
|
||||
$_SESSION['send_mail']=time();
|
||||
exit('{"code":0,"msg":"succ"}');
|
||||
}else{
|
||||
exit('{"code":-1,"msg":"写入数据库失败。'.$DB->error().'"}');
|
||||
}
|
||||
}else{
|
||||
file_put_contents('mail.log',$result);
|
||||
exit('{"code":-1,"msg":"邮件发送失败"}');
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'findpwd':
|
||||
$verifytype=$_POST['type'];
|
||||
$account=daddslashes(htmlspecialchars(strip_tags(trim($_POST['account']))));
|
||||
$code=trim(daddslashes($_POST['code']));
|
||||
$pwd=trim(daddslashes($_POST['pwd']));
|
||||
|
||||
if(empty($account) || empty($code) || empty($pwd)){
|
||||
exit('{"code":-1,"msg":"请确保各项不能为空"}');
|
||||
}
|
||||
if(!$_POST['csrf_token'] || $_POST['csrf_token']!=$_SESSION['csrf_token'])exit('{"code":-1,"msg":"CSRF TOKEN ERROR"}');
|
||||
if (strlen($pwd) < 6) {
|
||||
exit('{"code":-1,"msg":"密码不能低于6位"}');
|
||||
}elseif ($pwd == $account && $verifytype=='email') {
|
||||
exit('{"code":-1,"msg":"密码不能和邮箱相同"}');
|
||||
}elseif ($pwd == $account && $verifytype=='phone') {
|
||||
exit('{"code":-1,"msg":"密码不能和手机号码相同"}');
|
||||
}elseif (is_numeric($pwd)) {
|
||||
exit('{"code":-1,"msg":"密码不能为纯数字"}');
|
||||
}
|
||||
if($verifytype=='phone'){
|
||||
if(!is_numeric($account) || strlen($account)!=11){
|
||||
exit('{"code":-1,"msg":"手机号码不正确"}');
|
||||
}
|
||||
$userrow=$DB->getRow("select * from pre_user where phone='$account' limit 1");
|
||||
if(!$userrow){
|
||||
exit('{"code":-1,"msg":"该手机号未找到注册商户"}');
|
||||
}
|
||||
}else{
|
||||
if(!preg_match('/^[A-z0-9._-]+@[A-z0-9._-]+\.[A-z0-9._-]+$/', $account)){
|
||||
exit('{"code":-1,"msg":"邮箱格式不正确"}');
|
||||
}
|
||||
$userrow=$DB->getRow("select * from pre_user where email='$account' limit 1");
|
||||
if(!$userrow){
|
||||
exit('{"code":-1,"msg":"该邮箱未找到注册商户"}');
|
||||
}
|
||||
}
|
||||
if($verifytype=='phone'){
|
||||
$row=$DB->getRow("select * from pre_regcode where type=5 and code='$code' and `to`='$account' order by id desc limit 1");
|
||||
}else{
|
||||
$row=$DB->getRow("select * from pre_regcode where type=4 and code='$code' and `to`='$account' order by id desc limit 1");
|
||||
}
|
||||
if(!$row){
|
||||
exit('{"code":-1,"msg":"验证码不正确!"}');
|
||||
}
|
||||
if($row['time']<time()-3600 || $row['status']>0){
|
||||
exit('{"code":-1,"msg":"验证码已失效,请重新获取"}');
|
||||
}
|
||||
|
||||
$pwd = getMd5Pwd($pwd, $userrow['uid']);
|
||||
$sqs=$DB->exec("update `pre_user` set `pwd` ='{$pwd}' where `uid`='{$userrow['uid']}'");
|
||||
if($sqs!==false){
|
||||
exit('{"code":1,"msg":"重置密码成功!请牢记新密码"}');
|
||||
}else{
|
||||
exit('{"code":-1,"msg":"重置密码失败!'.$DB->error().'"}');
|
||||
}
|
||||
break;
|
||||
case 'qrcode':
|
||||
unset($_SESSION['openid']);
|
||||
if(!empty($conf['localurl_wxpay']) && !strpos($conf['localurl_wxpay'],$_SERVER['HTTP_HOST'])){
|
||||
$qrcode = $conf['localurl_wxpay'].'user/openid.php?sid='.session_id();
|
||||
}else{
|
||||
$qrcode = $siteurl.'user/openid.php?sid='.session_id();
|
||||
}
|
||||
$result=array("code"=>0,"msg"=>"succ","url"=>$qrcode);
|
||||
exit(json_encode($result));
|
||||
break;
|
||||
case 'getopenid':
|
||||
if(isset($_SESSION['openid']) && !empty($_SESSION['openid'])){
|
||||
$result=array("code"=>0,"msg"=>"succ","openid"=>$_SESSION['openid']);
|
||||
}else{
|
||||
$result=array("code"=>-1);
|
||||
}
|
||||
exit(json_encode($result));
|
||||
break;
|
||||
default:
|
||||
exit('{"code":-4,"msg":"No Act"}');
|
||||
break;
|
||||
}
|
||||
553
user/ajax2.php
Normal file
@@ -0,0 +1,553 @@
|
||||
<?php
|
||||
include("../includes/common.php");
|
||||
if($islogin2==1){}else exit('{"code":-3,"msg":"No Login"}');
|
||||
$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':
|
||||
$lastday=date("Y-m-d",strtotime("-1 day"));
|
||||
$today=date("Y-m-d");
|
||||
|
||||
$orders=$DB->getColumn("SELECT count(*) FROM pre_order WHERE uid={$uid} AND status=1");
|
||||
$orders_today=$DB->getColumn("SELECT count(*) from pre_order WHERE uid={$uid} AND status=1 AND date='$today'");
|
||||
|
||||
$settle_money=$DB->getColumn("SELECT sum(getmoney) FROM pre_settle WHERE uid={$uid} and status=1");
|
||||
$settle_money=round($settle_money,2);
|
||||
|
||||
$order_today['all']=$DB->getColumn("SELECT sum(getmoney) FROM pre_order WHERE uid={$uid} AND status=1 AND date='$today'");
|
||||
$order_today['all']=round($order_today['all'],2);
|
||||
$order_today['alipay']=$DB->getColumn("SELECT sum(getmoney) FROM pre_order WHERE uid={$uid} AND type=(SELECT id FROM pre_type WHERE name='alipay') AND status=1 AND date='$today'");
|
||||
$order_today['alipay']=round($order_today['alipay'],2);
|
||||
$order_today['wxpay']=$DB->getColumn("SELECT sum(getmoney) FROM pre_order WHERE uid={$uid} AND type=(SELECT id FROM pre_type WHERE name='wxpay') AND status=1 AND date='$today'");
|
||||
$order_today['wxpay']=round($order_today['wxpay'],2);
|
||||
$order_today['qqpay']=$DB->getColumn("SELECT sum(getmoney) FROM pre_order WHERE uid={$uid} AND type=(SELECT id FROM pre_type WHERE name='qqpay') AND status=1 AND date='$today'");
|
||||
$order_today['qqpay']=round($order_today['qqpay'],2);
|
||||
|
||||
$order_lastday['all']=$DB->getColumn("SELECT sum(getmoney) FROM pre_order WHERE uid={$uid} AND status=1 AND date='$lastday'");
|
||||
$order_lastday['all']=round($order_lastday['all'],2);
|
||||
$order_lastday['alipay']=$DB->getColumn("SELECT sum(getmoney) FROM pre_order WHERE uid={$uid} AND type=(SELECT id FROM pre_type WHERE name='alipay') AND status=1 AND date='$lastday'");
|
||||
$order_lastday['alipay']=round($order_lastday['alipay'],2);
|
||||
$order_lastday['wxpay']=$DB->getColumn("SELECT sum(getmoney) FROM pre_order WHERE uid={$uid} AND type=(SELECT id FROM pre_type WHERE name='wxpay') AND status=1 AND date='$lastday'");
|
||||
$order_lastday['wxpay']=round($order_lastday['wxpay'],2);
|
||||
$order_lastday['qqpay']=$DB->getColumn("SELECT sum(getmoney) FROM pre_order WHERE uid={$uid} AND type=(SELECT id FROM pre_type WHERE name='qqpay') AND status=1 AND date='$lastday'");
|
||||
$order_lastday['qqpay']=round($order_lastday['qqpay'],2);
|
||||
|
||||
$result=['code'=>0, 'orders'=>$orders, 'orders_today'=>$orders_today, 'settle_money'=>$settle_money, 'order_today'=>$order_today, 'order_lastday'=>$order_lastday];
|
||||
exit(json_encode($result));
|
||||
break;
|
||||
case 'sendcode':
|
||||
$situation=trim($_POST['situation']);
|
||||
$target=daddslashes(htmlspecialchars(strip_tags(trim($_POST['target']))));
|
||||
if(isset($_SESSION['send_mail']) && $_SESSION['send_mail']>time()-10){
|
||||
exit('{"code":-1,"msg":"请勿频繁发送验证码"}');
|
||||
}
|
||||
$GtSdk = new \lib\GeetestLib($conf['CAPTCHA_ID'], $conf['PRIVATE_KEY']);
|
||||
|
||||
$data = array(
|
||||
'user_id' => $uid, # 网站用户id
|
||||
'client_type' => "web", # web:电脑上的浏览器;h5:手机上的浏览器,包括移动应用内完全内置的web_view;native:通过原生SDK植入APP应用的方式
|
||||
'ip_address' => $clientip # 请在此处传输用户请求验证时所携带的IP
|
||||
);
|
||||
|
||||
if ($_SESSION['gtserver'] == 1) { //服务器正常
|
||||
$result = $GtSdk->success_validate($_POST['geetest_challenge'], $_POST['geetest_validate'], $_POST['geetest_seccode'], $data);
|
||||
if ($result) {
|
||||
//echo '{"status":"success"}';
|
||||
} else{
|
||||
exit('{"code":-1,"msg":"验证失败,请重新验证"}');
|
||||
}
|
||||
}else{ //服务器宕机,走failback模式
|
||||
if ($GtSdk->fail_validate($_POST['geetest_challenge'],$_POST['geetest_validate'],$_POST['geetest_seccode'])) {
|
||||
//echo '{"status":"success"}';
|
||||
}else{
|
||||
exit('{"code":-1,"msg":"验证失败,请重新验证"}');
|
||||
}
|
||||
}
|
||||
if($conf['verifytype']==1){
|
||||
if($situation=='bind'){
|
||||
$phone=$target;
|
||||
if(empty($phone) || strlen($phone)!=11){
|
||||
exit('{"code":-1,"msg":"请填写正确的手机号码!"}');
|
||||
}
|
||||
if($phone==$userrow['phone']){
|
||||
exit('{"code":-1,"msg":"你填写的手机号码和之前一样"}');
|
||||
}
|
||||
$row=$DB->getRow("select * from pre_user where phone='$phone' limit 1");
|
||||
if($row){
|
||||
exit('{"code":-1,"msg":"该手机号码已经绑定过其它商户"}');
|
||||
}
|
||||
}else{
|
||||
if(empty($userrow['phone']) || strlen($userrow['phone'])!=11){
|
||||
exit('{"code":-1,"msg":"请先绑定手机号码!"}');
|
||||
}
|
||||
$phone=$userrow['phone'];
|
||||
}
|
||||
$row=$DB->getRow("select * from pre_regcode where `to`='$phone' order by id desc limit 1");
|
||||
if($row['time']>time()-60){
|
||||
exit('{"code":-1,"msg":"两次发送短信之间需要相隔60秒!"}');
|
||||
}
|
||||
$count=$DB->getColumn("select count(*) from pre_regcode where `to`='$phone' and time>'".(time()-3600*24)."'");
|
||||
if($count>2){
|
||||
exit('{"code":-1,"msg":"该手机号码发送次数过多,暂无法发送!"}');
|
||||
}
|
||||
$count=$DB->getColumn("select count(*) from pre_regcode where ip='$clientip' and time>'".(time()-3600*24)."'");
|
||||
if($count>5){
|
||||
exit('{"code":-1,"msg":"你今天发送次数过多,已被禁止发送"}');
|
||||
}
|
||||
$code = rand(111111,999999);
|
||||
$result = send_sms($phone, $code, 'edit');
|
||||
if($result===true){
|
||||
if($DB->exec("insert into `pre_regcode` (`uid`,`type`,`code`,`to`,`time`,`ip`,`status`) values ('".$uid."','3','".$code."','".$phone."','".time()."','".$clientip."','0')")){
|
||||
$_SESSION['send_mail']=time();
|
||||
exit('{"code":0,"msg":"succ"}');
|
||||
}else{
|
||||
exit('{"code":-1,"msg":"写入数据库失败。'.$DB->error().'"}');
|
||||
}
|
||||
}else{
|
||||
exit('{"code":-1,"msg":"短信发送失败 '.$result.'"}');
|
||||
}
|
||||
}else{
|
||||
if($situation=='bind'){
|
||||
$email=$target;
|
||||
if(!preg_match('/^[A-z0-9._-]+@[A-z0-9._-]+\.[A-z0-9._-]+$/', $email)){
|
||||
exit('{"code":-1,"msg":"邮箱格式不正确"}');
|
||||
}
|
||||
if($email==$userrow['email']){
|
||||
exit('{"code":-1,"msg":"你填写的邮箱和之前一样"}');
|
||||
}
|
||||
$row=$DB->getRow("select * from pre_user where email='$email' limit 1");
|
||||
if($row){
|
||||
exit('{"code":-1,"msg":"该邮箱已经绑定过其它商户"}');
|
||||
}
|
||||
}else{
|
||||
if(empty($userrow['email']) || strpos($userrow['email'],'@')===false){
|
||||
exit('{"code":-1,"msg":"请先绑定邮箱!"}');
|
||||
}
|
||||
$email=$userrow['email'];
|
||||
}
|
||||
$row=$DB->getRow("select * from pre_regcode where `to`='$email' order by id desc limit 1");
|
||||
if($row['time']>time()-60){
|
||||
exit('{"code":-1,"msg":"两次发送邮件之间需要相隔60秒!"}');
|
||||
}
|
||||
$count=$DB->getColumn("select count(*) from pre_regcode where `to`='$email' and time>'".(time()-3600*24)."'");
|
||||
if($count>6){
|
||||
exit('{"code":-1,"msg":"该邮箱发送次数过多,请更换邮箱!"}');
|
||||
}
|
||||
$count=$DB->getColumn("select count(*) from pre_regcode where ip='$clientip' and time>'".(time()-3600*24)."'");
|
||||
if($count>10){
|
||||
exit('{"code":-1,"msg":"你今天发送次数过多,已被禁止发送"}');
|
||||
}
|
||||
$sub = $conf['sitename'].' - 验证码获取';
|
||||
$code = rand(1111111,9999999);
|
||||
if($situation=='settle')$msg = '您正在修改结算账号信息,验证码是:'.$code;
|
||||
elseif($situation=='mibao')$msg = '您正在修改密保邮箱,验证码是:'.$code;
|
||||
elseif($situation=='bind')$msg = '您正在绑定新邮箱,验证码是:'.$code;
|
||||
else $msg = '您的验证码是:'.$code;
|
||||
$result = send_mail($email, $sub, $msg);
|
||||
if($result===true){
|
||||
if($DB->exec("insert into `pre_regcode` (`uid`,`type`,`code`,`to`,`time`,`ip`,`status`) values ('".$uid."','2','".$code."','".$email."','".time()."','".$clientip."','0')")){
|
||||
$_SESSION['send_mail']=time();
|
||||
exit('{"code":0,"msg":"succ"}');
|
||||
}else{
|
||||
exit('{"code":-1,"msg":"写入数据库失败。'.$DB->error().'"}');
|
||||
}
|
||||
}else{
|
||||
file_put_contents('mail.log',$result);
|
||||
exit('{"code":-1,"msg":"邮件发送失败"}');
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'verifycode':
|
||||
$code=trim(daddslashes($_POST['code']));
|
||||
if($conf['verifytype']==1){
|
||||
$row=$DB->getRow("select * from pre_regcode where uid='$uid' and type=3 and code='$code' and `to`='{$userrow['phone']}' order by id desc limit 1");
|
||||
}else{
|
||||
$row=$DB->getRow("select * from pre_regcode where uid='$uid' and type=2 and code='$code' and `to`='{$userrow['email']}' order by id desc limit 1");
|
||||
}
|
||||
if(!$row){
|
||||
exit('{"code":-1,"msg":"验证码不正确!"}');
|
||||
}
|
||||
if($row['time']<time()-3600 || $row['status']>0){
|
||||
exit('{"code":-1,"msg":"验证码已失效,请重新获取"}');
|
||||
}
|
||||
$_SESSION['verify_ok']=$uid;
|
||||
$DB->exec("update `pre_regcode` set `status` ='1' where `id`='{$row['id']}'");
|
||||
exit('{"code":1,"msg":"succ"}');
|
||||
break;
|
||||
case 'completeinfo':
|
||||
$type=intval($_POST['stype']);
|
||||
$account=daddslashes(htmlspecialchars(strip_tags(trim($_POST['account']))));
|
||||
$username=daddslashes(htmlspecialchars(strip_tags(trim($_POST['username']))));
|
||||
$email=daddslashes(htmlspecialchars(strip_tags(trim($_POST['email']))));
|
||||
$qq=daddslashes(htmlspecialchars(strip_tags(trim($_POST['qq']))));
|
||||
$url=daddslashes(htmlspecialchars(strip_tags(trim($_POST['url']))));
|
||||
|
||||
if($account==null || $username==null || $qq==null || $url==null){
|
||||
exit('{"code":-1,"msg":"请确保每项都不为空"}');
|
||||
}
|
||||
if($type==1 && strlen($account)!=11 && strpos($account,'@')==false){
|
||||
exit('{"code":-1,"msg":"请填写正确的支付宝账号!"}');
|
||||
}
|
||||
if($type==2 && strlen($account)<3){
|
||||
exit('{"code":-1,"msg":"请填写正确的微信"}');
|
||||
}
|
||||
if($type==3 && (strlen($account)<5 || strlen($account)>10 || !is_numeric($account))){
|
||||
exit('{"code":-1,"msg":"请填写正确的QQ号码"}');
|
||||
}
|
||||
if(strlen($qq)<5 || strlen($account)>10 || !is_numeric($qq)){
|
||||
exit('{"code":-1,"msg":"请填写正确的QQ"}');
|
||||
}
|
||||
if(strlen($url)<4 || strpos($url,'.')==false){
|
||||
exit('{"code":-1,"msg":"请填写正确的网站域名!"}');
|
||||
}
|
||||
if($conf['verifytype']==1){
|
||||
if(!preg_match('/^[A-z0-9._-]+@[A-z0-9._-]+\.[A-z0-9._-]+$/', $email)){
|
||||
exit('{"code":-1,"msg":"邮箱格式不正确"}');
|
||||
}
|
||||
if($email!=$userrow['email']){
|
||||
$row=$DB->getRow("select * from pre_user where email='$email' limit 1");
|
||||
if($row){
|
||||
exit('{"code":-1,"msg":"该邮箱已经绑定过其它商户,如需找回,请退出登录后找回密码"}');
|
||||
}
|
||||
$sqls=",`email` ='{$email}'";
|
||||
}
|
||||
}
|
||||
$sqs=$DB->exec("update `pre_user` set `settle_id` ='{$type}',`account` ='{$account}',`username` ='{$username}',`qq` ='{$qq}',`url` ='{$url}'{$sqls} where `uid`='$uid'");
|
||||
if($sqs!==false){
|
||||
exit('{"code":1,"msg":"succ"}');
|
||||
}else{
|
||||
exit('{"code":-1,"msg":"保存失败!'.$DB->error().'"}');
|
||||
}
|
||||
break;
|
||||
case 'edit_settle':
|
||||
$type=intval($_POST['stype']);
|
||||
$account=daddslashes(htmlspecialchars(strip_tags(trim($_POST['account']))));
|
||||
$username=daddslashes(htmlspecialchars(strip_tags(trim($_POST['username']))));
|
||||
|
||||
if($account==null || $username==null){
|
||||
exit('{"code":-1,"msg":"请确保每项都不为空"}');
|
||||
}
|
||||
if($type==1 && strlen($account)!=11 && strpos($account,'@')==false){
|
||||
exit('{"code":-1,"msg":"请填写正确的支付宝账号!"}');
|
||||
}
|
||||
if($type==2 && strlen($account)<3){
|
||||
exit('{"code":-1,"msg":"请填写正确的微信"}');
|
||||
}
|
||||
if($type==3 && (strlen($account)<5 || strlen($account)>10 || !is_numeric($account))){
|
||||
exit('{"code":-1,"msg":"请填写正确的QQ号码"}');
|
||||
}
|
||||
if($userrow['type']!=2 && !empty($userrow['account']) && !empty($userrow['username']) && ($userrow['account']!=$account || $userrow['username']!=$username) && $_SESSION['verify_ok']!==$uid){
|
||||
if($conf['verifytype']==1 && (empty($userrow['phone']) || strlen($userrow['phone'])!=11)){
|
||||
exit('{"code":-1,"msg":"请先绑定手机号码!"}');
|
||||
}elseif($conf['verifytype']==0 && (empty($userrow['email']) || strpos($userrow['email'],'@')===false)){
|
||||
exit('{"code":-1,"msg":"请先绑定邮箱!"}');
|
||||
}
|
||||
exit('{"code":2,"msg":"need verify"}');
|
||||
}
|
||||
$sqs=$DB->exec("update `pre_user` set `settle_id` ='{$type}',`account` ='{$account}',`username` ='{$username}' where `uid`='$uid'");
|
||||
if($sqs!==false){
|
||||
exit('{"code":1,"msg":"succ"}');
|
||||
}else{
|
||||
exit('{"code":-1,"msg":"保存失败!'.$DB->error().'"}');
|
||||
}
|
||||
break;
|
||||
case 'edit_info':
|
||||
$email=daddslashes(htmlspecialchars(strip_tags(trim($_POST['email']))));
|
||||
$qq=daddslashes(htmlspecialchars(strip_tags(trim($_POST['qq']))));
|
||||
$url=daddslashes(htmlspecialchars(strip_tags(trim($_POST['url']))));
|
||||
$keylogin=intval($_POST['keylogin']);
|
||||
|
||||
if($qq==null || $url==null){
|
||||
exit('{"code":-1,"msg":"请确保每项都不为空"}');
|
||||
}
|
||||
if($conf['verifytype']==1){
|
||||
if($email!=$userrow['email']){
|
||||
$row=$DB->getRow("select * from pre_user where email='$email' limit 1");
|
||||
if($row){
|
||||
exit('{"code":-1,"msg":"该邮箱已经绑定过其它商户,如需找回,请退出登录后找回密码"}');
|
||||
}
|
||||
}
|
||||
$sqs=$DB->exec("update `pre_user` set `email` ='{$email}',`qq` ='{$qq}',`url` ='{$url}',`keylogin` ='{$keylogin}' where `uid`='$uid'");
|
||||
}else{
|
||||
$sqs=$DB->exec("update `pre_user` set `qq` ='{$qq}',`url` ='{$url}',`keylogin` ='{$keylogin}' where `uid`='$uid'");
|
||||
}
|
||||
if($sqs!==false){
|
||||
exit('{"code":1,"msg":"succ"}');
|
||||
}else{
|
||||
exit('{"code":-1,"msg":"保存失败!'.$DB->error().'"}');
|
||||
}
|
||||
break;
|
||||
case 'edit_mode':
|
||||
$mode=intval($_POST['mode']);
|
||||
|
||||
$sqs=$DB->exec("update `pre_user` set `mode` ='{$mode}' where `uid`='$uid'");
|
||||
if($sqs!==false){
|
||||
exit('{"code":1,"msg":"succ"}');
|
||||
}else{
|
||||
exit('{"code":-1,"msg":"保存失败!'.$DB->error().'"}');
|
||||
}
|
||||
break;
|
||||
case 'edit_bind':
|
||||
$email=daddslashes(htmlspecialchars(strip_tags(trim($_POST['email']))));
|
||||
$phone=daddslashes(htmlspecialchars(strip_tags(trim($_POST['phone']))));
|
||||
$code=daddslashes(trim($_POST['code']));
|
||||
|
||||
if($code==null || $email==null && $phone==null){
|
||||
exit('{"code":-1,"msg":"请确保每项都不为空"}');
|
||||
}
|
||||
if(empty($_SESSION['verify_ok']) || $_SESSION['verify_ok']!=$uid){
|
||||
exit('{"code":2,"msg":"请先完成验证"}');
|
||||
}
|
||||
if($conf['verifytype']==1){
|
||||
$row=$DB->getRow("select * from pre_regcode where type=3 and code='$code' and `to`='$phone' order by id desc limit 1");
|
||||
}else{
|
||||
$row=$DB->getRow("select * from pre_regcode where type=2 and code='$code' and `to`='$email' order by id desc limit 1");
|
||||
}
|
||||
if(!$row){
|
||||
exit('{"code":-1,"msg":"验证码不正确!"}');
|
||||
}
|
||||
if($row['time']<time()-3600 || $row['status']>0){
|
||||
exit('{"code":-1,"msg":"验证码已失效,请重新获取"}');
|
||||
}
|
||||
if($conf['verifytype']==1){
|
||||
$sqs=$DB->exec("update `pre_user` set `phone` ='{$phone}' where `uid`='$uid'");
|
||||
}else{
|
||||
$sqs=$DB->exec("update `pre_user` set `email` ='{$email}' where `uid`='$uid'");
|
||||
}
|
||||
if($sqs!==false){
|
||||
exit('{"code":1,"msg":"succ"}');
|
||||
}else{
|
||||
exit('{"code":-1,"msg":"保存失败!'.$DB->error().'"}');
|
||||
}
|
||||
break;
|
||||
case 'checkbind':
|
||||
if($conf['verifytype']==1 && (empty($userrow['phone']) || strlen($userrow['phone'])!=11)){
|
||||
exit('{"code":1,"msg":"bind"}');
|
||||
}elseif($conf['verifytype']==0 && (empty($userrow['email']) || strpos($userrow['email'],'@')===false)){
|
||||
exit('{"code":1,"msg":"bind"}');
|
||||
}elseif(isset($_SESSION['verify_ok']) && $_SESSION['verify_ok']===$uid){
|
||||
exit('{"code":1,"msg":"bind"}');
|
||||
}else{
|
||||
exit('{"code":2,"msg":"need verify"}');
|
||||
}
|
||||
break;
|
||||
case 'resetKey':
|
||||
if(isset($_POST['submit'])){
|
||||
$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 'edit_pwd':
|
||||
$oldpwd=trim($_POST['oldpwd']);
|
||||
$newpwd=trim($_POST['newpwd']);
|
||||
$newpwd2=trim($_POST['newpwd2']);
|
||||
|
||||
if(!empty($userrow['pwd']) && $oldpwd==null || $newpwd==null || $newpwd2==null){
|
||||
exit('{"code":-1,"msg":"请确保每项都不为空"}');
|
||||
}
|
||||
if(!empty($userrow['pwd']) && getMd5Pwd($oldpwd, $uid)!=$userrow['pwd']){
|
||||
exit('{"code":-1,"msg":"旧密码不正确"}');
|
||||
}
|
||||
if($newpwd!=$newpwd2){
|
||||
exit('{"code":-1,"msg":"两次输入密码不一致!"}');
|
||||
}
|
||||
if($oldpwd==$newpwd){
|
||||
exit('{"code":-1,"msg":"旧密码和新密码相同!"}');
|
||||
}
|
||||
if (strlen($newpwd) < 6) {
|
||||
exit('{"code":-1,"msg":"新密码不能低于6位"}');
|
||||
}elseif ($newpwd == $userrow['email']) {
|
||||
exit('{"code":-1,"msg":"新密码不能和邮箱相同"}');
|
||||
}elseif ($newpwd == $userrow['phone']) {
|
||||
exit('{"code":-1,"msg":"新密码不能和手机号码相同"}');
|
||||
}elseif (is_numeric($newpwd)) {
|
||||
exit('{"code":-1,"msg":"新密码不能为纯数字"}');
|
||||
}
|
||||
$pwd = getMd5Pwd($newpwd, $uid);
|
||||
$sqs=$DB->exec("update `pre_user` set `pwd` ='{$pwd}' where `uid`='$uid'");
|
||||
if($sqs!==false){
|
||||
exit('{"code":1,"msg":"修改密码成功!请牢记新密码"}');
|
||||
}else{
|
||||
exit('{"code":-1,"msg":"修改密码失败!'.$DB->error().'"}');
|
||||
}
|
||||
break;
|
||||
case 'edit_codename':
|
||||
$codename=daddslashes(htmlspecialchars(strip_tags(trim($_POST['codename']))));
|
||||
|
||||
$sqs=$DB->exec("update `pre_user` set `codename` ='{$codename}' where `uid`='$uid'");
|
||||
if($sqs!==false){
|
||||
exit('{"code":1,"msg":"保存成功!"}');
|
||||
}else{
|
||||
exit('{"code":-1,"msg":"保存失败!'.$DB->error().'"}');
|
||||
}
|
||||
break;
|
||||
case 'certificate':
|
||||
$certname=daddslashes(htmlspecialchars(strip_tags(trim($_POST['certname']))));
|
||||
$certno=daddslashes(htmlspecialchars(strip_tags(trim($_POST['certno']))));
|
||||
if(!$_POST['csrf_token'] || $_POST['csrf_token']!=$_SESSION['csrf_token'])exit('{"code":-1,"msg":"CSRF TOKEN ERROR"}');
|
||||
if($userrow['cert']==1)exit('{"code":-1,"msg":"你已完成实名认证"}');
|
||||
if($conf['cert_money']>0 && $userrow['money']<$conf['cert_money'])exit('{"code":-1,"msg":"账户余额不足'.$conf['cert_money'].'元,无法完成认证"}');
|
||||
if(empty($certname) || empty($certno))exit('{"code":-1,"msg":"请确保各项不能为空"}');
|
||||
if(strlen($certname)<3)exit('{"code":-1,"msg":"姓名填写错误"}');
|
||||
if(!is_idcard($certno))exit('{"code":-1,"msg":"身份证号不正确"}');
|
||||
/*$row=$DB->getRow("SELECT uid,phone,email FROM pre_user WHERE certname='$certname' AND certno='$certno' AND cert=1 LIMIT 1");
|
||||
if($row){
|
||||
exit('{"code":-2,"msg":"账号:'.($row['phone']?$row['phone']:$row['email']).'(商户ID:'.$row['uid'].')已经使用此身份认证,是否将该认证信息关联到当前商户?关联需要输入商户ID '.$row['uid'].' 的商户密钥","uid":"'.$row['uid'].'"}');
|
||||
}*/
|
||||
$channel = \lib\Channel::get($conf['cert_channel']);
|
||||
if(!$channel)exit('{"code":-1,"msg":"当前实名认证通道信息不存在"}');
|
||||
define("IN_PLUGIN", true);
|
||||
define("PAY_ROOT", PLUGIN_ROOT.'alipay/');
|
||||
require_once PAY_ROOT."inc/AlipayCertifyService.php";
|
||||
$certify = new AlipayCertifyService($config);
|
||||
$outer_order_no = date("YmdHis").rand(000,999).$uid;
|
||||
$certifyResult = $certify->initialize($outer_order_no, $certname, $certno, 'SMART_FACE');
|
||||
if(isset($certifyResult['certify_id'])){
|
||||
$_SESSION[$uid.'_certify_id']=$certifyResult['certify_id'];
|
||||
$sqs=$DB->exec("update `pre_user` set `certno` ='{$certno}',`certname` ='{$certname}' where `uid`='$uid'");
|
||||
if($sqs!==false){
|
||||
exit('{"code":1,"msg":"succ","certify_id":"'.$certifyResult['certify_id'].'","url":"'.$siteurl.'user/alipaycert.php?id='.$certifyResult['certify_id'].'"}');
|
||||
}else{
|
||||
exit('{"code":-1,"msg":"保存信息失败'.$DB->error().'"}');
|
||||
}
|
||||
}else{
|
||||
exit('{"code":-1,"msg":"支付宝接口返回异常['.$certifyResult['sub_code'].']'.$certifyResult['sub_msg'].'"}');
|
||||
}
|
||||
break;
|
||||
case 'cert_query':
|
||||
$certify_id = isset($_POST['certify_id'])?$_POST['certify_id']:exit('{"code":-1,"msg":"param is error"}');
|
||||
if(!$_POST['csrf_token'] || $_POST['csrf_token']!=$_SESSION['csrf_token'])exit('{"code":-1,"msg":"CSRF TOKEN ERROR"}');
|
||||
if(isset($_SESSION[$uid.'_certify_id']) && $_SESSION[$uid.'_certify_id'] == $certify_id){
|
||||
$channel = \lib\Channel::get($conf['cert_channel']);
|
||||
if(!$channel)exit('{"code":-1,"msg":"当前实名认证通道信息不存在"}');
|
||||
define("IN_PLUGIN", true);
|
||||
define("PAY_ROOT", PLUGIN_ROOT.'alipay/');
|
||||
require_once PAY_ROOT."inc/AlipayCertifyService.php";
|
||||
$certify = new AlipayCertifyService($config);
|
||||
$certifyResult = $certify->query($certify_id);
|
||||
if(isset($certifyResult['passed'])){
|
||||
if($certifyResult['passed'] == 'T'){
|
||||
unset($_SESSION[$uid]['certify_id']);
|
||||
$DB->exec("update `pre_user` set `cert`=1,`certtime`='$date' where `uid`='$uid'");
|
||||
if($conf['cert_money']>0){
|
||||
changeUserMoney($uid, $conf['cert_money'], false, '实名认证');
|
||||
}
|
||||
exit('{"code":1,"msg":"succ","passed":true}');
|
||||
}else{
|
||||
exit('{"code":1,"msg":"succ","passed":false}');
|
||||
}
|
||||
}else{
|
||||
exit('{"code":-1,"msg":"支付宝接口返回异常['.$certifyResult['sub_code'].']'.$certifyResult['sub_msg'].'"}');
|
||||
}
|
||||
}else{
|
||||
exit('{"code":-1,"msg":"Access Denied"}');
|
||||
}
|
||||
break;
|
||||
/*case 'cert_bind':
|
||||
$touid=intval($_POST['touid']);
|
||||
$certname=daddslashes(htmlspecialchars(strip_tags(trim($_POST['certname']))));
|
||||
$certno=daddslashes(htmlspecialchars(strip_tags(trim($_POST['certno']))));
|
||||
if(!$_POST['csrf_token'] || $_POST['csrf_token']!=$_SESSION['csrf_token'])exit('{"code":-1,"msg":"CSRF TOKEN ERROR"}');
|
||||
if($userrow['cert']==1)exit('{"code":-1,"msg":"你已完成实名认证"}');
|
||||
if(empty($certname) || empty($certno))exit('{"code":-1,"msg":"请确保各项不能为空"}');
|
||||
if(strlen($certname)<3)exit('{"code":-1,"msg":"姓名填写错误"}');
|
||||
if(!is_idcard($certno))exit('{"code":-1,"msg":"身份证号不正确"}');
|
||||
$row=$DB->getRow("SELECT uid,certname,certno,cert FROM pre_user WHERE uid='$touid' LIMIT 1");
|
||||
if($row && $row['cert']==1 && $row['certname']==$certname && $row['certno']==$certno){
|
||||
$sqs=$DB->exec("update `pre_user` set `cert`='1',`certno`='{$certno}',`certname`='{$certname}',`certtime`='{$date}' where `uid`='$uid'");
|
||||
if($sqs!==false){
|
||||
exit('{"code":1,"msg":"关联实名认证成功!"}');
|
||||
}else{
|
||||
exit('{"code":-1,"msg":"关联实名认证失败!'.$DB->error().'"}');
|
||||
}
|
||||
}else{
|
||||
exit('{"code":-1,"msg":"关联实名认证失败!"}');
|
||||
}
|
||||
break;*/
|
||||
case 'notify':
|
||||
$trade_no=daddslashes(trim($_POST['trade_no']));
|
||||
$row=$DB->getRow("select * from pre_order where trade_no='$trade_no' AND uid=$uid limit 1");
|
||||
if(!$row)
|
||||
exit('{"code":-1,"msg":"当前订单不存在!"}');
|
||||
if($row['status']==0)exit('{"code":-1,"msg":"订单尚未支付,无法重新通知!"}');
|
||||
$url=creat_callback_user($row,$userrow['key']);
|
||||
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 'settle_result':
|
||||
$id=intval($_GET['id']);
|
||||
$row=$DB->getRow("select * from pre_settle where id='$id' limit 1");
|
||||
if(!$row)
|
||||
exit('{"code":-1,"msg":"当前结算记录不存在!"}');
|
||||
$result = ['code'=>0,'msg'=>$row['result']];
|
||||
exit(json_encode($result));
|
||||
break;
|
||||
case 'recharge':
|
||||
$money=trim(daddslashes($_POST['money']));
|
||||
$typeid=intval($_POST['typeid']);
|
||||
$name = '充值余额 UID:'.$uid;
|
||||
if(!$_POST['csrf_token'] || $_POST['csrf_token']!=$_SESSION['csrf_token'])exit('{"code":-1,"msg":"CSRF TOKEN ERROR"}');
|
||||
if($money<=0 || !is_numeric($money) || !preg_match('/^[0-9.]+$/', $money))exit('{"code":-1,"msg":"金额不合法"}');
|
||||
if($conf['pay_maxmoney']>0 && $money>$conf['pay_maxmoney'])exit('{"code":-1,"msg":"最大支付金额是'.$conf['pay_maxmoney'].'元"}');
|
||||
if($conf['pay_minmoney']>0 && $money<$conf['pay_minmoney'])exit('{"code":-1,"msg":"最小支付金额是'.$conf['pay_minmoney'].'元"}');
|
||||
$trade_no=date("YmdHis").rand(11111,99999);
|
||||
$return_url=$siteurl.'user/recharge.php?ok=1&trade_no='.$trade_no;
|
||||
$domain=getdomain($return_url);
|
||||
if(!$DB->exec("INSERT INTO `pre_order` (`trade_no`,`out_trade_no`,`uid`,`tid`,`addtime`,`name`,`money`,`notify_url`,`return_url`,`domain`,`ip`,`status`) VALUES (:trade_no, :out_trade_no, :uid, 2, NOW(), :name, :money, :notify_url, :return_url, :domain, :clientip, 0)", [':trade_no'=>$trade_no, ':out_trade_no'=>$trade_no, ':uid'=>$uid, ':name'=>$name, ':money'=>$money, ':notify_url'=>$return_url, ':return_url'=>$return_url, ':domain'=>$domain, ':clientip'=>$clientip]))exit('{"code":-1,"msg":"创建订单失败,请返回重试!"}');
|
||||
unset($_SESSION['csrf_token']);
|
||||
$result = ['code'=>0, 'msg'=>'succ', 'url'=>'../submit2.php?typeid='.$typeid.'&trade_no='.$trade_no];
|
||||
exit(json_encode($result));
|
||||
break;
|
||||
case 'groupinfo':
|
||||
$gid=intval($_POST['gid']);
|
||||
$row=$DB->getRow("select * from pre_group where gid='$gid' limit 1");
|
||||
if(!$row)
|
||||
exit('{"code":-1,"msg":"当前会员等级不存在!"}');
|
||||
if($row['isbuy']==0)
|
||||
exit('{"code":-1,"msg":"当前会员等级无法购买!"}');
|
||||
if($gid==$userrow['gid'])exit('{"code":-1,"msg":"你已购买此会员等级,请勿重复购买"}');
|
||||
if($row['expire']==0)$expire='永久';
|
||||
else $expire=$row['expire'].'个月';
|
||||
$result = ['code'=>0,'msg'=>'succ','gid'=>$gid,'name'=>$row['name'],'price'=>$row['price'],'expire'=>$expire];
|
||||
exit(json_encode($result));
|
||||
break;
|
||||
case 'groupbuy':
|
||||
$gid=intval($_POST['gid']);
|
||||
$row=$DB->getRow("select * from pre_group where gid='$gid' limit 1");
|
||||
if(!$row)
|
||||
exit('{"code":-1,"msg":"当前会员等级不存在!"}');
|
||||
if($row['isbuy']==0)
|
||||
exit('{"code":-1,"msg":"当前会员等级无法购买!"}');
|
||||
if($gid==$userrow['gid'])exit('{"code":-1,"msg":"你已购买此会员等级,请勿重复购买"}');
|
||||
if(!$_POST['csrf_token'] || $_POST['csrf_token']!=$_SESSION['csrf_token'])exit('{"code":-1,"msg":"CSRF TOKEN ERROR"}');
|
||||
$money = $row['price'];
|
||||
$typeid=intval($_POST['typeid']);
|
||||
if($typeid==0){
|
||||
if($money>$userrow['money'])exit('{"code":-1,"msg":"余额不足,请选择其他方式支付"}');
|
||||
changeUserMoney($uid, $money, false, '购买会员');
|
||||
changeUserGroup($uid, $gid);
|
||||
unset($_SESSION['csrf_token']);
|
||||
$result = ['code'=>1, 'msg'=>'购买会员成功!'];
|
||||
exit(json_encode($result));
|
||||
}else{
|
||||
$name = '购买会员 #'.$gid.'#';
|
||||
$trade_no=date("YmdHis").rand(11111,99999);
|
||||
$return_url=$siteurl.'user/groupbuy.php?ok=1&trade_no='.$trade_no;
|
||||
$domain=getdomain($return_url);
|
||||
if(!$DB->exec("INSERT INTO `pre_order` (`trade_no`,`out_trade_no`,`uid`,`tid`,`addtime`,`name`,`money`,`notify_url`,`return_url`,`domain`,`ip`,`status`) VALUES (:trade_no, :out_trade_no, :uid, 4, NOW(), :name, :money, :notify_url, :return_url, :domain, :clientip, 0)", [':trade_no'=>$trade_no, ':out_trade_no'=>$trade_no, ':uid'=>$uid, ':name'=>$name, ':money'=>$money, ':notify_url'=>$return_url, ':return_url'=>$return_url, ':domain'=>$domain, ':clientip'=>$clientip]))exit('{"code":-1,"msg":"创建订单失败,请返回重试!"}');
|
||||
unset($_SESSION['csrf_token']);
|
||||
$result = ['code'=>0, 'msg'=>'succ', 'url'=>'../submit2.php?typeid='.$typeid.'&trade_no='.$trade_no];
|
||||
exit(json_encode($result));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
exit('{"code":-4,"msg":"No Act"}');
|
||||
break;
|
||||
}
|
||||
35
user/alipaycert.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
include("../includes/common.php");
|
||||
$certify_id = isset($_GET['id'])?$_GET['id']:exit('param is error');
|
||||
$channel = \lib\Channel::get($conf['cert_channel']);
|
||||
if(!$channel)sysmsg('当前实名认证通道信息不存在');
|
||||
define("IN_PLUGIN", true);
|
||||
define("PAY_ROOT", PLUGIN_ROOT.'alipay/');
|
||||
require_once PAY_ROOT."inc/AlipayCertifyService.php";
|
||||
$certify = new AlipayCertifyService($config);
|
||||
$html = $certify->certify($certify_id);
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
|
||||
<title>正在跳转</title>
|
||||
<style type="text/css">
|
||||
body {margin:0;padding:0;}
|
||||
p {position:absolute;
|
||||
left:50%;top:50%;
|
||||
width:330px;height:30px;
|
||||
margin:-35px 0 0 -160px;
|
||||
padding:20px;font:bold 14px/30px "宋体", Arial;
|
||||
background:#f9fafc url(../assets/img/loading.gif) no-repeat 20px 20px;
|
||||
text-indent:40px;border:1px solid #c5d0dc;}
|
||||
#waiting {font-family:Arial;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<p>正在跳转,请稍候...</p>
|
||||
<?php echo $html?>
|
||||
</body>
|
||||
</html>
|
||||
32
user/alipaycertok.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
include("../includes/common.php");
|
||||
if($islogin2==1 && isset($_SESSION[$uid.'_certify_id'])){
|
||||
exit("<script language='javascript'>window.location.href='./certificate.php?certify_id={$_SESSION[$uid.'_certify_id']}';</script>");
|
||||
}
|
||||
@header('Content-Type: text/html; charset=UTF-8');
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
|
||||
<link href="//cdn.bootcss.com/ionic/1.3.1/css/ionic.min.css" rel="stylesheet" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="bar bar-header bar-light" align-title="center">
|
||||
<h1 class="title">实名认证结果页面</h1>
|
||||
</div>
|
||||
<div class="has-header" style="padding: 5px;position: absolute;width: 100%;">
|
||||
<div class="text-center" style="color: #a09ee5;">
|
||||
<i class="icon ion-checkmark-circled" style="font-size: 80px;"></i><br>
|
||||
<span>实名认证成功,请关闭此页面</span>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
document.querySelector('body').addEventListener('touchmove', function (event) {
|
||||
event.preventDefault();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
145
user/apply.php
Normal file
@@ -0,0 +1,145 @@
|
||||
<?php
|
||||
include("../includes/common.php");
|
||||
if($islogin2==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
$title='申请提现';
|
||||
include './head.php';
|
||||
?>
|
||||
<?php
|
||||
|
||||
function display_type($type){
|
||||
if($type==1)
|
||||
return '支付宝';
|
||||
elseif($type==2)
|
||||
return '微信';
|
||||
elseif($type==3)
|
||||
return 'QQ钱包';
|
||||
elseif($type==4)
|
||||
return '银行卡';
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
if($conf['settle_open']==0||$conf['settle_open']==1)exit('未开启手动申请提现');
|
||||
|
||||
if($conf['settle_type']==1){
|
||||
$today=date("Y-m-d").' 00:00:00';
|
||||
$rs=$DB->query("SELECT realmoney from pre_order where uid={$uid} and status=1 and endtime>='$today'");
|
||||
$order_today=0;
|
||||
while($row = $rs->fetch())
|
||||
{
|
||||
$order_today+=$row['realmoney'];
|
||||
}
|
||||
$enable_money=round($userrow['money']-$order_today,2);
|
||||
if($enable_money<0)$enable_money=0;
|
||||
}else{
|
||||
$enable_money=$userrow['money'];
|
||||
}
|
||||
|
||||
if(isset($_GET['act']) && $_GET['act']=='do'){
|
||||
if($_POST['submit']=='申请提现'){
|
||||
$money=daddslashes(strip_tags($_POST['money']));
|
||||
if(!is_numeric($money) || !preg_match('/^[0-9.]+$/', $money))exit("<script language='javascript'>alert('提现金额输入不规范');history.go(-1);</script>");
|
||||
if($enable_money<$conf['settle_money']){
|
||||
exit("<script language='javascript'>alert('满{$conf['settle_money']}元才可以提现!');history.go(-1);</script>");
|
||||
}
|
||||
if($money<$conf['settle_money']){
|
||||
exit("<script language='javascript'>alert('最低提现金额为{$conf['settle_money']}元');history.go(-1);</script>");
|
||||
}
|
||||
if($userrow['settle']==0){
|
||||
exit("<script language='javascript'>alert('您的商户出现异常,无法提现');history.go(-1);</script>");
|
||||
}
|
||||
if($conf['settle_rate']>0){
|
||||
$fee=round($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=$money-$fee;
|
||||
}else{
|
||||
$realmoney=$money;
|
||||
}
|
||||
if($DB->exec("INSERT INTO `pre_settle` (`uid`, `type`, `username`, `account`, `money`, `realmoney`, `addtime`, `status`) VALUES ('{$uid}', '{$userrow['settle_id']}', '{$userrow['username']}', '{$userrow['account']}', '{$money}', '{$realmoney}', '{$date}', '0')")){
|
||||
changeUserMoney($uid, $money, false, '手动提现');
|
||||
}
|
||||
exit("<script language='javascript'>alert('申请提现成功!');window.location.href='./settle.php';</script>");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
<div id="content" class="app-content" role="main">
|
||||
<div class="app-content-body ">
|
||||
|
||||
<div class="bg-light lter b-b wrapper-md hidden-print">
|
||||
<h1 class="m-n font-thin h3">申请提现</h1>
|
||||
</div>
|
||||
<div class="wrapper-md control">
|
||||
<?php if(isset($msg)){?>
|
||||
<div class="alert alert-info">
|
||||
<?php echo $msg?>
|
||||
</div>
|
||||
<?php }?>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading font-bold">
|
||||
申请提现
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<form class="form-horizontal devform" action="./apply.php?act=do" method="post">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">提现方式</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="input-group"><input class="form-control" type="text" value="<?php echo display_type($userrow['settle_id'])?>" disabled><a href="./editinfo.php" class="input-group-addon">修改收款账号</a></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">提现账号</label>
|
||||
<div class="col-sm-9">
|
||||
<input class="form-control" type="text" value="<?php echo $userrow['account']?>" disabled>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">你的姓名</label>
|
||||
<div class="col-sm-9">
|
||||
<input class="form-control" type="text" value="<?php echo $userrow['username']?>" disabled>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">当前余额</label>
|
||||
<div class="col-sm-9">
|
||||
<input class="form-control" type="text" value="<?php echo $userrow['money']?>" disabled>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">可提现余额</label>
|
||||
<div class="col-sm-9">
|
||||
<input class="form-control" type="text" name="tmoney" value="<?php echo $enable_money?>" disabled>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">申请提现余额</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="input-group"><input class="form-control" type="text" name="money" value="" required><a href="javascript:inputMoney()" class="input-group-addon">全部</a></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-4"><input type="submit" name="submit" value="申请提现" class="btn btn-primary form-control"/><br/>
|
||||
</div>
|
||||
</form>
|
||||
<footer class="panel-footer">
|
||||
<div class="col-sm-offset-2 col-sm-6"><br/>
|
||||
<h4><span class="glyphicon glyphicon-info-sign"></span>注意事项</h4>
|
||||
当前最低提现金额为<b><?php echo $conf['settle_money']?></b>元<br/>
|
||||
当前手动提现模式是:<?php echo $conf['settle_type']==1?'<b>T+1</b>,可提现余额为截止到前一天你的收入':'<b>T+0</b>,可提现余额为截止到现在你的收入';?><br/>
|
||||
申请提现后,你的款项将在1个工作日内下发到指定账户内。
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include 'foot.php';?>
|
||||
<script>
|
||||
function inputMoney(){
|
||||
$("input[name='money']").val($("input[name='tmoney']").val());
|
||||
}
|
||||
</script>
|
||||
6
user/assets/css/animate.min.css
vendored
Normal file
5177
user/assets/css/app.css
Normal file
1
user/assets/css/captcha.css
Normal file
@@ -0,0 +1 @@
|
||||
#captcha_text{height:42px;width:100%;text-align:center;border-radius:2px;background-color:#F3F3F3;color:#BBBBBB;font-size:14px;letter-spacing:0.1px;line-height:42px}#captcha_wait{display:none;height:42px;width:100%;text-align:center;border-radius:2px;background-color:#F3F3F3}.loading{margin:auto;width:70px;height:20px}.loading-dot{float:left;width:8px;height:8px;margin:18px 4px;background:#ccc;-webkit-border-radius:50%;-moz-border-radius:50%;border-radius:50%;opacity:0;-webkit-box-shadow:0 0 2px black;-moz-box-shadow:0 0 2px black;-ms-box-shadow:0 0 2px black;-o-box-shadow:0 0 2px black;box-shadow:0 0 2px black;-webkit-animation:loadingFade 1s infinite;-moz-animation:loadingFade 1s infinite;animation:loadingFade 1s infinite}.loading-dot:nth-child(1){-webkit-animation-delay:0s;-moz-animation-delay:0s;animation-delay:0s}.loading-dot:nth-child(2){-webkit-animation-delay:0.1s;-moz-animation-delay:0.1s;animation-delay:0.1s}.loading-dot:nth-child(3){-webkit-animation-delay:0.2s;-moz-animation-delay:0.2s;animation-delay:0.2s}.loading-dot:nth-child(4){-webkit-animation-delay:0.3s;-moz-animation-delay:0.3s;animation-delay:0.3s}@-webkit-keyframes loadingFade{0%{opacity:0}50%{opacity:0.8}100%{opacity:0}}@-moz-keyframes loadingFade{0%{opacity:0}50%{opacity:0.8}100%{opacity:0}}@keyframes loadingFade{0%{opacity:0}50%{opacity:0.8}100%{opacity:0}}
|
||||
18
user/assets/css/font.css
Normal file
@@ -0,0 +1,18 @@
|
||||
@font-face {
|
||||
font-family: 'Source Sans Pro';
|
||||
font-style: normal;
|
||||
font-weight: 300;
|
||||
src: local('Source Sans Pro Light'), local('SourceSansPro-Light'), url('../fonts/sourcesanspro/sourcesanspro-light.woff') format('woff');
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'Source Sans Pro';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: local('Source Sans Pro'), local('SourceSansPro-Regular'), url('../fonts/sourcesanspro/sourcesanspro.woff') format('woff');
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'Source Sans Pro';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: local('Source Sans Pro Bold'), local('SourceSansPro-Bold'), url('../fonts/sourcesanspro/sourcesanspro-bold.woff') format('woff');
|
||||
}
|
||||
BIN
user/assets/fonts/sourcesanspro/sourcesanspro-bold.woff
Normal file
BIN
user/assets/fonts/sourcesanspro/sourcesanspro-light.woff
Normal file
BIN
user/assets/fonts/sourcesanspro/sourcesanspro.woff
Normal file
BIN
user/assets/img/alipay.png
Normal file
|
After Width: | Height: | Size: 8.7 KiB |
BIN
user/assets/img/logo.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
user/assets/img/p0.jpg
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
BIN
user/assets/img/qr.png
Normal file
|
After Width: | Height: | Size: 95 KiB |
BIN
user/assets/img/user.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
4
user/assets/js/app.min.js
vendored
Normal file
227
user/assets/js/config.json
Normal file
@@ -0,0 +1,227 @@
|
||||
{
|
||||
"dongxue": {
|
||||
"qrWidth": "364",
|
||||
"qrHeight": "364",
|
||||
"foreground": "#E3D6C6",
|
||||
"background": "#FFFFFF",
|
||||
"imgWidth": 900,
|
||||
"imgHeight": 1200,
|
||||
"font": "70px '黑体'",
|
||||
"fontColor": "#FFFFFF",
|
||||
"recNameLeft": "",
|
||||
"recNameTop": 178,
|
||||
"qrLeft": 270,
|
||||
"qrTop": 340,
|
||||
"url": "https://img.alicdn.com/imgextra/i2/2027555802/O1CN0178X3hU1sjMWfmkoh5_!!2027555802.png"
|
||||
},
|
||||
"pikaqiu": {
|
||||
"qrWidth": "316",
|
||||
"qrHeight": "316",
|
||||
"foreground": "#FBCE29",
|
||||
"background": "#FFFFFF",
|
||||
"imgWidth": 900,
|
||||
"imgHeight": 1200,
|
||||
"font": "70px '黑体'",
|
||||
"fontColor": "#FFFFFF",
|
||||
"recNameLeft": "",
|
||||
"recNameTop": 178,
|
||||
"qrLeft": 290,
|
||||
"qrTop": 367,
|
||||
"url": "https://img.alicdn.com/imgextra/i3/2027555802/O1CN01ETL8eZ1sjMWf7GHlX_!!2027555802.png"
|
||||
},
|
||||
"kanuobudingmao": {
|
||||
"qrWidth": "316",
|
||||
"qrHeight": "316",
|
||||
"foreground": "#E1C6B1",
|
||||
"background": "#FFFFFF",
|
||||
"imgWidth": 900,
|
||||
"imgHeight": 1200,
|
||||
"font": "70px '黑体'",
|
||||
"fontColor": "#E1C6B1",
|
||||
"recNameLeft": "",
|
||||
"recNameTop": 178,
|
||||
"qrLeft": 290,
|
||||
"qrTop": 367,
|
||||
"url": "https://img.alicdn.com/imgextra/i4/2027555802/O1CN01bFGxSs1sjMWcWW1uR_!!2027555802.png"
|
||||
},
|
||||
"niannianyouyu": {
|
||||
"qrWidth": "370",
|
||||
"qrHeight": "370",
|
||||
"foreground": "#E62601",
|
||||
"background": "#FFFFFF",
|
||||
"imgWidth": 900,
|
||||
"imgHeight": 1200,
|
||||
"font": "60px '黑体'",
|
||||
"fontColor": "#FFFFFF",
|
||||
"recNameLeft": "",
|
||||
"recNameTop": 255,
|
||||
"qrLeft": 270,
|
||||
"qrTop": 320,
|
||||
"url": "https://img.alicdn.com/imgextra/i1/2027555802/O1CN01T0g4kQ1sjMWf7HUZP_!!2027555802.png"
|
||||
},
|
||||
"xiaohuangren": {
|
||||
"qrWidth": "520",
|
||||
"qrHeight": "520",
|
||||
"foreground": "#F7D25D",
|
||||
"background": "#FFFFFF",
|
||||
"imgWidth": 900,
|
||||
"imgHeight": 1200,
|
||||
"font": "70px '黑体'",
|
||||
"fontColor": "transparent",
|
||||
"recNameLeft": "",
|
||||
"recNameTop": 178,
|
||||
"qrLeft": 183,
|
||||
"qrTop": 98,
|
||||
"url": "https://img.alicdn.com/imgextra/i4/2027555802/O1CN019MNjbn1sjMWe1zPkK_!!2027555802.png"
|
||||
},
|
||||
"qitao": {
|
||||
"qrWidth": "520",
|
||||
"qrHeight": "520",
|
||||
"foreground": "#212121",
|
||||
"background": "transparent",
|
||||
"imgWidth": 900,
|
||||
"imgHeight": 1200,
|
||||
"font": "70px '黑体'",
|
||||
"fontColor": "transparent",
|
||||
"recNameLeft": "",
|
||||
"recNameTop": 178,
|
||||
"qrLeft": 93,
|
||||
"qrTop": 98,
|
||||
"url": "https://img.alicdn.com/imgextra/i4/2027555802/O1CN01vCBhEb1sjMWbLYdfv_!!2027555802.png"
|
||||
},
|
||||
"baobei": {
|
||||
"qrWidth": "500",
|
||||
"qrHeight": "500",
|
||||
"foreground": "#A95B5E",
|
||||
"background": "transparent",
|
||||
"imgWidth": 900,
|
||||
"imgHeight": 1200,
|
||||
"font": "70px '黑体'",
|
||||
"fontColor": "transparent",
|
||||
"recNameLeft": "",
|
||||
"recNameTop": 178,
|
||||
"qrLeft": 200,
|
||||
"qrTop": 370,
|
||||
"url": "https://img.alicdn.com/imgextra/i3/2027555802/O1CN01ABc7nR1sjMWbLWQRm_!!2027555802.png"
|
||||
},
|
||||
"toushi": {
|
||||
"qrWidth": "400",
|
||||
"qrHeight": "400",
|
||||
"foreground": "#FDA3B8",
|
||||
"background": "transparent",
|
||||
"imgWidth": 900,
|
||||
"imgHeight": 1200,
|
||||
"font": "70px '黑体'",
|
||||
"fontColor": "transparent",
|
||||
"recNameLeft": "",
|
||||
"recNameTop": 178,
|
||||
"qrLeft": 408,
|
||||
"qrTop": 605,
|
||||
"url": "https://img.alicdn.com/imgextra/i4/2027555802/O1CN01mO4EYP1sjMWeSZtzX_!!2027555802.png"
|
||||
},
|
||||
"gongzhu": {
|
||||
"qrWidth": "520",
|
||||
"qrHeight": "520",
|
||||
"foreground": "#F36C79",
|
||||
"background": "transparent",
|
||||
"imgWidth": 900,
|
||||
"imgHeight": 1200,
|
||||
"font": "70px '黑体'",
|
||||
"fontColor": "transparent",
|
||||
"recNameLeft": "",
|
||||
"recNameTop": 178,
|
||||
"qrLeft": 185,
|
||||
"qrTop": 370,
|
||||
"url": "https://img.alicdn.com/imgextra/i4/2027555802/O1CN01LDfMYs1sjMWhTHmPR_!!2027555802.png"
|
||||
},
|
||||
"qiuzanzhu": {
|
||||
"qrWidth": "460",
|
||||
"qrHeight": "460",
|
||||
"foreground": "#F36C79",
|
||||
"background": "transparent",
|
||||
"imgWidth": 900,
|
||||
"imgHeight": 1200,
|
||||
"font": "70px '黑体'",
|
||||
"fontColor": "transparent",
|
||||
"recNameLeft": "",
|
||||
"recNameTop": 178,
|
||||
"qrLeft": 220,
|
||||
"qrTop": 425,
|
||||
"url": "https://img.alicdn.com/imgextra/i2/2027555802/O1CN01EAhVdL1sjMWe1yXjJ_!!2027555802.png"
|
||||
},
|
||||
"huanyingdashang": {
|
||||
"qrWidth": "510",
|
||||
"qrHeight": "510",
|
||||
"foreground": "#F00",
|
||||
"background": "transparent",
|
||||
"imgWidth": 900,
|
||||
"imgHeight": 1200,
|
||||
"font": "70px '黑体'",
|
||||
"fontColor": "transparent",
|
||||
"recNameLeft": "",
|
||||
"recNameTop": 178,
|
||||
"qrLeft": 195,
|
||||
"qrTop": 625,
|
||||
"url": "https://img.alicdn.com/imgextra/i4/2027555802/O1CN01Yuipi71sjMWhTI32u_!!2027555802.png"
|
||||
},
|
||||
"yinlian": {
|
||||
"qrWidth": "330",
|
||||
"qrHeight": "330",
|
||||
"foreground": "#fff",
|
||||
"background": "transparent",
|
||||
"imgWidth": 900,
|
||||
"imgHeight": 1200,
|
||||
"font": "70px '黑体'",
|
||||
"fontColor": "transparent",
|
||||
"recNameLeft": "",
|
||||
"recNameTop": 178,
|
||||
"qrLeft": 190,
|
||||
"qrTop": 180,
|
||||
"url": "https://img.alicdn.com/imgextra/i4/2027555802/O1CN01DU5ECy1sjMWe205L5_!!2027555802.png"
|
||||
},
|
||||
"yitiji": {
|
||||
"qrWidth": "380",
|
||||
"qrHeight": "380",
|
||||
"foreground": "#FB7C2F",
|
||||
"background": "transparent",
|
||||
"imgWidth": 900,
|
||||
"imgHeight": 1200,
|
||||
"font": "70px '黑体'",
|
||||
"fontColor": "transparent",
|
||||
"recNameLeft": "",
|
||||
"recNameTop": 178,
|
||||
"qrLeft": 260,
|
||||
"qrTop": 190,
|
||||
"url": "https://img.alicdn.com/imgextra/i4/2027555802/O1CN01B4y11v1sjMWeSGuWy_!!2027555802.png"
|
||||
},
|
||||
"maomi": {
|
||||
"qrWidth": "480",
|
||||
"qrHeight": "480",
|
||||
"foreground": "#FDD699",
|
||||
"background": "transparent",
|
||||
"imgWidth": 900,
|
||||
"imgHeight": 1200,
|
||||
"font": "70px '黑体'",
|
||||
"fontColor": "transparent",
|
||||
"recNameLeft": "",
|
||||
"recNameTop": 178,
|
||||
"qrLeft": 210,
|
||||
"qrTop": 150,
|
||||
"url": "https://img.alicdn.com/imgextra/i4/2027555802/O1CN017OCNEy1sjMWfe9Z3U_!!2027555802.png"
|
||||
},
|
||||
"longmao": {
|
||||
"qrWidth": "464",
|
||||
"qrHeight": "464",
|
||||
"foreground": "#7394B6",
|
||||
"background": "transparent",
|
||||
"imgWidth": 900,
|
||||
"imgHeight": 1200,
|
||||
"font": "70px '黑体'",
|
||||
"fontColor": "transparent",
|
||||
"recNameLeft": "",
|
||||
"recNameTop": 178,
|
||||
"qrLeft": 218,
|
||||
"qrTop": 214,
|
||||
"url": "https://img.alicdn.com/imgextra/i4/2027555802/O1CN01Jb4sxE1sjMWWkB2GX_!!2027555802.png"
|
||||
}
|
||||
}
|
||||
120
user/assets/js/onecode.js
Normal file
@@ -0,0 +1,120 @@
|
||||
var config;
|
||||
// 生成收款码
|
||||
function makeDiyBg(element, qrWidth, qrHeight, url, foreground, background, imgUrl, imgWidth, imgHeight, font, fontColor, recName, recNameLeft, recNameTop, qrLeft, qrTop) {
|
||||
$(element).qrcode({
|
||||
render: "canvas",
|
||||
width: qrWidth,
|
||||
height: qrHeight,
|
||||
text: url,
|
||||
foreground: foreground,
|
||||
background: background
|
||||
});
|
||||
var canvas = document.getElementById('canvas');
|
||||
canvas.width = imgWidth;
|
||||
canvas.height = imgHeight;
|
||||
var ctx = canvas.getContext("2d");
|
||||
var img = new Image();
|
||||
img.crossOrigin = "Anonymous"
|
||||
img.src = imgUrl;
|
||||
img.onload = function () {
|
||||
// 生成背景图
|
||||
var bg = ctx.createPattern(img, "no-repeat");
|
||||
ctx.fillStyle = bg;
|
||||
ctx.fillRect(0, 0, imgWidth, imgHeight);
|
||||
// 生成收款名
|
||||
ctx.textAlign = "center";
|
||||
ctx.font = font;
|
||||
ctx.fillStyle = fontColor;
|
||||
if (recName) {
|
||||
if (!recNameLeft) {
|
||||
recNameLeft = imgWidth / 2;
|
||||
}
|
||||
ctx.fillText("扫码向 " + recName + " 付款", recNameLeft, recNameTop);
|
||||
}
|
||||
// 在canvas上生成二维码
|
||||
var canvasOld = document.getElementsByTagName('canvas')[0];
|
||||
ctx.drawImage(canvasOld, qrLeft, qrTop);
|
||||
|
||||
|
||||
var image = new Image();
|
||||
image.crossOrigin = "Anonymous"
|
||||
image.src = canvas.toDataURL("image/png");
|
||||
$("#endImg").attr("src", image.src);
|
||||
$("#load").hide();
|
||||
$("#qrcode").show();
|
||||
}
|
||||
}
|
||||
function showQrCode(styleName){
|
||||
$("#load").show();
|
||||
$("#qrcode").hide();
|
||||
$("#code").empty();
|
||||
styleName = styleName || 'dongxue';
|
||||
var qrWidth = config[styleName].qrWidth;
|
||||
var qrHeight = config[styleName].qrHeight;
|
||||
var foreground = config[styleName].foreground;
|
||||
var background = config[styleName].background;
|
||||
var imgWidth = config[styleName].imgWidth;
|
||||
var imgHeight = config[styleName].imgHeight;
|
||||
var font = config[styleName].font;
|
||||
var fontColor = config[styleName].fontColor;
|
||||
var recNameLeft = config[styleName].recNameLeft;
|
||||
var recNameTop = config[styleName].recNameTop;
|
||||
var qrLeft = config[styleName].qrLeft;
|
||||
var qrTop = config[styleName].qrTop;
|
||||
var nowUrl = config[styleName].url;
|
||||
makeDiyBg("#code", qrWidth, qrHeight, $("#code_url").val(), foreground, background, nowUrl, imgWidth, imgHeight, font, fontColor, $("#recName").val(), recNameLeft, recNameTop, qrLeft, qrTop);
|
||||
}
|
||||
$(document).ready(function(){
|
||||
var clipboard = new Clipboard('.copy-btn');
|
||||
clipboard.on('success', function (e) {
|
||||
layer.msg('复制成功!', {icon: 1});
|
||||
});
|
||||
clipboard.on('error', function (e) {
|
||||
layer.msg('复制失败,请长按链接后手动复制', {icon: 2});
|
||||
});
|
||||
$("#editName").click(function(){
|
||||
var codename=$("input[name='codename']").val();
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
url : "ajax2.php?act=edit_codename",
|
||||
data : {codename:codename},
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 1){
|
||||
layer.alert(data.msg, {icon: 1}, function(){window.location.reload()});
|
||||
}else{
|
||||
layer.alert(data.msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
//点击按钮保存图片
|
||||
$("#downImg").click(function () {
|
||||
var img = document.getElementById('endImg');
|
||||
var url = img.src;
|
||||
var a = document.createElement('a');
|
||||
var event = new MouseEvent('click');
|
||||
a.download = '一码支付-' + document.getElementById("recName").value;
|
||||
a.href = url;
|
||||
a.dispatchEvent(event);
|
||||
});
|
||||
$("#styleName").change(function(){
|
||||
$.cookie('styleName',$(this).val());
|
||||
showQrCode($(this).val());
|
||||
});
|
||||
if($.cookie('styleName')){
|
||||
$("#styleName").val($.cookie('styleName'));
|
||||
}
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: "./assets/js/config.json",
|
||||
dataType: "json",
|
||||
async: true,
|
||||
success: function (data) {
|
||||
config = data;
|
||||
$("#styleName").change();
|
||||
}
|
||||
})
|
||||
})
|
||||
115
user/assets/js/qrlogin.js
Normal file
@@ -0,0 +1,115 @@
|
||||
var interval1,interval2;
|
||||
function setCookie(name,value)
|
||||
{
|
||||
var exp = new Date();
|
||||
exp.setTime(exp.getTime() + 30*1000);
|
||||
document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
|
||||
}
|
||||
function getCookie(name)
|
||||
{
|
||||
var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
|
||||
if(arr=document.cookie.match(reg))
|
||||
return unescape(arr[2]);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
function getqrpic(force){
|
||||
force = force || false;
|
||||
cleartime();
|
||||
var qrsig = getCookie('qrsig');
|
||||
var qrimg = getCookie('qrimg');
|
||||
if(qrsig!=null && qrimg!=null && force==false){
|
||||
$('#qrimg').attr('qrsig',qrsig);
|
||||
$('#qrimg').html('<img id="qrcodeimg" onclick="getqrpic(true)" src="data:image/png;base64,'+qrimg+'" title="点击刷新">');
|
||||
if( /Android|SymbianOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Windows Phone|Midp/i.test(navigator.userAgent) && navigator.userAgent.indexOf("QQ/") == -1) {
|
||||
$('#mobile').show();
|
||||
}
|
||||
interval1=setInterval(loginload,1000);
|
||||
interval2=setInterval(qrlogin,3000);
|
||||
}else{
|
||||
var getvcurl='qrlogin.php?do=getqrpic&r='+Math.random(1);
|
||||
$.get(getvcurl, function(d) {
|
||||
if(d.saveOK ==0){
|
||||
setCookie('qrsig',d.qrsig);
|
||||
setCookie('qrimg',d.data);
|
||||
$('#qrimg').attr('qrsig',d.qrsig);
|
||||
$('#qrimg').html('<img id="qrcodeimg" onclick="getqrpic(true)" src="data:image/png;base64,'+d.data+'" title="点击刷新">');
|
||||
if( /Android|SymbianOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Windows Phone|Midp/i.test(navigator.userAgent) && navigator.userAgent.indexOf("QQ/") == -1) {
|
||||
$('#mobile').show();
|
||||
}
|
||||
interval1=setInterval(loginload,1000);
|
||||
interval2=setInterval(qrlogin,3000);
|
||||
}else{
|
||||
alert(d.msg);
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
}
|
||||
function qrlogin(){
|
||||
if ($('#login').attr("data-lock") === "true") return;
|
||||
var qrsig=$('#qrimg').attr('qrsig');
|
||||
var url = 'qrlogin.php?do=qrlogin&qrsig='+decodeURIComponent(qrsig)+'&r='+Math.random(1);
|
||||
$.get(url, function(d) {
|
||||
if(d.saveOK ==0){
|
||||
$('#loginmsg').html('QQ已成功登录!');
|
||||
$('#login').hide();
|
||||
$('#qrimg').hide();
|
||||
$('#submit').hide();
|
||||
$('#login').attr("data-lock", "true");
|
||||
$.get("connect.php?act=qrlogin&r="+Math.random(1), function(arr) {
|
||||
if(arr.code==0) {
|
||||
layer.msg(arr.msg, {icon: 16,time: 10000,shade:[0.3, "#000"]});
|
||||
setTimeout(function(){ window.location.href=arr.url }, 1000);
|
||||
}else{
|
||||
layer.alert(arr.msg);
|
||||
}
|
||||
}, 'json');
|
||||
cleartime();
|
||||
}else if(d.saveOK ==1){
|
||||
getqrpic(true);
|
||||
$('#loginmsg').html('请重新扫描二维码');
|
||||
}else if(d.saveOK ==2){
|
||||
$('#loginmsg').html('使用QQ手机版扫描二维码');
|
||||
}else if(d.saveOK ==3){
|
||||
$('#loginmsg').html('扫描成功,请在手机上确认授权登录');
|
||||
}else if(d.saveOK ==4){
|
||||
cleartime();
|
||||
$('#loginmsg').html('QQ验证失败,请解除登录异常后重试!');
|
||||
}else{
|
||||
cleartime();
|
||||
$('#loginmsg').html(d.msg);
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
function loginload(){
|
||||
if ($('#login').attr("data-lock") === "true") return;
|
||||
var load=document.getElementById('loginload').innerHTML;
|
||||
var len=load.length;
|
||||
if(len>2){
|
||||
load='.';
|
||||
}else{
|
||||
load+='.';
|
||||
}
|
||||
document.getElementById('loginload').innerHTML=load;
|
||||
}
|
||||
function cleartime(){
|
||||
clearInterval(interval1);
|
||||
clearInterval(interval2);
|
||||
}
|
||||
function mloginurl(){
|
||||
var imagew = $('#qrcodeimg').attr('src');
|
||||
imagew = imagew.replace(/data:image\/png;base64,/, "");
|
||||
$('#mlogin').html("正在跳转...");
|
||||
$.post("connect.php?act=qrcode&r="+Math.random(1),"image="+encodeURIComponent(imagew), function(arr) {
|
||||
if(arr.code==0) {
|
||||
$('#loginmsg').html('跳转到QQ登录后请返回此页面');
|
||||
window.location.href='mqqapi://forward/url?version=1&src_type=web&url_prefix='+window.btoa(arr.url);
|
||||
}else{
|
||||
alert(arr.msg);
|
||||
}
|
||||
$('#mlogin').html("跳转QQ快捷登录");
|
||||
}, 'json');
|
||||
}
|
||||
$(document).ready(function(){
|
||||
getqrpic();
|
||||
});
|
||||
46
user/assets/js/ui-jp.config.js
Normal file
@@ -0,0 +1,46 @@
|
||||
// lazyload config
|
||||
|
||||
var jp_config = {
|
||||
easyPieChart: [ './assets/vendor/jquery.easy-pie-chart/dist/jquery.easypiechart.fill.js'],
|
||||
sparkline: [ './assets/vendor/jquery.sparkline/dist/jquery.sparkline.retina.js'],
|
||||
plot: [ './assets/vendor/flot/jquery.flot.js',
|
||||
'./assets/vendor/flot/jquery.flot.pie.js',
|
||||
'./assets/vendor/flot/jquery.flot.resize.js',
|
||||
'./assets/vendor/flot.tooltip/js/jquery.flot.tooltip.min.js',
|
||||
'./assets/vendor/flot.orderbars/js/jquery.flot.orderBars.js',
|
||||
'./assets/vendor/flot-spline/js/jquery.flot.spline.min.js'],
|
||||
moment: [ './assets/vendor/moment/moment.js'],
|
||||
screenfull: [ './assets/vendor/screenfull/dist/screenfull.min.js'],
|
||||
slimScroll: [ './assets/vendor/slimscroll/jquery.slimscroll.min.js'],
|
||||
sortable: [ './assets/vendor/html5sortable/jquery.sortable.js'],
|
||||
nestable: [ './assets/vendor/nestable/jquery.nestable.js',
|
||||
'./assets/vendor/nestable/jquery.nestable.css'],
|
||||
filestyle: [ './assets/vendor/bootstrap-filestyle/src/bootstrap-filestyle.js'],
|
||||
slider: [ './assets/vendor/bootstrap-slider/bootstrap-slider.js',
|
||||
'./assets/vendor/bootstrap-slider/bootstrap-slider.css'],
|
||||
chosen: [ './assets/vendor/chosen/chosen.jquery.min.js',
|
||||
'./assets/vendor/bootstrap-chosen/bootstrap-chosen.css'],
|
||||
TouchSpin: [ './assets/vendor/bootstrap-touchspin/dist/jquery.bootstrap-touchspin.min.js',
|
||||
'./assets/vendor/bootstrap-touchspin/dist/jquery.bootstrap-touchspin.min.css'],
|
||||
wysiwyg: [ './assets/vendor/bootstrap-wysiwyg/bootstrap-wysiwyg.js',
|
||||
'./assets/vendor/bootstrap-wysiwyg/external/jquery.hotkeys.js'],
|
||||
dataTable: [ './assets/vendor/datatables/media/js/jquery.dataTables.min.js',
|
||||
'./assets/vendor/plugins/integration/bootstrap/3/dataTables.bootstrap.js',
|
||||
'./assets/vendor/plugins/integration/bootstrap/3/dataTables.bootstrap.css'],
|
||||
vectorMap: [ './assets/vendor/bower-jvectormap/jquery-jvectormap-1.2.2.min.js',
|
||||
'./assets/vendor/bower-jvectormap/jquery-jvectormap-world-mill-en.js',
|
||||
'./assets/vendor/bower-jvectormap/jquery-jvectormap-us-aea-en.js',
|
||||
'./assets/vendor/bower-jvectormap/jquery-jvectormap-1.2.2.css'],
|
||||
footable: [ './assets/vendor/footable/dist/footable.all.min.js',
|
||||
'./assets/vendor/footable/css/footable.core.css'],
|
||||
fullcalendar: [ './assets/vendor/moment/moment.js',
|
||||
'./assets/vendor/fullcalendar/dist/fullcalendar.min.js',
|
||||
'./assets/vendor/fullcalendar/dist/fullcalendar.css',
|
||||
'./assets/vendor/fullcalendar/dist/fullcalendar.theme.css'],
|
||||
daterangepicker:[ './assets/vendor/moment/moment.js',
|
||||
'./assets/vendor/bootstrap-daterangepicker/daterangepicker.js',
|
||||
'./assets/vendor/bootstrap-daterangepicker/daterangepicker-bs3.css'],
|
||||
tagsinput: [ './assets/vendor/bootstrap-tagsinput/dist/bootstrap-tagsinput.js',
|
||||
'./assets/vendor/bootstrap-tagsinput/dist/bootstrap-tagsinput.css']
|
||||
|
||||
};
|
||||
19
user/assets/js/ui-jp.js
Normal file
@@ -0,0 +1,19 @@
|
||||
+function ($) {
|
||||
|
||||
$(function(){
|
||||
|
||||
$("[ui-jq]").each(function(){
|
||||
var self = $(this);
|
||||
var options = eval('[' + self.attr('ui-options') + ']');
|
||||
|
||||
if ($.isPlainObject(options[0])) {
|
||||
options[0] = $.extend({}, options[0]);
|
||||
}
|
||||
|
||||
uiLoad.load(jp_config[self.attr('ui-jq')]).then( function(){
|
||||
self[self.attr('ui-jq')].apply(self, options);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
}(jQuery);
|
||||
86
user/assets/js/ui-load.js
Normal file
@@ -0,0 +1,86 @@
|
||||
|
||||
/**
|
||||
* 0.1.0
|
||||
* Deferred load js/css file, used for ui-jq.js and Lazy Loading.
|
||||
*
|
||||
* @ flatfull.com All Rights Reserved.
|
||||
* Author url: http://themeforest.net/user/flatfull
|
||||
*/
|
||||
var uiLoad = uiLoad || {};
|
||||
|
||||
(function($, $document, uiLoad) {
|
||||
"use strict";
|
||||
|
||||
var loaded = [],
|
||||
promise = false,
|
||||
deferred = $.Deferred();
|
||||
|
||||
/**
|
||||
* Chain loads the given sources
|
||||
* @param srcs array, script or css
|
||||
* @returns {*} Promise that will be resolved once the sources has been loaded.
|
||||
*/
|
||||
uiLoad.load = function (srcs) {
|
||||
srcs = $.isArray(srcs) ? srcs : srcs.split(/\s+/);
|
||||
if(!promise){
|
||||
promise = deferred.promise();
|
||||
}
|
||||
|
||||
$.each(srcs, function(index, src) {
|
||||
promise = promise.then( function(){
|
||||
return src.indexOf('.css') >=0 ? loadCSS(src) : loadScript(src);
|
||||
} );
|
||||
});
|
||||
deferred.resolve();
|
||||
return promise;
|
||||
};
|
||||
|
||||
/**
|
||||
* Dynamically loads the given script
|
||||
* @param src The url of the script to load dynamically
|
||||
* @returns {*} Promise that will be resolved once the script has been loaded.
|
||||
*/
|
||||
var loadScript = function (src) {
|
||||
if(loaded[src]) return loaded[src].promise();
|
||||
|
||||
var deferred = $.Deferred();
|
||||
var script = $document.createElement('script');
|
||||
script.src = src;
|
||||
script.onload = function (e) {
|
||||
deferred.resolve(e);
|
||||
};
|
||||
script.onerror = function (e) {
|
||||
deferred.reject(e);
|
||||
};
|
||||
$document.body.appendChild(script);
|
||||
loaded[src] = deferred;
|
||||
|
||||
return deferred.promise();
|
||||
};
|
||||
|
||||
/**
|
||||
* Dynamically loads the given CSS file
|
||||
* @param href The url of the CSS to load dynamically
|
||||
* @returns {*} Promise that will be resolved once the CSS file has been loaded.
|
||||
*/
|
||||
var loadCSS = function (href) {
|
||||
if(loaded[href]) return loaded[href].promise();
|
||||
|
||||
var deferred = $.Deferred();
|
||||
var style = $document.createElement('link');
|
||||
style.rel = 'stylesheet';
|
||||
style.type = 'text/css';
|
||||
style.href = href;
|
||||
style.onload = function (e) {
|
||||
deferred.resolve(e);
|
||||
};
|
||||
style.onerror = function (e) {
|
||||
deferred.reject(e);
|
||||
};
|
||||
$document.head.appendChild(style);
|
||||
loaded[href] = deferred;
|
||||
|
||||
return deferred.promise();
|
||||
}
|
||||
|
||||
})(jQuery, document, uiLoad);
|
||||
20
user/assets/js/ui-nav.js
Normal file
@@ -0,0 +1,20 @@
|
||||
+function ($) {
|
||||
|
||||
$(function(){
|
||||
|
||||
// nav
|
||||
$(document).on('click', '[ui-nav] a', function (e) {
|
||||
var $this = $(e.target), $active;
|
||||
$this.is('a') || ($this = $this.closest('a'));
|
||||
|
||||
$active = $this.parent().siblings( ".active" );
|
||||
$active && $active.toggleClass('active').find('> ul:visible').slideUp(200);
|
||||
|
||||
($this.parent().hasClass('active') && $this.next().slideUp(200)) || $this.next().slideDown(200);
|
||||
$this.parent().toggleClass('active');
|
||||
|
||||
$this.next().is('ul') && e.preventDefault();
|
||||
});
|
||||
|
||||
});
|
||||
}(jQuery);
|
||||
14
user/assets/js/ui-toggle.js
Normal file
@@ -0,0 +1,14 @@
|
||||
+function ($) {
|
||||
|
||||
$(function(){
|
||||
|
||||
$(document).on('click', '[ui-toggle]', function (e) {
|
||||
e.preventDefault();
|
||||
var $this = $(e.target);
|
||||
$this.attr('ui-toggle') || ($this = $this.closest('[ui-toggle]'));
|
||||
var $target = $($this.attr('target')) || $this;
|
||||
$target.toggleClass($this.attr('ui-toggle'));
|
||||
});
|
||||
|
||||
});
|
||||
}(jQuery);
|
||||
399
user/assets/vendor/chosen/bootstrap-chosen.css
vendored
Normal file
@@ -0,0 +1,399 @@
|
||||
.chosen-select {
|
||||
width: 100%;
|
||||
}
|
||||
.chosen-select-deselect {
|
||||
width: 100%;
|
||||
}
|
||||
.chosen-container {
|
||||
display: inline-block;
|
||||
font-size: 14px;
|
||||
position: relative;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.chosen-container .chosen-drop {
|
||||
background: #ffffff;
|
||||
border: 1px solid #cccccc;
|
||||
border-bottom-right-radius: 4px;
|
||||
border-bottom-left-radius: 4px;
|
||||
-webkit-box-shadow: 0 8px 8px rgba(0, 0, 0, .25);
|
||||
box-shadow: 0 8px 8px rgba(0, 0, 0, .25);
|
||||
margin-top: -1px;
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: -9000px;
|
||||
z-index: 1060;
|
||||
}
|
||||
.chosen-container.chosen-with-drop .chosen-drop {
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
.chosen-container .chosen-results {
|
||||
color: #555555;
|
||||
margin: 0 4px 4px 0;
|
||||
max-height: 240px;
|
||||
padding: 0 0 0 4px;
|
||||
position: relative;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
.chosen-container .chosen-results li {
|
||||
display: none;
|
||||
line-height: 1.42857143;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 5px 6px;
|
||||
}
|
||||
.chosen-container .chosen-results li em {
|
||||
background: #feffde;
|
||||
font-style: normal;
|
||||
}
|
||||
.chosen-container .chosen-results li.group-result {
|
||||
display: list-item;
|
||||
cursor: default;
|
||||
color: #999;
|
||||
font-weight: bold;
|
||||
}
|
||||
.chosen-container .chosen-results li.group-option {
|
||||
padding-left: 15px;
|
||||
}
|
||||
.chosen-container .chosen-results li.active-result {
|
||||
cursor: pointer;
|
||||
display: list-item;
|
||||
}
|
||||
.chosen-container .chosen-results li.highlighted {
|
||||
background-color: #337ab7;
|
||||
background-image: none;
|
||||
color: white;
|
||||
}
|
||||
.chosen-container .chosen-results li.highlighted em {
|
||||
background: transparent;
|
||||
}
|
||||
.chosen-container .chosen-results li.disabled-result {
|
||||
display: list-item;
|
||||
color: #777777;
|
||||
}
|
||||
.chosen-container .chosen-results .no-results {
|
||||
background: #eeeeee;
|
||||
display: list-item;
|
||||
}
|
||||
.chosen-container .chosen-results-scroll {
|
||||
background: white;
|
||||
margin: 0 4px;
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
width: 321px;
|
||||
z-index: 1;
|
||||
}
|
||||
.chosen-container .chosen-results-scroll span {
|
||||
display: inline-block;
|
||||
height: 1.42857143;
|
||||
text-indent: -5000px;
|
||||
width: 9px;
|
||||
}
|
||||
.chosen-container .chosen-results-scroll-down {
|
||||
bottom: 0;
|
||||
}
|
||||
.chosen-container .chosen-results-scroll-down span {
|
||||
background: url("chosen-sprite.png") no-repeat -4px -3px;
|
||||
}
|
||||
.chosen-container .chosen-results-scroll-up span {
|
||||
background: url("chosen-sprite.png") no-repeat -22px -3px;
|
||||
}
|
||||
.chosen-container-single .chosen-single {
|
||||
background-color: #ffffff;
|
||||
-webkit-background-clip: padding-box;
|
||||
-moz-background-clip: padding;
|
||||
background-clip: padding-box;
|
||||
border: 1px solid #cccccc;
|
||||
border-top-right-radius: 4px;
|
||||
border-top-left-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
border-bottom-left-radius: 4px;
|
||||
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
|
||||
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
|
||||
color: #555555;
|
||||
display: block;
|
||||
height: 34px;
|
||||
overflow: hidden;
|
||||
line-height: 34px;
|
||||
padding: 0 0 0 8px;
|
||||
position: relative;
|
||||
text-decoration: none;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.chosen-container-single .chosen-single span {
|
||||
display: block;
|
||||
margin-right: 26px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.chosen-container-single .chosen-single abbr {
|
||||
background: url("chosen-sprite.png") right top no-repeat;
|
||||
display: block;
|
||||
font-size: 1px;
|
||||
height: 10px;
|
||||
position: absolute;
|
||||
right: 26px;
|
||||
top: 12px;
|
||||
width: 12px;
|
||||
}
|
||||
.chosen-container-single .chosen-single abbr:hover {
|
||||
background-position: right -11px;
|
||||
}
|
||||
.chosen-container-single .chosen-single.chosen-disabled .chosen-single abbr:hover {
|
||||
background-position: right 2px;
|
||||
}
|
||||
.chosen-container-single .chosen-single div {
|
||||
display: block;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 18px;
|
||||
}
|
||||
.chosen-container-single .chosen-single div b {
|
||||
background: url("chosen-sprite.png") no-repeat 0 7px;
|
||||
display: block;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
.chosen-container-single .chosen-default {
|
||||
color: #777777;
|
||||
}
|
||||
.chosen-container-single .chosen-search {
|
||||
margin: 0;
|
||||
padding: 3px 4px;
|
||||
position: relative;
|
||||
white-space: nowrap;
|
||||
z-index: 1000;
|
||||
}
|
||||
.chosen-container-single .chosen-search input[type="text"] {
|
||||
background: url("chosen-sprite.png") no-repeat 100% -20px, #ffffff;
|
||||
border: 1px solid #cccccc;
|
||||
border-top-right-radius: 4px;
|
||||
border-top-left-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
border-bottom-left-radius: 4px;
|
||||
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
|
||||
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
|
||||
margin: 1px 0;
|
||||
padding: 4px 20px 4px 4px;
|
||||
width: 100%;
|
||||
}
|
||||
.chosen-container-single .chosen-drop {
|
||||
margin-top: -1px;
|
||||
border-bottom-right-radius: 4px;
|
||||
border-bottom-left-radius: 4px;
|
||||
-webkit-background-clip: padding-box;
|
||||
-moz-background-clip: padding;
|
||||
background-clip: padding-box;
|
||||
}
|
||||
.chosen-container-single-nosearch .chosen-search input {
|
||||
position: absolute;
|
||||
left: -9000px;
|
||||
}
|
||||
.chosen-container-multi .chosen-choices {
|
||||
background-color: #ffffff;
|
||||
border: 1px solid #cccccc;
|
||||
border-top-right-radius: 4px;
|
||||
border-top-left-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
border-bottom-left-radius: 4px;
|
||||
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
|
||||
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
|
||||
cursor: text;
|
||||
height: auto !important;
|
||||
height: 1%;
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
padding: 0;
|
||||
position: relative;
|
||||
}
|
||||
.chosen-container-multi .chosen-choices li {
|
||||
float: left;
|
||||
list-style: none;
|
||||
}
|
||||
.chosen-container-multi .chosen-choices .search-field {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.chosen-container-multi .chosen-choices .search-field input[type="text"] {
|
||||
background: transparent !important;
|
||||
border: 0 !important;
|
||||
-webkit-box-shadow: none;
|
||||
box-shadow: none;
|
||||
color: #555555;
|
||||
height: 32px;
|
||||
margin: 0;
|
||||
padding: 4px;
|
||||
outline: 0;
|
||||
}
|
||||
.chosen-container-multi .chosen-choices .search-field .default {
|
||||
color: #999;
|
||||
}
|
||||
.chosen-container-multi .chosen-choices .search-choice {
|
||||
-webkit-background-clip: padding-box;
|
||||
-moz-background-clip: padding;
|
||||
background-clip: padding-box;
|
||||
background-color: #eeeeee;
|
||||
border: 1px solid #cccccc;
|
||||
border-top-right-radius: 4px;
|
||||
border-top-left-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
border-bottom-left-radius: 4px;
|
||||
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
|
||||
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
|
||||
color: #333333;
|
||||
cursor: default;
|
||||
line-height: 13px;
|
||||
margin: 6px 0 3px 5px;
|
||||
padding: 3px 20px 3px 5px;
|
||||
position: relative;
|
||||
}
|
||||
.chosen-container-multi .chosen-choices .search-choice .search-choice-close {
|
||||
background: url("chosen-sprite.png") right top no-repeat;
|
||||
display: block;
|
||||
font-size: 1px;
|
||||
height: 10px;
|
||||
position: absolute;
|
||||
right: 4px;
|
||||
top: 5px;
|
||||
width: 12px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.chosen-container-multi .chosen-choices .search-choice .search-choice-close:hover {
|
||||
background-position: right -11px;
|
||||
}
|
||||
.chosen-container-multi .chosen-choices .search-choice-focus {
|
||||
background: #d4d4d4;
|
||||
}
|
||||
.chosen-container-multi .chosen-choices .search-choice-focus .search-choice-close {
|
||||
background-position: right -11px;
|
||||
}
|
||||
.chosen-container-multi .chosen-results {
|
||||
margin: 0 0 0 0;
|
||||
padding: 0;
|
||||
}
|
||||
.chosen-container-multi .chosen-drop .result-selected {
|
||||
display: none;
|
||||
}
|
||||
.chosen-container-active .chosen-single {
|
||||
border: 1px solid #66afe9;
|
||||
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .075) inset, 0 0 8px rgba(82, 168, 236, .6);
|
||||
box-shadow: 0 1px 1px rgba(0, 0, 0, .075) inset, 0 0 8px rgba(82, 168, 236, .6);
|
||||
-webkit-transition: border linear .2s, box-shadow linear .2s;
|
||||
-o-transition: border linear .2s, box-shadow linear .2s;
|
||||
transition: border linear .2s, box-shadow linear .2s;
|
||||
}
|
||||
.chosen-container-active.chosen-with-drop .chosen-single {
|
||||
background-color: #ffffff;
|
||||
border: 1px solid #66afe9;
|
||||
border-bottom-right-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .075) inset, 0 0 8px rgba(82, 168, 236, .6);
|
||||
box-shadow: 0 1px 1px rgba(0, 0, 0, .075) inset, 0 0 8px rgba(82, 168, 236, .6);
|
||||
-webkit-transition: border linear .2s, box-shadow linear .2s;
|
||||
-o-transition: border linear .2s, box-shadow linear .2s;
|
||||
transition: border linear .2s, box-shadow linear .2s;
|
||||
}
|
||||
.chosen-container-active.chosen-with-drop .chosen-single div {
|
||||
background: transparent;
|
||||
border-left: none;
|
||||
}
|
||||
.chosen-container-active.chosen-with-drop .chosen-single div b {
|
||||
background-position: -18px 7px;
|
||||
}
|
||||
.chosen-container-active .chosen-choices {
|
||||
border: 1px solid #66afe9;
|
||||
border-bottom-right-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .075) inset, 0 0 8px rgba(82, 168, 236, .6);
|
||||
box-shadow: 0 1px 1px rgba(0, 0, 0, .075) inset, 0 0 8px rgba(82, 168, 236, .6);
|
||||
-webkit-transition: border linear .2s, box-shadow linear .2s;
|
||||
-o-transition: border linear .2s, box-shadow linear .2s;
|
||||
transition: border linear .2s, box-shadow linear .2s;
|
||||
}
|
||||
.chosen-container-active .chosen-choices .search-field input[type="text"] {
|
||||
color: #111 !important;
|
||||
}
|
||||
.chosen-container-active.chosen-with-drop .chosen-choices {
|
||||
border-bottom-right-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
}
|
||||
.chosen-disabled {
|
||||
cursor: default;
|
||||
opacity: 0.5 !important;
|
||||
}
|
||||
.chosen-disabled .chosen-single {
|
||||
cursor: default;
|
||||
}
|
||||
.chosen-disabled .chosen-choices .search-choice .search-choice-close {
|
||||
cursor: default;
|
||||
}
|
||||
.chosen-rtl {
|
||||
text-align: right;
|
||||
}
|
||||
.chosen-rtl .chosen-single {
|
||||
padding: 0 8px 0 0;
|
||||
overflow: visible;
|
||||
}
|
||||
.chosen-rtl .chosen-single span {
|
||||
margin-left: 26px;
|
||||
margin-right: 0;
|
||||
direction: rtl;
|
||||
}
|
||||
.chosen-rtl .chosen-single div {
|
||||
left: 7px;
|
||||
right: auto;
|
||||
}
|
||||
.chosen-rtl .chosen-single abbr {
|
||||
left: 26px;
|
||||
right: auto;
|
||||
}
|
||||
.chosen-rtl .chosen-choices .search-field input[type="text"] {
|
||||
direction: rtl;
|
||||
}
|
||||
.chosen-rtl .chosen-choices li {
|
||||
float: right;
|
||||
}
|
||||
.chosen-rtl .chosen-choices .search-choice {
|
||||
margin: 6px 5px 3px 0;
|
||||
padding: 3px 5px 3px 19px;
|
||||
}
|
||||
.chosen-rtl .chosen-choices .search-choice .search-choice-close {
|
||||
background-position: right top;
|
||||
left: 4px;
|
||||
right: auto;
|
||||
}
|
||||
.chosen-rtl.chosen-container-single .chosen-results {
|
||||
margin: 0 0 4px 4px;
|
||||
padding: 0 4px 0 0;
|
||||
}
|
||||
.chosen-rtl .chosen-results .group-option {
|
||||
padding-left: 0;
|
||||
padding-right: 15px;
|
||||
}
|
||||
.chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div {
|
||||
border-right: none;
|
||||
}
|
||||
.chosen-rtl .chosen-search input[type="text"] {
|
||||
background: url("chosen-sprite.png") no-repeat -28px -20px, #ffffff;
|
||||
direction: rtl;
|
||||
padding: 4px 5px 4px 20px;
|
||||
}
|
||||
@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-resolution: 2dppx) {
|
||||
.chosen-rtl .chosen-search input[type="text"],
|
||||
.chosen-container-single .chosen-single abbr,
|
||||
.chosen-container-single .chosen-single div b,
|
||||
.chosen-container-single .chosen-search input[type="text"],
|
||||
.chosen-container-multi .chosen-choices .search-choice .search-choice-close,
|
||||
.chosen-container .chosen-results-scroll-down span,
|
||||
.chosen-container .chosen-results-scroll-up span {
|
||||
background-image: url("chosen-sprite@2x.png") !important;
|
||||
background-size: 52px 37px !important;
|
||||
background-repeat: no-repeat !important;
|
||||
}
|
||||
}
|
||||
BIN
user/assets/vendor/chosen/chosen-sprite.png
vendored
Normal file
|
After Width: | Height: | Size: 646 B |
BIN
user/assets/vendor/chosen/chosen-sprite@2x.png
vendored
Normal file
|
After Width: | Height: | Size: 872 B |
2
user/assets/vendor/chosen/chosen.jquery.min.js
vendored
Normal file
1
user/assets/vendor/flot-spline/js/jquery.flot.spline.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
!function(a){"use strict";function b(a,b,c,d,e,f,g){var j,k,l,m,n,o,p,q,h=Math.pow,i=Math.sqrt;return j=i(h(c-a,2)+h(d-b,2)),k=i(h(e-c,2)+h(f-d,2)),l=g*j/(j+k),m=g-l,n=c+l*(a-e),o=d+l*(b-f),p=c-m*(a-e),q=d-m*(b-f),[n,o,p,q]}function d(b,c,d,e,f){var g=a.color.parse(f);g.a="number"==typeof e?e:.3,g.normalize(),g=g.toString(),c.beginPath(),c.moveTo(b[0][0],b[0][1]);for(var h=b.length,i=0;h>i;i++)c[b[i][3]].apply(c,b[i][2]);c.stroke(),c.lineWidth=0,c.lineTo(b[h-1][0],d),c.lineTo(b[0][0],d),c.closePath(),e!==!1&&(c.fillStyle=g,c.fill())}function e(a,b,d,e){(void 0===b||"bezier"!==b&&"quadratic"!==b)&&(b="quadratic"),b+="CurveTo",0==c.length?c.push([d[0],d[1],e.concat(d.slice(2)),b]):"quadraticCurveTo"==b&&2==d.length?(e=e.slice(0,2).concat(d),c.push([d[0],d[1],e,b])):c.push([d[2],d[3],e.concat(d.slice(2)),b])}function f(f,g,h){if(h.splines.show===!0){var k,l,m,i=[],j=h.splines.tension||.5,n=h.datapoints.points,o=h.datapoints.pointsize,p=f.getPlotOffset(),q=n.length,r=[];if(c=[],4>q/o)return a.extend(h.lines,h.splines),void 0;for(k=0;q>k;k+=o)l=n[k],m=n[k+1],null==l||l<h.xaxis.min||l>h.xaxis.max||m<h.yaxis.min||m>h.yaxis.max||r.push(h.xaxis.p2c(l)+p.left,h.yaxis.p2c(m)+p.top);for(q=r.length,k=0;q-2>k;k+=2)i=i.concat(b.apply(this,r.slice(k,k+6).concat([j])));for(g.save(),g.strokeStyle=h.color,g.lineWidth=h.splines.lineWidth,e(g,"quadratic",r.slice(0,4),i.slice(0,2)),k=2;q-3>k;k+=2)e(g,"bezier",r.slice(k,k+4),i.slice(2*k-2,2*k+2));e(g,"quadratic",r.slice(q-2,q),[i[2*q-10],i[2*q-9],r[q-4],r[q-3]]),d(c,g,f.height()+10,h.splines.fill,h.color),g.restore()}}var c=[];a.plot.plugins.push({init:function(a){a.hooks.drawSeries.push(f)},options:{series:{splines:{show:!1,lineWidth:2,tension:.5,fill:!1}}},name:"spline",version:"0.8.2"})}(jQuery);
|
||||
201
user/assets/vendor/flot.orderbars/js/jquery.flot.orderBars.js
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
/*
|
||||
* Flot plugin to order bars side by side.
|
||||
*
|
||||
* Released under the MIT license by Benjamin BUFFET, 20-Sep-2010.
|
||||
* Modifications made by Steven Hall <github.com/emmerich>, 01-May-2013.
|
||||
*
|
||||
* This plugin is an alpha version.
|
||||
*
|
||||
* To activate the plugin you must specify the parameter "order" for the specific serie :
|
||||
*
|
||||
* $.plot($("#placeholder"), [{ data: [ ... ], bars :{ order = null or integer }])
|
||||
*
|
||||
* If 2 series have the same order param, they are ordered by the position in the array;
|
||||
*
|
||||
* The plugin adjust the point by adding a value depanding of the barwidth
|
||||
* Exemple for 3 series (barwidth : 0.1) :
|
||||
*
|
||||
* first bar décalage : -0.15
|
||||
* second bar décalage : -0.05
|
||||
* third bar décalage : 0.05
|
||||
*
|
||||
*/
|
||||
|
||||
// INFO: decalage/decallage is French for gap. It's used to denote the spacing applied to each
|
||||
// bar.
|
||||
(function($){
|
||||
function init(plot){
|
||||
var orderedBarSeries;
|
||||
var nbOfBarsToOrder;
|
||||
var borderWidth;
|
||||
var borderWidthInXabsWidth;
|
||||
var pixelInXWidthEquivalent = 1;
|
||||
var isHorizontal = false;
|
||||
|
||||
// A mapping of order integers to decallage.
|
||||
var decallageByOrder = {};
|
||||
|
||||
/*
|
||||
* This method add shift to x values
|
||||
*/
|
||||
function reOrderBars(plot, serie, datapoints){
|
||||
var shiftedPoints = null;
|
||||
|
||||
if(serieNeedToBeReordered(serie)){
|
||||
checkIfGraphIsHorizontal(serie);
|
||||
calculPixel2XWidthConvert(plot);
|
||||
retrieveBarSeries(plot);
|
||||
calculBorderAndBarWidth(serie);
|
||||
|
||||
if(nbOfBarsToOrder >= 2){
|
||||
var position = findPosition(serie);
|
||||
var decallage = 0;
|
||||
|
||||
var centerBarShift = calculCenterBarShift();
|
||||
|
||||
// If we haven't already calculated the decallage for this order value, do it.
|
||||
if(typeof decallageByOrder[serie.bars.order] === 'undefined') {
|
||||
if (isBarAtLeftOfCenter(position)){
|
||||
decallageByOrder[serie.bars.order] = -1*(sumWidth(orderedBarSeries,position-1,Math.floor(nbOfBarsToOrder / 2)-1)) - centerBarShift;
|
||||
}else{
|
||||
decallageByOrder[serie.bars.order] = sumWidth(orderedBarSeries,Math.ceil(nbOfBarsToOrder / 2),position-2) + centerBarShift + borderWidthInXabsWidth*2;
|
||||
}
|
||||
}
|
||||
|
||||
// Lookup the decallage based on the series' order value.
|
||||
decallage = decallageByOrder[serie.bars.order];
|
||||
|
||||
shiftedPoints = shiftPoints(datapoints,serie,decallage);
|
||||
datapoints.points = shiftedPoints;
|
||||
}
|
||||
}
|
||||
return shiftedPoints;
|
||||
}
|
||||
|
||||
function serieNeedToBeReordered(serie){
|
||||
return serie.bars != null
|
||||
&& serie.bars.show
|
||||
&& serie.bars.order != null;
|
||||
}
|
||||
|
||||
function calculPixel2XWidthConvert(plot){
|
||||
var gridDimSize = isHorizontal ? plot.getPlaceholder().innerHeight() : plot.getPlaceholder().innerWidth();
|
||||
var minMaxValues = isHorizontal ? getAxeMinMaxValues(plot.getData(),1) : getAxeMinMaxValues(plot.getData(),0);
|
||||
var AxeSize = minMaxValues[1] - minMaxValues[0];
|
||||
pixelInXWidthEquivalent = AxeSize / gridDimSize;
|
||||
}
|
||||
|
||||
function getAxeMinMaxValues(series,AxeIdx){
|
||||
var minMaxValues = new Array();
|
||||
for(var i = 0; i < series.length; i++){
|
||||
minMaxValues[0] = series[i].data[0][AxeIdx];
|
||||
minMaxValues[1] = series[i].data[series[i].data.length - 1][AxeIdx];
|
||||
}
|
||||
return minMaxValues;
|
||||
}
|
||||
|
||||
function retrieveBarSeries(plot){
|
||||
orderedBarSeries = findOthersBarsToReOrders(plot.getData());
|
||||
nbOfBarsToOrder = orderedBarSeries.length;
|
||||
}
|
||||
|
||||
function findOthersBarsToReOrders(series){
|
||||
var retSeries = new Array();
|
||||
var orderValuesSeen = [];
|
||||
|
||||
for(var i = 0; i < series.length; i++){
|
||||
if(series[i].bars.order != null && series[i].bars.show &&
|
||||
orderValuesSeen.indexOf(series[i].bars.order) < 0){
|
||||
|
||||
orderValuesSeen.push(series[i].bars.order);
|
||||
retSeries.push(series[i]);
|
||||
}
|
||||
}
|
||||
return retSeries.sort(sortByOrder);
|
||||
}
|
||||
|
||||
function sortByOrder(serie1,serie2){
|
||||
var x = serie1.bars.order;
|
||||
var y = serie2.bars.order;
|
||||
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
|
||||
}
|
||||
|
||||
function calculBorderAndBarWidth(serie){
|
||||
borderWidth = typeof serie.bars.lineWidth !== 'undefined' ? serie.bars.lineWidth : 2;
|
||||
borderWidthInXabsWidth = borderWidth * pixelInXWidthEquivalent;
|
||||
}
|
||||
|
||||
function checkIfGraphIsHorizontal(serie){
|
||||
if(serie.bars.horizontal){
|
||||
isHorizontal = true;
|
||||
}
|
||||
}
|
||||
|
||||
function findPosition(serie){
|
||||
var pos = 0
|
||||
for (var i = 0; i < orderedBarSeries.length; ++i) {
|
||||
if (serie == orderedBarSeries[i]){
|
||||
pos = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return pos+1;
|
||||
}
|
||||
|
||||
function calculCenterBarShift(){
|
||||
var width = 0;
|
||||
|
||||
if(nbOfBarsToOrder%2 != 0)
|
||||
width = (orderedBarSeries[Math.ceil(nbOfBarsToOrder / 2)].bars.barWidth)/2;
|
||||
|
||||
return width;
|
||||
}
|
||||
|
||||
function isBarAtLeftOfCenter(position){
|
||||
return position <= Math.ceil(nbOfBarsToOrder / 2);
|
||||
}
|
||||
|
||||
function sumWidth(series,start,end){
|
||||
var totalWidth = 0;
|
||||
|
||||
for(var i = start; i <= end; i++){
|
||||
totalWidth += series[i].bars.barWidth+borderWidthInXabsWidth*2;
|
||||
}
|
||||
|
||||
return totalWidth;
|
||||
}
|
||||
|
||||
function shiftPoints(datapoints,serie,dx){
|
||||
var ps = datapoints.pointsize;
|
||||
var points = datapoints.points;
|
||||
var j = 0;
|
||||
for(var i = isHorizontal ? 1 : 0;i < points.length; i += ps){
|
||||
points[i] += dx;
|
||||
//Adding the new x value in the serie to be abble to display the right tooltip value,
|
||||
//using the index 3 to not overide the third index.
|
||||
serie.data[j][3] = points[i];
|
||||
j++;
|
||||
}
|
||||
|
||||
return points;
|
||||
}
|
||||
|
||||
plot.hooks.processDatapoints.push(reOrderBars);
|
||||
|
||||
}
|
||||
|
||||
var options = {
|
||||
series : {
|
||||
bars: {order: null} // or number/string
|
||||
}
|
||||
};
|
||||
|
||||
$.plot.plugins.push({
|
||||
init: init,
|
||||
options: options,
|
||||
name: "orderBars",
|
||||
version: "0.2"
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
12
user/assets/vendor/flot.tooltip/js/jquery.flot.tooltip.min.js
vendored
Normal file
3168
user/assets/vendor/flot/jquery.flot.js
vendored
Normal file
820
user/assets/vendor/flot/jquery.flot.pie.js
vendored
Normal file
@@ -0,0 +1,820 @@
|
||||
/* Flot plugin for rendering pie charts.
|
||||
|
||||
Copyright (c) 2007-2014 IOLA and Ole Laursen.
|
||||
Licensed under the MIT license.
|
||||
|
||||
The plugin assumes that each series has a single data value, and that each
|
||||
value is a positive integer or zero. Negative numbers don't make sense for a
|
||||
pie chart, and have unpredictable results. The values do NOT need to be
|
||||
passed in as percentages; the plugin will calculate the total and per-slice
|
||||
percentages internally.
|
||||
|
||||
* Created by Brian Medendorp
|
||||
|
||||
* Updated with contributions from btburnett3, Anthony Aragues and Xavi Ivars
|
||||
|
||||
The plugin supports these options:
|
||||
|
||||
series: {
|
||||
pie: {
|
||||
show: true/false
|
||||
radius: 0-1 for percentage of fullsize, or a specified pixel length, or 'auto'
|
||||
innerRadius: 0-1 for percentage of fullsize or a specified pixel length, for creating a donut effect
|
||||
startAngle: 0-2 factor of PI used for starting angle (in radians) i.e 3/2 starts at the top, 0 and 2 have the same result
|
||||
tilt: 0-1 for percentage to tilt the pie, where 1 is no tilt, and 0 is completely flat (nothing will show)
|
||||
offset: {
|
||||
top: integer value to move the pie up or down
|
||||
left: integer value to move the pie left or right, or 'auto'
|
||||
},
|
||||
stroke: {
|
||||
color: any hexidecimal color value (other formats may or may not work, so best to stick with something like '#FFF')
|
||||
width: integer pixel width of the stroke
|
||||
},
|
||||
label: {
|
||||
show: true/false, or 'auto'
|
||||
formatter: a user-defined function that modifies the text/style of the label text
|
||||
radius: 0-1 for percentage of fullsize, or a specified pixel length
|
||||
background: {
|
||||
color: any hexidecimal color value (other formats may or may not work, so best to stick with something like '#000')
|
||||
opacity: 0-1
|
||||
},
|
||||
threshold: 0-1 for the percentage value at which to hide labels (if they're too small)
|
||||
},
|
||||
combine: {
|
||||
threshold: 0-1 for the percentage value at which to combine slices (if they're too small)
|
||||
color: any hexidecimal color value (other formats may or may not work, so best to stick with something like '#CCC'), if null, the plugin will automatically use the color of the first slice to be combined
|
||||
label: any text value of what the combined slice should be labeled
|
||||
}
|
||||
highlight: {
|
||||
opacity: 0-1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
More detail and specific examples can be found in the included HTML file.
|
||||
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
|
||||
// Maximum redraw attempts when fitting labels within the plot
|
||||
|
||||
var REDRAW_ATTEMPTS = 10;
|
||||
|
||||
// Factor by which to shrink the pie when fitting labels within the plot
|
||||
|
||||
var REDRAW_SHRINK = 0.95;
|
||||
|
||||
function init(plot) {
|
||||
|
||||
var canvas = null,
|
||||
target = null,
|
||||
options = null,
|
||||
maxRadius = null,
|
||||
centerLeft = null,
|
||||
centerTop = null,
|
||||
processed = false,
|
||||
ctx = null;
|
||||
|
||||
// interactive variables
|
||||
|
||||
var highlights = [];
|
||||
|
||||
// add hook to determine if pie plugin in enabled, and then perform necessary operations
|
||||
|
||||
plot.hooks.processOptions.push(function(plot, options) {
|
||||
if (options.series.pie.show) {
|
||||
|
||||
options.grid.show = false;
|
||||
|
||||
// set labels.show
|
||||
|
||||
if (options.series.pie.label.show == "auto") {
|
||||
if (options.legend.show) {
|
||||
options.series.pie.label.show = false;
|
||||
} else {
|
||||
options.series.pie.label.show = true;
|
||||
}
|
||||
}
|
||||
|
||||
// set radius
|
||||
|
||||
if (options.series.pie.radius == "auto") {
|
||||
if (options.series.pie.label.show) {
|
||||
options.series.pie.radius = 3/4;
|
||||
} else {
|
||||
options.series.pie.radius = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// ensure sane tilt
|
||||
|
||||
if (options.series.pie.tilt > 1) {
|
||||
options.series.pie.tilt = 1;
|
||||
} else if (options.series.pie.tilt < 0) {
|
||||
options.series.pie.tilt = 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
plot.hooks.bindEvents.push(function(plot, eventHolder) {
|
||||
var options = plot.getOptions();
|
||||
if (options.series.pie.show) {
|
||||
if (options.grid.hoverable) {
|
||||
eventHolder.unbind("mousemove").mousemove(onMouseMove);
|
||||
}
|
||||
if (options.grid.clickable) {
|
||||
eventHolder.unbind("click").click(onClick);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
plot.hooks.processDatapoints.push(function(plot, series, data, datapoints) {
|
||||
var options = plot.getOptions();
|
||||
if (options.series.pie.show) {
|
||||
processDatapoints(plot, series, data, datapoints);
|
||||
}
|
||||
});
|
||||
|
||||
plot.hooks.drawOverlay.push(function(plot, octx) {
|
||||
var options = plot.getOptions();
|
||||
if (options.series.pie.show) {
|
||||
drawOverlay(plot, octx);
|
||||
}
|
||||
});
|
||||
|
||||
plot.hooks.draw.push(function(plot, newCtx) {
|
||||
var options = plot.getOptions();
|
||||
if (options.series.pie.show) {
|
||||
draw(plot, newCtx);
|
||||
}
|
||||
});
|
||||
|
||||
function processDatapoints(plot, series, datapoints) {
|
||||
if (!processed) {
|
||||
processed = true;
|
||||
canvas = plot.getCanvas();
|
||||
target = $(canvas).parent();
|
||||
options = plot.getOptions();
|
||||
plot.setData(combine(plot.getData()));
|
||||
}
|
||||
}
|
||||
|
||||
function combine(data) {
|
||||
|
||||
var total = 0,
|
||||
combined = 0,
|
||||
numCombined = 0,
|
||||
color = options.series.pie.combine.color,
|
||||
newdata = [];
|
||||
|
||||
// Fix up the raw data from Flot, ensuring the data is numeric
|
||||
|
||||
for (var i = 0; i < data.length; ++i) {
|
||||
|
||||
var value = data[i].data;
|
||||
|
||||
// If the data is an array, we'll assume that it's a standard
|
||||
// Flot x-y pair, and are concerned only with the second value.
|
||||
|
||||
// Note how we use the original array, rather than creating a
|
||||
// new one; this is more efficient and preserves any extra data
|
||||
// that the user may have stored in higher indexes.
|
||||
|
||||
if ($.isArray(value) && value.length == 1) {
|
||||
value = value[0];
|
||||
}
|
||||
|
||||
if ($.isArray(value)) {
|
||||
// Equivalent to $.isNumeric() but compatible with jQuery < 1.7
|
||||
if (!isNaN(parseFloat(value[1])) && isFinite(value[1])) {
|
||||
value[1] = +value[1];
|
||||
} else {
|
||||
value[1] = 0;
|
||||
}
|
||||
} else if (!isNaN(parseFloat(value)) && isFinite(value)) {
|
||||
value = [1, +value];
|
||||
} else {
|
||||
value = [1, 0];
|
||||
}
|
||||
|
||||
data[i].data = [value];
|
||||
}
|
||||
|
||||
// Sum up all the slices, so we can calculate percentages for each
|
||||
|
||||
for (var i = 0; i < data.length; ++i) {
|
||||
total += data[i].data[0][1];
|
||||
}
|
||||
|
||||
// Count the number of slices with percentages below the combine
|
||||
// threshold; if it turns out to be just one, we won't combine.
|
||||
|
||||
for (var i = 0; i < data.length; ++i) {
|
||||
var value = data[i].data[0][1];
|
||||
if (value / total <= options.series.pie.combine.threshold) {
|
||||
combined += value;
|
||||
numCombined++;
|
||||
if (!color) {
|
||||
color = data[i].color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < data.length; ++i) {
|
||||
var value = data[i].data[0][1];
|
||||
if (numCombined < 2 || value / total > options.series.pie.combine.threshold) {
|
||||
newdata.push(
|
||||
$.extend(data[i], { /* extend to allow keeping all other original data values
|
||||
and using them e.g. in labelFormatter. */
|
||||
data: [[1, value]],
|
||||
color: data[i].color,
|
||||
label: data[i].label,
|
||||
angle: value * Math.PI * 2 / total,
|
||||
percent: value / (total / 100)
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (numCombined > 1) {
|
||||
newdata.push({
|
||||
data: [[1, combined]],
|
||||
color: color,
|
||||
label: options.series.pie.combine.label,
|
||||
angle: combined * Math.PI * 2 / total,
|
||||
percent: combined / (total / 100)
|
||||
});
|
||||
}
|
||||
|
||||
return newdata;
|
||||
}
|
||||
|
||||
function draw(plot, newCtx) {
|
||||
|
||||
if (!target) {
|
||||
return; // if no series were passed
|
||||
}
|
||||
|
||||
var canvasWidth = plot.getPlaceholder().width(),
|
||||
canvasHeight = plot.getPlaceholder().height(),
|
||||
legendWidth = target.children().filter(".legend").children().width() || 0;
|
||||
|
||||
ctx = newCtx;
|
||||
|
||||
// WARNING: HACK! REWRITE THIS CODE AS SOON AS POSSIBLE!
|
||||
|
||||
// When combining smaller slices into an 'other' slice, we need to
|
||||
// add a new series. Since Flot gives plugins no way to modify the
|
||||
// list of series, the pie plugin uses a hack where the first call
|
||||
// to processDatapoints results in a call to setData with the new
|
||||
// list of series, then subsequent processDatapoints do nothing.
|
||||
|
||||
// The plugin-global 'processed' flag is used to control this hack;
|
||||
// it starts out false, and is set to true after the first call to
|
||||
// processDatapoints.
|
||||
|
||||
// Unfortunately this turns future setData calls into no-ops; they
|
||||
// call processDatapoints, the flag is true, and nothing happens.
|
||||
|
||||
// To fix this we'll set the flag back to false here in draw, when
|
||||
// all series have been processed, so the next sequence of calls to
|
||||
// processDatapoints once again starts out with a slice-combine.
|
||||
// This is really a hack; in 0.9 we need to give plugins a proper
|
||||
// way to modify series before any processing begins.
|
||||
|
||||
processed = false;
|
||||
|
||||
// calculate maximum radius and center point
|
||||
|
||||
maxRadius = Math.min(canvasWidth, canvasHeight / options.series.pie.tilt) / 2;
|
||||
centerTop = canvasHeight / 2 + options.series.pie.offset.top;
|
||||
centerLeft = canvasWidth / 2;
|
||||
|
||||
if (options.series.pie.offset.left == "auto") {
|
||||
if (options.legend.position.match("w")) {
|
||||
centerLeft += legendWidth / 2;
|
||||
} else {
|
||||
centerLeft -= legendWidth / 2;
|
||||
}
|
||||
if (centerLeft < maxRadius) {
|
||||
centerLeft = maxRadius;
|
||||
} else if (centerLeft > canvasWidth - maxRadius) {
|
||||
centerLeft = canvasWidth - maxRadius;
|
||||
}
|
||||
} else {
|
||||
centerLeft += options.series.pie.offset.left;
|
||||
}
|
||||
|
||||
var slices = plot.getData(),
|
||||
attempts = 0;
|
||||
|
||||
// Keep shrinking the pie's radius until drawPie returns true,
|
||||
// indicating that all the labels fit, or we try too many times.
|
||||
|
||||
do {
|
||||
if (attempts > 0) {
|
||||
maxRadius *= REDRAW_SHRINK;
|
||||
}
|
||||
attempts += 1;
|
||||
clear();
|
||||
if (options.series.pie.tilt <= 0.8) {
|
||||
drawShadow();
|
||||
}
|
||||
} while (!drawPie() && attempts < REDRAW_ATTEMPTS)
|
||||
|
||||
if (attempts >= REDRAW_ATTEMPTS) {
|
||||
clear();
|
||||
target.prepend("<div class='error'>Could not draw pie with labels contained inside canvas</div>");
|
||||
}
|
||||
|
||||
if (plot.setSeries && plot.insertLegend) {
|
||||
plot.setSeries(slices);
|
||||
plot.insertLegend();
|
||||
}
|
||||
|
||||
// we're actually done at this point, just defining internal functions at this point
|
||||
|
||||
function clear() {
|
||||
ctx.clearRect(0, 0, canvasWidth, canvasHeight);
|
||||
target.children().filter(".pieLabel, .pieLabelBackground").remove();
|
||||
}
|
||||
|
||||
function drawShadow() {
|
||||
|
||||
var shadowLeft = options.series.pie.shadow.left;
|
||||
var shadowTop = options.series.pie.shadow.top;
|
||||
var edge = 10;
|
||||
var alpha = options.series.pie.shadow.alpha;
|
||||
var radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius;
|
||||
|
||||
if (radius >= canvasWidth / 2 - shadowLeft || radius * options.series.pie.tilt >= canvasHeight / 2 - shadowTop || radius <= edge) {
|
||||
return; // shadow would be outside canvas, so don't draw it
|
||||
}
|
||||
|
||||
ctx.save();
|
||||
ctx.translate(shadowLeft,shadowTop);
|
||||
ctx.globalAlpha = alpha;
|
||||
ctx.fillStyle = "#000";
|
||||
|
||||
// center and rotate to starting position
|
||||
|
||||
ctx.translate(centerLeft,centerTop);
|
||||
ctx.scale(1, options.series.pie.tilt);
|
||||
|
||||
//radius -= edge;
|
||||
|
||||
for (var i = 1; i <= edge; i++) {
|
||||
ctx.beginPath();
|
||||
ctx.arc(0, 0, radius, 0, Math.PI * 2, false);
|
||||
ctx.fill();
|
||||
radius -= i;
|
||||
}
|
||||
|
||||
ctx.restore();
|
||||
}
|
||||
|
||||
function drawPie() {
|
||||
|
||||
var startAngle = Math.PI * options.series.pie.startAngle;
|
||||
var radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius;
|
||||
|
||||
// center and rotate to starting position
|
||||
|
||||
ctx.save();
|
||||
ctx.translate(centerLeft,centerTop);
|
||||
ctx.scale(1, options.series.pie.tilt);
|
||||
//ctx.rotate(startAngle); // start at top; -- This doesn't work properly in Opera
|
||||
|
||||
// draw slices
|
||||
|
||||
ctx.save();
|
||||
var currentAngle = startAngle;
|
||||
for (var i = 0; i < slices.length; ++i) {
|
||||
slices[i].startAngle = currentAngle;
|
||||
drawSlice(slices[i].angle, slices[i].color, true);
|
||||
}
|
||||
ctx.restore();
|
||||
|
||||
// draw slice outlines
|
||||
|
||||
if (options.series.pie.stroke.width > 0) {
|
||||
ctx.save();
|
||||
ctx.lineWidth = options.series.pie.stroke.width;
|
||||
currentAngle = startAngle;
|
||||
for (var i = 0; i < slices.length; ++i) {
|
||||
drawSlice(slices[i].angle, options.series.pie.stroke.color, false);
|
||||
}
|
||||
ctx.restore();
|
||||
}
|
||||
|
||||
// draw donut hole
|
||||
|
||||
drawDonutHole(ctx);
|
||||
|
||||
ctx.restore();
|
||||
|
||||
// Draw the labels, returning true if they fit within the plot
|
||||
|
||||
if (options.series.pie.label.show) {
|
||||
return drawLabels();
|
||||
} else return true;
|
||||
|
||||
function drawSlice(angle, color, fill) {
|
||||
|
||||
if (angle <= 0 || isNaN(angle)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (fill) {
|
||||
ctx.fillStyle = color;
|
||||
} else {
|
||||
ctx.strokeStyle = color;
|
||||
ctx.lineJoin = "round";
|
||||
}
|
||||
|
||||
ctx.beginPath();
|
||||
if (Math.abs(angle - Math.PI * 2) > 0.000000001) {
|
||||
ctx.moveTo(0, 0); // Center of the pie
|
||||
}
|
||||
|
||||
//ctx.arc(0, 0, radius, 0, angle, false); // This doesn't work properly in Opera
|
||||
ctx.arc(0, 0, radius,currentAngle, currentAngle + angle / 2, false);
|
||||
ctx.arc(0, 0, radius,currentAngle + angle / 2, currentAngle + angle, false);
|
||||
ctx.closePath();
|
||||
//ctx.rotate(angle); // This doesn't work properly in Opera
|
||||
currentAngle += angle;
|
||||
|
||||
if (fill) {
|
||||
ctx.fill();
|
||||
} else {
|
||||
ctx.stroke();
|
||||
}
|
||||
}
|
||||
|
||||
function drawLabels() {
|
||||
|
||||
var currentAngle = startAngle;
|
||||
var radius = options.series.pie.label.radius > 1 ? options.series.pie.label.radius : maxRadius * options.series.pie.label.radius;
|
||||
|
||||
for (var i = 0; i < slices.length; ++i) {
|
||||
if (slices[i].percent >= options.series.pie.label.threshold * 100) {
|
||||
if (!drawLabel(slices[i], currentAngle, i)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
currentAngle += slices[i].angle;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
function drawLabel(slice, startAngle, index) {
|
||||
|
||||
if (slice.data[0][1] == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// format label text
|
||||
|
||||
var lf = options.legend.labelFormatter, text, plf = options.series.pie.label.formatter;
|
||||
|
||||
if (lf) {
|
||||
text = lf(slice.label, slice);
|
||||
} else {
|
||||
text = slice.label;
|
||||
}
|
||||
|
||||
if (plf) {
|
||||
text = plf(text, slice);
|
||||
}
|
||||
|
||||
var halfAngle = ((startAngle + slice.angle) + startAngle) / 2;
|
||||
var x = centerLeft + Math.round(Math.cos(halfAngle) * radius);
|
||||
var y = centerTop + Math.round(Math.sin(halfAngle) * radius) * options.series.pie.tilt;
|
||||
|
||||
var html = "<span class='pieLabel' id='pieLabel" + index + "' style='position:absolute;top:" + y + "px;left:" + x + "px;'>" + text + "</span>";
|
||||
target.append(html);
|
||||
|
||||
var label = target.children("#pieLabel" + index);
|
||||
var labelTop = (y - label.height() / 2);
|
||||
var labelLeft = (x - label.width() / 2);
|
||||
|
||||
label.css("top", labelTop);
|
||||
label.css("left", labelLeft);
|
||||
|
||||
// check to make sure that the label is not outside the canvas
|
||||
|
||||
if (0 - labelTop > 0 || 0 - labelLeft > 0 || canvasHeight - (labelTop + label.height()) < 0 || canvasWidth - (labelLeft + label.width()) < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (options.series.pie.label.background.opacity != 0) {
|
||||
|
||||
// put in the transparent background separately to avoid blended labels and label boxes
|
||||
|
||||
var c = options.series.pie.label.background.color;
|
||||
|
||||
if (c == null) {
|
||||
c = slice.color;
|
||||
}
|
||||
|
||||
var pos = "top:" + labelTop + "px;left:" + labelLeft + "px;";
|
||||
$("<div class='pieLabelBackground' style='position:absolute;width:" + label.width() + "px;height:" + label.height() + "px;" + pos + "background-color:" + c + ";'></div>")
|
||||
.css("opacity", options.series.pie.label.background.opacity)
|
||||
.insertBefore(label);
|
||||
}
|
||||
|
||||
return true;
|
||||
} // end individual label function
|
||||
} // end drawLabels function
|
||||
} // end drawPie function
|
||||
} // end draw function
|
||||
|
||||
// Placed here because it needs to be accessed from multiple locations
|
||||
|
||||
function drawDonutHole(layer) {
|
||||
if (options.series.pie.innerRadius > 0) {
|
||||
|
||||
// subtract the center
|
||||
|
||||
layer.save();
|
||||
var innerRadius = options.series.pie.innerRadius > 1 ? options.series.pie.innerRadius : maxRadius * options.series.pie.innerRadius;
|
||||
layer.globalCompositeOperation = "destination-out"; // this does not work with excanvas, but it will fall back to using the stroke color
|
||||
layer.beginPath();
|
||||
layer.fillStyle = options.series.pie.stroke.color;
|
||||
layer.arc(0, 0, innerRadius, 0, Math.PI * 2, false);
|
||||
layer.fill();
|
||||
layer.closePath();
|
||||
layer.restore();
|
||||
|
||||
// add inner stroke
|
||||
|
||||
layer.save();
|
||||
layer.beginPath();
|
||||
layer.strokeStyle = options.series.pie.stroke.color;
|
||||
layer.arc(0, 0, innerRadius, 0, Math.PI * 2, false);
|
||||
layer.stroke();
|
||||
layer.closePath();
|
||||
layer.restore();
|
||||
|
||||
// TODO: add extra shadow inside hole (with a mask) if the pie is tilted.
|
||||
}
|
||||
}
|
||||
|
||||
//-- Additional Interactive related functions --
|
||||
|
||||
function isPointInPoly(poly, pt) {
|
||||
for(var c = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i)
|
||||
((poly[i][1] <= pt[1] && pt[1] < poly[j][1]) || (poly[j][1] <= pt[1] && pt[1]< poly[i][1]))
|
||||
&& (pt[0] < (poly[j][0] - poly[i][0]) * (pt[1] - poly[i][1]) / (poly[j][1] - poly[i][1]) + poly[i][0])
|
||||
&& (c = !c);
|
||||
return c;
|
||||
}
|
||||
|
||||
function findNearbySlice(mouseX, mouseY) {
|
||||
|
||||
var slices = plot.getData(),
|
||||
options = plot.getOptions(),
|
||||
radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius,
|
||||
x, y;
|
||||
|
||||
for (var i = 0; i < slices.length; ++i) {
|
||||
|
||||
var s = slices[i];
|
||||
|
||||
if (s.pie.show) {
|
||||
|
||||
ctx.save();
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(0, 0); // Center of the pie
|
||||
//ctx.scale(1, options.series.pie.tilt); // this actually seems to break everything when here.
|
||||
ctx.arc(0, 0, radius, s.startAngle, s.startAngle + s.angle / 2, false);
|
||||
ctx.arc(0, 0, radius, s.startAngle + s.angle / 2, s.startAngle + s.angle, false);
|
||||
ctx.closePath();
|
||||
x = mouseX - centerLeft;
|
||||
y = mouseY - centerTop;
|
||||
|
||||
if (ctx.isPointInPath) {
|
||||
if (ctx.isPointInPath(mouseX - centerLeft, mouseY - centerTop)) {
|
||||
ctx.restore();
|
||||
return {
|
||||
datapoint: [s.percent, s.data],
|
||||
dataIndex: 0,
|
||||
series: s,
|
||||
seriesIndex: i
|
||||
};
|
||||
}
|
||||
} else {
|
||||
|
||||
// excanvas for IE doesn;t support isPointInPath, this is a workaround.
|
||||
|
||||
var p1X = radius * Math.cos(s.startAngle),
|
||||
p1Y = radius * Math.sin(s.startAngle),
|
||||
p2X = radius * Math.cos(s.startAngle + s.angle / 4),
|
||||
p2Y = radius * Math.sin(s.startAngle + s.angle / 4),
|
||||
p3X = radius * Math.cos(s.startAngle + s.angle / 2),
|
||||
p3Y = radius * Math.sin(s.startAngle + s.angle / 2),
|
||||
p4X = radius * Math.cos(s.startAngle + s.angle / 1.5),
|
||||
p4Y = radius * Math.sin(s.startAngle + s.angle / 1.5),
|
||||
p5X = radius * Math.cos(s.startAngle + s.angle),
|
||||
p5Y = radius * Math.sin(s.startAngle + s.angle),
|
||||
arrPoly = [[0, 0], [p1X, p1Y], [p2X, p2Y], [p3X, p3Y], [p4X, p4Y], [p5X, p5Y]],
|
||||
arrPoint = [x, y];
|
||||
|
||||
// TODO: perhaps do some mathmatical trickery here with the Y-coordinate to compensate for pie tilt?
|
||||
|
||||
if (isPointInPoly(arrPoly, arrPoint)) {
|
||||
ctx.restore();
|
||||
return {
|
||||
datapoint: [s.percent, s.data],
|
||||
dataIndex: 0,
|
||||
series: s,
|
||||
seriesIndex: i
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
ctx.restore();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function onMouseMove(e) {
|
||||
triggerClickHoverEvent("plothover", e);
|
||||
}
|
||||
|
||||
function onClick(e) {
|
||||
triggerClickHoverEvent("plotclick", e);
|
||||
}
|
||||
|
||||
// trigger click or hover event (they send the same parameters so we share their code)
|
||||
|
||||
function triggerClickHoverEvent(eventname, e) {
|
||||
|
||||
var offset = plot.offset();
|
||||
var canvasX = parseInt(e.pageX - offset.left);
|
||||
var canvasY = parseInt(e.pageY - offset.top);
|
||||
var item = findNearbySlice(canvasX, canvasY);
|
||||
|
||||
if (options.grid.autoHighlight) {
|
||||
|
||||
// clear auto-highlights
|
||||
|
||||
for (var i = 0; i < highlights.length; ++i) {
|
||||
var h = highlights[i];
|
||||
if (h.auto == eventname && !(item && h.series == item.series)) {
|
||||
unhighlight(h.series);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// highlight the slice
|
||||
|
||||
if (item) {
|
||||
highlight(item.series, eventname);
|
||||
}
|
||||
|
||||
// trigger any hover bind events
|
||||
|
||||
var pos = { pageX: e.pageX, pageY: e.pageY };
|
||||
target.trigger(eventname, [pos, item]);
|
||||
}
|
||||
|
||||
function highlight(s, auto) {
|
||||
//if (typeof s == "number") {
|
||||
// s = series[s];
|
||||
//}
|
||||
|
||||
var i = indexOfHighlight(s);
|
||||
|
||||
if (i == -1) {
|
||||
highlights.push({ series: s, auto: auto });
|
||||
plot.triggerRedrawOverlay();
|
||||
} else if (!auto) {
|
||||
highlights[i].auto = false;
|
||||
}
|
||||
}
|
||||
|
||||
function unhighlight(s) {
|
||||
if (s == null) {
|
||||
highlights = [];
|
||||
plot.triggerRedrawOverlay();
|
||||
}
|
||||
|
||||
//if (typeof s == "number") {
|
||||
// s = series[s];
|
||||
//}
|
||||
|
||||
var i = indexOfHighlight(s);
|
||||
|
||||
if (i != -1) {
|
||||
highlights.splice(i, 1);
|
||||
plot.triggerRedrawOverlay();
|
||||
}
|
||||
}
|
||||
|
||||
function indexOfHighlight(s) {
|
||||
for (var i = 0; i < highlights.length; ++i) {
|
||||
var h = highlights[i];
|
||||
if (h.series == s)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
function drawOverlay(plot, octx) {
|
||||
|
||||
var options = plot.getOptions();
|
||||
|
||||
var radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius;
|
||||
|
||||
octx.save();
|
||||
octx.translate(centerLeft, centerTop);
|
||||
octx.scale(1, options.series.pie.tilt);
|
||||
|
||||
for (var i = 0; i < highlights.length; ++i) {
|
||||
drawHighlight(highlights[i].series);
|
||||
}
|
||||
|
||||
drawDonutHole(octx);
|
||||
|
||||
octx.restore();
|
||||
|
||||
function drawHighlight(series) {
|
||||
|
||||
if (series.angle <= 0 || isNaN(series.angle)) {
|
||||
return;
|
||||
}
|
||||
|
||||
//octx.fillStyle = parseColor(options.series.pie.highlight.color).scale(null, null, null, options.series.pie.highlight.opacity).toString();
|
||||
octx.fillStyle = "rgba(255, 255, 255, " + options.series.pie.highlight.opacity + ")"; // this is temporary until we have access to parseColor
|
||||
octx.beginPath();
|
||||
if (Math.abs(series.angle - Math.PI * 2) > 0.000000001) {
|
||||
octx.moveTo(0, 0); // Center of the pie
|
||||
}
|
||||
octx.arc(0, 0, radius, series.startAngle, series.startAngle + series.angle / 2, false);
|
||||
octx.arc(0, 0, radius, series.startAngle + series.angle / 2, series.startAngle + series.angle, false);
|
||||
octx.closePath();
|
||||
octx.fill();
|
||||
}
|
||||
}
|
||||
} // end init (plugin body)
|
||||
|
||||
// define pie specific options and their default values
|
||||
|
||||
var options = {
|
||||
series: {
|
||||
pie: {
|
||||
show: false,
|
||||
radius: "auto", // actual radius of the visible pie (based on full calculated radius if <=1, or hard pixel value)
|
||||
innerRadius: 0, /* for donut */
|
||||
startAngle: 3/2,
|
||||
tilt: 1,
|
||||
shadow: {
|
||||
left: 5, // shadow left offset
|
||||
top: 15, // shadow top offset
|
||||
alpha: 0.02 // shadow alpha
|
||||
},
|
||||
offset: {
|
||||
top: 0,
|
||||
left: "auto"
|
||||
},
|
||||
stroke: {
|
||||
color: "#fff",
|
||||
width: 1
|
||||
},
|
||||
label: {
|
||||
show: "auto",
|
||||
formatter: function(label, slice) {
|
||||
return "<div style='font-size:x-small;text-align:center;padding:2px;color:" + slice.color + ";'>" + label + "<br/>" + Math.round(slice.percent) + "%</div>";
|
||||
}, // formatter function
|
||||
radius: 1, // radius at which to place the labels (based on full calculated radius if <=1, or hard pixel value)
|
||||
background: {
|
||||
color: null,
|
||||
opacity: 0
|
||||
},
|
||||
threshold: 0 // percentage at which to hide the label (i.e. the slice is too narrow)
|
||||
},
|
||||
combine: {
|
||||
threshold: -1, // percentage at which to combine little slices into one larger slice
|
||||
color: null, // color to give the new slice (auto-generated if null)
|
||||
label: "Other" // label to give the new slice
|
||||
},
|
||||
highlight: {
|
||||
//color: "#fff", // will add this functionality once parseColor is available
|
||||
opacity: 0.5
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$.plot.plugins.push({
|
||||
init: init,
|
||||
options: options,
|
||||
name: "pie",
|
||||
version: "1.1"
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
59
user/assets/vendor/flot/jquery.flot.resize.js
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
/* Flot plugin for automatically redrawing plots as the placeholder resizes.
|
||||
|
||||
Copyright (c) 2007-2014 IOLA and Ole Laursen.
|
||||
Licensed under the MIT license.
|
||||
|
||||
It works by listening for changes on the placeholder div (through the jQuery
|
||||
resize event plugin) - if the size changes, it will redraw the plot.
|
||||
|
||||
There are no options. If you need to disable the plugin for some plots, you
|
||||
can just fix the size of their placeholders.
|
||||
|
||||
*/
|
||||
|
||||
/* Inline dependency:
|
||||
* jQuery resize event - v1.1 - 3/14/2010
|
||||
* http://benalman.com/projects/jquery-resize-plugin/
|
||||
*
|
||||
* Copyright (c) 2010 "Cowboy" Ben Alman
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
* http://benalman.com/about/license/
|
||||
*/
|
||||
(function($,e,t){"$:nomunge";var i=[],n=$.resize=$.extend($.resize,{}),a,r=false,s="setTimeout",u="resize",m=u+"-special-event",o="pendingDelay",l="activeDelay",f="throttleWindow";n[o]=200;n[l]=20;n[f]=true;$.event.special[u]={setup:function(){if(!n[f]&&this[s]){return false}var e=$(this);i.push(this);e.data(m,{w:e.width(),h:e.height()});if(i.length===1){a=t;h()}},teardown:function(){if(!n[f]&&this[s]){return false}var e=$(this);for(var t=i.length-1;t>=0;t--){if(i[t]==this){i.splice(t,1);break}}e.removeData(m);if(!i.length){if(r){cancelAnimationFrame(a)}else{clearTimeout(a)}a=null}},add:function(e){if(!n[f]&&this[s]){return false}var i;function a(e,n,a){var r=$(this),s=r.data(m)||{};s.w=n!==t?n:r.width();s.h=a!==t?a:r.height();i.apply(this,arguments)}if($.isFunction(e)){i=e;return a}else{i=e.handler;e.handler=a}}};function h(t){if(r===true){r=t||1}for(var s=i.length-1;s>=0;s--){var l=$(i[s]);if(l[0]==e||l.is(":visible")){var f=l.width(),c=l.height(),d=l.data(m);if(d&&(f!==d.w||c!==d.h)){l.trigger(u,[d.w=f,d.h=c]);r=t||true}}else{d=l.data(m);d.w=0;d.h=0}}if(a!==null){if(r&&(t==null||t-r<1e3)){a=e.requestAnimationFrame(h)}else{a=setTimeout(h,n[o]);r=false}}}if(!e.requestAnimationFrame){e.requestAnimationFrame=function(){return e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame||e.msRequestAnimationFrame||function(t,i){return e.setTimeout(function(){t((new Date).getTime())},n[l])}}()}if(!e.cancelAnimationFrame){e.cancelAnimationFrame=function(){return e.webkitCancelRequestAnimationFrame||e.mozCancelRequestAnimationFrame||e.oCancelRequestAnimationFrame||e.msCancelRequestAnimationFrame||clearTimeout}()}})(jQuery,this);
|
||||
|
||||
(function ($) {
|
||||
var options = { }; // no options
|
||||
|
||||
function init(plot) {
|
||||
function onResize() {
|
||||
var placeholder = plot.getPlaceholder();
|
||||
|
||||
// somebody might have hidden us and we can't plot
|
||||
// when we don't have the dimensions
|
||||
if (placeholder.width() == 0 || placeholder.height() == 0)
|
||||
return;
|
||||
|
||||
plot.resize();
|
||||
plot.setupGrid();
|
||||
plot.draw();
|
||||
}
|
||||
|
||||
function bindEvents(plot, eventHolder) {
|
||||
plot.getPlaceholder().resize(onResize);
|
||||
}
|
||||
|
||||
function shutdown(plot, eventHolder) {
|
||||
plot.getPlaceholder().unbind("resize", onResize);
|
||||
}
|
||||
|
||||
plot.hooks.bindEvents.push(bindEvents);
|
||||
plot.hooks.shutdown.push(shutdown);
|
||||
}
|
||||
|
||||
$.plot.plugins.push({
|
||||
init: init,
|
||||
options: options,
|
||||
name: 'resize',
|
||||
version: '1.0'
|
||||
});
|
||||
})(jQuery);
|
||||
209
user/assets/vendor/jquery.easy-pie-chart/dist/jquery.easypiechart.fill.js
vendored
Normal file
@@ -0,0 +1,209 @@
|
||||
// Generated by CoffeeScript 1.6.3
|
||||
/*
|
||||
Easy pie chart is a jquery plugin to display simple animated pie charts for only one value
|
||||
|
||||
Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
|
||||
and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
|
||||
|
||||
Built on top of the jQuery library (http://jquery.com)
|
||||
|
||||
@source: http://github.com/rendro/easy-pie-chart/
|
||||
@autor: Robert Fleischmann
|
||||
@version: 1.2.5
|
||||
|
||||
Inspired by: http://dribbble.com/shots/631074-Simple-Pie-Charts-II?list=popular&offset=210
|
||||
Thanks to Philip Thrasher for the jquery plugin boilerplate for coffee script
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
$.easyPieChart = function(el, options) {
|
||||
var addScaleLine, animateLine, drawLine, easeInOutQuad, rAF, renderBackground, renderScale, renderTrack,
|
||||
_this = this;
|
||||
this.el = el;
|
||||
this.$el = $(el);
|
||||
this.$el.data("easyPieChart", this);
|
||||
this.init = function() {
|
||||
var percent, scaleBy;
|
||||
_this.options = $.extend({}, $.easyPieChart.defaultOptions, options);
|
||||
percent = _this.options.percent || parseInt(_this.$el.data('percent'), 10);
|
||||
_this.percentage = 0;
|
||||
_this.canvas = $("<canvas width='" + _this.options.size + "' height='" + _this.options.size + "'></canvas>").get(0);
|
||||
_this.$el.append(_this.canvas);
|
||||
if (typeof G_vmlCanvasManager !== "undefined" && G_vmlCanvasManager !== null) {
|
||||
G_vmlCanvasManager.initElement(_this.canvas);
|
||||
}
|
||||
_this.ctx = _this.canvas.getContext('2d');
|
||||
if (window.devicePixelRatio > 1) {
|
||||
scaleBy = window.devicePixelRatio;
|
||||
$(_this.canvas).css({
|
||||
width: _this.options.size,
|
||||
height: _this.options.size
|
||||
});
|
||||
_this.canvas.width *= scaleBy;
|
||||
_this.canvas.height *= scaleBy;
|
||||
_this.ctx.scale(scaleBy, scaleBy);
|
||||
}
|
||||
_this.ctx.translate(_this.options.size / 2, _this.options.size / 2);
|
||||
_this.ctx.rotate(_this.options.rotate * Math.PI / 180);
|
||||
_this.$el.addClass('easyPieChart');
|
||||
_this.$el.css({
|
||||
width: _this.options.size,
|
||||
height: _this.options.size,
|
||||
lineHeight: "" + _this.options.size + "px"
|
||||
});
|
||||
_this.update(percent);
|
||||
return _this;
|
||||
};
|
||||
this.update = function(percent) {
|
||||
percent = parseFloat(percent) || 0;
|
||||
if (_this.options.animate === false) {
|
||||
drawLine(percent);
|
||||
} else {
|
||||
if (_this.options.delay) {
|
||||
animateLine(_this.percentage, 0);
|
||||
setTimeout(function() {
|
||||
return animateLine(_this.percentage, percent);
|
||||
}, _this.options.delay);
|
||||
} else {
|
||||
animateLine(_this.percentage, percent);
|
||||
}
|
||||
}
|
||||
return _this;
|
||||
};
|
||||
renderScale = function() {
|
||||
var i, _i, _results;
|
||||
_this.ctx.fillStyle = _this.options.scaleColor;
|
||||
_this.ctx.lineWidth = 1;
|
||||
_results = [];
|
||||
for (i = _i = 0; _i <= 24; i = ++_i) {
|
||||
_results.push(addScaleLine(i));
|
||||
}
|
||||
return _results;
|
||||
};
|
||||
addScaleLine = function(i) {
|
||||
var offset;
|
||||
offset = i % 6 === 0 ? 0 : _this.options.size * 0.017;
|
||||
_this.ctx.save();
|
||||
_this.ctx.rotate(i * Math.PI / 12);
|
||||
_this.ctx.fillRect(_this.options.size / 2 - offset, 0, -_this.options.size * 0.05 + offset, 1);
|
||||
_this.ctx.restore();
|
||||
};
|
||||
renderTrack = function() {
|
||||
var offset;
|
||||
offset = _this.options.size / 2 - _this.options.lineWidth / 2;
|
||||
if (_this.options.scaleColor !== false) {
|
||||
offset -= _this.options.size * 0.08;
|
||||
}
|
||||
_this.ctx.beginPath();
|
||||
_this.ctx.arc(0, 0, offset, 0, Math.PI * 2, true);
|
||||
_this.ctx.closePath();
|
||||
_this.ctx.strokeStyle = _this.options.trackColor;
|
||||
|
||||
if (_this.options.color) {
|
||||
_this.ctx.fillStyle = _this.options.color;
|
||||
_this.ctx.fill();
|
||||
}
|
||||
|
||||
_this.ctx.lineWidth = _this.options.lineWidth;
|
||||
_this.ctx.stroke();
|
||||
};
|
||||
renderBackground = function() {
|
||||
if (_this.options.scaleColor !== false) {
|
||||
renderScale();
|
||||
}
|
||||
if (_this.options.trackColor !== false) {
|
||||
renderTrack();
|
||||
}
|
||||
};
|
||||
drawLine = function(percent) {
|
||||
var offset;
|
||||
renderBackground();
|
||||
_this.ctx.strokeStyle = $.isFunction(_this.options.barColor) ? _this.options.barColor(percent) : _this.options.barColor;
|
||||
_this.ctx.lineCap = _this.options.lineCap;
|
||||
_this.ctx.lineWidth = _this.options.lineWidth;
|
||||
offset = _this.options.size / 2 - _this.options.lineWidth / 2;
|
||||
if (_this.options.scaleColor !== false) {
|
||||
offset -= _this.options.size * 0.08;
|
||||
}
|
||||
_this.ctx.save();
|
||||
_this.ctx.rotate(-Math.PI / 2);
|
||||
_this.ctx.beginPath();
|
||||
_this.ctx.arc(0, 0, offset, 0, Math.PI * 2 * percent / 100, false);
|
||||
_this.ctx.stroke();
|
||||
_this.ctx.restore();
|
||||
};
|
||||
rAF = (function() {
|
||||
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) {
|
||||
return window.setTimeout(callback, 1000 / 60);
|
||||
};
|
||||
})();
|
||||
animateLine = function(from, to) {
|
||||
var anim, startTime;
|
||||
_this.options.onStart.call(_this);
|
||||
_this.percentage = to;
|
||||
Date.now || (Date.now = function() {
|
||||
return +(new Date);
|
||||
});
|
||||
startTime = Date.now();
|
||||
anim = function() {
|
||||
var currentValue, process;
|
||||
process = Math.min(Date.now() - startTime, _this.options.animate);
|
||||
_this.ctx.clearRect(-_this.options.size / 2, -_this.options.size / 2, _this.options.size, _this.options.size);
|
||||
renderBackground.call(_this);
|
||||
currentValue = [easeInOutQuad(process, from, to - from, _this.options.animate)];
|
||||
_this.options.onStep.call(_this, currentValue);
|
||||
drawLine.call(_this, currentValue);
|
||||
if (process >= _this.options.animate) {
|
||||
return _this.options.onStop.call(_this, currentValue, to);
|
||||
} else {
|
||||
return rAF(anim);
|
||||
}
|
||||
};
|
||||
rAF(anim);
|
||||
};
|
||||
easeInOutQuad = function(t, b, c, d) {
|
||||
var easeIn, easing;
|
||||
easeIn = function(t) {
|
||||
return Math.pow(t, 2);
|
||||
};
|
||||
easing = function(t) {
|
||||
if (t < 1) {
|
||||
return easeIn(t);
|
||||
} else {
|
||||
return 2 - easeIn((t / 2) * -2 + 2);
|
||||
}
|
||||
};
|
||||
t /= d / 2;
|
||||
return c / 2 * easing(t) + b;
|
||||
};
|
||||
return this.init();
|
||||
};
|
||||
$.easyPieChart.defaultOptions = {
|
||||
percent: 0,
|
||||
barColor: '#ef1e25',
|
||||
trackColor: '#f2f2f2',
|
||||
scaleColor: '#dfe0e0',
|
||||
lineCap: 'round',
|
||||
rotate: 0,
|
||||
size: 110,
|
||||
lineWidth: 3,
|
||||
animate: false,
|
||||
delay: false,
|
||||
onStart: $.noop,
|
||||
onStop: $.noop,
|
||||
onStep: $.noop
|
||||
};
|
||||
$.fn.easyPieChart = function(options) {
|
||||
return $.each(this, function(i, el) {
|
||||
var $el, instanceOptions;
|
||||
$el = $(el);
|
||||
if (!$el.data('easyPieChart')) {
|
||||
instanceOptions = $.extend({}, options, $el.data());
|
||||
return $el.data('easyPieChart', new $.easyPieChart(el, instanceOptions));
|
||||
} else{
|
||||
$el.data('easyPieChart').update(options['percent']);
|
||||
}
|
||||
});
|
||||
};
|
||||
return void 0;
|
||||
})(jQuery);
|
||||
2
user/assets/vendor/jquery.sparkline/dist/jquery.sparkline.retina.js
vendored
Normal file
3111
user/assets/vendor/moment/moment.js
vendored
Normal file
299
user/certificate.php
Normal file
@@ -0,0 +1,299 @@
|
||||
<?php
|
||||
include("../includes/common.php");
|
||||
if($islogin2==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
$title='实名认证';
|
||||
include './head.php';
|
||||
?>
|
||||
<?php
|
||||
function showstar($num){
|
||||
$data = '';
|
||||
for($i=0;$i<$num;$i++){
|
||||
$data .= '*';
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
if(isset($_GET['certify_id'])){
|
||||
$certify_id=htmlspecialchars(strip_tags($_GET['certify_id']));
|
||||
if(!isset($_SESSION[$uid.'_certify_id']) || $_SESSION[$uid.'_certify_id'] !== $certify_id){
|
||||
exit("<script language='javascript'>window.location.href='./certificate.php';</script>");
|
||||
}
|
||||
}
|
||||
|
||||
if(strlen($userrow['phone'])==11){
|
||||
$userrow['phone']=substr($userrow['phone'],0,3).'****'.substr($userrow['phone'],7,10);
|
||||
}
|
||||
|
||||
$csrf_token = md5(mt_rand(0,999).time());
|
||||
$_SESSION['csrf_token'] = $csrf_token;
|
||||
?>
|
||||
<style>
|
||||
.verified .row{padding:25px}
|
||||
.verified .mt-step-col{padding:5px 5px 5px 30px;}
|
||||
.verified .mt-step-col .mt-step-col-cont{background:#94aac5;color:rgba(255,255,255,.6);width:100%;border-radius:3px}
|
||||
.verified .font-grey-cascade{padding-top:0;font-size:16px!important}
|
||||
.verified .complete-active .mt-step-col-cont{background:#635ebe}
|
||||
.verified .icon{color:#fff;position:absolute;top:10px;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);-o-transform:translateY(-50%);transform:translateY(-50%);left:20px;width:40px;height:40px;font-size:24px;line-height:40px;color:#fff;text-align:center;background:rgba(255,255,255,.1);border-radius:50%}
|
||||
@media screen and (max-width:1200px) {
|
||||
.verified .row {
|
||||
padding: 15px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<div id="content" class="app-content" role="main">
|
||||
<div class="app-content-body ">
|
||||
<div class="bg-light lter b-b wrapper-md hidden-print">
|
||||
<h1 class="m-n font-thin h3">个人资料</h1>
|
||||
</div>
|
||||
<div class="wrapper-md control">
|
||||
<?php if(!$conf['cert_channel'])showmsg('未开启实名认证功能');?>
|
||||
<?php if(isset($msg)){?>
|
||||
<div class="alert alert-info">
|
||||
<?php echo $msg?>
|
||||
</div>
|
||||
<?php }?>
|
||||
<div class="tab-container ng-isolate-scope">
|
||||
<ul class="nav nav-tabs">
|
||||
<li style="width: 25%;" align="center">
|
||||
<a href="userinfo.php?mod=api">API信息</a>
|
||||
</li>
|
||||
<li style="width: 25%;" align="center">
|
||||
<a href="editinfo.php">修改资料</a>
|
||||
</li>
|
||||
<li style="width: 25%;" align="center">
|
||||
<a href="userinfo.php?mod=account">修改密码</a>
|
||||
</li>
|
||||
<?php if($conf['cert_channel']){?>
|
||||
<li style="width: 25%;" align="center" class="active">
|
||||
<a href="certificate.php">实名认证</a>
|
||||
</li>
|
||||
<?php }?>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane ng-scope active">
|
||||
<div class="row step-line nav nav-pills nav-justified steps verified">
|
||||
<div id="tag1" class="col-sm-12 col-md-4 mt-step-col first fill complete-active">
|
||||
<div class="mt-step-col-cont row bg-primary">
|
||||
<div class="col-xs-3 bg-primary-l">
|
||||
<i class="icon glyphicon glyphicon-edit"></i>
|
||||
</div>
|
||||
<div class="col-xs-9 bg-primary-r">
|
||||
<div class="mt-step-title uppercase font-grey-cascade ">填写认证信息
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="tag2" class="col-sm-12 col-md-4 mt-step-col <?php if($userrow['cert']==1||$certify_id)echo 'complete-active';?>">
|
||||
<div class="mt-step-col-cont row">
|
||||
<div class="col-xs-3 bg-primary-l">
|
||||
<i class="icon fa fa-qrcode"></i>
|
||||
</div>
|
||||
<div class="col-xs-9 bg-primary-r">
|
||||
<div class="mt-step-title uppercase font-grey-cascade ">
|
||||
支付宝扫码快捷认证</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="tag3" class="col-sm-12 col-md-4 mt-step-col last <?php if($userrow['cert']==1)echo 'complete-active';?>">
|
||||
<div class="mt-step-col-cont row ">
|
||||
<div class="col-xs-3 bg-primary-l">
|
||||
<i class="icon fa fa-check-circle-o"></i>
|
||||
</div>
|
||||
<div class="col-xs-9 bg-primary-r">
|
||||
<div class="mt-step-title uppercase font-grey-cascade ">
|
||||
认证完成</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="line line-dashed b-b line-lg pull-in"></div>
|
||||
<?php if($userrow['cert']==1){?>
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-6">
|
||||
<img src="https://imgcache.qq.com/open_proj/proj_qcloud_v2/mc_2014/user/auth/css/mod/img/sfz.jpg" class="pull-right">
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-6">
|
||||
<h4>恭喜您已通过<?php echo $conf['sitename']?>实名认证!</h4>
|
||||
<p>认证途径:支付宝快捷认证</p>
|
||||
<p>真实姓名:<?php echo showstar((strlen($userrow['certname'])-3)/3).substr($userrow['certname'],-3)?></p>
|
||||
<p>身份证号:<?php echo substr($userrow['certno'],0,3).showstar(11).substr($userrow['certno'],-4)?></p>
|
||||
<p>认证时间:<?php echo $userrow['certtime']?></p>
|
||||
</div>
|
||||
</div>
|
||||
<?php }else{?>
|
||||
<?php if($conf['cert_money']>0){?>
|
||||
<div class="alert alert-info alert-dismissible" role="alert" style="line-height: 26px;">
|
||||
<p>认证需要<b><?php echo $conf['cert_money']; ?></b>元,请确保你的账号内有<?php echo $conf['cert_money']; ?>元余额[<a href="recharge.php">点此充值</a>],认证成功会自动扣除,认证失败不扣费</p>
|
||||
</div>
|
||||
<?php }?>
|
||||
<?php if($certify_id){?>
|
||||
<div id="step2">
|
||||
<form class="form-horizontal devform">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo $csrf_token?>">
|
||||
<input type="hidden" name="certify_id" value="<?php echo $certify_id?>">
|
||||
<input type="hidden" name="qrcode_url" value="<?php echo $siteurl.'user/alipaycert.php?id='.$certify_id?>">
|
||||
<center><div id="qrcode"></div>
|
||||
<p class="text-muted" style="line-height: 26px;">请使用支付宝APP扫描二维码</p>
|
||||
<?php if(checkmobile()){?><p><a href="javascript:openAlipay()" id="jumplink" class="btn btn-success">点此跳转到支付宝</a></p><p class="text-muted">到支付宝确认之后请返回此页面才能认证成功</p><?php }?>
|
||||
<p><a href="./certificate.php" class="btn btn-default btn-sm">返回重新填写</a></p>
|
||||
</center>
|
||||
</form>
|
||||
</div>
|
||||
<?php }else{?>
|
||||
<div id="step1">
|
||||
<form class="form-horizontal devform">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo $csrf_token?>">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">认证方式</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="certification_type">
|
||||
<img src="/assets/icon/alipay.ico" width="25"> 支付宝快捷认证
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">真实姓名</label>
|
||||
<div class="col-sm-9">
|
||||
<input class="form-control" type="text" name="certname" value="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">身份证号</label>
|
||||
<div class="col-sm-9">
|
||||
<input class="form-control" type="text" name="certno" value="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-4"><div class="text-muted"><small>姓名需与所认证的支付宝账号姓名一致</small></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-4"><input type="button" id="certSubmit" value="提交认证" class="btn btn-primary form-control"/><br/>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="alert alert-warning alert-dismissible" role="alert" style="line-height: 26px;font-size: 13px;margin-top: 50px;">
|
||||
<p>1、为了更好的享受<?php echo $conf['sitename']?>提供的服务,本人知晓并同意授权支付宝的实人认证方式用于验证本人信息的真实性</p>
|
||||
<p>2、本站承诺任何在本网站提交的用户信息,仅限用于本站为用户提供服务,本站承诺为用户的隐私及其他个人信息采取严格保密措施,并在必要时销毁数据。</p>
|
||||
</div>
|
||||
</div>
|
||||
<?php }?>
|
||||
<?php }?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php include 'foot.php';?>
|
||||
<script src="../assets/layer/layer.js"></script>
|
||||
<script src="../assets/js/jquery-qrcode.min.js"></script>
|
||||
<script>
|
||||
<?php if($certify_id){?>
|
||||
var alipay_url;
|
||||
$(document).ready(function(){
|
||||
alipay_url = $("input[name='qrcode_url']").val();
|
||||
$('#qrcode').qrcode({
|
||||
text: alipay_url,
|
||||
width: 230,
|
||||
height: 230,
|
||||
foreground: "#000000",
|
||||
background: "#ffffff",
|
||||
typeNumber: -1
|
||||
});
|
||||
openAlipay();
|
||||
setTimeout(certQuery, 5000);
|
||||
});
|
||||
<?php }else{?>
|
||||
$(document).ready(function(){
|
||||
$("#certSubmit").click(function(){
|
||||
var certname=$("input[name='certname']").val();
|
||||
var certno=$("input[name='certno']").val();
|
||||
var csrf_token=$("input[name='csrf_token']").val();
|
||||
if(certname=='' || certno==''){
|
||||
layer.alert('请确保各项不能为空');return false;
|
||||
}
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
url : "ajax2.php?act=certificate",
|
||||
data : {certname:certname,certno:certno,csrf_token:csrf_token},
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 1){
|
||||
window.location.href='./certificate.php?certify_id='+data.certify_id;
|
||||
}else if(data.code == -2){
|
||||
var confirmobj = layer.confirm(data.msg, {
|
||||
icon: 0, btn: ['关联认证','取消']
|
||||
}, function(){
|
||||
certBind(data.uid);
|
||||
}, function(){
|
||||
layer.close(confirmobj);
|
||||
});
|
||||
}else{
|
||||
layer.alert(data.msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
<?php }?>
|
||||
function openAlipay(){
|
||||
var scheme = 'alipays://platformapi/startapp?appId=20000067&url=';
|
||||
scheme += encodeURIComponent(alipay_url);
|
||||
window.location.href = scheme;
|
||||
}
|
||||
function certBind(touid){
|
||||
var certname=$("input[name='certname']").val();
|
||||
var certno=$("input[name='certno']").val();
|
||||
var csrf_token=$("input[name='csrf_token']").val();
|
||||
layer.prompt({title: '请输入商户ID'+uid+'的商户密钥', value: '', formType: 0}, function(text, index){
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : 'ajax2.php?act=cert_bind',
|
||||
data : {touid:touid,certname:certname,certno:certno,csrf_token:csrf_token},
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 1){
|
||||
layer.alert(data.msg, {icon: 1}, function(){window.location.reload()});
|
||||
}else{
|
||||
layer.alert(data.msg, {icon: 2});
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
function certQuery(){
|
||||
var csrf_token=$("input[name='csrf_token']").val();
|
||||
var certify_id=$("input[name='certify_id']").val();
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : 'ajax2.php?act=cert_query',
|
||||
data : {certify_id:certify_id, csrf_token:csrf_token},
|
||||
dataType : 'json',
|
||||
async: true,
|
||||
success : function(data) {
|
||||
if(data.code == 1){
|
||||
if(data.passed == true){
|
||||
layer.msg('实名认证成功!', {icon: 1,time: 10000,shade:[0.3, "#000"]});
|
||||
setTimeout(function(){ window.location.href='./certificate.php' }, 800);
|
||||
}else{
|
||||
setTimeout(certQuery, 3000)
|
||||
}
|
||||
}else{
|
||||
layer.alert(data.msg, {icon: 2});
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
211
user/completeinfo.php
Normal file
@@ -0,0 +1,211 @@
|
||||
<?php
|
||||
include("../includes/common.php");
|
||||
if($islogin2==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
$title='完善账户资料';
|
||||
include './head.php';
|
||||
?>
|
||||
<?php
|
||||
?>
|
||||
<div id="content" class="app-content" role="main">
|
||||
<div class="app-content-body ">
|
||||
<div class="bg-light lter b-b wrapper-md hidden-print">
|
||||
<h1 class="m-n font-thin h3">完善账户资料</h1>
|
||||
</div>
|
||||
<div class="wrapper-md control">
|
||||
<?php if(isset($msg)){?>
|
||||
<div class="alert alert-info">
|
||||
<?php echo $msg?>
|
||||
</div>
|
||||
<?php }?>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading font-bold">
|
||||
<h3 class="panel-title">完善账户资料</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="alert alert-success">
|
||||
你已经注册成功了,请先填写你的收款账号与联系方式信息!
|
||||
</div>
|
||||
<form class="form-horizontal devform">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">结算方式</label>
|
||||
<div class="col-sm-9">
|
||||
<select class="form-control" name="stype" default="<?php echo $userrow['settle_id']?>">
|
||||
<?php if($conf['settle_alipay']){?><option value="1" input="支付宝账号">支付宝结算</option>
|
||||
<?php }if($conf['settle_wxpay']){?><option value="2" input="<?php echo $conf['transfer_wxpay']?'微信OpenId':'微信号';?>">微信结算</option>
|
||||
<?php }if($conf['settle_qqpay']){?><option value="3" input="QQ号码">QQ钱包结算</option>
|
||||
<?php }if($conf['settle_bank']){?><option value="4" input="银行卡号">银行卡结算</option>
|
||||
<?php }?></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" id="typename">收款账号</label>
|
||||
<div class="col-sm-9">
|
||||
<input class="form-control" type="text" name="account" value="<?php echo $userrow['account']?>">
|
||||
</div>
|
||||
</div>
|
||||
<?php if($conf['transfer_wxpay']){?>
|
||||
<div class="form-group" style="display:none;" id="getopenid_form">
|
||||
<div class="col-sm-offset-2 col-sm-4">
|
||||
<a class="btn btn-sm btn-default" id="getopenid">点此获取微信OpenId</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php }?>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">真实姓名</label>
|
||||
<div class="col-sm-9">
|
||||
<input class="form-control" type="text" name="username" value="<?php echo $userrow['username']?>">
|
||||
</div>
|
||||
</div>
|
||||
<?php if($conf['verifytype']==1){?>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">邮箱</label>
|
||||
<div class="col-sm-9">
|
||||
<input class="form-control" type="text" name="email" value="<?php echo $userrow['email']?>">
|
||||
</div>
|
||||
</div>
|
||||
<?php }?>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">QQ</label>
|
||||
<div class="col-sm-9">
|
||||
<input class="form-control" type="text" name="qq" value="<?php echo $userrow['qq']?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">网站域名</label>
|
||||
<div class="col-sm-9">
|
||||
<input class="form-control" type="text" name="url" value="<?php echo $userrow['url']?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-4"><input type="button" id="save" value="保存" class="btn btn-primary form-control"/><br/>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php include 'foot.php';?>
|
||||
<script src="../assets/layer/layer.js"></script>
|
||||
<script src="../assets/js/jquery-qrcode.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$("select[name='stype']").change(function(){
|
||||
var input = $("select[name='stype'] option:selected").attr("input");
|
||||
$("#typename").html(input);
|
||||
if($(this).val() == 2){
|
||||
$("#getopenid_form").show();
|
||||
}else{
|
||||
$("#getopenid_form").hide();
|
||||
}
|
||||
});
|
||||
$("select[name='stype']").change();
|
||||
$("#save").click(function(){
|
||||
var stype=$("select[name='stype']").val();
|
||||
var account=$("input[name='account']").val();
|
||||
var username=$("input[name='username']").val();
|
||||
var email=$("input[name='email']").val();
|
||||
var qq=$("input[name='qq']").val();
|
||||
var url=$("input[name='url']").val();
|
||||
if(account=='' || username=='' || email=='' || qq=='' || url==''){layer.alert('请确保各项不能为空!');return false;}
|
||||
if(email.length>0){
|
||||
var reg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
|
||||
if(!reg.test(email)){layer.alert('邮箱格式不正确!');return false;}
|
||||
}
|
||||
if (url.indexOf(" ")>=0){
|
||||
url = url.replace(/ /g,"");
|
||||
}
|
||||
if (url.toLowerCase().indexOf("http://")==0){
|
||||
url = url.slice(7);
|
||||
}
|
||||
if (url.toLowerCase().indexOf("https://")==0){
|
||||
url = url.slice(8);
|
||||
}
|
||||
if (url.slice(url.length-1)=="/"){
|
||||
url = url.slice(0,url.length-1);
|
||||
}
|
||||
$("input[name='url']").val(url);
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
url : "ajax2.php?act=completeinfo",
|
||||
data : {stype:stype,account:account,username:username,email:email,qq:qq,url:url},
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 1){
|
||||
layer.alert('保存成功!', {icon:1}, function(){ window.location.href="./" });
|
||||
}else{
|
||||
layer.alert(data.msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
$('#getopenid').click(function () {
|
||||
if ($(this).attr("data-lock") === "true") return;
|
||||
$(this).attr("data-lock", "true");
|
||||
$.ajax({
|
||||
type : "GET",
|
||||
url : "ajax.php?act=qrcode",
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
$('#getopenid').attr("data-lock", "false");
|
||||
if(data.code == 0){
|
||||
$.openidform = layer.open({
|
||||
type: 1,
|
||||
title: '请使用微信扫描以下二维码',
|
||||
skin: 'layui-layer-demo',
|
||||
anim: 2,
|
||||
shadeClose: true,
|
||||
content: '<div id="qrcode" class="list-group-item text-center"></div>',
|
||||
success: function(){
|
||||
$('#qrcode').qrcode({
|
||||
text: data.url,
|
||||
width: 230,
|
||||
height: 230,
|
||||
foreground: "#000000",
|
||||
background: "#ffffff",
|
||||
typeNumber: -1
|
||||
});
|
||||
$.ostart = true;
|
||||
setTimeout('checkopenid()', 2000);
|
||||
},
|
||||
end: function(){
|
||||
$.ostart = false;
|
||||
}
|
||||
});
|
||||
}else{
|
||||
layer.alert(data.msg, {icon: 0});
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误', {icon: 2});
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
function checkopenid(){
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
url: "ajax.php?act=getopenid",
|
||||
success: function (data, textStatus) {
|
||||
if (data.code == 0) {
|
||||
layer.msg('Openid获取成功');
|
||||
layer.close($.openidform);
|
||||
$("input[name='account']").val(data.openid);
|
||||
}else if($.ostart==true){
|
||||
setTimeout('checkopenid()', 2000);
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
},
|
||||
error: function (data) {
|
||||
layer.msg('服务器错误', {icon: 2});
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
144
user/connect.php
Normal file
@@ -0,0 +1,144 @@
|
||||
<?php
|
||||
/**
|
||||
* QQ互联
|
||||
**/
|
||||
include("../includes/common.php");
|
||||
|
||||
if(isset($_GET['act']) && $_GET['act']=='qrlogin' && $conf['login_qq']==2){
|
||||
if(isset($_SESSION['findpwd_qq']) && $qq=$_SESSION['findpwd_qq']){
|
||||
$userrow=$DB->getRow("SELECT * FROM pre_user WHERE qq_uid='$qq' LIMIT 1");
|
||||
unset($_SESSION['findpwd_qq']);
|
||||
if($userrow){
|
||||
$uid=$userrow['uid'];
|
||||
$key=$userrow['key'];
|
||||
if($islogin2==1){
|
||||
exit('{"code":-1,"msg":"当前QQ已绑定商户ID:'.$uid.',请勿重复绑定!"}');
|
||||
}
|
||||
$DB->exec("insert into `pre_log` (`uid`,`type`,`date`,`ip`,`city`) values ('".$uid."','QQ快捷登录','".$date."','".$clientip."','".$city."')");
|
||||
$session=md5($uid.$key.$password_hash);
|
||||
$expiretime=time()+604800;
|
||||
$token=authcode("{$uid}\t{$session}\t{$expiretime}", 'ENCODE', SYS_KEY);
|
||||
setcookie("user_token", $token, time() + 604800);
|
||||
$DB->exec("update `pre_user` set `lasttime` ='$date' where `uid`='$uid'");
|
||||
$result=array("code"=>0,"msg"=>"登录成功!正在跳转到用户中心","url"=>"./");
|
||||
}elseif($islogin2==1){
|
||||
$sds=$DB->exec("update `pre_user` set `qq_uid` ='$qq' where `uid`='$uid'");
|
||||
$result=array("code"=>0,"msg"=>"已成功绑定QQ账号!","url"=>"./editinfo.php");
|
||||
}else{
|
||||
$_SESSION['Oauth_qq_uid']=$openId;
|
||||
$result=array("code"=>0,"msg"=>"请输入商户ID和密钥完成绑定和登录","url"=>"./login.php?connect=true");
|
||||
}
|
||||
}else{
|
||||
$result=array("code"=>-1, "msg"=>"验证失败,请重新扫码");
|
||||
}
|
||||
exit(json_encode($result));
|
||||
}elseif(isset($_GET['act']) && $_GET['act']=='qrcode'){
|
||||
$image=trim($_POST['image']);
|
||||
$result = qrcodelogin($image);
|
||||
exit(json_encode($result));
|
||||
}
|
||||
|
||||
$QC_config['appid']=$conf['login_qq_appid'];
|
||||
$QC_config['appkey']=$conf['login_qq_appkey'];
|
||||
$QC_config['callback']=$siteurl.'user/connect.php';
|
||||
|
||||
if($_GET['code'] && $conf['login_qq']==1){
|
||||
$QC=new \lib\QC($QC_config);
|
||||
$access_token=$QC->qq_callback();
|
||||
$openid=$QC->get_openid($access_token);
|
||||
|
||||
$userrow=$DB->getRow("SELECT * FROM pre_user WHERE qq_uid='{$openid}' limit 1");
|
||||
if($userrow){
|
||||
$uid=$userrow['uid'];
|
||||
$key=$userrow['key'];
|
||||
if($islogin2==1){
|
||||
@header('Content-Type: text/html; charset=UTF-8');
|
||||
exit("<script language='javascript'>alert('当前QQ已绑定商户ID:{$uid},请勿重复绑定!');window.location.href='./editinfo.php';</script>");
|
||||
}
|
||||
$DB->exec("insert into `pre_log` (`uid`,`type`,`date`,`ip`,`city`) values ('".$uid."','QQ快捷登录','".$date."','".$clientip."','".$city."')");
|
||||
$session=md5($uid.$key.$password_hash);
|
||||
$expiretime=time()+604800;
|
||||
$token=authcode("{$uid}\t{$session}\t{$expiretime}", 'ENCODE', SYS_KEY);
|
||||
setcookie("user_token", $token, time() + 604800);
|
||||
$DB->exec("update `pre_user` set `lasttime` ='$date' where `uid`='$uid'");
|
||||
exit("<script language='javascript'>window.location.href='./';</script>");
|
||||
}elseif($islogin2==1){
|
||||
$sds=$DB->exec("update `pre_user` set `qq_uid` ='$openid' where `uid`='$uid'");
|
||||
@header('Content-Type: text/html; charset=UTF-8');
|
||||
exit("<script language='javascript'>alert('已成功绑定QQ!');window.location.href='./editinfo.php';</script>");
|
||||
}else{
|
||||
$_SESSION['Oauth_qq_uid']=$openid;
|
||||
@header('Content-Type: text/html; charset=UTF-8');
|
||||
exit("<script language='javascript'>alert('请输入商户ID和密钥完成绑定和登录');window.location.href='./login.php?connect=true';</script>");
|
||||
}
|
||||
}elseif($islogin2==1 && isset($_GET['unbind'])){
|
||||
$DB->exec("update `pre_user` set `qq_uid` =NULL where `uid`='$uid'");
|
||||
@header('Content-Type: text/html; charset=UTF-8');
|
||||
exit("<script language='javascript'>alert('您已成功解绑QQ!');window.location.href='./editinfo.php';</script>");
|
||||
}elseif($islogin2==1 && !isset($_GET['bind'])){
|
||||
@header('Content-Type: text/html; charset=UTF-8');
|
||||
exit("<script language='javascript'>alert('您已登陆!');window.location.href='./';</script>");
|
||||
}else{
|
||||
if($conf['login_qq']==1){
|
||||
$QC=new \lib\QC($QC_config);
|
||||
$QC->qq_login();
|
||||
}else{
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>QQ扫码登录 | <?php echo $conf['sitename']?></title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
|
||||
<link rel="stylesheet" href="//cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="//cdn.staticfile.org/animate.css/3.5.2/animate.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="//cdn.staticfile.org/font-awesome/4.7.0/css/font-awesome.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="//cdn.staticfile.org/simple-line-icons/2.4.1/css/simple-line-icons.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="./assets/css/font.css" type="text/css" />
|
||||
<link rel="stylesheet" href="./assets/css/app.css" type="text/css" />
|
||||
<style>input:-webkit-autofill{-webkit-box-shadow:0 0 0px 1000px white inset;-webkit-text-fill-color:#333;}img.logo{width:14px;height:14px;margin:0 5px 0 3px;}</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="app app-header-fixed ">
|
||||
<div class="container w-xxl w-auto-xs" ng-controller="SigninFormController" ng-init="app.settings.container = false;">
|
||||
<span class="navbar-brand block m-t" id="sitename"><?php echo $conf['sitename']?></span>
|
||||
<div class="m-b-lg">
|
||||
<div class="wrapper text-center">
|
||||
<strong>QQ扫码登录</strong>
|
||||
</div>
|
||||
<form name="form" class="form-validation">
|
||||
<div class="text-danger wrapper text-center" ng-show="authError">
|
||||
</div>
|
||||
<div class="form-group" style="text-align: center;">
|
||||
<div class="list-group-item list-group-item-info" style="font-weight: bold;" id="login">
|
||||
<span id="loginmsg">请使用QQ手机版扫描二维码</span><span id="loginload" style="padding-left: 10px;color: #790909;">.</span>
|
||||
</div>
|
||||
<div id="qrimg" class="list-group-item">
|
||||
</div>
|
||||
<div class="list-group-item" id="mobile" style="display:none;"><button type="button" id="mlogin" onclick="mloginurl()" class="btn btn-warning btn-block">跳转QQ快捷登录</button><br/><button type="button" onclick="loadScript()" class="btn btn-success btn-block">我已完成登录</button></div>
|
||||
<div class="list-group-item">
|
||||
<div class="btn-group">
|
||||
<a href="login.php" class="btn btn-primary btn-rounded"><i class="fa fa-user"></i> 返回登录</a>
|
||||
<a href="reg.php" class="btn btn-info btn-rounded"><i class="fa fa-user-plus"></i> 注册账号</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<p>
|
||||
<small class="text-muted"><a href="/"><?php echo $conf['sitename']?></a><br>© 2016~2020</small>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="//cdn.staticfile.org/jquery/3.3.1/jquery.min.js"></script>
|
||||
<script src="//cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
|
||||
<script src="../assets/layer/layer.js"></script>
|
||||
<script src="./assets/js/qrlogin.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
602
user/editinfo.php
Normal file
@@ -0,0 +1,602 @@
|
||||
<?php
|
||||
include("../includes/common.php");
|
||||
if($islogin2==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
$title='个人资料';
|
||||
include './head.php';
|
||||
?>
|
||||
<?php
|
||||
$mod=isset($_GET['mod'])?$_GET['mod']:'api';
|
||||
|
||||
if(strlen($userrow['phone'])==11){
|
||||
$userrow['phone']=substr($userrow['phone'],0,3).'****'.substr($userrow['phone'],7,10);
|
||||
}
|
||||
|
||||
?>
|
||||
<input type="hidden" id="situation" value="">
|
||||
<div id="content" class="app-content" role="main">
|
||||
<div class="app-content-body ">
|
||||
<div class="modal inmodal fade" id="myModal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">关闭</span>
|
||||
</button>
|
||||
<h4 class="modal-title">验证密保信息</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<?php if($conf['verifytype']==1){?>
|
||||
<div class="list-group-item">密保手机:<?php echo $userrow['phone']?></div>
|
||||
<div class="list-group-item">
|
||||
<div class="input-group">
|
||||
<input type="text" name="code" placeholder="输入短信验证码" class="form-control" required>
|
||||
<a class="input-group-addon" id="sendcode">获取验证码</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php }else{?>
|
||||
<div class="list-group-item">密保邮箱:<?php echo $userrow['email']?></div>
|
||||
<div class="list-group-item">
|
||||
<div class="input-group">
|
||||
<input type="text" name="code" placeholder="输入验证码" class="form-control" required>
|
||||
<a class="input-group-addon" id="sendcode">获取验证码</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php }?>
|
||||
<button type="button" id="verifycode" class="btn btn-primary btn-block">确定</button>
|
||||
<div id="embed-captcha"></div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal inmodal fade" id="myModal2" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">关闭</span>
|
||||
</button>
|
||||
<h4 class="modal-title">修改密保信息</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<?php if($conf['verifytype']==1){?>
|
||||
<div class="list-group-item">
|
||||
<input type="text" name="phone_n" placeholder="输入新的手机号码" class="form-control" required>
|
||||
</div>
|
||||
<div class="list-group-item">
|
||||
<div class="input-group">
|
||||
<input type="text" name="code_n" placeholder="输入短信验证码" class="form-control" required>
|
||||
<a class="input-group-addon" id="sendcode2">获取验证码</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php }else{?>
|
||||
<div class="list-group-item">
|
||||
<input type="email" name="email_n" placeholder="输入新的邮箱" class="form-control" required>
|
||||
</div>
|
||||
<div class="list-group-item">
|
||||
<div class="input-group">
|
||||
<input type="text" name="code_n" placeholder="输入验证码" class="form-control" required>
|
||||
<a class="input-group-addon" id="sendcode2">获取验证码</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php }?>
|
||||
<button type="button" id="editBind" class="btn btn-primary btn-block">确定</button>
|
||||
<div id="embed-captcha"></div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bg-light lter b-b wrapper-md hidden-print">
|
||||
<h1 class="m-n font-thin h3">个人资料</h1>
|
||||
</div>
|
||||
<div class="wrapper-md control">
|
||||
<?php if(isset($msg)){?>
|
||||
<div class="alert alert-info">
|
||||
<?php echo $msg?>
|
||||
</div>
|
||||
<?php }?>
|
||||
<div class="tab-container ng-isolate-scope">
|
||||
<ul class="nav nav-tabs">
|
||||
<li style="width: 25%;" align="center">
|
||||
<a href="userinfo.php?mod=api">API信息</a>
|
||||
</li>
|
||||
<li style="width: 25%;" align="center" class="active">
|
||||
<a href="editinfo.php">修改资料</a>
|
||||
</li>
|
||||
<li style="width: 25%;" align="center">
|
||||
<a href="userinfo.php?mod=account">修改密码</a>
|
||||
</li>
|
||||
<?php if($conf['cert_channel']){?>
|
||||
<li style="width: 25%;" align="center">
|
||||
<a href="certificate.php">实名认证</a>
|
||||
</li>
|
||||
<?php }?>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane ng-scope active">
|
||||
<form class="form-horizontal devform">
|
||||
<div class="form-group"><div class="col-sm-offset-2 col-sm-4"><h4>收款账号设置:</h4></div></div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">结算方式</label>
|
||||
<div class="col-sm-9">
|
||||
<select class="form-control" name="stype" default="<?php echo $userrow['settle_id']?>">
|
||||
<?php if($conf['settle_alipay']){?><option value="1" input="支付宝账号">支付宝结算</option>
|
||||
<?php }if($conf['settle_wxpay']){?><option value="2" input="<?php echo $conf['transfer_wxpay']?'微信OpenId':'微信号';?>">微信结算</option>
|
||||
<?php }if($conf['settle_qqpay']){?><option value="3" input="QQ号码">QQ钱包结算</option>
|
||||
<?php }if($conf['settle_bank']){?><option value="4" input="银行卡号">银行卡结算</option>
|
||||
<?php }?></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" id="typename">收款账号</label>
|
||||
<div class="col-sm-9">
|
||||
<input class="form-control" type="text" name="account" value="<?php echo $userrow['account']?>">
|
||||
</div>
|
||||
</div>
|
||||
<?php if($conf['transfer_wxpay']){?>
|
||||
<div class="form-group" style="display:none;" id="getopenid_form">
|
||||
<div class="col-sm-offset-2 col-sm-4">
|
||||
<a class="btn btn-sm btn-default" id="getopenid">点此获取微信OpenId</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php }?>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">真实姓名</label>
|
||||
<div class="col-sm-9">
|
||||
<input class="form-control" type="text" name="username" value="<?php echo $userrow['username']?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-4"><input type="button" id="editSettle" value="确定修改" class="btn btn-primary form-control"/><br/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="line line-dashed b-b line-lg pull-in"></div>
|
||||
<div class="form-group"><div class="col-sm-offset-2 col-sm-4"><h4>联系方式设置:</h4></div></div>
|
||||
<?php if($conf['verifytype']==1){?>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">手机号码</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="input-group">
|
||||
<input class="form-control" type="text" name="phone" value="<?php echo $userrow['phone']?>" disabled>
|
||||
<a class="input-group-addon" id="checkbind">修改绑定</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">邮箱</label>
|
||||
<div class="col-sm-9">
|
||||
<input class="form-control" type="text" name="email" value="<?php echo $userrow['email']?>">
|
||||
</div>
|
||||
</div>
|
||||
<?php }else{?>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">邮箱</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="input-group">
|
||||
<input class="form-control" type="text" name="email" value="<?php echo $userrow['email']?>" disabled>
|
||||
<a class="input-group-addon" id="checkbind">修改绑定</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php }?>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">QQ</label>
|
||||
<div class="col-sm-9">
|
||||
<input class="form-control" type="text" name="qq" value="<?php echo $userrow['qq']?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">网站域名</label>
|
||||
<div class="col-sm-9">
|
||||
<input class="form-control" type="text" name="url" value="<?php echo $userrow['url']?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">开启密钥登录</label>
|
||||
<div class="col-sm-9">
|
||||
<select class="form-control" name="keylogin" default="<?php echo $userrow['keylogin']?>"><option value="0">关闭</option><option value="1">开启</option></select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-4"><input type="button" id="editInfo" value="确定修改" class="btn btn-primary form-control"/><br/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="line line-dashed b-b line-lg pull-in"></div>
|
||||
<div class="form-group"><div class="col-sm-offset-2 col-sm-4"><h4>支付手续费扣除模式选择:</h4></div></div>
|
||||
<div class="form-group has-success">
|
||||
<div class="col-sm-offset-2 col-sm-9">
|
||||
<div class="alert alert-success">
|
||||
1、余额扣费 (经典模式,默认):例如费率1%,客户购买100元商品,客户需支付100元,卖家到账99元,手续费1元由卖家支付<br> 2、订单加费 (奸商模式):例如费率1%,客户购买100元商品,客户需支付101元,卖家到账100元,手续费1元由买家支付
|
||||
</div>
|
||||
<select class="form-control" name="mode" default="<?php echo $userrow['mode']?>">
|
||||
<option value="0">余额扣费</option>
|
||||
<option value="1">订单加费</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-4"><input type="button" id="editMode" value="确定修改" class="btn btn-primary form-control"/><br/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="line line-dashed b-b line-lg pull-in"></div>
|
||||
<div class="form-group"><div class="col-sm-offset-2 col-sm-4"><h4>第三方账号绑定:</h4></div></div>
|
||||
<?php if($conf['login_qq']>0){?>
|
||||
<div class="form-group">
|
||||
<div class="col-xs-6"><span class="pull-right"><i class="fa fa-qq fa-2x fa-fw" style="color: #0BB2FF"></i> QQ快捷登录 </span></div>
|
||||
<div class="col-xs-6">
|
||||
<?php if($userrow['qq_uid']){?>
|
||||
<a class="btn btn-sm btn-success" disabled title="<?php echo $userrow['qq_uid']?>">已绑定</a> <a class="btn btn-sm btn-danger" href="./connect.php?unbind=1" onclick="return confirm('解绑后将无法通过QQ一键登录,是否确定解绑?');">解绑</a>
|
||||
<?php }else{?>
|
||||
<a class="btn btn-sm btn-success" href="./connect.php?bind=1">立即绑定</a>
|
||||
<?php }?>
|
||||
</div>
|
||||
</div>
|
||||
<?php }?>
|
||||
<?php if($conf['login_wx']>0){?>
|
||||
<div class="form-group">
|
||||
<div class="col-xs-6"><span class="pull-right"><i class="fa fa-wechat fa-2x fa-fw" style="color: green"></i> 微信快捷登录 </span></div>
|
||||
<div class="col-xs-6">
|
||||
<?php if($userrow['wxid']){?>
|
||||
<a class="btn btn-sm btn-success" disabled title="<?php echo $userrow['wxid']?>">已绑定</a> <a class="btn btn-sm btn-danger" href="./wxlogin.php?unbind=1" onclick="return confirm('解绑后将无法通过微信一键登录,是否确定解绑?');">解绑</a>
|
||||
<?php }else{?>
|
||||
<a class="btn btn-sm btn-success" href="./wxlogin.php?bind=1">立即绑定</a>
|
||||
<?php }?>
|
||||
</div>
|
||||
</div>
|
||||
<?php }?>
|
||||
<?php if($conf['login_alipay']>0){?>
|
||||
<div class="form-group">
|
||||
<div class="col-xs-6"><span class="pull-right"><i class="fa fa-2x"><img src="/assets/icon/alipay.ico" style="border-radius:50px;"></i> 支付宝快捷登录</span></div>
|
||||
<div class="col-xs-6">
|
||||
<?php if($userrow['alipay_uid']){?>
|
||||
<a class="btn btn-sm btn-success" disabled title="<?php echo $userrow['alipay_uid']?>">已绑定</a> <a class="btn btn-sm btn-danger" href="./oauth.php?unbind=1" onclick="return confirm('解绑后将无法通过支付宝一键登录,是否确定解绑?');">解绑</a>
|
||||
<?php }else{?>
|
||||
<a class="btn btn-sm btn-success" href="./oauth.php?bind=1">立即绑定</a>
|
||||
<?php }?>
|
||||
</div>
|
||||
</div>
|
||||
<?php }?>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php include 'foot.php';?>
|
||||
<script src="../assets/layer/layer.js"></script>
|
||||
<script src="../assets/js/jquery-qrcode.min.js"></script>
|
||||
<script src="//static.geetest.com/static/tools/gt.js"></script>
|
||||
<script>
|
||||
function invokeSettime(obj){
|
||||
var countdown=60;
|
||||
settime(obj);
|
||||
function settime(obj) {
|
||||
if (countdown == 0) {
|
||||
$(obj).attr("data-lock", "false");
|
||||
$(obj).text("获取验证码");
|
||||
countdown = 60;
|
||||
return;
|
||||
} else {
|
||||
$(obj).attr("data-lock", "true");
|
||||
$(obj).attr("disabled",true);
|
||||
$(obj).text("(" + countdown + ") s 重新发送");
|
||||
countdown--;
|
||||
}
|
||||
setTimeout(function() {
|
||||
settime(obj) }
|
||||
,1000)
|
||||
}
|
||||
}
|
||||
var handlerEmbed = function (captchaObj) {
|
||||
var target;
|
||||
captchaObj.onReady(function () {
|
||||
$("#wait").hide();
|
||||
}).onSuccess(function () {
|
||||
var result = captchaObj.getValidate();
|
||||
if (!result) {
|
||||
return alert('请完成验证');
|
||||
}
|
||||
var situation=$("#situation").val();
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
url : "ajax2.php?act=sendcode",
|
||||
data : {situation:situation,target:target,geetest_challenge:result.geetest_challenge,geetest_validate:result.geetest_validate,geetest_seccode:result.geetest_seccode},
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
new invokeSettime("#sendcode");
|
||||
new invokeSettime("#sendcode2");
|
||||
layer.msg('发送成功,请注意查收!');
|
||||
}else{
|
||||
layer.alert(data.msg);
|
||||
captchaObj.reset();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
$('#sendcode').click(function () {
|
||||
if ($(this).attr("data-lock") === "true") return;
|
||||
captchaObj.verify();
|
||||
});
|
||||
$('#sendcode2').click(function () {
|
||||
if ($(this).attr("data-lock") === "true") return;
|
||||
if($("input[name='phone_n']").length>0){
|
||||
target=$("input[name='phone_n']").val();
|
||||
if(target==''){layer.alert('手机号码不能为空!');return false;}
|
||||
if(target.length!=11){layer.alert('手机号码不正确!');return false;}
|
||||
}else{
|
||||
target=$("input[name='email_n']").val();
|
||||
if(target==''){layer.alert('邮箱不能为空!');return false;}
|
||||
var reg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
|
||||
if(!reg.test(target)){layer.alert('邮箱格式不正确!');return false;}
|
||||
}
|
||||
captchaObj.verify();
|
||||
})
|
||||
// 更多接口参考:http://www.geetest.com/install/sections/idx-client-sdk.html
|
||||
};
|
||||
$(document).ready(function(){
|
||||
var items = $("select[default]");
|
||||
for (i = 0; i < items.length; i++) {
|
||||
$(items[i]).val($(items[i]).attr("default")||1);
|
||||
}
|
||||
$("select[name='stype']").change(function(){
|
||||
var input = $("select[name='stype'] option:selected").attr("input");
|
||||
$("#typename").html(input);
|
||||
if($(this).val() == 2){
|
||||
$("#getopenid_form").show();
|
||||
}else{
|
||||
$("#getopenid_form").hide();
|
||||
}
|
||||
});
|
||||
$("select[name='stype']").change();
|
||||
$("#editSettle").click(function(){
|
||||
var stype=$("select[name='stype']").val();
|
||||
var account=$("input[name='account']").val();
|
||||
var username=$("input[name='username']").val();
|
||||
if(account=='' || username==''){layer.alert('请确保各项不能为空!');return false;}
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
url : "ajax2.php?act=edit_settle",
|
||||
data : {stype:stype,account:account,username:username},
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 1){
|
||||
layer.alert('修改成功!', {icon:1});
|
||||
}else if(data.code == 2){
|
||||
$("#situation").val("settle");
|
||||
$('#myModal').modal('show');
|
||||
}else{
|
||||
layer.alert(data.msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
$("#editInfo").click(function(){
|
||||
var email=$("input[name='email']").val();
|
||||
var qq=$("input[name='qq']").val();
|
||||
var url=$("input[name='url']").val();
|
||||
var keylogin=$("select[name='keylogin']").val();
|
||||
if(email=='' || qq=='' || url==''){layer.alert('请确保各项不能为空!');return false;}
|
||||
if(email.length>0){
|
||||
var reg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
|
||||
if(!reg.test(email)){layer.alert('邮箱格式不正确!');return false;}
|
||||
}
|
||||
if (url.indexOf(" ")>=0){
|
||||
url = url.replace(/ /g,"");
|
||||
}
|
||||
if (url.toLowerCase().indexOf("http://")==0){
|
||||
url = url.slice(7);
|
||||
}
|
||||
if (url.toLowerCase().indexOf("https://")==0){
|
||||
url = url.slice(8);
|
||||
}
|
||||
if (url.slice(url.length-1)=="/"){
|
||||
url = url.slice(0,url.length-1);
|
||||
}
|
||||
$("input[name='url']").val(url);
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
url : "ajax2.php?act=edit_info",
|
||||
data : {email:email,qq:qq,url:url,keylogin:keylogin},
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 1){
|
||||
layer.alert('修改成功!', {icon:1});
|
||||
}else{
|
||||
layer.alert(data.msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
$("#editMode").click(function(){
|
||||
var mode=$("select[name='mode']").val();
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
url : "ajax2.php?act=edit_mode",
|
||||
data : {mode:mode},
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 1){
|
||||
layer.alert('修改成功!', {icon:1});
|
||||
}else{
|
||||
layer.alert(data.msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
$("#checkbind").click(function(){
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : "GET",
|
||||
url : "ajax2.php?act=checkbind",
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 1){
|
||||
$("#situation").val("bind");
|
||||
$('#myModal2').modal('show');
|
||||
}else if(data.code == 2){
|
||||
$("#situation").val("mibao");
|
||||
$('#myModal').modal('show');
|
||||
}else{
|
||||
layer.alert(data.msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
$("#editBind").click(function(){
|
||||
var phone=$("input[name='phone_n']").val();
|
||||
var email=$("input[name='email_n']").val();
|
||||
var code=$("input[name='code_n']").val();
|
||||
if(code==''){layer.alert('请输入验证码!');return false;}
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
url : "ajax2.php?act=edit_bind",
|
||||
data : {phone:phone,email:email,code:code},
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 1){
|
||||
layer.alert('修改绑定成功!', {icon:1}, function(){window.location.reload()});
|
||||
}else{
|
||||
layer.alert(data.msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
$("#verifycode").click(function(){
|
||||
var code=$("input[name='code']").val();
|
||||
var situation=$("#situation").val();
|
||||
if(code==''){layer.alert('请输入验证码!');return false;}
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
url : "ajax2.php?act=verifycode",
|
||||
data : {code:code},
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 1){
|
||||
layer.msg('验证成功!', {icon:1});
|
||||
$('#myModal').modal('hide');
|
||||
if(situation=='settle'){
|
||||
$("#editSettle").click();
|
||||
}else if(situation=='mibao'){
|
||||
$("#situation").val("bind");
|
||||
$('#myModal2').modal('show');
|
||||
}else if(situation=='bind'){
|
||||
$('#myModal2').modal('hide');
|
||||
window.location.reload();
|
||||
}
|
||||
}else{
|
||||
layer.alert(data.msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
$('#getopenid').click(function () {
|
||||
if ($(this).attr("data-lock") === "true") return;
|
||||
$(this).attr("data-lock", "true");
|
||||
$.ajax({
|
||||
type : "GET",
|
||||
url : "ajax.php?act=qrcode",
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
$('#getopenid').attr("data-lock", "false");
|
||||
if(data.code == 0){
|
||||
$.openidform = layer.open({
|
||||
type: 1,
|
||||
title: '请使用微信扫描以下二维码',
|
||||
skin: 'layui-layer-demo',
|
||||
anim: 2,
|
||||
shadeClose: true,
|
||||
content: '<div id="qrcode" class="list-group-item text-center"></div>',
|
||||
success: function(){
|
||||
$('#qrcode').qrcode({
|
||||
text: data.url,
|
||||
width: 230,
|
||||
height: 230,
|
||||
foreground: "#000000",
|
||||
background: "#ffffff",
|
||||
typeNumber: -1
|
||||
});
|
||||
$.ostart = true;
|
||||
setTimeout('checkopenid()', 2000);
|
||||
},
|
||||
end: function(){
|
||||
$.ostart = false;
|
||||
}
|
||||
});
|
||||
}else{
|
||||
layer.alert(data.msg, {icon: 0});
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误', {icon: 2});
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
$.ajax({
|
||||
// 获取id,challenge,success(是否启用failback)
|
||||
url: "ajax.php?act=captcha&t=" + (new Date()).getTime(), // 加随机数防止缓存
|
||||
type: "get",
|
||||
asysn: true,
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
console.log(data);
|
||||
// 使用initGeetest接口
|
||||
// 参数1:配置参数
|
||||
// 参数2:回调,回调的第一个参数验证码对象,之后可以使用它做appendTo之类的事件
|
||||
initGeetest({
|
||||
width: '100%',
|
||||
gt: data.gt,
|
||||
challenge: data.challenge,
|
||||
new_captcha: data.new_captcha,
|
||||
product: "bind", // 产品形式,包括:float,embed,popup。注意只对PC版验证码有效
|
||||
offline: !data.success // 表示用户后台检测极验服务器是否宕机,一般不需要关注
|
||||
// 更多配置参数请参见:http://www.geetest.com/install/sections/idx-client-sdk.html#config
|
||||
}, handlerEmbed);
|
||||
}
|
||||
});
|
||||
});
|
||||
function checkopenid(){
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
url: "ajax.php?act=getopenid",
|
||||
success: function (data, textStatus) {
|
||||
if (data.code == 0) {
|
||||
layer.msg('Openid获取成功');
|
||||
layer.close($.openidform);
|
||||
$("input[name='account']").val(data.openid);
|
||||
}else if($.ostart==true){
|
||||
setTimeout('checkopenid()', 2000);
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
},
|
||||
error: function (data) {
|
||||
layer.msg('服务器错误', {icon: 2});
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
203
user/findpwd.php
Normal file
@@ -0,0 +1,203 @@
|
||||
<?php
|
||||
|
||||
include("../includes/common.php");
|
||||
|
||||
if($conf['reg_open']==0)sysmsg('未开放商户申请');
|
||||
|
||||
$csrf_token = md5(mt_rand(0,999).time());
|
||||
$_SESSION['csrf_token'] = $csrf_token;
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>找回密码 | <?php echo $conf['sitename']?></title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
|
||||
<link rel="stylesheet" href="//cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="//cdn.staticfile.org/animate.css/3.5.2/animate.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="//cdn.staticfile.org/font-awesome/4.7.0/css/font-awesome.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="//cdn.staticfile.org/simple-line-icons/2.4.1/css/simple-line-icons.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="./assets/css/font.css" type="text/css" />
|
||||
<link rel="stylesheet" href="./assets/css/app.css" type="text/css" />
|
||||
<style>input:-webkit-autofill{-webkit-box-shadow:0 0 0px 1000px white inset;-webkit-text-fill-color:#333;}img.logo{width:14px;height:14px;margin:0 5px 0 3px;}</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="app app-header-fixed ">
|
||||
<div class="container w-xxl w-auto-xs" ng-controller="SigninFormController" ng-init="app.settings.container = false;">
|
||||
<span class="navbar-brand block m-t" id="sitename"><?php echo $conf['sitename']?></span>
|
||||
<div class="m-b-lg">
|
||||
<div class="wrapper text-center">
|
||||
<strong>找回密码</strong>
|
||||
</div>
|
||||
<form name="form" class="form-validation">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo $csrf_token?>">
|
||||
<div class="text-danger wrapper text-center" ng-show="authError">
|
||||
</div>
|
||||
<div class="list-group list-group-sm swaplogin">
|
||||
<div class="list-group-item">
|
||||
<select class="form-control" name="type">
|
||||
<option value="email">使用邮箱找回</option><option value="phone">使用手机找回</option></select>
|
||||
</div>
|
||||
<div class="list-group-item">
|
||||
<input type="text" name="account" placeholder="邮箱/手机号" class="form-control no-border" required>
|
||||
</div>
|
||||
<div class="list-group-item">
|
||||
<div class="input-group">
|
||||
<input type="text" name="code" placeholder="输入验证码" class="form-control no-border" required>
|
||||
<a class="input-group-addon" id="sendcode">获取验证码</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="list-group-item">
|
||||
<input type="password" name="pwd" placeholder="请输入新密码" class="form-control no-border" required>
|
||||
</div>
|
||||
<div class="list-group-item">
|
||||
<input type="password" name="pwd2" placeholder="请重新输入密码" class="form-control no-border" required>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" id="submit" class="btn btn-lg btn-primary btn-block" ng-click="login()" ng-disabled='form.$invalid'>确认提交</button>
|
||||
<a href="login.php" ui-sref="access.signup" class="btn btn-lg btn-default btn-block">返回登录</a>
|
||||
</form>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<p>
|
||||
<small class="text-muted"><a href="/"><?php echo $conf['sitename']?></a><br>© 2016~2020</small>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="//cdn.staticfile.org/jquery/3.3.1/jquery.min.js"></script>
|
||||
<script src="//cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
|
||||
<script src="../assets/layer/layer.js"></script>
|
||||
<script src="../assets/js/jquery-qrcode.min.js"></script>
|
||||
<script src="//static.geetest.com/static/tools/gt.js"></script>
|
||||
<script>
|
||||
function invokeSettime(obj){
|
||||
var countdown=60;
|
||||
settime(obj);
|
||||
function settime(obj) {
|
||||
if (countdown == 0) {
|
||||
$(obj).attr("data-lock", "false");
|
||||
$(obj).text("获取验证码");
|
||||
countdown = 60;
|
||||
return;
|
||||
} else {
|
||||
$(obj).attr("data-lock", "true");
|
||||
$(obj).attr("disabled",true);
|
||||
$(obj).text("(" + countdown + ") s 重新发送");
|
||||
countdown--;
|
||||
}
|
||||
setTimeout(function() {
|
||||
settime(obj) }
|
||||
,1000)
|
||||
}
|
||||
}
|
||||
var handlerEmbed = function (captchaObj) {
|
||||
var sendto,type;
|
||||
captchaObj.onReady(function () {
|
||||
$("#wait").hide();
|
||||
}).onSuccess(function () {
|
||||
var result = captchaObj.getValidate();
|
||||
if (!result) {
|
||||
return alert('请完成验证');
|
||||
}
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
url : "ajax.php?act=sendcode2",
|
||||
data : {type:type,sendto:sendto,geetest_challenge:result.geetest_challenge,geetest_validate:result.geetest_validate,geetest_seccode:result.geetest_seccode},
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
new invokeSettime("#sendsms");
|
||||
layer.msg('发送成功,请注意查收!');
|
||||
}else{
|
||||
layer.alert(data.msg);
|
||||
captchaObj.reset();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
$('#sendcode').click(function () {
|
||||
if ($(this).attr("data-lock") === "true") return;
|
||||
type = $("select[name='type']").val();
|
||||
sendto=$("input[name='account']").val();
|
||||
if(type=='phone'){
|
||||
if(sendto==''){layer.alert('手机号码不能为空!');return false;}
|
||||
if(sendto.length!=11){layer.alert('手机号码不正确!');return false;}
|
||||
}else{
|
||||
if(sendto==''){layer.alert('邮箱不能为空!');return false;}
|
||||
var reg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
|
||||
if(!reg.test(sendto)){layer.alert('邮箱格式不正确!');return false;}
|
||||
}
|
||||
captchaObj.verify();
|
||||
});
|
||||
};
|
||||
$(document).ready(function(){
|
||||
$("select[name='type']").change(function(){
|
||||
if($(this).val() == 'email'){
|
||||
$("input[name='account']").attr('placeholder','邮箱');
|
||||
}else{
|
||||
$("input[name='account']").attr('placeholder','手机号码');
|
||||
}
|
||||
});
|
||||
$("select[name='type']").change();
|
||||
$("#submit").click(function(){
|
||||
if ($(this).attr("data-lock") === "true") return;
|
||||
var type=$("select[name='type']").val();
|
||||
var account=$("input[name='account']").val();
|
||||
var code=$("input[name='code']").val();
|
||||
var pwd=$("input[name='pwd']").val();
|
||||
var pwd2=$("input[name='pwd2']").val();
|
||||
if(account=='' || code=='' || pwd=='' || pwd2==''){layer.alert('请确保各项不能为空!');return false;}
|
||||
if(pwd!=pwd2){layer.alert('两次输入密码不一致!');return false;}
|
||||
if(type=='phone'){
|
||||
if(account.length!=11){layer.alert('手机号码不正确!');return false;}
|
||||
}else{
|
||||
var reg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
|
||||
if(!reg.test(account)){layer.alert('邮箱格式不正确!');return false;}
|
||||
}
|
||||
var csrf_token=$("input[name='csrf_token']").val();
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$(this).attr("data-lock", "true");
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
url : "ajax.php?act=findpwd",
|
||||
data : {type:type,account:account,code:code,pwd:pwd,csrf_token:csrf_token},
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
$("#submit").attr("data-lock", "false");
|
||||
layer.close(ii);
|
||||
if(data.code == 1){
|
||||
layer.alert(data.msg, {icon: 1}, function(){window.location.href="login.php"});
|
||||
}else{
|
||||
layer.alert(data.msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
$.ajax({
|
||||
// 获取id,challenge,success(是否启用failback)
|
||||
url: "ajax.php?act=captcha&t=" + (new Date()).getTime(), // 加随机数防止缓存
|
||||
type: "get",
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
console.log(data);
|
||||
// 使用initGeetest接口
|
||||
// 参数1:配置参数
|
||||
// 参数2:回调,回调的第一个参数验证码对象,之后可以使用它做appendTo之类的事件
|
||||
initGeetest({
|
||||
width: '100%',
|
||||
gt: data.gt,
|
||||
challenge: data.challenge,
|
||||
new_captcha: data.new_captcha,
|
||||
product: "bind", // 产品形式,包括:float,embed,popup。注意只对PC版验证码有效
|
||||
offline: !data.success // 表示用户后台检测极验服务器是否宕机,一般不需要关注
|
||||
// 更多配置参数请参见:http://www.geetest.com/install/sections/idx-client-sdk.html#config
|
||||
}, handlerEmbed);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
22
user/foot.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<!-- / content -->
|
||||
|
||||
<!-- footer -->
|
||||
<footer id="footer" class="app-footer" role="footer">
|
||||
<div class="wrapper b-t bg-light">
|
||||
<span class="pull-right">Powered by <a href="/" target="_blank"><?php echo $conf['sitename']?></a></span>
|
||||
© 2016-2020 Copyright.
|
||||
</div>
|
||||
</footer>
|
||||
<!-- / footer -->
|
||||
|
||||
</div>
|
||||
|
||||
<script src="//cdn.staticfile.org/jquery/3.3.1/jquery.min.js"></script>
|
||||
<script src="//cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
|
||||
<script src="./assets/js/ui-load.js"></script>
|
||||
<script src="./assets/js/ui-jp.config.js"></script>
|
||||
<script src="./assets/js/ui-jp.js"></script>
|
||||
<script src="./assets/js/ui-nav.js"></script>
|
||||
<script src="./assets/js/ui-toggle.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
207
user/groupbuy.php
Normal file
@@ -0,0 +1,207 @@
|
||||
<?php
|
||||
include("../includes/common.php");
|
||||
if($islogin2==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
$title='购买会员';
|
||||
include './head.php';
|
||||
?>
|
||||
<style>
|
||||
.table>tbody>tr>td{vertical-align: middle;}
|
||||
</style>
|
||||
<?php
|
||||
|
||||
if($conf['group_buy']==0)exit('未开启购买会员');
|
||||
|
||||
$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);
|
||||
|
||||
function display_info($info){
|
||||
global $paytype,$paytypes;
|
||||
$result = '';
|
||||
$arr = json_decode($info, true);
|
||||
foreach($arr as $k=>$v){
|
||||
if($v['channel']==0)continue;
|
||||
$result .= '<label><img src="/assets/icon/'.$paytypes[$k].'.ico" width="18px" title="'.$v['channel'].'"> '.$paytype[$k].'('.$v['rate'].'%)</label> ';
|
||||
}
|
||||
return substr($result,0,-1);
|
||||
}
|
||||
|
||||
$paytypem = \lib\Channel::getTypes($userrow['gid']);
|
||||
$list = $DB->getAll("SELECT * FROM pre_group WHERE isbuy=1 ORDER BY SORT ASC");
|
||||
$group=[];
|
||||
foreach($list as $row){
|
||||
$group[$row['gid']] = $row['name'];
|
||||
}
|
||||
$csrf_token = md5(mt_rand(0,999).time());
|
||||
$_SESSION['csrf_token'] = $csrf_token;
|
||||
?>
|
||||
<div id="content" class="app-content" role="main">
|
||||
<div class="app-content-body ">
|
||||
|
||||
<div class="bg-light lter b-b wrapper-md hidden-print">
|
||||
<h1 class="m-n font-thin h3">购买会员</h1>
|
||||
</div>
|
||||
<div class="wrapper-md control">
|
||||
<?php if(isset($msg)){?>
|
||||
<div class="alert alert-info">
|
||||
<?php echo $msg?>
|
||||
</div>
|
||||
<?php }?>
|
||||
<div class="row" id="listFrame">
|
||||
<div class="col-xs-12">
|
||||
<?php if(isset($_GET['ok']) && $_GET['ok']==1){
|
||||
$order = $DB->getRow("SELECT * FROM pre_order WHERE trade_no=:trade_no limit 1", [':trade_no'=>$_GET['trade_no']]);
|
||||
if($order){
|
||||
$start = strpos($order['name'],'#')+1;
|
||||
$end = strrpos($order['name'],'#');
|
||||
$id=intval(substr($order['name'],$start,$end-$start));
|
||||
?>
|
||||
<div class="alert alert-success alert-dismissible" role="alert">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
会员等级 <b><?php echo $group[$id]?></b> 已开通成功!
|
||||
</div>
|
||||
<?php }}?>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading font-bold">
|
||||
<i class="fa fa-shopping-cart"></i> 购买会员
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="list-group-item">
|
||||
<b>当前会员等级:</b><font color="red"><?php echo $group[$userrow['gid']]?></font>
|
||||
</div>
|
||||
<div class="line line-dashed b-b line-lg pull-in"></div>
|
||||
<table class="table table-striped table-hover">
|
||||
<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>'.display_info($res['info']).'</td><td><span style="font-size:20px;font-weight:700;color:#f40;">'.$res['price'].'</span></td><td>'.($userrow['gid']==$res['gid']?'<a class="btn btn-sm btn-info" href="javascript:;" disabled>当前等级</a>':'<a class="btn btn-sm btn-info" href="javascript:buy('.$res['gid'].')">立即购买</a>').'</td></tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" id="infoFrame" style="display:none;">
|
||||
<div class="col-xs-12 col-sm-10 col-md-8 col-lg-6 center-block" style="float: none;">
|
||||
<button class="btn btn-default btn-block" onclick="back()"><i class="fa fa-reply"></i> 返回列表</button>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading font-bold">
|
||||
<i class="fa fa-shopping-cart"></i> 购买会员
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<form class="form-horizontal devform">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo $csrf_token?>">
|
||||
<input type="hidden" name="group_id" value="">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">会员等级</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="group_name" value="" readonly="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">有效期</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="group_expire" value="" readonly="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">售价</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="group_price" value="" readonly="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">支付方式</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="radio">
|
||||
<label class="i-checks"><input type="radio" name="type" value="0"><i></i>余额支付</label>
|
||||
<?php foreach($paytypem as $row){?>
|
||||
<label class="i-checks"><input type="radio" name="type" value="<?php echo $row['id']?>" rate="<?php echo $row['rate']?>"><i></i><?php echo $row['showname']?>
|
||||
</label>
|
||||
<?php }?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-3 col-sm-8"><input type="button" id="submit" value="立即购买" class="btn btn-success form-control"/><br/>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include 'foot.php';?>
|
||||
<script src="../assets/layer/layer.js"></script>
|
||||
<script>
|
||||
function buy(gid){
|
||||
var ii = layer.load();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
data: {gid:gid},
|
||||
url: "ajax2.php?act=groupinfo",
|
||||
success: function (data, textStatus) {
|
||||
layer.close(ii);
|
||||
if (data.code == 0) {
|
||||
$("input[name='group_id']").val(gid);
|
||||
$("input[name='group_name']").val(data.name);
|
||||
$("input[name='group_expire']").val(data.expire);
|
||||
$("input[name='group_price']").val(data.price);
|
||||
$("#listFrame").slideUp();
|
||||
$("#infoFrame").slideDown();
|
||||
}else{
|
||||
layer.alert(data.msg, {icon: 0});
|
||||
}
|
||||
},
|
||||
error: function (data) {
|
||||
layer.msg('服务器错误', {icon: 2});
|
||||
}
|
||||
});
|
||||
}
|
||||
function back(){
|
||||
$("#listFrame").slideDown();
|
||||
$("#infoFrame").slideUp();
|
||||
}
|
||||
$(document).ready(function(){
|
||||
$("input[name=type]:first").attr("checked",true);
|
||||
$("#submit").click(function(){
|
||||
var csrf_token=$("input[name='csrf_token']").val();
|
||||
var gid=$("input[name='group_id']").val();
|
||||
var typeid=$("input[name=type]:checked").val();
|
||||
var ii = layer.load();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
data: {gid:gid, typeid:typeid, csrf_token:csrf_token},
|
||||
url: "ajax2.php?act=groupbuy",
|
||||
success: function (data, textStatus) {
|
||||
layer.close(ii);
|
||||
if (data.code == 0) {
|
||||
window.location.href=data.url;
|
||||
}else if (data.code == 1) {
|
||||
layer.alert(data.msg, {icon: 1}, function(){ window.location.reload() });
|
||||
}else{
|
||||
layer.alert(data.msg, {icon: 2});
|
||||
}
|
||||
},
|
||||
error: function (data) {
|
||||
layer.msg('服务器错误', {icon: 2});
|
||||
}
|
||||
});
|
||||
return false;
|
||||
})
|
||||
});
|
||||
</script>
|
||||
265
user/head.php
Normal file
@@ -0,0 +1,265 @@
|
||||
<?php
|
||||
@header('Content-Type: text/html; charset=UTF-8');
|
||||
if($userrow['status']==0){
|
||||
sysmsg('你的商户由于违反相关法律法规与《<a href="/?mod=agreement">"'.$conf['sitename'].'用户协议</a>》,已被禁用!');
|
||||
}
|
||||
switch($conf['user_style']){
|
||||
case 1: $style=['bg-black','bg-black','bg-white']; break;
|
||||
case 2: $style=['bg-dark','bg-white','bg-dark']; break;
|
||||
case 3: $style=['bg-dark','bg-dark','bg-light']; break;
|
||||
case 4: $style=['bg-info','bg-info','bg-black']; break;
|
||||
case 5: $style=['bg-info','bg-info','bg-white']; break;
|
||||
case 6: $style=['bg-primary','bg-primary','bg-dark']; break;
|
||||
case 7: $style=['bg-primary','bg-primary','bg-white']; break;
|
||||
default: $style=['bg-black','bg-white','bg-black']; break;
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title><?php echo $title?> | <?php echo $conf['sitename']?></title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||
<link rel="stylesheet" href="//cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="//cdn.staticfile.org/animate.css/3.5.2/animate.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="//cdn.staticfile.org/font-awesome/4.7.0/css/font-awesome.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="//cdn.staticfile.org/simple-line-icons/2.4.1/css/simple-line-icons.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="./assets/css/font.css" type="text/css" />
|
||||
<link rel="stylesheet" href="./assets/css/app.css" type="text/css" />
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="app app-header-fixed ">
|
||||
<!-- header -->
|
||||
<header id="header" class="app-header navbar" role="menu">
|
||||
<!-- navbar header -->
|
||||
<div class="navbar-header <?php echo $style[0]?>">
|
||||
<button class="pull-right visible-xs dk" ui-toggle="show" target=".navbar-collapse">
|
||||
<i class="glyphicon glyphicon-cog"></i>
|
||||
</button>
|
||||
<button class="pull-right visible-xs" ui-toggle="off-screen" target=".app-aside" ui-scroll="app">
|
||||
<i class="glyphicon glyphicon-align-justify"></i>
|
||||
</button>
|
||||
<!-- brand -->
|
||||
<a href="./" class="navbar-brand text-lt">
|
||||
<i class="fa fa-btc"></i>
|
||||
<span class="hidden-folded m-l-xs"><?php echo $conf['sitename']?></span>
|
||||
</a>
|
||||
<!-- / brand -->
|
||||
</div>
|
||||
<!-- / navbar header -->
|
||||
|
||||
<!-- navbar collapse -->
|
||||
<div class="collapse pos-rlt navbar-collapse box-shadow <?php echo $style[1]?>">
|
||||
<!-- buttons -->
|
||||
<div class="nav navbar-nav hidden-xs">
|
||||
<a href="#" class="btn no-shadow navbar-btn" ui-toggle="app-aside-folded" target=".app">
|
||||
<i class="fa fa-dedent fa-fw text"></i>
|
||||
<i class="fa fa-indent fa-fw text-active"></i>
|
||||
</a>
|
||||
</div>
|
||||
<!-- / buttons -->
|
||||
|
||||
<!-- nabar right -->
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li class="dropdown">
|
||||
<a href="#" data-toggle="dropdown" class="dropdown-toggle clear" data-toggle="dropdown">
|
||||
<span class="thumb-sm avatar pull-right m-t-n-sm m-b-n-sm m-l-sm">
|
||||
<img src="<?php echo ($userrow['qq'])?'//q2.qlogo.cn/headimg_dl?bs=qq&dst_uin='.$userrow['qq'].'&src_uin='.$userrow['qq'].'&fid='.$userrow['qq'].'&spec=100&url_enc=0&referer=bu_interface&term_type=PC':'assets/img/user.png'?>">
|
||||
<i class="on md b-white bottom"></i>
|
||||
</span>
|
||||
<span class="hidden-sm hidden-md" style="text-transform:uppercase;"><?php echo $uid?></span> <b class="caret"></b>
|
||||
</a>
|
||||
<!-- dropdown -->
|
||||
<ul class="dropdown-menu animated fadeInRight w">
|
||||
<li>
|
||||
<a href="index.php">
|
||||
<span>用户中心</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="userinfo.php?mod=info">
|
||||
<span>修改资料</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="userinfo.php?mod=account">
|
||||
<span>修改密码</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="divider"></li>
|
||||
<li>
|
||||
<a ui-sref="access.signin" href="login.php?logout">退出登录</a>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- / dropdown -->
|
||||
</li>
|
||||
</ul>
|
||||
<!-- / navbar right -->
|
||||
</div>
|
||||
<!-- / navbar collapse -->
|
||||
</header>
|
||||
<!-- / header -->
|
||||
<!-- aside -->
|
||||
<aside id="aside" class="app-aside hidden-xs <?php echo $style[2]?>">
|
||||
<div class="aside-wrap">
|
||||
<div class="navi-wrap">
|
||||
|
||||
<!-- nav -->
|
||||
<nav ui-nav class="navi clearfix">
|
||||
<ul class="nav">
|
||||
<li class="hidden-folded padder m-t m-b-sm text-muted text-xs">
|
||||
<span>导航</span>
|
||||
</li>
|
||||
<li class="<?php echo checkIfActive('index,')?>">
|
||||
<a href="./">
|
||||
<i class="glyphicon glyphicon-home icon text-primary-dker"></i>
|
||||
<b class="label bg-info pull-right">N</b>
|
||||
<span class="font-bold">用户中心</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="<?php echo checkIfActive('userinfo,editinfo,certificate')?>">
|
||||
<a href class="auto">
|
||||
<span class="pull-right text-muted">
|
||||
<i class="fa fa-fw fa-angle-right text"></i>
|
||||
<i class="fa fa-fw fa-angle-down text-active"></i>
|
||||
</span>
|
||||
<i class="glyphicon glyphicon-leaf icon text-success-lter"></i>
|
||||
<span>个人资料</span>
|
||||
</a>
|
||||
<ul class="nav nav-sub dk">
|
||||
<li>
|
||||
<a href="userinfo.php?mod=api">
|
||||
<span>API信息</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="editinfo.php">
|
||||
<span>修改资料</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="userinfo.php?mod=account">
|
||||
<span>修改密码</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php if($conf['cert_channel']){?>
|
||||
<li>
|
||||
<a href="certificate.php">
|
||||
<span>实名认证</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php }?>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="line dk"></li>
|
||||
<li class="hidden-folded padder m-t m-b-sm text-muted text-xs">
|
||||
<span>查询</span>
|
||||
</li>
|
||||
<li class="<?php echo checkIfActive('order')?>">
|
||||
<a href="order.php">
|
||||
<i class="glyphicon glyphicon-list-alt"></i>
|
||||
<span>订单记录</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="<?php echo checkIfActive('settle')?>">
|
||||
<a href="settle.php">
|
||||
<i class="glyphicon glyphicon-check"></i>
|
||||
<span>结算记录</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="<?php echo checkIfActive('record')?>">
|
||||
<a href="record.php">
|
||||
<i class="glyphicon glyphicon-calendar"></i>
|
||||
<span>资金明细</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php if($conf['settle_open']==2||$conf['settle_open']==3){?>
|
||||
<li class="<?php echo checkIfActive('apply')?>">
|
||||
<a href="apply.php">
|
||||
<i class="glyphicon glyphicon-edit"></i>
|
||||
<span>申请提现</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php }?>
|
||||
<?php if($conf['recharge']==1){?>
|
||||
<li class="<?php echo checkIfActive('recharge')?>">
|
||||
<a href="recharge.php">
|
||||
<i class="glyphicon glyphicon-yen"></i>
|
||||
<span>余额充值</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php }?>
|
||||
<?php if($conf['group_buy']==1){?>
|
||||
<li class="<?php echo checkIfActive('groupbuy')?>">
|
||||
<a href="groupbuy.php">
|
||||
<i class="glyphicon glyphicon-shopping-cart"></i>
|
||||
<span>购买会员</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php }?>
|
||||
<li class="line dk hidden-folded"></li>
|
||||
|
||||
<li class="hidden-folded padder m-t m-b-sm text-muted text-xs">
|
||||
<span>其他</span>
|
||||
</li>
|
||||
<?php if($conf['onecode']==1){?>
|
||||
<li class="<?php echo checkIfActive('onecode')?>">
|
||||
<a href="onecode.php">
|
||||
<i class="fa fa-qrcode fa-fw"></i>
|
||||
<span>一码支付</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php }?>
|
||||
<li>
|
||||
<a href="/doc.html" target="_blank">
|
||||
<i class="fa fa-book"></i>
|
||||
<span>开发文档</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php if(!empty($conf['qqqun'])){?>
|
||||
<li>
|
||||
<a href="<?php echo $conf['qqqun']?>" target="blank">
|
||||
<i class="fa fa-qq"></i>
|
||||
<span>产品QQ群</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php }?>
|
||||
<?php if(!empty($conf['appurl'])){?>
|
||||
<li>
|
||||
<a href="<?php echo $conf['appurl']?>" target="blank">
|
||||
<i class="fa fa-android"></i>
|
||||
<span>APP下载</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php }?>
|
||||
</ul>
|
||||
</nav>
|
||||
<!-- nav -->
|
||||
|
||||
<!-- aside footer -->
|
||||
<div class="wrapper m-t">
|
||||
<div class="text-center-folded">
|
||||
<span class="pull-right pull-none-folded">60%</span>
|
||||
<span class="hidden-folded">Milestone</span>
|
||||
</div>
|
||||
<div class="progress progress-xxs m-t-sm dk">
|
||||
<div class="progress-bar progress-bar-info" style="width: 60%;">
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-center-folded">
|
||||
<span class="pull-right pull-none-folded">35%</span>
|
||||
<span class="hidden-folded">Release</span>
|
||||
</div>
|
||||
<div class="progress progress-xxs m-t-sm dk">
|
||||
<div class="progress-bar progress-bar-primary" style="width: 35%;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- / aside footer -->
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
<!-- / aside -->
|
||||
<!-- content -->
|
||||
95
user/help.php
Normal file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
include("../includes/common.php");
|
||||
if($islogin2==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
$title='使用说明';
|
||||
include './head.php';
|
||||
?>
|
||||
<?php
|
||||
|
||||
?>
|
||||
<div id="content" class="app-content" role="main">
|
||||
<div class="app-content-body ">
|
||||
|
||||
<div class="bg-light lter b-b wrapper-md hidden-print">
|
||||
<h1 class="m-n font-thin h3">使用说明</h1>
|
||||
</div>
|
||||
<div class="wrapper-md control">
|
||||
<?php if(isset($msg)){?>
|
||||
<div class="alert alert-info">
|
||||
<?php echo $msg?>
|
||||
</div>
|
||||
<?php }?>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading font-bold">
|
||||
使用说明
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<h3>1分钟读懂<?php echo $conf['sitename']?>交易规则</h3>
|
||||
<div style="line-height:26px"><span style="white-space:nowrap;">
|
||||
<p style="white-space:normal;margin-bottom:14px;color:#333333;font-family:'microsoft yahei';font-size:14px;line-height:24px;">
|
||||
<strong>一、交易即时到账</strong>
|
||||
</p>
|
||||
<p style="white-space:normal;margin-bottom:14px;color:#333333;font-family:'microsoft yahei';font-size:14px;line-height:24px;">
|
||||
你的客户通过<?php echo $conf['sitename']?>中任意一种付款方式(支付宝、微信支付、财付通、QQ钱包)付款成功后均会时时到账于你的<?php echo $conf['sitename']?>账户,你可以在用户中心或订单记录中查看。
|
||||
</p>
|
||||
<p style="white-space:normal;margin-bottom:14px;color:#333333;font-family:'microsoft yahei';font-size:14px;line-height:24px;">
|
||||
<strong>二、T+1提现方案详解</strong>
|
||||
</p>
|
||||
<p style="white-space:normal;margin-top:0px;margin-bottom:10px;padding:0px;border:0px;font-size:14px;line-height:25px;color:#79848E;font-family:'Microsoft YaHei', 'Heiti SC', simhei, 'Lucida Sans Unicode', 'Myriad Pro', 'Hiragino Sans GB', Verdana;text-indent:2em;background-color:#FFFFFF;">
|
||||
1、星期一、<span style="font-size:13px;line-height:20px;text-indent:26px;">星期</span>二、<span style="font-size:13px;line-height:20px;text-indent:26px;">星期</span>三、<span style="font-size:13px;line-height:20px;text-indent:26px;">星期</span>四、<span style="color:#79848E;font-family:'Microsoft YaHei', 'Heiti SC', simhei, 'Lucida Sans Unicode', 'Myriad Pro', 'Hiragino Sans GB', Verdana;font-size:14px;line-height:25px;text-indent:28px;white-space:normal;background-color:#FFFFFF;">星期五、</span><span style="color:#79848E;font-family:'Microsoft YaHei', 'Heiti SC', simhei, 'Lucida Sans Unicode', 'Myriad Pro', 'Hiragino Sans GB', Verdana;white-space:normal;font-size:13px;line-height:20px;text-indent:26px;">星期</span><span style="color:#79848E;font-family:'Microsoft YaHei', 'Heiti SC', simhei, 'Lucida Sans Unicode', 'Myriad Pro', 'Hiragino Sans GB', Verdana;font-size:14px;line-height:25px;text-indent:28px;white-space:normal;background-color:#FFFFFF;">六、</span><span style="color:#79848E;font-family:'Microsoft YaHei', 'Heiti SC', simhei, 'Lucida Sans Unicode', 'Myriad Pro', 'Hiragino Sans GB', Verdana;white-space:normal;font-size:13px;line-height:20px;text-indent:26px;">星期</span><span style="color:#79848E;font-family:'Microsoft YaHei', 'Heiti SC', simhei, 'Lucida Sans Unicode', 'Myriad Pro', 'Hiragino Sans GB', Verdana;font-size:14px;line-height:25px;text-indent:28px;white-space:normal;background-color:#FFFFFF;">日</span>,0点~23点59分59秒间提现的资金将于次日23点前到账。
|
||||
</p>
|
||||
<!--p style="white-space:normal;margin-top:0px;margin-bottom:10px;padding:0px;border:0px;font-size:14px;line-height:25px;color:#79848E;font-family:'Microsoft YaHei', 'Heiti SC', simhei, 'Lucida Sans Unicode', 'Myriad Pro', 'Hiragino Sans GB', Verdana;text-indent:2em;background-color:#FFFFFF;">
|
||||
<span style="font-size:13px;line-height:20px;text-indent:26px;">2、国家法定节假日期间提现的资金将于 节假日后第一个工作日23点前到账。</span>
|
||||
</p-->
|
||||
<p style="white-space:normal;margin-bottom:14px;color:#333333;font-family:'microsoft yahei';font-size:14px;line-height:24px;">
|
||||
<strong>三、提现费率</strong>
|
||||
</p>
|
||||
<table class="table table-striped table-condensed" width="735" style="color:#666666;font-family:'Helvetica Neue', 'Hiragino Sans GB', 'WenQuanYi Micro Hei', 'Microsoft Yahei', sans-serif;font-size:15.54px;line-height:24.864px;">
|
||||
<tbody style="box-sizing:border-box;margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;font-size:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;">
|
||||
<tr class="info firstRow" style="box-sizing:border-box;margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;font-size:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;">
|
||||
<td style="box-sizing:border-box;margin:0px;padding-top:11px;padding-right:0px;padding-bottom:11px;border:none;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;font-size:inherit;line-height:17px;font-family:inherit;vertical-align:top;background-color:#D9EDF7;">
|
||||
<p style="box-sizing:border-box;margin-bottom:10px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;font-size:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;color:#000000;text-indent:2em;">
|
||||
<strong style="box-sizing:border-box;margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-stretch:inherit;font-size:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;">单笔提现金额</strong>
|
||||
</p>
|
||||
</td>
|
||||
<td style="box-sizing:border-box;margin:0px;padding-top:11px;padding-right:0px;padding-bottom:11px;border:none;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;font-size:inherit;line-height:17px;font-family:inherit;vertical-align:top;background-color:#D9EDF7;">
|
||||
<p style="box-sizing:border-box;margin-bottom:10px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;font-size:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;color:#000000;text-indent:2em;">
|
||||
<strong style="box-sizing:border-box;margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-stretch:inherit;font-size:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;">提现费率</strong>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="box-sizing:border-box;margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;font-size:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;background-color:#F4F6F8;">
|
||||
<td style="box-sizing:border-box;margin:0px;padding-top:11px;padding-right:0px;padding-bottom:11px;border:none;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;font-size:inherit;line-height:17px;font-family:inherit;vertical-align:top;">
|
||||
<p style="box-sizing:border-box;margin-bottom:10px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;font-size:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;color:#000000;text-indent:2em;">
|
||||
大于10元起提上不封顶
|
||||
</p>
|
||||
</td>
|
||||
<td style="box-sizing:border-box;margin:0px;padding-top:11px;padding-right:0px;padding-bottom:11px;border:none;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;font-size:inherit;line-height:17px;font-family:inherit;vertical-align:top;">
|
||||
<p style="box-sizing:border-box;margin-bottom:10px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;font-size:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;color:#000000;text-indent:2em;">
|
||||
0.5%(最高25元)
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p style="white-space:normal;margin-bottom:14px;color:#333333;font-family:'microsoft yahei';font-size:14px;line-height:24px;">
|
||||
提现时手续费不足1元按1元收取
|
||||
</p>
|
||||
<p style="white-space:normal;margin-bottom:14px;color:#333333;font-family:'microsoft yahei';font-size:14px;line-height:24px;">
|
||||
<strong>四、多种结算方式</strong>
|
||||
</p>
|
||||
<p style="white-space:normal;margin-bottom:14px;color:#333333;font-family:'microsoft yahei';font-size:14px;line-height:24px;">
|
||||
<span style="font-family:'Microsoft YaHei', 'Heiti SC', simhei, 'Lucida Sans Unicode', 'Myriad Pro', 'Hiragino Sans GB', Verdana;font-size:13px;line-height:20px;text-indent:26px;background-color:#FFFFFF;"><?php echo $conf['sitename']?></span>官方企业支付宝 -> 您的个人支付宝(小额)
|
||||
</p>
|
||||
<p style="white-space:normal;margin-bottom:14px;color:#333333;font-family:'microsoft yahei';font-size:14px;line-height:24px;">
|
||||
<span style="font-family:'Microsoft YaHei', 'Heiti SC', simhei, 'Lucida Sans Unicode', 'Myriad Pro', 'Hiragino Sans GB', Verdana;font-size:13px;line-height:20px;text-indent:26px;background-color:#FFFFFF;"><?php echo $conf['sitename']?></span>官方对公账户 -> 您的个人银行卡(大额)
|
||||
</p>
|
||||
</span></div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include 'foot.php';?>
|
||||
283
user/index.php
Normal file
@@ -0,0 +1,283 @@
|
||||
<?php
|
||||
include("../includes/common.php");
|
||||
if($islogin2==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
|
||||
if(empty($userrow['account']) || empty($userrow['username'])){
|
||||
exit("<script language='javascript'>window.location.href='./completeinfo.php';</script>");
|
||||
}
|
||||
$title='用户中心';
|
||||
include './head.php';
|
||||
?>
|
||||
<style>
|
||||
.round {
|
||||
line-height: 53px;
|
||||
color: #7266ba;
|
||||
width: 58px;
|
||||
height: 58px;
|
||||
font-size: 26px;
|
||||
margin-left:15px;
|
||||
display: inline-block;
|
||||
font-weight: 400;
|
||||
border: 3px solid #f8f8fe;
|
||||
text-align: center;
|
||||
border-radius: 50%;
|
||||
background: #e3dff9;
|
||||
}
|
||||
</style>
|
||||
<?php
|
||||
$rs=$DB->query("SELECT * FROM pre_settle WHERE uid={$uid} AND status=1 ORDER BY id DESC LIMIT 9");
|
||||
$max_settle=0;
|
||||
$chart='';
|
||||
$i=0;
|
||||
while($row = $rs->fetch())
|
||||
{
|
||||
if($row['money']>$max_settle)$max_settle=$row['money'];
|
||||
$chart.='['.$i++.','.$row['money'].'],';
|
||||
}
|
||||
$chart=substr($chart,0,-1);
|
||||
|
||||
$list = $DB->getAll("SELECT * FROM pre_anounce ORDER BY sort ASC");
|
||||
|
||||
$rates = \lib\Channel::getTypes($userrow['gid']);
|
||||
?>
|
||||
<div id="content" class="app-content" role="main">
|
||||
<div class="app-content-body ">
|
||||
<div class="modal inmodal fade" id="myModal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">关闭</span>
|
||||
</button>
|
||||
<h4 class="modal-title">欢迎回来</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<?php echo $conf['modal']?>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="bg-light lter b-b wrapper-md hidden-print">
|
||||
<h1 class="m-n font-thin h3">用户中心</h1>
|
||||
<small class="text-muted">欢迎使用<?php echo $conf['sitename']?></small>
|
||||
</div>
|
||||
<div class="wrapper-md control">
|
||||
<!-- stats -->
|
||||
<?php
|
||||
if($conf['cert_force']==1 && $userrow['cert']==0){
|
||||
echo '<div class="alert alert-danger"><span class="btn-sm btn-danger">重要</span> 请完成实名认证,否则您的商户无法正常收款! <a href="./certificate.php" class="btn btn-default btn-xs">立即实名认证</a></div>';
|
||||
}
|
||||
if($conf['verifytype']==1 && empty($userrow['phone'])){
|
||||
echo '<div class="alert alert-warning"><span class="btn-sm btn-warning">提示</span> 您还没有绑定密保手机,请 <a href="editinfo.php" class="btn btn-default btn-xs">尽快绑定</a></div>';
|
||||
}elseif($conf['verifytype']==0 && empty($userrow['email'])){
|
||||
echo '<div class="alert alert-warning"><span class="btn-sm btn-warning">提示</span> 您还没有绑定密保邮箱,请 <a href="editinfo.php" class="btn btn-default btn-xs">尽快绑定</a></div>';
|
||||
}
|
||||
if(empty($userrow['pwd'])){
|
||||
echo '<div class="alert alert-warning"><span class="btn-sm btn-warning">提示</span> 您还没有设置登录密码,请 <a href="userinfo.php?mod=account" class="btn btn-default btn-xs">点此设置</a>,设置登录密码之后你就可以使用手机号/邮箱+密码登录</div>';
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="row row-sm text-center">
|
||||
<div class="col-xs-6 col-sm-3">
|
||||
<div class="panel padder-v item">
|
||||
<div class="top text-right w-full"><i class="fa fa-caret-down text-warning m-r-sm"></i></div>
|
||||
<div class="row">
|
||||
<div class="col-xs-3"><div class="round"><i class="fa fa-money fa-fw"></i></div></div>
|
||||
<div class="col-xs-9"><div class="h1 text-primary-dk font-thin h1"><span class="text-muted text-md">¥</span><?php echo $userrow['money']?></div><span class="text-muted">商户当前余额</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6 col-sm-3">
|
||||
<div class="panel padder-v item">
|
||||
<div class="top text-right w-full"><i class="fa fa-caret-down text-warning m-r-sm"></i></div>
|
||||
<div class="row">
|
||||
<div class="col-xs-3"><div class="round"><i class="fa fa-check-square-o fa-fw"></i></div></div>
|
||||
<div class="col-xs-9"><div class="h1 text-dark-dk font-thin h1"><span class="text-muted text-md">¥</span><span id="settle_money"></span></div><span class="text-muted">已结算余额</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6 col-sm-3">
|
||||
<div class="panel padder-v item">
|
||||
<div class="top text-right w-full"><i class="fa fa-caret-down text-warning m-r-sm"></i></div>
|
||||
<div class="row">
|
||||
<div class="col-xs-3"><div class="round"><i class="fa fa-area-chart fa-fw"></i></div></div>
|
||||
<div class="col-xs-9"><div class="h1 text-success-dk font-thin h1"><span id="orders"></span><span class="text-muted text-md">个</span></div><span class="text-muted">订单总数</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6 col-sm-3">
|
||||
<div class="panel padder-v item">
|
||||
<div class="top text-right w-full"><i class="fa fa-caret-down text-warning m-r-sm"></i></div>
|
||||
<div class="row">
|
||||
<div class="col-xs-3"><div class="round"><i class="fa fa-cart-plus fa-fw"></i></div></div>
|
||||
<div class="col-xs-9"><div class="h1 text-info-dk font-thin h1"><span id="orders_today"></span><span class="text-muted text-md">个</span></div><span class="text-muted">今日订单</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
|
||||
<div class="panel b-a">
|
||||
<div class="panel-heading bg-info dk no-border wrapper-lg">
|
||||
<a class="btn btn-sm btn-rounded btn-info pull-right m-r" href="./editinfo.php"><i class="fa fa-cog fa-fw"></i> 修改资料</a>
|
||||
<a class="btn btn-sm btn-rounded btn-info m-l" href="./userinfo.php?mod=api"><i class="fa fa-lock fa-fw"></i> API信息</a>
|
||||
</div>
|
||||
<div class="text-center m-b clearfix">
|
||||
<div class="thumb-lg avatar m-t-n-xxl">
|
||||
<img src="<?php echo ($userrow['qq'])?'//q2.qlogo.cn/headimg_dl?bs=qq&dst_uin='.$userrow['qq'].'&src_uin='.$userrow['qq'].'&fid='.$userrow['qq'].'&spec=100&url_enc=0&referer=bu_interface&term_type=PC':'assets/img/user.png'?>" alt="..." class="b b-3x b-white">
|
||||
</div>
|
||||
<div class="h2 font-thin m-t-sm">欢迎您,<?php echo $userrow['username']?></div>
|
||||
</div>
|
||||
<div class="hbox text-center b-t b-light bg-light">
|
||||
<a class="col padder-v text-muted b-r b-light">
|
||||
<div class="h3"><span id="order_today_all"></span></div>
|
||||
<i class="fa fa-plus fa-fw"></i><span>今日收入</span>
|
||||
</a>
|
||||
<a class="col padder-v text-muted">
|
||||
<div class="h3"><span id="order_lastday_all"></span></div>
|
||||
<i class="fa fa-plus-circle fa-fw"></i><span>昨日收入</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="hbox b-t b-light bg-gd">
|
||||
<div class="panel-body text-center">
|
||||
<div class="row">
|
||||
<div class="col-md-2 col-xs-4">
|
||||
<div class="quick-all">
|
||||
<i class="fa fa-2x"><img src="/assets/icon/alipay.ico" style="border-radius:50px;margin-top: -6px;margin-bottom: -2px;"></i>
|
||||
<h4><span id="order_today_alipay"></span></h4>
|
||||
<p style="word-break: keep-all;">今日支付宝</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2 col-xs-4">
|
||||
<div class="quick-all">
|
||||
<i class="fa fa-qq fa-2x" style="color: #0BB2FF"></i>
|
||||
<h4><span id="order_today_qqpay"></span></h4>
|
||||
<p style="word-break: keep-all;">今日QQ</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2 col-xs-4">
|
||||
<div class="quick-all">
|
||||
<i class="fa fa-weixin fa-2x" style="color: green"></i>
|
||||
<h4><span id="order_today_wxpay"></span></h4>
|
||||
<p style="word-break: keep-all;">今日微信</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2 col-xs-4">
|
||||
<div class="quick-all">
|
||||
<i class="fa fa-2x"><img src="assets/img/alipay.png" height="30" style="border-radius:50px;margin-top: -6px;margin-bottom: -2px;"></i>
|
||||
<h4><span id="order_lastday_alipay"></span></h4>
|
||||
<p style="word-break: keep-all;">昨日支付宝</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2 col-xs-4">
|
||||
<div class="quick-all">
|
||||
<i class="fa fa-qq fa-2x"></i>
|
||||
<h4><span id="order_lastday_qqpay"></span></h4>
|
||||
<p style="word-break: keep-all;">昨日QQ</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2 col-xs-4">
|
||||
<div class="quick-all">
|
||||
<i class="fa fa-weixin fa-2x"></i>
|
||||
<h4><span id="order_lastday_wxpay"></span></h4>
|
||||
<p style="word-break: keep-all;">昨日微信</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default text-center">
|
||||
<div class="panel-heading font-bold">
|
||||
通道费率
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead><tr>
|
||||
<?php foreach($rates as $row){?>
|
||||
<th style="text-align:center;"><img src="/assets/icon/<?php echo $row['name']?>.ico" width="18px"> <?php echo $row['showname']?></th>
|
||||
<?php }?>
|
||||
</tr></thead><tbody><tr>
|
||||
<?php foreach($rates as $row){?>
|
||||
<td><?php echo $row['rate']?>%</td>
|
||||
<?php }?>
|
||||
</tr></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading font-bold text-center">
|
||||
公告通知
|
||||
</div>
|
||||
<div class="list-group">
|
||||
<?php foreach($list as $row){?>
|
||||
<a 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><span class="text-xs text-muted"> -<?php echo $row['addtime']?></span></a>
|
||||
<?php }?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel wrapper">
|
||||
<label class="i-switch bg-warning pull-right" ng-init="showSpline=true">
|
||||
<input type="checkbox" ng-model="showSpline">
|
||||
<i></i>
|
||||
</label>
|
||||
<h4 class="font-thin m-t-none m-b text-muted">结算统计表</h4>
|
||||
<div ui-jq="plot" ui-refresh="showSpline" ui-options="
|
||||
[
|
||||
{ data: [ <?php echo $chart?> ], label:'结算金额', points: { show: true, radius: 1}, splines: { show: true, tension: 0.4, lineWidth: 1, fill: 0.8 } }
|
||||
],
|
||||
{
|
||||
colors: ['#23b7e5', '#7266ba'],
|
||||
series: { shadowSize: 3 },
|
||||
xaxis:{ font: { color: '#a1a7ac' } },
|
||||
yaxis:{ font: { color: '#a1a7ac' }, max:<?php echo ($max_settle+10)?> },
|
||||
grid: { hoverable: true, clickable: true, borderWidth: 0, color: '#dce5ec' },
|
||||
tooltip: true,
|
||||
tooltipOpts: { content: '结算金额¥%y', defaultTheme: false, shifts: { x: 10, y: -25 } }
|
||||
}
|
||||
" style="height:246px" >
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- / stats -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include 'foot.php';?>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$.ajax({
|
||||
type : "GET",
|
||||
url : "ajax2.php?act=getcount",
|
||||
dataType : 'json',
|
||||
async: true,
|
||||
success : function(data) {
|
||||
$('#orders').html(data.orders);
|
||||
$('#orders_today').html(data.orders_today);
|
||||
$('#settle_money').html(data.settle_money);
|
||||
$('#order_today_all').html(data.order_today.all);
|
||||
$('#order_today_alipay').html(data.order_today.alipay);
|
||||
$('#order_today_wxpay').html(data.order_today.wxpay);
|
||||
$('#order_today_qqpay').html(data.order_today.qqpay);
|
||||
$('#order_lastday_all').html(data.order_lastday.all);
|
||||
$('#order_lastday_alipay').html(data.order_lastday.alipay);
|
||||
$('#order_lastday_wxpay').html(data.order_lastday.wxpay);
|
||||
$('#order_lastday_qqpay').html(data.order_lastday.qqpay);
|
||||
}
|
||||
});
|
||||
<?php if(!empty($conf['modal'])){?>
|
||||
$('#myModal').modal('show');
|
||||
<?php }?>
|
||||
});
|
||||
</script>
|
||||
198
user/login.php
Normal file
@@ -0,0 +1,198 @@
|
||||
<?php
|
||||
/**
|
||||
* 登录
|
||||
**/
|
||||
$is_defend=true;
|
||||
include("../includes/common.php");
|
||||
|
||||
if(isset($_GET['logout'])){
|
||||
setcookie("user_token", "", time() - 604800);
|
||||
@header('Content-Type: text/html; charset=UTF-8');
|
||||
exit("<script language='javascript'>alert('您已成功注销本次登录!');window.location.href='./login.php';</script>");
|
||||
}elseif($islogin2==1){
|
||||
exit("<script language='javascript'>alert('您已登录!');window.location.href='./';</script>");
|
||||
}
|
||||
$csrf_token = md5(mt_rand(0,999).time());
|
||||
$_SESSION['csrf_token'] = $csrf_token;
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>登录 | <?php echo $conf['sitename']?></title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
|
||||
<link rel="stylesheet" href="//cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="//cdn.staticfile.org/animate.css/3.5.2/animate.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="//cdn.staticfile.org/font-awesome/4.7.0/css/font-awesome.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="//cdn.staticfile.org/simple-line-icons/2.4.1/css/simple-line-icons.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="./assets/css/font.css" type="text/css" />
|
||||
<link rel="stylesheet" href="./assets/css/app.css" type="text/css" />
|
||||
<link rel="stylesheet" href="./assets/css/captcha.css" type="text/css" />
|
||||
<style>input:-webkit-autofill{-webkit-box-shadow:0 0 0px 1000px white inset;-webkit-text-fill-color:#333;}</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="app app-header-fixed ">
|
||||
<div class="container w-xxl w-auto-xs" ng-controller="SigninFormController" ng-init="app.settings.container = false;">
|
||||
<span class="navbar-brand block m-t"><?php echo $conf['sitename']?></span>
|
||||
<div class="m-b-lg">
|
||||
<div class="wrapper text-center">
|
||||
<strong>请输入您的商户信息</strong>
|
||||
</div>
|
||||
<form name="form" class="form-validation" method="post" action="login.php">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo $csrf_token?>">
|
||||
<div class="text-danger wrapper text-center" ng-show="authError">
|
||||
</div>
|
||||
<ul class="nav nav-tabs">
|
||||
<li style="width: 50%;" align="center" class="<?php echo $_GET['m']!='key'?'active':null;?>">
|
||||
<a href="./login.php">密码登录(New)</a>
|
||||
</li>
|
||||
<li style="width: 50%;" align="center" class="<?php echo $_GET['m']=='key'?'active':null;?>">
|
||||
<a href="./login.php?m=key">密钥登录</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active">
|
||||
<div class="list-group list-group-sm swaplogin">
|
||||
<?php if($_GET['m']=='key'){?>
|
||||
<input type="hidden" name="type" value="0"/>
|
||||
<div class="list-group-item">
|
||||
<input type="text" name="user" placeholder="商户ID" value="" class="form-control no-border" onkeydown="if(event.keyCode==13){$('#submit').click()}">
|
||||
</div>
|
||||
<div class="list-group-item">
|
||||
<input type="password" name="pass" placeholder="商户密钥" value="" class="form-control no-border" onkeydown="if(event.keyCode==13){$('#submit').click()}">
|
||||
</div>
|
||||
<?php }else{?>
|
||||
<input type="hidden" name="type" value="1"/>
|
||||
<div class="list-group-item">
|
||||
<input type="text" name="user" placeholder="邮箱/手机号" value="" class="form-control no-border" onkeydown="if(event.keyCode==13){$('#submit').click()}">
|
||||
</div>
|
||||
<div class="list-group-item">
|
||||
<input type="password" name="pass" placeholder="密码" value="" class="form-control no-border" onkeydown="if(event.keyCode==13){$('#submit').click()}">
|
||||
</div>
|
||||
<?php }?>
|
||||
<?php if($conf['captcha_open_login']==1){?>
|
||||
<div class="list-group-item" id="captcha" style="margin: auto;"><div id="captcha_text">
|
||||
正在加载验证码
|
||||
</div>
|
||||
<div id="captcha_wait">
|
||||
<div class="loading">
|
||||
<div class="loading-dot"></div>
|
||||
<div class="loading-dot"></div>
|
||||
<div class="loading-dot"></div>
|
||||
<div class="loading-dot"></div>
|
||||
</div>
|
||||
</div></div>
|
||||
<div id="captchaform"></div>
|
||||
<?php }?>
|
||||
</div>
|
||||
<button type="button" class="btn btn-lg btn-primary btn-block" id="submit">立即登录</button>
|
||||
</div>
|
||||
</div>
|
||||
<a href="reg.php" ui-sref="access.signup" class="btn btn-lg btn-default btn-block <?php echo $conf['reg_open']==0?'hide':null;?>">自助申请商户</a>
|
||||
<div class="line line-dashed"></div>
|
||||
<?php if(!isset($_GET['connect'])){?>
|
||||
<div class="wrapper text-center">
|
||||
<?php if($conf['login_alipay']>0){?>
|
||||
<button type="button" class="btn btn-rounded btn-lg btn-icon btn-default" title="支付宝快捷登录" onclick="window.location.href='oauth.php'"><img src="../assets/icon/alipay.ico" style="border-radius:50px;"></button>
|
||||
<?php }?>
|
||||
<?php if($conf['login_qq']>0){?>
|
||||
<button type="button" class="btn btn-rounded btn-lg btn-icon btn-default" title="QQ快捷登录" onclick="window.location.href='connect.php'"><i class="fa fa-qq fa-lg" style="color: #0BB2FF"></i></button>
|
||||
<?php }?>
|
||||
<?php if($conf['login_wx']>0){?>
|
||||
<button type="button" class="btn btn-rounded btn-lg btn-icon btn-default" title="微信快捷登录" onclick="window.location.href='wxlogin.php'"><i class="fa fa-wechat fa-lg" style="color: green"></i></button>
|
||||
</div>
|
||||
<?php }?>
|
||||
<?php }?>
|
||||
<div class="text-center m-t m-b"><a ui-sref="access.forgotpwd" href="findpwd.php">找回密码</a></div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<p>
|
||||
<small class="text-muted"><a href="/"><?php echo $conf['sitename']?></a><br>© 2016~2020</small>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="//cdn.staticfile.org/jquery/3.3.1/jquery.min.js"></script>
|
||||
<script src="//cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
|
||||
<script src="../assets/layer/layer.js"></script>
|
||||
<script src="//static.geetest.com/static/tools/gt.js"></script>
|
||||
<script>
|
||||
var captcha_open = 0;
|
||||
var handlerEmbed = function (captchaObj) {
|
||||
captchaObj.appendTo('#captcha');
|
||||
captchaObj.onReady(function () {
|
||||
$("#captcha_wait").hide();
|
||||
}).onSuccess(function () {
|
||||
var result = captchaObj.getValidate();
|
||||
if (!result) {
|
||||
return alert('请完成验证');
|
||||
}
|
||||
$("#captchaform").html('<input type="hidden" name="geetest_challenge" value="'+result.geetest_challenge+'" /><input type="hidden" name="geetest_validate" value="'+result.geetest_validate+'" /><input type="hidden" name="geetest_seccode" value="'+result.geetest_seccode+'" />');
|
||||
});
|
||||
};
|
||||
$(document).ready(function(){
|
||||
if($("#captcha").length>0) captcha_open=1;
|
||||
$("#submit").click(function(){
|
||||
var type=$("input[name='type']").val();
|
||||
var user=$("input[name='user']").val();
|
||||
var pass=$("input[name='pass']").val();
|
||||
if(user=='' || pass==''){layer.alert(type==1?'账号和密码不能为空!':'ID和密钥不能为空!');return false;}
|
||||
submitLogin(type,user,pass);
|
||||
});
|
||||
if(captcha_open==1){
|
||||
$.ajax({
|
||||
url: "./ajax.php?act=captcha&t=" + (new Date()).getTime(),
|
||||
type: "get",
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
$('#captcha_text').hide();
|
||||
$('#captcha_wait').show();
|
||||
initGeetest({
|
||||
gt: data.gt,
|
||||
challenge: data.challenge,
|
||||
new_captcha: data.new_captcha,
|
||||
product: "popup",
|
||||
width: "100%",
|
||||
offline: !data.success
|
||||
}, handlerEmbed);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
function submitLogin(type,user,pass){
|
||||
var csrf_token=$("input[name='csrf_token']").val();
|
||||
var data = {type:type, user:user, pass:pass, csrf_token:csrf_token};
|
||||
if(captcha_open == 1){
|
||||
var geetest_challenge = $("input[name='geetest_challenge']").val();
|
||||
var geetest_validate = $("input[name='geetest_validate']").val();
|
||||
var geetest_seccode = $("input[name='geetest_seccode']").val();
|
||||
if(geetest_challenge == ""){
|
||||
layer.alert('请先完成滑动验证!'); return false;
|
||||
}
|
||||
var adddata = {geetest_challenge:geetest_challenge, geetest_validate:geetest_validate, geetest_seccode:geetest_seccode};
|
||||
}
|
||||
var ii = layer.load();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
data: Object.assign(data, adddata),
|
||||
url: "ajax.php?act=login",
|
||||
success: function (data, textStatus) {
|
||||
layer.close(ii);
|
||||
if (data.code == 0) {
|
||||
layer.msg(data.msg, {icon: 16,time: 10000,shade:[0.3, "#000"]});
|
||||
setTimeout(function(){ window.location.href=data.url }, 1000);
|
||||
}else{
|
||||
layer.alert(data.msg, {icon: 2});
|
||||
}
|
||||
},
|
||||
error: function (data) {
|
||||
layer.msg('服务器错误', {icon: 2});
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
177
user/oauth.php
Normal file
@@ -0,0 +1,177 @@
|
||||
<?php
|
||||
/**
|
||||
* 登录
|
||||
**/
|
||||
$nosession=true;
|
||||
include("../includes/common.php");
|
||||
if(!$conf['login_alipay'])sysmsg("未开启支付宝快捷登录");
|
||||
|
||||
if(isset($_GET['sid'])){
|
||||
$sid = trim(daddslashes($_GET['sid']));
|
||||
if(!preg_match('/^(.[a-zA-Z0-9]+)$/',$sid))exit("Access Denied");
|
||||
session_id($sid);
|
||||
}
|
||||
session_start();
|
||||
|
||||
if(isset($_GET['act']) && $_GET['act']=='login'){
|
||||
if(isset($_SESSION['alipay_uid']) && !empty($_SESSION['alipay_uid'])){
|
||||
$alipay_uid = daddslashes($_SESSION['alipay_uid']);
|
||||
$userrow=$DB->getRow("SELECT * FROM pre_user WHERE alipay_uid='{$alipay_uid}' limit 1");
|
||||
if($userrow){
|
||||
$uid=$userrow['uid'];
|
||||
$key=$userrow['key'];
|
||||
if($islogin2==1){
|
||||
exit('{"code":-1,"msg":"当前支付宝已绑定商户ID:'.$uid.',请勿重复绑定!"}');
|
||||
}
|
||||
$session=md5($uid.$key.$password_hash);
|
||||
$expiretime=time()+604800;
|
||||
$token=authcode("{$uid}\t{$session}\t{$expiretime}", 'ENCODE', SYS_KEY);
|
||||
setcookie("user_token", $token, time() + 604800);
|
||||
$DB->exec("update `pre_user` set `lasttime` ='$date' where `uid`='$uid'");
|
||||
$result=array("code"=>0,"msg"=>"登录成功!正在跳转到用户中心","url"=>"./");
|
||||
}elseif($islogin2==1){
|
||||
$sds=$DB->exec("update `pre_user` set `alipay_uid`='$alipay_uid' where `uid`='$uid'");
|
||||
$result=array("code"=>0,"msg"=>"已成功绑定支付宝账号!","url"=>"./editinfo.php");
|
||||
}else{
|
||||
$_SESSION['Oauth_alipay_uid']=$alipay_uid;
|
||||
$result=array("code"=>0,"msg"=>"请输入商户ID和密钥完成绑定和登录","url"=>"./login.php?connect=true");
|
||||
}
|
||||
}else{
|
||||
$result=array("code"=>1);
|
||||
}
|
||||
exit(json_encode($result));
|
||||
}
|
||||
|
||||
$channel = \lib\Channel::get($conf['login_alipay']);
|
||||
if(!$channel)exit('{"code":-1,"msg":"当前支付通道信息不存在"}');
|
||||
define("PAY_ROOT", PLUGIN_ROOT.'alipay/');
|
||||
require_once(PAY_ROOT."inc/AlipayOauthService.php");
|
||||
|
||||
if(isset($_GET['auth_code'])){
|
||||
|
||||
$oauth = new AlipayOauthService($config);
|
||||
$result = $oauth->getToken($_GET['auth_code']);
|
||||
|
||||
if($result['user_id']){
|
||||
|
||||
//支付宝用户号
|
||||
$user_id = daddslashes($result['user_id']);
|
||||
$_SESSION['alipay_uid'] = $user_id;
|
||||
|
||||
$userrow=$DB->getRow("SELECT * FROM pre_user WHERE alipay_uid='{$user_id}' limit 1");
|
||||
if($userrow){
|
||||
$uid=$userrow['uid'];
|
||||
$key=$userrow['key'];
|
||||
if($islogin2==1){
|
||||
@header('Content-Type: text/html; charset=UTF-8');
|
||||
exit("<script language='javascript'>alert('当前支付宝已绑定商户ID:{$uid},请勿重复绑定!');window.location.href='./editinfo.php';</script>");
|
||||
}
|
||||
$DB->exec("insert into `pre_log` (`uid`,`type`,`date`,`ip`,`city`) values ('".$uid."','支付宝快捷登录','".$date."','".$clientip."','".$city."')");
|
||||
$session=md5($uid.$key.$password_hash);
|
||||
$expiretime=time()+604800;
|
||||
$token=authcode("{$uid}\t{$session}\t{$expiretime}", 'ENCODE', SYS_KEY);
|
||||
setcookie("user_token", $token, time() + 604800);
|
||||
@header('Content-Type: text/html; charset=UTF-8');
|
||||
exit("<script language='javascript'>window.location.href='./';</script>");
|
||||
}elseif($islogin2==1){
|
||||
$sds=$DB->exec("update `pre_user` set `alipay_uid` ='$user_id' where `uid`='$uid'");
|
||||
@header('Content-Type: text/html; charset=UTF-8');
|
||||
exit("<script language='javascript'>alert('已成功绑定支付宝账号!');window.location.href='./editinfo.php';</script>");
|
||||
}else{
|
||||
$_SESSION['Oauth_alipay_uid']=$user_id;
|
||||
exit("<script language='javascript'>alert('请输入商户ID和密钥完成绑定和登录');window.location.href='./login.php?connect=true';</script>");
|
||||
}
|
||||
}
|
||||
else {
|
||||
@header('Content-Type: text/html; charset=UTF-8');
|
||||
sysmsg('支付宝快捷登录失败!['.$result['sub_code'].']'.$result['sub_msg']);
|
||||
}
|
||||
|
||||
}elseif(isset($_GET['logout'])){
|
||||
setcookie("user_token", "", time() - 604800);
|
||||
@header('Content-Type: text/html; charset=UTF-8');
|
||||
exit("<script language='javascript'>alert('您已成功注销本次登陆!');window.location.href='./login.php';</script>");
|
||||
}elseif($islogin2==1 && isset($_GET['unbind'])){
|
||||
$DB->exec("update `pre_user` set `alipay_uid` =NULL where `uid`='$uid'");
|
||||
@header('Content-Type: text/html; charset=UTF-8');
|
||||
exit("<script language='javascript'>alert('您已成功解绑支付宝账号!');window.location.href='./editinfo.php';</script>");
|
||||
}elseif($islogin2==1 && !isset($_GET['bind'])){
|
||||
exit("<script language='javascript'>alert('您已登陆!');window.location.href='./';</script>");
|
||||
}elseif(checkmobile()==false || strpos($_SERVER['HTTP_USER_AGENT'], 'AlipayClient')){
|
||||
$oauth = new AlipayOauthService($config);
|
||||
$oauth->oauth();
|
||||
}else{
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>支付宝快捷登录 | <?php echo $conf['sitename']?></title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
|
||||
<link rel="stylesheet" href="//cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="//cdn.staticfile.org/animate.css/3.5.2/animate.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="//cdn.staticfile.org/font-awesome/4.7.0/css/font-awesome.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="//cdn.staticfile.org/simple-line-icons/2.4.1/css/simple-line-icons.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="./assets/css/font.css" type="text/css" />
|
||||
<link rel="stylesheet" href="./assets/css/app.css" type="text/css" />
|
||||
<style>input:-webkit-autofill{-webkit-box-shadow:0 0 0px 1000px white inset;-webkit-text-fill-color:#333;}img.logo{width:14px;height:14px;margin:0 5px 0 3px;}</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="app app-header-fixed ">
|
||||
<div class="container w-xxl w-auto-xs" ng-controller="SigninFormController" ng-init="app.settings.container = false;">
|
||||
<span class="navbar-brand block m-t" id="sitename"><?php echo $conf['sitename']?></span>
|
||||
<div class="m-b-lg">
|
||||
<div class="wrapper text-center">
|
||||
支付宝快捷登录
|
||||
</div>
|
||||
<form name="form" class="form-validation">
|
||||
<div class="text-center">
|
||||
<button type="button" class="btn btn-lg btn-primary btn-block" onclick="jump()" ng-disabled='form.$invalid'>跳转到支付宝</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<p>
|
||||
<small class="text-muted"><a href="/"><?php echo $conf['sitename']?></a><br>© 2016~2020</small>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="//cdn.staticfile.org/jquery/3.3.1/jquery.min.js"></script>
|
||||
<script src="//cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
|
||||
<script>
|
||||
function jump(){
|
||||
var url = window.location.href;
|
||||
window.location.href='alipays://platformapi/startapp?saId=10000007&clientVersion=3.7.0.0718&qrcode='+encodeURIComponent(url);
|
||||
}
|
||||
$(document).ready(function(){
|
||||
jump();
|
||||
setTimeout('checkopenid()', 2000);
|
||||
});
|
||||
function checkopenid(){
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
url: "oauth.php?act=login",
|
||||
success: function (data, textStatus) {
|
||||
if (data.code == 0) {
|
||||
layer.msg(data.msg, {icon: 16,time: 10000,shade:[0.3, "#000"]});
|
||||
setTimeout(function(){ window.location.href=data.url }, 1000);
|
||||
}else if (data.code == 1) {
|
||||
setTimeout('checkopenid()', 2000);
|
||||
}else{
|
||||
layer.alert(data.msg);
|
||||
}
|
||||
},
|
||||
error: function (data) {
|
||||
layer.msg('服务器错误', {icon: 2});
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
}
|
||||
124
user/onecode.php
Normal file
@@ -0,0 +1,124 @@
|
||||
<?php
|
||||
include("../includes/common.php");
|
||||
if($islogin2==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
$title='一码支付';
|
||||
include './head.php';
|
||||
?>
|
||||
<?php
|
||||
if(!$conf['onecode'])exit('未开启一码支付');
|
||||
|
||||
$merchant = authcode($uid, 'ENCODE', SYS_KEY);
|
||||
$code_url = $siteurl.'paypage/?merchant='.urlencode($merchant);
|
||||
if(isset($_SESSION['onecode_url'])){
|
||||
$code_url = $_SESSION['onecode_url'];
|
||||
}else{
|
||||
$code_url = getdwz($code_url);
|
||||
if($code_url){
|
||||
$_SESSION['onecode_url'] = $code_url;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div id="content" class="app-content" role="main">
|
||||
<div class="app-content-body ">
|
||||
|
||||
<div class="bg-light lter b-b wrapper-md hidden-print">
|
||||
<h1 class="m-n font-thin h3">一码支付</h1>
|
||||
</div>
|
||||
<div class="wrapper-md control">
|
||||
<?php if(isset($msg)){?>
|
||||
<div class="alert alert-info">
|
||||
<?php echo $msg?>
|
||||
</div>
|
||||
<?php }?>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading font-bold">
|
||||
<i class="fa fa-list"></i> 产品介绍
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<p>一码支付是基于一个收款二维码,支持支付宝、微信、QQ等主流支付方式的收款产品。</p>
|
||||
<p>商家只需要一个固定的二维码,就可以完成支付宝、微信、QQ等主流支付方式的收款,方便快捷。</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading font-bold">
|
||||
<i class="fa fa-qrcode"></i> 一码支付配置
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<form class="form-horizontal devform">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">收款方名称</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="codename" value="<?php echo $userrow['codename']?>" placeholder="留空默认显示“<?php echo $userrow['username']?>”" onkeydown="if(event.keyCode==13){$('#editName').click()}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-3 col-sm-8"><input type="button" id="editName" value="保存" class="btn btn-primary form-control"/><br/>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading font-bold">
|
||||
<i class="fa fa-qrcode"></i> 你的一码支付收款链接
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<p>你可以将收款链接发到QQ、微信等聊天工具,别人点击后可以直接输入金额付款。</p>
|
||||
<div class="form-group">
|
||||
<input class="form-control" type="text" id="code_url" value="<?php echo $code_url?>" readonly>
|
||||
</div>
|
||||
<p class="text-center"><a href="javascript:;" class="btn btn-success copy-btn" data-clipboard-text="<?php echo $code_url?>" title="点击复制">点击复制</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading font-bold">
|
||||
<i class="fa fa-qrcode"></i> 你的一码支付收款码
|
||||
</div>
|
||||
<div class="panel-body text-center">
|
||||
<input type="hidden" id="recName" value="<?php echo $userrow['codename']?$userrow['codename']:$userrow['username']?>">
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">选择收款码风格</span>
|
||||
<select class="form-control" id="styleName">
|
||||
<option value="dongxue">风格1-冬雪</option>
|
||||
<option value="pikaqiu">风格2-皮卡丘</option>
|
||||
<option value="kanuobudingmao">风格3-布叮猫</option>
|
||||
<option value="niannianyouyu">风格4-年年有余</option>
|
||||
<option value="xiaohuangren">风格5-小黄人</option>
|
||||
<option value="qitao">风格6-乞讨</option>
|
||||
<option value="baobei">风格7-宝贝</option>
|
||||
<option value="toushi">风格8-投食</option>
|
||||
<option value="gongzhu">风格9-公主</option>
|
||||
<option value="qiuzanzhu">风格10-求赞助</option>
|
||||
<option value="huanyingdashang">风格11-欢迎打赏</option>
|
||||
<option value="yinlian">风格12-银联</option>
|
||||
<option value="yitiji">风格13-一体机</option>
|
||||
<option value="maomi">风格14-猫咪</option>
|
||||
<option value="longmao">风格15-龙猫</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div id="load"><img src="/assets/img/loading.gif"> 正在生成中</div>
|
||||
<div id="qrcode" style="display:none;"><img class="img-responsive center-block" alt="收款码" id="endImg" style="max-width: 300px;"/><br/><a href="javascript:;" id="downImg" class="btn btn-success btn-sm">长按图片或点我保存</a></div>
|
||||
<div class="hide">
|
||||
<div id="code"></div>
|
||||
<canvas id="canvas"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include 'foot.php';?>
|
||||
<script src="../assets/layer/layer.js"></script>
|
||||
<script src="//cdn.staticfile.org/clipboard.js/1.7.1/clipboard.min.js"></script>
|
||||
<script src="//cdn.staticfile.org/jquery.qrcode/1.0/jquery.qrcode.min.js"></script>
|
||||
<script src="//cdn.staticfile.org/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
|
||||
<script src="./assets/js/onecode.js"></script>
|
||||
61
user/openid.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
$nosession=true;
|
||||
include("../includes/common.php");
|
||||
if(isset($_GET['sid'])){
|
||||
$sid = trim(daddslashes($_GET['sid']));
|
||||
if(!preg_match('/^(.[a-zA-Z0-9]+)$/',$sid))exit("Access Denied");
|
||||
session_id($sid);
|
||||
}
|
||||
session_start();
|
||||
|
||||
@header('Content-Type: text/html; charset=UTF-8');
|
||||
|
||||
if(!$conf['login_wx'])sysmsg("未开启微信快捷登录");
|
||||
$channel = \lib\Channel::get($conf['login_wx']);
|
||||
if(!$channel)exit('{"code":-1,"msg":"当前支付通道信息不存在"}');
|
||||
define("PAY_ROOT", PLUGIN_ROOT.'wxpay/');
|
||||
|
||||
require_once PAY_ROOT."inc/WxPay.Api.php";
|
||||
require_once PAY_ROOT."inc/WxPay.JsApiPay.php";
|
||||
|
||||
$tools = new JsApiPay();
|
||||
$openId = $tools->GetOpenid();
|
||||
|
||||
if(!$openId)sysmsg('OpenId获取失败');
|
||||
|
||||
$_SESSION['openid'] = $openId;
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
|
||||
<title>获取OpenID</title>
|
||||
<link href="//cdn.bootcss.com/ionic/1.3.1/css/ionic.min.css" rel="stylesheet" />
|
||||
<style type="text/css">
|
||||
.qr-text {padding: 30px;margin: 5px 0;background-color: #FDFDCA;border-radius: 3px;border: 1px solid #EEEEEE;word-wrap: break-word;word-break: break-all;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="bar bar-header bar-light" align-title="center">
|
||||
<h1 class="title">提示信息</h1>
|
||||
</div>
|
||||
<div class="has-header" style="padding: 5px;position: absolute;width: 100%;">
|
||||
<div class="text-center" style="color: #a09ee5;">
|
||||
<i class="icon ion-checkmark-circled" style="font-size: 80px;"></i><br>
|
||||
<span>获取OpenId成功</span>
|
||||
</div>
|
||||
<div class="text-center" style="padding: 15px;">
|
||||
<span>如未自动填写,请手动复制下方OpenId:</span>
|
||||
<p class="qr-text"><strong><?php echo $openId?></strong></p>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
document.querySelector('body').addEventListener('touchmove', function (event) {
|
||||
event.preventDefault();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
116
user/order-table.php
Normal file
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
/**
|
||||
* 订单列表
|
||||
**/
|
||||
include("../includes/common.php");
|
||||
if($islogin2==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;
|
||||
}
|
||||
|
||||
$paytype = [];
|
||||
$paytypes = [];
|
||||
$rs = $DB->getAll("SELECT * FROM pre_type WHERE status=1");
|
||||
foreach($rs as $row){
|
||||
$paytype[$row['id']] = $row['showname'];
|
||||
$paytypes[$row['id']] = $row['name'];
|
||||
}
|
||||
unset($rs);
|
||||
|
||||
$sql=" uid=$uid";
|
||||
$links='';
|
||||
if(isset($_GET['paytype']) && $_GET['paytype']>0) {
|
||||
$paytype = intval($_GET['paytype']);
|
||||
$sql.=" AND A.`type`='$paytype'";
|
||||
$links.='&paytype='.$paytype;
|
||||
}
|
||||
if(isset($_GET['dstatus']) && $_GET['dstatus']==1) {
|
||||
$sql.=" AND A.status=1";
|
||||
$links.='&dstatus=1';
|
||||
}
|
||||
if(isset($_GET['kw']) && !empty($_GET['kw'])) {
|
||||
$kw=daddslashes($_GET['kw']);
|
||||
if($_GET['type']==1){
|
||||
$sql.=" AND A.`trade_no`='{$kw}'";
|
||||
}elseif($_GET['type']==2){
|
||||
$sql.=" AND A.`out_trade_no`='{$kw}'";
|
||||
}elseif($_GET['type']==3){
|
||||
$sql.=" AND A.`name` like '%{$kw}%'";
|
||||
}elseif($_GET['type']==4){
|
||||
$sql.=" AND A.`money`='{$kw}'";
|
||||
}elseif($_GET['type']==5){
|
||||
$kws = explode('>',$kw);
|
||||
$sql.=" AND A.`addtime`>='{$kws[0]}' AND A.`addtime`<='{$kws[1]}'";
|
||||
}
|
||||
$numrows=$DB->getColumn("SELECT count(*) from pre_order A WHERE{$sql}");
|
||||
$con='包含 '.$_GET['value'].' 的共有 <b>'.$numrows.'</b> 条订单';
|
||||
$link='&type='.$_GET['type'].'&kw='.$_GET['kw'].$links;
|
||||
}else{
|
||||
$numrows=$DB->getColumn("SELECT count(*) from pre_order A WHERE{$sql}");
|
||||
$con='共有 <b>'.$numrows.'</b> 条订单';
|
||||
$link=$links;
|
||||
}
|
||||
?>
|
||||
<div class="table-responsive">
|
||||
<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 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>'.$res['trade_no'].'<br/>'.$res['out_trade_no'].'</td><td>'.$res['name'].'</td><td>¥ <b>'.$res['money'].'</b></td><td> <b><img src="/assets/icon/'.$paytypes[$res['type']].'.ico" width="16" onerror="this.style.display=\'none\'">'.$paytype[$res['type']].'</b></td><td>'.$res['addtime'].'<br/>'.$res['endtime'].'</td><td>'.display_status($res['status'], $res['notify']).'</td><td><a href="./record.php?type=3&kw='.$res['trade_no'].'" class="btn btn-info btn-xs">明细</a> <a href="javascript:callnotify(\''.$res['trade_no'].'\')" class="btn btn-success btn-xs">补单</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>';
|
||||
177
user/order.php
Normal file
@@ -0,0 +1,177 @@
|
||||
<?php
|
||||
include("../includes/common.php");
|
||||
if($islogin2==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
$title='订单记录';
|
||||
include './head.php';
|
||||
?>
|
||||
<?php
|
||||
|
||||
$type_select = '<option value="0">所有支付方式</option>';
|
||||
$rs = $DB->getAll("SELECT * FROM pre_type WHERE status=1");
|
||||
foreach($rs as $row){
|
||||
$type_select .= '<option value="'.$row['id'].'">'.$row['showname'].'</option>';
|
||||
}
|
||||
unset($rs);
|
||||
|
||||
?>
|
||||
<div id="content" class="app-content" role="main">
|
||||
<div class="app-content-body ">
|
||||
|
||||
<div class="bg-light lter b-b wrapper-md hidden-print">
|
||||
<h1 class="m-n font-thin h3">订单记录</h1>
|
||||
</div>
|
||||
<div class="wrapper-md control">
|
||||
<?php if(isset($msg)){?>
|
||||
<div class="alert alert-info">
|
||||
<?php echo $msg?>
|
||||
</div>
|
||||
<?php }?>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading font-bold">
|
||||
<h3 class="panel-title">订单记录<a href="javascript:searchClear()" class="btn btn-default btn-xs pull-right" title="刷新订单列表"><i class="fa fa-refresh"></i></a></h3>
|
||||
</div>
|
||||
<div class="row wrapper">
|
||||
<form onsubmit="return searchOrder()" method="GET" class="form">
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<select class="form-control" name="type">
|
||||
<option value="1">系统订单号</option>
|
||||
<option value="2">商户订单号</option>
|
||||
<option value="3">商品名称</option>
|
||||
<option value="4">商品金额</option>
|
||||
<option value="5">交易时间</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group" id="searchword">
|
||||
<input type="text" class="form-control" name="kw" placeholder="搜索内容,时间支持区间查询 例如2018-06-07 16:15>2018-07-06 14:00">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<select name="paytype" class="form-control" default="<?php echo $_GET['type']?$_GET['type']:0?>"><?php echo $type_select?></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<button class="btn btn-default" type="submit">搜索</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div id="listTable"></div>
|
||||
</div>
|
||||
<?php if($DB->getRow("SHOW TABLES LIKE 'pay_order_old'")){echo '<a href="./order_old.php" class="btn btn-default btn-xs">历史订单查询</a>';}?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include 'foot.php';?>
|
||||
<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 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 searchOrder(){
|
||||
var type=$("select[name='type']").val();
|
||||
var kw=$("input[name='kw']").val();
|
||||
var paytype=$("select[name='paytype']").val();
|
||||
if(kw==''){
|
||||
listTable('paytype='+paytype);
|
||||
}else{
|
||||
listTable('type='+type+'&kw='+kw+'&paytype='+paytype);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function searchClear(){
|
||||
$("select[name='type']").val(1);
|
||||
$("input[name='kw']").val('');
|
||||
$("select[name='paytype']").val(0);
|
||||
listTable('start');
|
||||
}
|
||||
function callnotify(trade_no){
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : 'ajax2.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 : 'ajax2.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;
|
||||
}
|
||||
$(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>
|
||||
147
user/order_old.php
Normal file
@@ -0,0 +1,147 @@
|
||||
<?php
|
||||
include("../includes/common.php");
|
||||
if($islogin2==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
$title='历史订单记录';
|
||||
include './head.php';
|
||||
?>
|
||||
<?php
|
||||
if(!$DB->getRow("SHOW TABLES LIKE 'pay_order_old'")){
|
||||
showmsg('历史订单表不存在');
|
||||
}
|
||||
function do_callback($data){
|
||||
global $DB,$userrow;
|
||||
if($data['status']>=1)$trade_status='TRADE_SUCCESS';
|
||||
else $trade_status='TRADE_FAIL';
|
||||
$array=array('pid'=>$data['pid'],'trade_no'=>$data['trade_no'],'out_trade_no'=>$data['out_trade_no'],'type'=>$data['type'],'name'=>$data['name'],'money'=>$data['money'],'trade_status'=>$trade_status);
|
||||
$arg=argSort(paraFilter($array));
|
||||
$prestr=createLinkstring($arg);
|
||||
$urlstr=createLinkstringUrlencode($arg);
|
||||
$sign=md5Sign($prestr, $userrow['key']);
|
||||
if(strpos($data['notify_url'],'?'))
|
||||
$url=$data['notify_url'].'&'.$urlstr.'&sign='.$sign.'&sign_type=MD5';
|
||||
else
|
||||
$url=$data['notify_url'].'?'.$urlstr.'&sign='.$sign.'&sign_type=MD5';
|
||||
return $url;
|
||||
}
|
||||
|
||||
if(!empty($_GET['type']) && !empty($_GET['kw'])) {
|
||||
$kw=daddslashes($_GET['kw']);
|
||||
if($_GET['type']==1)$sql=" and trade_no='$kw'";
|
||||
elseif($_GET['type']==2)$sql=" and out_trade_no='$kw'";
|
||||
elseif($_GET['type']==3)$sql=" and name='$kw'";
|
||||
elseif($_GET['type']==4)$sql=" and money='$kw'";
|
||||
elseif($_GET['type']==5)$sql=" and type='$kw'";
|
||||
else $sql="";
|
||||
$link='&type='.$_GET['type'].'&kw='.$_GET['kw'];
|
||||
}else{
|
||||
$sql="";
|
||||
$link='';
|
||||
}
|
||||
$numrows=$DB->getColumn("SELECT count(*) from pay_order_old WHERE pid={$pid}{$sql}");
|
||||
$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);
|
||||
|
||||
$list=$DB->getAll("SELECT * FROM pay_order_old WHERE pid={$pid}{$sql} order by trade_no desc limit $offset,$pagesize");
|
||||
|
||||
?>
|
||||
<div id="content" class="app-content" role="main">
|
||||
<div class="app-content-body ">
|
||||
|
||||
<div class="bg-light lter b-b wrapper-md hidden-print">
|
||||
<h1 class="m-n font-thin h3">历史订单记录</h1>
|
||||
</div>
|
||||
<div class="wrapper-md control">
|
||||
<?php if(isset($msg)){?>
|
||||
<div class="alert alert-info">
|
||||
<?php echo $msg?>
|
||||
</div>
|
||||
<?php }?>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading font-bold">
|
||||
订单记录 (<?php echo $numrows?>)
|
||||
</div>
|
||||
<div class="row wrapper">
|
||||
<div class="col-sm-5 m-b-xs">
|
||||
<form action="order_old.php" method="GET" class="form-inline">
|
||||
<div class="form-group">
|
||||
<select class="input-sm form-control" name="type">
|
||||
<option value="1">交易号</option>
|
||||
<option value="2">商户订单号</option>
|
||||
<option value="3">商品名称</option>
|
||||
<option value="4">商品金额</option>
|
||||
<option value="5">支付方式</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="text" class="input-sm form-control" name="kw" placeholder="搜索内容">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button class="btn btn-sm btn-default" type="submit">搜索</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead><tr><th>交易号/商户订单号</th><th>商品名称</th><th>商品金额</th><th>支付方式</th><th>创建时间/完成时间</th><th>状态</th><th>操作</th></tr></thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach($list as $res){
|
||||
echo '<tr><td>'.$res['trade_no'].'<br/>'.$res['out_trade_no'].'</td><td>'.$res['name'].'</td><td>¥ <b>'.$res['money'].'</b></td><td> <b>'.$res['type'].'</b></td><td>'.$res['addtime'].'<br/>'.$res['endtime'].'</td><td>'.($res['status']==1?'<font color=green>已完成</font>':'<font color=red>未完成</font>').'</td><td><a href="'.do_callback($res).'" target="_blank" rel="noreferrer">重新通知</a></td></tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<footer class="panel-footer">
|
||||
<?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)$pages=10;
|
||||
for ($i=$page+1;$i<=$pages;$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>';
|
||||
#分页
|
||||
?>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include 'foot.php';?>
|
||||
111
user/qrlogin.php
Normal file
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
error_reporting(0);
|
||||
|
||||
session_start();
|
||||
header('Content-type: application/json');
|
||||
class qq_qrlogin{
|
||||
public function getqrpic(){
|
||||
$url='https://ssl.ptlogin2.qq.com/ptqrshow?appid=549000912&e=2&l=M&s=5&d=72&v=4&t=0.5409099'.time().'&daid=5';
|
||||
$arr=$this->get_curl($url,0,0,0,1,0,0,1);
|
||||
preg_match('/qrsig=(.*?);/',$arr['header'],$match);
|
||||
if($qrsig=$match[1])
|
||||
return array('saveOK'=>0,'qrsig'=>$qrsig,'data'=>base64_encode($arr['body']));
|
||||
else
|
||||
return array('saveOK'=>1,'msg'=>'二维码获取失败');
|
||||
}
|
||||
public function qrlogin($qrsig){
|
||||
if(empty($qrsig))return array('saveOK'=>-1,'msg'=>'qrsig不能为空');
|
||||
$url='https://ssl.ptlogin2.qq.com/ptqrlogin?u1=https%3A%2F%2Fqzs.qq.com%2Fqzone%2Fv5%2Floginsucc.html%3Fpara%3Dizone&ptqrtoken='.$this->getqrtoken($qrsig).'&ptredirect=0&h=1&t=1&g=1&from_ui=1&ptlang=2052&action=0-0-'.time().'0000&js_ver=10194&js_type=1&login_sig='.$sig.'&pt_uistyle=40&aid=549000912&daid=5&';
|
||||
$ret = $this->get_curl($url,0,$url,'qrsig='.$qrsig.'; ',1);
|
||||
if(preg_match("/ptuiCB\('(.*?)'\)/", $ret, $arr)){
|
||||
$r=explode("','",str_replace("', '","','",$arr[1]));
|
||||
if($r[0]==0){
|
||||
preg_match('/uin=(\d+)&/',$ret,$uin);
|
||||
$uin=$uin[1];
|
||||
preg_match('/skey=@(.{9});/',$ret,$skey);
|
||||
if($uin && $skey[1]){
|
||||
$_SESSION['findpwd_qq']=$uin;
|
||||
return array('saveOK'=>0,'uin'=>$uin,'nickname'=>$r[5]);
|
||||
}else{
|
||||
return array('saveOK'=>4,'msg'=>'QQ验证未通过!');
|
||||
}
|
||||
}elseif($r[0]==65){
|
||||
return array('saveOK'=>1,'msg'=>'二维码已失效。');
|
||||
}elseif($r[0]==66){
|
||||
return array('saveOK'=>2,'msg'=>'二维码未失效。');
|
||||
}elseif($r[0]==67){
|
||||
return array('saveOK'=>3,'msg'=>'正在验证二维码。');
|
||||
}else{
|
||||
return array('saveOK'=>6,'msg'=>$r[4]);
|
||||
}
|
||||
}else{
|
||||
return array('saveOK'=>6,'msg'=>$ret);
|
||||
}
|
||||
}
|
||||
private function getqrtoken($qrsig){
|
||||
$len = strlen($qrsig);
|
||||
$hash = 0;
|
||||
for($i = 0; $i < $len; $i++){
|
||||
$hash += (($hash << 5) & 2147483647) + ord($qrsig[$i]) & 2147483647;
|
||||
$hash &= 2147483647;
|
||||
}
|
||||
return $hash & 2147483647;
|
||||
}
|
||||
private function get_curl($url,$post=0,$referer=0,$cookie=0,$header=0,$ua=0,$nobaody=0,$split=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: application/json";
|
||||
$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){
|
||||
curl_setopt($ch, CURLOPT_REFERER, $referer);
|
||||
}
|
||||
if($ua){
|
||||
curl_setopt($ch, CURLOPT_USERAGENT,$ua);
|
||||
}else{
|
||||
curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36');
|
||||
}
|
||||
if($nobaody){
|
||||
curl_setopt($ch, CURLOPT_NOBODY,1);
|
||||
|
||||
}
|
||||
curl_setopt($ch, CURLOPT_ENCODING, "gzip");
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
|
||||
$ret = curl_exec($ch);
|
||||
if ($split) {
|
||||
$headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
|
||||
$header = substr($ret, 0, $headerSize);
|
||||
$body = substr($ret, $headerSize);
|
||||
$ret=array();
|
||||
$ret['header']=$header;
|
||||
$ret['body']=$body;
|
||||
}
|
||||
curl_close($ch);
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
||||
if(strpos($_SERVER['HTTP_REFERER'],$_SERVER['HTTP_HOST'])===false)exit('{"saveOK":-1}');
|
||||
|
||||
$login=new qq_qrlogin();
|
||||
if($_GET['do']=='qrlogin'){
|
||||
$array=$login->qrlogin($_GET['qrsig']);
|
||||
}
|
||||
if($_GET['do']=='getqrpic'){
|
||||
$array=$login->getqrpic();
|
||||
}
|
||||
echo json_encode($array);
|
||||
133
user/recharge.php
Normal file
@@ -0,0 +1,133 @@
|
||||
<?php
|
||||
include("../includes/common.php");
|
||||
if($islogin2==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
$title='余额充值';
|
||||
include './head.php';
|
||||
?>
|
||||
<?php
|
||||
$paytype = \lib\Channel::getTypes($userrow['gid']);
|
||||
$csrf_token = md5(mt_rand(0,999).time());
|
||||
$_SESSION['csrf_token'] = $csrf_token;
|
||||
?>
|
||||
<div id="content" class="app-content" role="main">
|
||||
<div class="app-content-body ">
|
||||
|
||||
<div class="bg-light lter b-b wrapper-md hidden-print">
|
||||
<h1 class="m-n font-thin h3">余额充值</h1>
|
||||
</div>
|
||||
<div class="wrapper-md control">
|
||||
<?php if(isset($msg)){?>
|
||||
<div class="alert alert-info">
|
||||
<?php echo $msg?>
|
||||
</div>
|
||||
<?php }?>
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-10 col-md-8 col-lg-6 center-block" style="float: none;">
|
||||
<?php if(isset($_GET['ok']) && $_GET['ok']==1){
|
||||
$order = $DB->getRow("SELECT * FROM pre_order WHERE trade_no=:trade_no limit 1", [':trade_no'=>$_GET['trade_no']]);
|
||||
?>
|
||||
<div class="alert alert-success alert-dismissible" role="alert">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
恭喜你成功充值<strong><?php echo $order['money']?></strong>元余额!
|
||||
</div>
|
||||
<?php }?>
|
||||
<div class="alert alert-info text-md">
|
||||
<p>充值手续费按当前商户通道费率收取,支付没到账请联系客服进行补单。</p><p>充值的余额仅限用于平台消费或订单退款资金,严禁频繁大额充值后提现,否则封禁商户并冻结余额!</p>
|
||||
</div>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading font-bold">
|
||||
<i class="fa fa-cny"></i> 余额充值
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<form class="form-horizontal devform">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo $csrf_token?>">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">当前余额</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="rmoney" value="<?php echo $userrow['money']?> 元" readonly="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">充值金额</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="money" value="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">支付方式</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="radio">
|
||||
<?php foreach($paytype as $row){?>
|
||||
<label class="i-checks"><input type="radio" name="type" value="<?php echo $row['id']?>" rate="<?php echo $row['rate']?>"><i></i><?php echo $row['showname']?>
|
||||
</label>
|
||||
<?php }?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">共需支付</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="need" value="" readonly="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-3 col-sm-8"><input type="button" id="submit" value="充值" class="btn btn-success form-control"/><br/>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include 'foot.php';?>
|
||||
<script src="../assets/layer/layer.js"></script>
|
||||
<script>
|
||||
function showneed(){
|
||||
var money = parseFloat($("input[name='money']").val());
|
||||
var rate = parseFloat($("input[name=type]:checked").attr('rate'));
|
||||
if(isNaN(money) || isNaN(rate))return;
|
||||
var need = (money + money * (1-rate/100)).toFixed(2);
|
||||
$("input[name='need']").val(need)
|
||||
}
|
||||
$(document).ready(function(){
|
||||
$("input[name=type]:first").attr("checked",true);
|
||||
$("input[name='money']").blur(function(){
|
||||
showneed()
|
||||
});
|
||||
$("input[name='type']").click(function(){
|
||||
showneed()
|
||||
});
|
||||
$("#submit").click(function(){
|
||||
var csrf_token=$("input[name='csrf_token']").val();
|
||||
var money=$("input[name='money']").val();
|
||||
var typeid=$("input[name=type]:checked").val();
|
||||
if(money==''){
|
||||
layer.alert("金额不能为空");
|
||||
return false;
|
||||
}
|
||||
var ii = layer.load();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
data: {money:money, typeid:typeid, csrf_token:csrf_token},
|
||||
url: "ajax2.php?act=recharge",
|
||||
success: function (data, textStatus) {
|
||||
layer.close(ii);
|
||||
if (data.code == 0) {
|
||||
window.location.href=data.url;
|
||||
}else{
|
||||
layer.alert(data.msg, {icon: 2});
|
||||
}
|
||||
},
|
||||
error: function (data) {
|
||||
layer.msg('服务器错误', {icon: 2});
|
||||
}
|
||||
});
|
||||
return false;
|
||||
})
|
||||
});
|
||||
</script>
|
||||
75
user/record-table.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/**
|
||||
* 资金明细
|
||||
**/
|
||||
include("../includes/common.php");
|
||||
if($islogin2==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
|
||||
|
||||
$sql=" uid=$uid";
|
||||
if(isset($_GET['kw']) && !empty($_GET['kw'])) {
|
||||
$kw=daddslashes($_GET['kw']);
|
||||
if($_GET['type']==1){
|
||||
$sql.=" AND `type`='{$kw}'";
|
||||
}elseif($_GET['type']==2){
|
||||
$sql.=" AND `money`='{$kw}'";
|
||||
}elseif($_GET['type']==3){
|
||||
$sql.=" AND `trade_no`='{$kw}'";
|
||||
}
|
||||
$numrows=$DB->getColumn("SELECT count(*) from pre_record A WHERE{$sql}");
|
||||
$con='包含 '.$_GET['value'].' 的共有 <b>'.$numrows.'</b> 条记录';
|
||||
$link='&type='.$_GET['type'].'&kw='.$_GET['kw'];
|
||||
}else{
|
||||
$numrows=$DB->getColumn("SELECT count(*) from pre_record A WHERE{$sql}");
|
||||
$con='共有 <b>'.$numrows.'</b> 条记录';
|
||||
}
|
||||
?>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-bordered table-vcenter">
|
||||
<thead><tr><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>'.($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?type=1&kw='.$res['trade_no'].'">'.$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>';
|
||||
97
user/record.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
include("../includes/common.php");
|
||||
if($islogin2==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
$title='资金明细';
|
||||
include './head.php';
|
||||
?>
|
||||
<div id="content" class="app-content" role="main">
|
||||
<div class="app-content-body ">
|
||||
|
||||
<div class="bg-light lter b-b wrapper-md hidden-print">
|
||||
<h1 class="m-n font-thin h3">资金明细</h1>
|
||||
</div>
|
||||
<div class="wrapper-md control">
|
||||
<?php if(isset($msg)){?>
|
||||
<div class="alert alert-info">
|
||||
<?php echo $msg?>
|
||||
</div>
|
||||
<?php }?>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading font-bold">
|
||||
<h3 class="panel-title">资金明细<a href="javascript:listTable('start')" class="btn btn-default btn-xs pull-right" title="刷新明细列表"><i class="fa fa-refresh"></i></a></h3>
|
||||
</div>
|
||||
<div class="row wrapper">
|
||||
<form onsubmit="return searchOrder()" method="GET" class="form">
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<select class="form-control" name="type">
|
||||
<option value="1">操作类型</option>
|
||||
<option value="2">变更金额</option>
|
||||
<option value="3">关联订单号</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group" id="searchword">
|
||||
<input type="text" class="form-control" name="kw" placeholder="搜索内容">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<button class="btn btn-default" type="submit">搜索</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div id="listTable"></div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include 'foot.php';?>
|
||||
<a style="display: none;" href="" id="vurl" rel="noreferrer" target="_blank"></a>
|
||||
<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 searchOrder(){
|
||||
var type=$("select[name='type']").val();
|
||||
var kw=$("input[name='kw']").val();
|
||||
if(kw==''){
|
||||
listTable();
|
||||
}else{
|
||||
listTable('type='+type+'&kw='+kw);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
$(document).ready(function(){
|
||||
listTable();
|
||||
})
|
||||
</script>
|
||||
246
user/reg.php
Normal file
@@ -0,0 +1,246 @@
|
||||
<?php
|
||||
$is_defend=true;
|
||||
include("../includes/common.php");
|
||||
if(isset($_GET['regok'])){
|
||||
exit("<script language='javascript'>alert('恭喜你,商户注册成功!');window.location.href='./login.php';</script>");
|
||||
}
|
||||
if($islogin2==1){
|
||||
exit("<script language='javascript'>alert('您已登录!');window.location.href='./';</script>");
|
||||
}
|
||||
|
||||
if($conf['reg_open']==0)sysmsg('未开放商户申请');
|
||||
|
||||
$csrf_token = md5(mt_rand(0,999).time());
|
||||
$_SESSION['csrf_token'] = $csrf_token;
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>申请商户 | <?php echo $conf['sitename']?></title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
|
||||
<link rel="stylesheet" href="//cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="//cdn.staticfile.org/animate.css/3.5.2/animate.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="//cdn.staticfile.org/font-awesome/4.7.0/css/font-awesome.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="//cdn.staticfile.org/simple-line-icons/2.4.1/css/simple-line-icons.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="./assets/css/font.css" type="text/css" />
|
||||
<link rel="stylesheet" href="./assets/css/app.css" type="text/css" />
|
||||
<style>input:-webkit-autofill{-webkit-box-shadow:0 0 0px 1000px white inset;-webkit-text-fill-color:#333;}img.logo{width:14px;height:14px;margin:0 5px 0 3px;}</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="modal inmodal fade" id="myModal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">关闭</span>
|
||||
</button>
|
||||
<h4 class="modal-title">注册须知</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<?php echo $conf['zhuce']?>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="app app-header-fixed ">
|
||||
<div class="container w-xxl w-auto-xs" ng-controller="SigninFormController" ng-init="app.settings.container = false;">
|
||||
<span class="navbar-brand block m-t" id="sitename"><?php echo $conf['sitename']?></span>
|
||||
<div class="m-b-lg">
|
||||
<div class="wrapper text-center">
|
||||
<strong>自助申请商户</strong>
|
||||
</div>
|
||||
<form name="form" class="form-validation"><input type="hidden" name="csrf_token" value="<?php echo $csrf_token?>"><input type="hidden" name="verifytype" value="<?php echo $conf['verifytype']?>">
|
||||
<?php if($conf['reg_pay']){?><div class="wrapper">商户申请价格为:<b><?php echo $conf['reg_pay_price']?></b>元</div><?php }?>
|
||||
<div class="list-group list-group-sm swaplogin">
|
||||
<?php if($conf['verifytype']==1){?>
|
||||
<div class="list-group-item">
|
||||
<input type="text" name="phone" placeholder="手机号码(同时作为登录账号)" class="form-control no-border" required>
|
||||
</div>
|
||||
<div class="list-group-item">
|
||||
<div class="input-group">
|
||||
<input type="text" name="code" placeholder="短信验证码" class="form-control no-border" required>
|
||||
<a class="input-group-addon" id="sendcode">获取验证码</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php }else{?>
|
||||
<div class="list-group-item">
|
||||
<input type="email" name="email" placeholder="邮箱(同时作为登录账号)" class="form-control no-border" required>
|
||||
</div>
|
||||
<div class="list-group-item">
|
||||
<div class="input-group">
|
||||
<input type="text" name="code" placeholder="邮箱验证码" class="form-control no-border" required>
|
||||
<a class="input-group-addon" id="sendcode">获取验证码</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php }?>
|
||||
<div class="list-group-item">
|
||||
<input type="password" name="pwd" placeholder="请输入你的密码" class="form-control no-border" required>
|
||||
</div>
|
||||
<div class="list-group-item">
|
||||
<input type="password" name="pwd2" placeholder="请再次输入密码" class="form-control no-border" required>
|
||||
</div>
|
||||
<div class="checkbox m-b-md m-t-none">
|
||||
<label class="i-checks">
|
||||
<input type="checkbox" ng-model="agree" checked required><i></i> 同意<a href="../agreement.html" target="_blank">我们的条款</a>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" id="submit" class="btn btn-lg btn-primary btn-block" ng-click="login()" ng-disabled='form.$invalid'>立即注册</button>
|
||||
<a href="login.php" ui-sref="access.signup" class="btn btn-lg btn-default btn-block">返回登录</a>
|
||||
</form>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<p>
|
||||
<small class="text-muted"><a href="/"><?php echo $conf['sitename']?></a><br>© 2016~2020</small>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="//cdn.staticfile.org/jquery/3.3.1/jquery.min.js"></script>
|
||||
<script src="//cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
|
||||
<script src="//lib.baomitu.com/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
|
||||
<script src="../assets/layer/layer.js"></script>
|
||||
<script src="//static.geetest.com/static/tools/gt.js"></script>
|
||||
<script>
|
||||
function invokeSettime(obj){
|
||||
var countdown=60;
|
||||
settime(obj);
|
||||
function settime(obj) {
|
||||
if (countdown == 0) {
|
||||
$(obj).attr("data-lock", "false");
|
||||
$(obj).text("获取验证码");
|
||||
countdown = 60;
|
||||
return;
|
||||
} else {
|
||||
$(obj).attr("data-lock", "true");
|
||||
$(obj).attr("disabled",true);
|
||||
$(obj).text("(" + countdown + ") s 重新发送");
|
||||
countdown--;
|
||||
}
|
||||
setTimeout(function() {
|
||||
settime(obj) }
|
||||
,1000)
|
||||
}
|
||||
}
|
||||
var handlerEmbed = function (captchaObj) {
|
||||
var sendto;
|
||||
captchaObj.onReady(function () {
|
||||
$("#wait").hide();
|
||||
}).onSuccess(function () {
|
||||
var result = captchaObj.getValidate();
|
||||
if (!result) {
|
||||
return alert('请完成验证');
|
||||
}
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
url : "ajax.php?act=sendcode",
|
||||
data : {sendto:sendto,geetest_challenge:result.geetest_challenge,geetest_validate:result.geetest_validate,geetest_seccode:result.geetest_seccode},
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
new invokeSettime("#sendsms");
|
||||
layer.msg('发送成功,请注意查收!');
|
||||
}else{
|
||||
layer.alert(data.msg);
|
||||
captchaObj.reset();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
$('#sendcode').click(function () {
|
||||
if ($(this).attr("data-lock") === "true") return;
|
||||
if($("input[name='verifytype']").val()=='1'){
|
||||
sendto=$("input[name='phone']").val();
|
||||
if(sendto==''){layer.alert('手机号码不能为空!');return false;}
|
||||
if(sendto.length!=11){layer.alert('手机号码不正确!');return false;}
|
||||
}else{
|
||||
sendto=$("input[name='email']").val();
|
||||
if(sendto==''){layer.alert('邮箱不能为空!');return false;}
|
||||
var reg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
|
||||
if(!reg.test(sendto)){layer.alert('邮箱格式不正确!');return false;}
|
||||
}
|
||||
captchaObj.verify();
|
||||
});
|
||||
};
|
||||
$(document).ready(function(){
|
||||
$("#submit").click(function(){
|
||||
if ($(this).attr("data-lock") === "true") return;
|
||||
var email=$("input[name='email']").val();
|
||||
var phone=$("input[name='phone']").val();
|
||||
var code=$("input[name='code']").val();
|
||||
var pwd=$("input[name='pwd']").val();
|
||||
var pwd2=$("input[name='pwd2']").val();
|
||||
if(email=='' || phone=='' || code=='' || pwd=='' || pwd2==''){layer.alert('请确保各项不能为空!');return false;}
|
||||
if(pwd!=pwd2){layer.alert('两次输入密码不一致!');return false;}
|
||||
if($("input[name='verifytype']").val()=='1'){
|
||||
if(phone.length!=11){layer.alert('手机号码不正确!');return false;}
|
||||
}else{
|
||||
var reg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
|
||||
if(!reg.test(email)){layer.alert('邮箱格式不正确!');return false;}
|
||||
}
|
||||
var ii = layer.load();
|
||||
$(this).attr("data-lock", "true");
|
||||
var csrf_token=$("input[name='csrf_token']").val();
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
url : "ajax.php?act=reg",
|
||||
data : {email:email,phone:phone,code:code,pwd:pwd,csrf_token:csrf_token},
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
$("#submit").attr("data-lock", "false");
|
||||
layer.close(ii);
|
||||
if(data.code == 1){
|
||||
layer.alert('恭喜你,商户申请成功!', {icon: 1}, function(){
|
||||
window.location.href="./login.php";
|
||||
});
|
||||
}else if(data.code == 2){
|
||||
var paymsg = '';
|
||||
$.each(data.paytype, function(key, value) {
|
||||
paymsg+='<button class="btn btn-default btn-block" onclick="window.location.href=\'../submit2.php?typeid='+key+'&trade_no='+data.trade_no+'\'" style="margin-top:10px;"><img width="20" src="../assets/icon/'+value.name+'.ico" class="logo">'+value.showname+'</button>';
|
||||
});
|
||||
layer.alert('<center><h2>¥ '+data.need+'</h2><hr>'+paymsg+'<hr>提示:支付完成后即可直接登录</center>',{
|
||||
btn:[],
|
||||
title:'支付确认页面',
|
||||
closeBtn: false
|
||||
});
|
||||
}else{
|
||||
layer.alert(data.msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
$.ajax({
|
||||
// 获取id,challenge,success(是否启用failback)
|
||||
url: "ajax.php?act=captcha&t=" + (new Date()).getTime(), // 加随机数防止缓存
|
||||
type: "get",
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
console.log(data);
|
||||
// 使用initGeetest接口
|
||||
// 参数1:配置参数
|
||||
// 参数2:回调,回调的第一个参数验证码对象,之后可以使用它做appendTo之类的事件
|
||||
initGeetest({
|
||||
width: '100%',
|
||||
gt: data.gt,
|
||||
challenge: data.challenge,
|
||||
new_captcha: data.new_captcha,
|
||||
product: "bind", // 产品形式,包括:float,embed,popup。注意只对PC版验证码有效
|
||||
offline: !data.success // 表示用户后台检测极验服务器是否宕机,一般不需要关注
|
||||
// 更多配置参数请参见:http://www.geetest.com/install/sections/idx-client-sdk.html#config
|
||||
}, handlerEmbed);
|
||||
}
|
||||
});
|
||||
<?php if(!empty($conf['zhuce'])){?>
|
||||
$('#myModal').modal('show');
|
||||
<?php }?>
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
134
user/settle.php
Normal file
@@ -0,0 +1,134 @@
|
||||
<?php
|
||||
include("../includes/common.php");
|
||||
if($islogin2==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
$title='结算记录';
|
||||
include './head.php';
|
||||
?>
|
||||
<?php
|
||||
|
||||
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:showResult('.$id.')" title="点此查看失败原因"><font color=red>结算失败</font></a>';
|
||||
else
|
||||
return '<font color=blue>待结算</font>';
|
||||
}
|
||||
|
||||
$numrows=$DB->query("SELECT * from pre_settle WHERE uid={$uid}")->rowCount();
|
||||
$pagesize=20;
|
||||
$pages=ceil($numrows/$pagesize);
|
||||
$page=isset($_GET['page'])?intval($_GET['page']):1;
|
||||
$offset=$pagesize*($page - 1);
|
||||
|
||||
$list=$DB->query("SELECT * FROM pre_settle WHERE uid={$uid} order by id desc limit $offset,$pagesize")->fetchAll();
|
||||
|
||||
?>
|
||||
<div id="content" class="app-content" role="main">
|
||||
<div class="app-content-body ">
|
||||
|
||||
<div class="bg-light lter b-b wrapper-md hidden-print">
|
||||
<h1 class="m-n font-thin h3">结算记录</h1>
|
||||
</div>
|
||||
<div class="wrapper-md control">
|
||||
<?php if(isset($msg)){?>
|
||||
<div class="alert alert-info">
|
||||
<?php echo $msg?>
|
||||
</div>
|
||||
<?php }?>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading font-bold">
|
||||
结算记录 (<?php echo $numrows?>)
|
||||
</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>'.$res['id'].'</td><td>'.display_type($res['type']).($res['auto']!=1?'<small>[手动]</small>':null).'</td><td>'.$res['account'].'</td><td>¥ <b>'.$res['money'].'</b></td><td>¥ <b>'.$res['realmoney'].'</b></td><td>'.$res['addtime'].'</td><td>'.display_status($res['status'],$res['id']).'</td></tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<footer class="panel-footer">
|
||||
<?php
|
||||
echo'<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>';
|
||||
}
|
||||
$start=$page-10>1?$page-10:1;
|
||||
$end=$page+10<$pages?$page+10:$pages;
|
||||
for ($i=$start;$i<$page;$i++)
|
||||
echo '<li><a href="settle.php?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="settle.php?page='.$i.$link.'">'.$i .'</a></li>';
|
||||
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>';
|
||||
#分页
|
||||
?>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include 'foot.php';?>
|
||||
|
||||
<script src="//cdn.staticfile.org/layer/2.3/layer.js"></script>
|
||||
<script>
|
||||
function showResult(id) {
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : 'GET',
|
||||
url : 'ajax2.php?act=settle_result&id='+id,
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 0){
|
||||
layer.alert(data.msg, {icon:0, title:'失败原因'});
|
||||
}else{
|
||||
layer.alert(data.msg, {icon:2});
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
109
user/test.php
Normal file
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
$is_defend=true;
|
||||
include("../includes/common.php");
|
||||
if(!$conf['test_open'])sysmsg("未开启测试支付");
|
||||
if(isset($_GET['ok']) && isset($_GET['trade_no'])){
|
||||
$trade_no=daddslashes($_GET['trade_no']);
|
||||
$row=$DB->getRow("SELECT * FROM pre_order WHERE trade_no='{$trade_no}' AND uid='{$conf['test_pay_uid']}' limit 1");
|
||||
if(!$row)sysmsg('订单号不存在');
|
||||
if($row['status']!=1)sysmsg('订单未完成支付');
|
||||
$money = $row['money'];
|
||||
}else{
|
||||
$trade_no=date("YmdHis").rand(111,999);
|
||||
$gid = $DB->getColumn("SELECT gid FROM pre_user WHERE uid='{$conf['test_pay_uid']}' limit 1");
|
||||
$paytype = \lib\Channel::getTypes($gid);
|
||||
$csrf_token = md5(mt_rand(0,999).time());
|
||||
$_SESSION['csrf_token'] = $csrf_token;
|
||||
$money = 1;
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<body>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
|
||||
<title><?php echo $conf['sitename']?> - 测试支付</title>
|
||||
<link href="//cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
|
||||
<link href="./assets/css/bootswatch.min.css" rel="stylesheet"/>
|
||||
</head>
|
||||
<div class="container">
|
||||
<div class="col-xs-12 col-sm-10 col-lg-8 center-block" style="float: none;">
|
||||
<div class="page-header">
|
||||
<h4><?php echo $conf['sitename']?> - 测试支付<a href="/" class="pull-right"><small>返回首页</small></a></h4>
|
||||
</div>
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-body">
|
||||
|
||||
<form name="alipayment">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo $csrf_token?>">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon"><span class="glyphicon glyphicon-barcode"></span></span>
|
||||
<input class="form-control" placeholder="商户订单号" value="<?php echo $trade_no?>" name="trade_no" type="text" disabled="">
|
||||
</div>
|
||||
<br>
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon"><span class="glyphicon glyphicon-shopping-cart"></span></span>
|
||||
<input class="form-control" placeholder="商品名称" value="支付测试" name="name" type="text" disabled="" >
|
||||
</div>
|
||||
<br>
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon"><span class="glyphicon glyphicon-yen"></span></span>
|
||||
<input class="form-control" placeholder="付款金额" value="<?php echo $money?>" name="money" type="text" <?php echo isset($_GET['ok'])?'disabled=""':'required=""'?>>
|
||||
</div>
|
||||
<br>
|
||||
<center>
|
||||
<?php if(isset($_GET['ok'])){?>
|
||||
<div class="alert alert-success"><i class="glyphicon glyphicon-ok-circle"></i> 订单已支付成功!</div>
|
||||
<?php }else{?>
|
||||
<div class="btn-group btn-group-justified" role="group" aria-label="...">
|
||||
<?php foreach($paytype as $rows){?>
|
||||
<div class="btn-group" role="group">
|
||||
<button type="button" name="type" value="<?php echo $rows['id']?>" class="btn btn-default" onclick="submitPay(this)"><img src="/assets/icon/<?php echo $rows['name']?>.ico" height="18"> <?php echo $rows['showname']?></button>
|
||||
</div>
|
||||
<?php }?>
|
||||
</div>
|
||||
<?php }?>
|
||||
</center>
|
||||
</form>
|
||||
</div>
|
||||
<div class="panel-footer text-center">
|
||||
<?php echo $conf['sitename']?> © 2020 All Rights Reserved.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="//cdn.staticfile.org/jquery/3.3.1/jquery.min.js"></script>
|
||||
<script src="//cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
|
||||
<script src="../assets/layer/layer.js"></script>
|
||||
<script>
|
||||
function submitPay(obj){
|
||||
var csrf_token=$("input[name='csrf_token']").val();
|
||||
var money=$("input[name='money']").val();
|
||||
var typeid=$(obj).val();
|
||||
if(money==''){
|
||||
layer.alert("金额不能为空");
|
||||
return false;
|
||||
}
|
||||
var ii = layer.load();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
data: {money:money, typeid:typeid, csrf_token:csrf_token},
|
||||
url: "ajax.php?act=testpay",
|
||||
success: function (data, textStatus) {
|
||||
layer.close(ii);
|
||||
if (data.code == 0) {
|
||||
window.location.href=data.url;
|
||||
}else{
|
||||
layer.alert(data.msg, {icon: 2});
|
||||
}
|
||||
},
|
||||
error: function (data) {
|
||||
layer.msg('服务器错误', {icon: 2});
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
168
user/userinfo.php
Normal file
@@ -0,0 +1,168 @@
|
||||
<?php
|
||||
include("../includes/common.php");
|
||||
if($islogin2==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
|
||||
$title='个人资料';
|
||||
include './head.php';
|
||||
?>
|
||||
<?php
|
||||
$mod=isset($_GET['mod'])?$_GET['mod']:'api';
|
||||
|
||||
if(strlen($userrow['phone'])==11){
|
||||
$userrow['phone']=substr($userrow['phone'],0,3).'****'.substr($userrow['phone'],7,10);
|
||||
}
|
||||
|
||||
?>
|
||||
<div id="content" class="app-content" role="main">
|
||||
<div class="app-content-body ">
|
||||
<div class="bg-light lter b-b wrapper-md hidden-print">
|
||||
<h1 class="m-n font-thin h3">个人资料</h1>
|
||||
</div>
|
||||
<div class="wrapper-md control">
|
||||
<?php if(isset($msg)){?>
|
||||
<div class="alert alert-info">
|
||||
<?php echo $msg?>
|
||||
</div>
|
||||
<?php }?>
|
||||
<div class="tab-container ng-isolate-scope">
|
||||
<ul class="nav nav-tabs">
|
||||
<li style="width: 25%;" align="center" class="<?php echo $mod=='api'?'active':null?>">
|
||||
<a href="userinfo.php?mod=api">API信息</a>
|
||||
</li>
|
||||
<li style="width: 25%;" align="center" class="<?php echo $mod=='info'?'active':null?>">
|
||||
<a href="editinfo.php">修改资料</a>
|
||||
</li>
|
||||
<li style="width: 25%;" align="center" class="<?php echo $mod=='account'?'active':null?>">
|
||||
<a href="userinfo.php?mod=account">修改密码</a>
|
||||
</li>
|
||||
<?php if($conf['cert_channel']){?>
|
||||
<li style="width: 25%;" align="center">
|
||||
<a href="certificate.php">实名认证</a>
|
||||
</li>
|
||||
<?php }?>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane ng-scope active">
|
||||
<?php if($mod=='api'){?>
|
||||
<form class="form-horizontal devform">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">接口地址</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="input-group"><input class="form-control" type="text" value="<?php echo $siteurl?>" readonly><div class="input-group-addon"><a href="javascript:;" class="copy-btn" data-clipboard-text="<?php echo $siteurl?>" title="点击复制"><i class="fa fa-copy"></i></a></div></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">商户ID</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="input-group"><input class="form-control" type="text" value="<?php echo $uid?>" readonly><div class="input-group-addon"><a href="javascript:;" class="copy-btn" data-clipboard-text="<?php echo $uid?>" title="点击复制"><i class="fa fa-copy"></i></a></div></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">商户密钥</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="input-group"><input class="form-control" type="text" value="<?php echo $userrow['key']?>" readonly><div class="input-group-addon"><a href="javascript:;" class="copy-btn" data-clipboard-text="<?php echo $userrow['key']?>" title="点击复制"><i class="fa fa-copy"></i></a></div></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="line line-dashed b-b line-lg pull-in"></div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-4"><a href="/doc.html" class="btn btn-sm btn-success" target="_blank">查看开发文档</a> <a href="javascript:resetKey()" class="btn btn-sm btn-danger">重置密钥</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<?php }elseif($mod=='account'){?>
|
||||
<form class="form-horizontal devform">
|
||||
<div class="form-group"><div class="col-sm-offset-2 col-sm-4"><h4>修改登录密码:</h4></div></div>
|
||||
<?php if(!empty($userrow['pwd'])){?>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">旧密码</label>
|
||||
<div class="col-sm-9">
|
||||
<input class="form-control" type="password" name="oldpwd" value="">
|
||||
</div>
|
||||
</div>
|
||||
<?php }?>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">新密码</label>
|
||||
<div class="col-sm-9">
|
||||
<input class="form-control" type="password" name="newpwd" value="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">重复密码</label>
|
||||
<div class="col-sm-9">
|
||||
<input class="form-control" type="password" name="newpwd2" value="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-4"><input type="button" id="changePwd" value="修改密码" class="btn btn-primary form-control"/><br/>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<?php }?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php include 'foot.php';?>
|
||||
<script src="../assets/layer/layer.js"></script>
|
||||
<script src="//cdn.staticfile.org/clipboard.js/1.7.1/clipboard.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
var clipboard = new Clipboard('.copy-btn');
|
||||
clipboard.on('success', function (e) {
|
||||
layer.msg('复制成功!', {icon: 1});
|
||||
});
|
||||
clipboard.on('error', function (e) {
|
||||
layer.msg('复制失败,请长按链接后手动复制', {icon: 2});
|
||||
});
|
||||
$("#changePwd").click(function(){
|
||||
var oldpwd=$("input[name='oldpwd']").val();
|
||||
var newpwd=$("input[name='newpwd']").val();
|
||||
var newpwd2=$("input[name='newpwd2']").val();
|
||||
if(oldpwd==''){layer.alert('旧密码不能为空');return false;}
|
||||
if(newpwd==''||newpwd2==''){layer.alert('新密码不能为空');return false;}
|
||||
if(newpwd!=newpwd2){layer.alert('两次输入密码不一致!');return false;}
|
||||
if(oldpwd==newpwd){layer.alert('旧密码和新密码相同!');return false;}
|
||||
var ii = layer.load(2, {shade:[0.1,'#fff']});
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
url : "ajax2.php?act=edit_pwd",
|
||||
data : {oldpwd:oldpwd,newpwd:newpwd,newpwd2:newpwd2},
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
layer.close(ii);
|
||||
if(data.code == 1){
|
||||
layer.alert(data.msg, {icon: 1}, function(){window.location.reload()});
|
||||
}else{
|
||||
layer.alert(data.msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
function resetKey(){
|
||||
var confirmobj = layer.confirm('是否确认重置对接密钥?重置后需要重新登录', {
|
||||
btn: ['确定','取消']
|
||||
}, function(){
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : 'ajax2.php?act=resetKey',
|
||||
data : 'submit=do',
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
if(data.code == 0){
|
||||
layer.alert('重置密钥成功!', {icon:1}, function(){window.location.reload()});
|
||||
}else{
|
||||
layer.alert(data.msg, {icon:2});
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
layer.msg('服务器错误');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}, function(){
|
||||
layer.close(confirmobj);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
192
user/wxlogin.php
Normal file
@@ -0,0 +1,192 @@
|
||||
<?php
|
||||
/**
|
||||
* 微信登录
|
||||
**/
|
||||
$is_defend=true;
|
||||
$nosession=true;
|
||||
include("../includes/common.php");
|
||||
if(!$conf['login_wx'])sysmsg("未开启微信快捷登录");
|
||||
|
||||
if(isset($_GET['sid'])){
|
||||
$sid = trim(daddslashes($_GET['sid']));
|
||||
if(!preg_match('/^(.[a-zA-Z0-9]+)$/',$sid))exit("Access Denied");
|
||||
session_id($sid);
|
||||
}
|
||||
session_start();
|
||||
|
||||
if(isset($_GET['act']) && $_GET['act']=='login'){
|
||||
if(isset($_SESSION['openid']) && !empty($_SESSION['openid'])){
|
||||
$openId = daddslashes($_SESSION['openid']);
|
||||
$userrow=$DB->getRow("SELECT * FROM pre_user WHERE wxid='{$openId}' LIMIT 1");
|
||||
if($userrow){
|
||||
$uid=$userrow['uid'];
|
||||
$key=$userrow['key'];
|
||||
if($islogin2==1){
|
||||
exit('{"code":-1,"msg":"当前微信已绑定商户ID:'.$uid.',请勿重复绑定!"}');
|
||||
}
|
||||
$session=md5($uid.$key.$password_hash);
|
||||
$expiretime=time()+604800;
|
||||
$token=authcode("{$uid}\t{$session}\t{$expiretime}", 'ENCODE', SYS_KEY);
|
||||
setcookie("user_token", $token, time() + 604800);
|
||||
$DB->exec("update `pre_user` set `lasttime` ='$date' where `uid`='$uid'");
|
||||
$result=array("code"=>0,"msg"=>"登录成功!正在跳转到用户中心","url"=>"./");
|
||||
}elseif($islogin2==1){
|
||||
$sds=$DB->exec("update `pre_user` set `wxid` ='$openId' where `uid`='$uid'");
|
||||
$result=array("code"=>0,"msg"=>"已成功绑定微信账号!","url"=>"./editinfo.php");
|
||||
}else{
|
||||
$_SESSION['Oauth_wx_uid']=$openId;
|
||||
$result=array("code"=>0,"msg"=>"请输入商户ID和密钥完成绑定和登录","url"=>"./login.php?connect=true");
|
||||
}
|
||||
}else{
|
||||
$result=array("code"=>1);
|
||||
}
|
||||
exit(json_encode($result));
|
||||
}
|
||||
|
||||
if(!empty($conf['localurl_wxpay']) && !strpos($conf['localurl_wxpay'],$_SERVER['HTTP_HOST'])){
|
||||
$code_url = $conf['localurl_wxpay'].'user/wxlogin.php?sid='.session_id();
|
||||
}else{
|
||||
$code_url = $siteurl.'user/wxlogin.php?sid='.session_id();
|
||||
}
|
||||
if(isset($_GET['bind'])){
|
||||
$code_url .= '&bind=1';
|
||||
}
|
||||
|
||||
if($islogin2==1 && isset($_GET['unbind'])){
|
||||
$DB->exec("update `pre_user` set `wxid` =NULL where `uid`='$uid'");
|
||||
@header('Content-Type: text/html; charset=UTF-8');
|
||||
exit("<script language='javascript'>alert('您已成功解绑微信账号!');window.location.href='./editinfo.php';</script>");
|
||||
}elseif(strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger')!==false){
|
||||
|
||||
$redirect_url = isset($_GET['url'])?$_GET['url']:null;
|
||||
if($islogin2==1 && !isset($_GET['bind']) && !isset($_GET['code'])){
|
||||
exit("<script language='javascript'>window.location.href='./{$redirect_url}';</script>");
|
||||
}
|
||||
|
||||
if(!$conf['login_wx'])sysmsg("未开启微信快捷登录");
|
||||
$channel = \lib\Channel::get($conf['login_wx']);
|
||||
if(!$channel)exit('{"code":-1,"msg":"当前支付通道信息不存在"}');
|
||||
define("PAY_ROOT", PLUGIN_ROOT.'wxpay/');
|
||||
|
||||
require_once PAY_ROOT."inc/WxPay.Api.php";
|
||||
require_once PAY_ROOT."inc/WxPay.JsApiPay.php";
|
||||
|
||||
$tools = new JsApiPay();
|
||||
$openId = $tools->GetOpenid();
|
||||
|
||||
if(!$openId)sysmsg('OpenId获取失败');
|
||||
$_SESSION['openid'] = $openId;
|
||||
|
||||
$userrow=$DB->getRow("SELECT * FROM pre_user WHERE wxid='{$openId}' limit 1");
|
||||
if($userrow){
|
||||
$uid=$userrow['uid'];
|
||||
$key=$userrow['key'];
|
||||
$DB->exec("insert into `pre_log` (`uid`,`type`,`date`,`ip`,`city`) values ('".$uid."','微信快捷登录','".$date."','".$clientip."','".$city."')");
|
||||
$session=md5($uid.$key.$password_hash);
|
||||
$expiretime=time()+604800;
|
||||
$token=authcode("{$uid}\t{$session}\t{$expiretime}", 'ENCODE', SYS_KEY);
|
||||
setcookie("user_token", $token, time() + 604800);
|
||||
@header('Content-Type: text/html; charset=UTF-8');
|
||||
exit("<script language='javascript'>window.location.href='./{$redirect_url}';</script>");
|
||||
}elseif($islogin2==1){
|
||||
$sds=$DB->exec("update `pre_user` set `wxid` ='$openId' where `uid`='$uid'");
|
||||
@header('Content-Type: text/html; charset=UTF-8');
|
||||
exit("<script language='javascript'>alert('已成功绑定微信账号!');window.location.href='./editinfo.php';</script>");
|
||||
}else{
|
||||
$_SESSION['Oauth_wx_uid']=$openId;
|
||||
exit("<script language='javascript'>alert('请输入商户ID和密钥完成绑定和登录');window.location.href='./login.php?connect=true';</script>");
|
||||
}
|
||||
}elseif($islogin2==1 && !isset($_GET['bind'])){
|
||||
exit("<script language='javascript'>window.location.href='./';</script>");
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>微信登录 | <?php echo $conf['sitename']?></title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
|
||||
<link rel="stylesheet" href="//cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="//cdn.staticfile.org/animate.css/3.5.2/animate.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="//cdn.staticfile.org/font-awesome/4.7.0/css/font-awesome.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="//cdn.staticfile.org/simple-line-icons/2.4.1/css/simple-line-icons.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="./assets/css/font.css" type="text/css" />
|
||||
<link rel="stylesheet" href="./assets/css/app.css" type="text/css" />
|
||||
<style>input:-webkit-autofill{-webkit-box-shadow:0 0 0px 1000px white inset;-webkit-text-fill-color:#333;}img.logo{width:14px;height:14px;margin:0 5px 0 3px;}</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="app app-header-fixed ">
|
||||
<div class="container w-xxl w-auto-xs" ng-controller="SigninFormController" ng-init="app.settings.container = false;">
|
||||
<span class="navbar-brand block m-t" id="sitename"><?php echo $conf['sitename']?></span>
|
||||
<div class="m-b-lg">
|
||||
<div class="wrapper text-center">
|
||||
<strong>微信扫码登录</strong>
|
||||
</div>
|
||||
<form name="form" class="form-validation">
|
||||
<div class="text-danger wrapper text-center" ng-show="authError">
|
||||
</div>
|
||||
<div class="form-group" style="text-align: center;">
|
||||
<div class="list-group-item list-group-item-success" style="font-weight: bold;" id="login">
|
||||
<span id="loginmsg">请使用微信扫描二维码登录</span>
|
||||
</div>
|
||||
<div id="qrcode" class="qr-image list-group-item">
|
||||
</div>
|
||||
<div class="list-group-item" id="mobile" style="display:none;"><button type="button" id="mlogin" onclick="mloginurl()" class="btn btn-warning btn-block">跳转QQ快捷登录</button><br/><button type="button" onclick="loadScript()" class="btn btn-success btn-block">我已完成登录</button></div>
|
||||
<div class="list-group-item">
|
||||
<div class="btn-group">
|
||||
<a href="login.php" class="btn btn-primary btn-rounded"><i class="fa fa-user"></i> 返回登录</a>
|
||||
<a href="reg.php" class="btn btn-info btn-rounded"><i class="fa fa-user-plus"></i> 注册账号</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<p>
|
||||
<small class="text-muted"><a href="/"><?php echo $conf['sitename']?></a><br>© 2016~2020</small>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="//cdn.staticfile.org/jquery/3.3.1/jquery.min.js"></script>
|
||||
<script src="//cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
|
||||
<script src="../assets/layer/layer.js"></script>
|
||||
<script src="../assets/js/jquery-qrcode.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$('#qrcode').qrcode({
|
||||
text: "<?php echo $code_url?>",
|
||||
width: 230,
|
||||
height: 230,
|
||||
foreground: "#000000",
|
||||
background: "#ffffff",
|
||||
typeNumber: -1
|
||||
});
|
||||
setTimeout('checkopenid()', 2000);
|
||||
});
|
||||
function checkopenid(){
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
url: "wxlogin.php?act=login",
|
||||
success: function (data, textStatus) {
|
||||
if (data.code == 0) {
|
||||
layer.msg(data.msg, {icon: 16,time: 10000,shade:[0.3, "#000"]});
|
||||
setTimeout(function(){ window.location.href=data.url }, 1000);
|
||||
}else if (data.code == 1) {
|
||||
setTimeout('checkopenid()', 2000);
|
||||
}else{
|
||||
layer.alert(data.msg);
|
||||
}
|
||||
},
|
||||
error: function (data) {
|
||||
layer.msg('服务器错误', {icon: 2});
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||