找回密码
 立即注册

扫一扫,微信登陆

QQ登录

只需一步,快速开始

查看: 1101|回复: 0

[网站程序] 自动发卡发货插件[图片版]源码超市插件修复文件

[复制链接]

68

主题

11

回帖

222

积分

正式成员

123

积分
222
QQ
发表于 2018-1-16 10:49:54 | 显示全部楼层 |阅读模式
  1. <?php
  2. if (!defined('IN_DISCUZ')) {
  3.     exit('Access Denied');
  4. }
  5. require_once libfile('function/mail');  
  6. $ac=isset($_GET['ac'])?daddslashes($_GET['ac']):'';
  7. if(!in_array($ac, array('pay_window','checkpay')) && !empty($ac)){
  8.     exit('Access Denied');
  9. }
  10. $goods_number=isset($_GET['goods_number'])?intval($_GET['goods_number']):1;
  11. $myconf = $_G['cache']['plugin']['yc88_faka'];
  12. $payway=unserialize($myconf['payway']);
  13. $goods_id=intval($_GET['goods_id']);
  14. if(in_array(1, $payway)){
  15.     $myconf_yc88_pay = $_G['cache']['plugin']['yc88_pay'];
  16.     $payway_yc88_pay=unserialize($myconf_yc88_pay['payway']);
  17.     if(empty($myconf_yc88_pay['mchid']) || empty($myconf_yc88_pay['secret']) || empty($myconf_yc88_pay['integral_type'])){
  18.         showmessage('yc88_pay:config_err');
  19.         return;
  20.     }
  21. }

  22. $orderid=daddslashes($_GET['orderid']);
  23. if($ac=='checkpay'){
  24.     $info_order=DB::fetch_first("select status,goods_id from ".DB::table('yc88_faka_order')." where no='{$orderid}'");
  25.     $code=DB::result_first("select content from ".DB::table('yc88_faka_kami')." where order_no='{$orderid}'");
  26.     if(!$code){
  27.         $code=DB::result_first("select content from ".DB::table('yc88_faka_kami')." where goods_id='{$info_order['goods_id']}'");
  28.     }
  29.     header("Content-Type:application/json; charset=utf-8");
  30.     $re=array(
  31.         'status'=>$info_order['status'],
  32.         'code'=>$code
  33.     );
  34.     echo json_encode($re);
  35.     die;
  36. }



  37. //积分
  38. $integral_type=$myconf['integral_type'];
  39. switch ($integral_type) {
  40.     case 1:
  41.         $jifen=DB::fetch_first("select extcredits1 from ".DB::table('common_member_count')." where uid=".$_G['uid']);
  42.         $jifen=$jifen['extcredits1'];
  43.         break;
  44.     case 2:
  45.         $jifen=DB::fetch_first("select extcredits2 from ".DB::table('common_member_count')." where uid=".$_G['uid']);
  46.         $jifen=$jifen['extcredits2'];
  47.         break;
  48.     case 3:
  49.         $jifen=DB::fetch_first("select extcredits3 from ".DB::table('common_member_count')." where uid=".$_G['uid']);
  50.         $jifen=$jifen['extcredits3'];
  51.         break;
  52.     case 4:
  53.         $jifen=DB::fetch_first("select extcredits4 from ".DB::table('common_member_count')." where uid=".$_G['uid']);
  54.         $jifen=$jifen['extcredits4'];
  55.         break;
  56.     case 5:
  57.         $jifen=DB::fetch_first("select extcredits5 from ".DB::table('common_member_count')." where uid=".$_G['uid']);
  58.         $jifen=$jifen['extcredits5'];
  59.         break;
  60.     case 6:
  61.         $jifen=DB::fetch_first("select extcredits6 from ".DB::table('common_member_count')." where uid=".$_G['uid']);
  62.         $jifen=$jifen['extcredits6'];
  63.         break;
  64.     case 7:
  65.         $jifen=DB::fetch_first("select extcredits7 from ".DB::table('common_member_count')." where uid=".$_G['uid']);
  66.         $jifen=$jifen['extcredits7'];
  67.         break;
  68. }
  69. $goods_info=DB::fetch_first("select * from ".DB::table('yc88_faka_goods')." where id=".$goods_id);
  70. $amount=$goods_info["integral"]*$goods_number;
  71. //库存
  72. $goods_kucun=DB::result_first("select count(1) from ".DB::table('yc88_faka_kami')." where goods_id={$goods_id} and status=0");
  73. if($goods_info['faka_type']==1){
  74.     $goods_kucun=999;
  75. }
  76. if($goods_kucun<intval($_GET['goods_number'])){
  77.     showmessage(lang('plugin/yc88_faka','pay_001'));
  78. }
  79. if(submitcheck('paysubmit')){
  80.     $order_no =  date('YmdHis') . str_pad(mt_rand(1, 99999), 5, '0', STR_PAD_LEFT);
  81.     if(daddslashes($_GET['bankid'])=='JIFEN' && $amount<=$jifen){
  82.         $data=array(
  83.             'no'=>$order_no,
  84.             'status'=>1,
  85.             'uid'=>$_G['uid'],
  86.             'goods_id'=>$goods_id,
  87.             'goods_name'=>$goods_info["name"],
  88.             'goods_price'=>$goods_info["price"],
  89.             'goods_number'=>intval($_GET['goods_number']),
  90.             'ctime'=>time(),
  91.             'paytime'=>time(),
  92.             'email'=>daddslashes($_GET["email"]),
  93.             'integral'=>$goods_info["integral"]*intval($_GET['goods_number'])
  94.         );
  95.         $re=DB::insert('yc88_faka_order', $data);
  96.         //发卡
  97.         $faka_type=DB::result_first("select faka_type from ".DB::table('yc88_faka_goods')." where id=".$goods_id);
  98.         if($faka_type==1){
  99.             $kami_list_str=DB::result_first("select content from ".DB::table('yc88_faka_kami')." where goods_id=".$goods_id);
  100.         }else{
  101.             $kami_ids=DB::fetch_all("select id from ".DB::table('yc88_faka_kami')." where goods_id=".$goods_id."  and order_no='' limit 0,".intval($_GET['goods_number']));
  102.             $kami_ids_str='';
  103.             foreach ($kami_ids as $k => $v) {
  104.                 if($k==0){
  105.                     $kami_ids_str=$v['id'];
  106.                 }else{
  107.                     $kami_ids_str.=','.$v['id'];
  108.                 }
  109.             }
  110.             $kami_ids_str=empty($kami_ids_str)?'0':$kami_ids_str;
  111.             DB::query("update ".DB::table('yc88_faka_kami')." set status=1,order_no='".$order_no."' where id in({$kami_ids_str})");
  112.             $kami_list=DB::fetch_all("select content from ".DB::table('yc88_faka_kami')." where  id in({$kami_ids_str})");
  113.             $kami_list_str='';
  114.             foreach ($kami_list as $k => $v) {
  115.                 if($k==0){
  116.                     $kami_list_str=$v['content'];
  117.                 }else{
  118.                     $kami_list_str.='<br>'.$v['content'];
  119.                 }
  120.             }
  121.         }
  122.          
  123.          
  124.         $email_content="<p class='summary'>".lang('plugin/yc88_faka', 'callback_001').":<span>{$order_no}</span></p><p class='summary'>".lang('plugin/yc88_faka', 'callback_002').":<span>{$kami_list_str}</span></p>";
  125.         sendmail(daddslashes($_GET["email"]),lang('plugin/yc88_faka', 'callback_003'),$email_content);
  126.         updatemembercount($_G['uid'], array($myconf['integral_type'] => -$goods_info['integral']*intval($_GET['goods_number'])),true,'',1,'', lang('plugin/yc88_faka', 'callback_004'));
  127.         notification_add($_G['uid'], 'system', lang('plugin/yc88_faka', 'callback_003')."<p class='summary'>".lang('plugin/yc88_faka', 'callback_001').": <span>{$order_no}</span></p><p class='summary'>".lang('plugin/yc88_faka', 'callback_002').": <span>{$kami_list_str}</span></p>");
  128.         header ("location:../../../home.php?mod=space&do=notice&view=system");
  129.     }else if(in_array(1, $payway)){
  130.         $data=array(
  131.             'no'=>$order_no,
  132.             'status'=>0,
  133.             'uid'=>$_G['uid'],
  134.             'amount'=>$goods_info["price"]*intval($_GET['goods_number']),
  135.             'goods_id'=>$goods_id,
  136.             'goods_name'=>$goods_info["name"],
  137.             'goods_price'=>$goods_info["price"],
  138.             'goods_number'=>intval($_GET['goods_number']),
  139.             'ctime'=>time(),
  140.             'email'=>daddslashes($_GET["email"]),
  141.         );
  142.         $re=DB::insert('yc88_faka_order', $data);
  143.         $parter = $myconf_yc88_pay['mchid'];
  144.         $key        = $myconf_yc88_pay['secret'];   
  145.         $submiturl = 'http://api.a8tg.com/interface/chargebank.aspx';  
  146.         $callbackurl  = trim($_G['siteurl'] . 'source/plugin/yc88_faka/notify.php');   
  147.         $value =  $goods_info["price"]*intval($_GET['goods_number']);
  148.         $type =  daddslashes($_GET["bankid"]);
  149.         $attach = "123";
  150.         $sign = "parter=".$parter."&type=".$type."&orderid=".$order_no."&callbackurl=".$callbackurl;
  151.         $sign = md5($sign.$key);
  152.         $re=wd_http($submiturl, array(
  153.             'parter'=>$parter,
  154.             'type'=>$type,
  155.             'value'=>$value,
  156.             'orderid'=>$order_no,
  157.             'callbackurl'=>$callbackurl,
  158.             'attach'=>$attach,
  159.             'sign'=>$sign,
  160.         ));
  161.         $re=json_decode($re,true);
  162.         switch ($type) {
  163.             case 'ALQR':
  164.                 $pay_name=lang('plugin/yc88_pay', 'alipay');
  165.                 $pay_name_en='alipay-wechat';
  166.                 break;
  167.             case 'WXQR':
  168.                 $pay_name=lang('plugin/yc88_pay', 'wxpay');
  169.                 $pay_name_en='wxpay-wechat';
  170.                 break;
  171.             case 'QQQR':
  172.                 $pay_name=lang('plugin/yc88_pay', 'qqpay');
  173.                 $pay_name_en='qqpay-wechat';
  174.                 break;
  175.         }
  176.         include template('yc88_faka:pay_show');
  177.     }
  178.      
  179.      
  180.      
  181. }

  182. if($ac=='pay_window'){
  183.     include template('yc88_faka:pay');
  184. }



  185. function wd_http($url, $param, $data = '', $method = 'GET',$header=''){
  186.     return dfsockopen($url,0,$param);
  187. }
复制代码


修复文件与完整插件下载
游客,如果您要查看本帖隐藏内容请回复

pay.inc.rar

2.12 KB, 下载次数: 1, 下载积分: 贡献(日常收益) -10

玖毅论坛www.webbbs.cn
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表