Ver código fonte

修复使用OSS在微信中不能上传图片的BUG,及修复微信中框架不能支付的BUG

齐博 1 ano atrás
pai
commit
9cf7ee603f

+ 1 - 0
application/common/upgrade/log337.txt

@@ -0,0 +1 @@
+修复使用OSS在微信中不能上传图片的BUG,及修复微信中框架不能支付的BUG

+ 8 - 1
application/index/controller/Pay.php

@@ -36,12 +36,19 @@ class Pay extends IndexBase
      */
     public function index($banktype = '' , $action = '' , $back_post = '')
     {
+        if(input('money')&&!preg_match("/^([\.\d]+)$/", input('money'))){
+            $this->error('金额类型有误!');
+        }elseif(input('totalmoney')&&!preg_match("/^([\.\d]+)$/", input('totalmoney'))){
+            $this->error('金额类型有误!');
+        }
+        $this->weburl = filtrate($this->weburl);
         if ($banktype == '') {  //没有指定支付方式的话,就让用户自由选择支付方式
             if (empty($this->user)) {
                 //$this->error('请先登录!');
             }
             $this->assign('weburl',$this->weburl);
-            $this->assign('money',input('money'));
+            $this->assign('money',input('money'));              //有可能是除去余额还需要支付的金额
+            $this->assign('totalmoney',input('totalmoney')?:0);    //实际所需要的总金额 , 这样就避免显示余额支付的尴尬
             return $this->fetch(input('iframe')?'pc_iframe_choose':'index');
             
         } elseif($banktype == 'rmb') {  //选择了余额支付

+ 2 - 0
application/member/controller/Group.php

@@ -126,6 +126,7 @@ class Group extends MemberBase
             if($this->user['rmb']<$need_money){                
                 $payurl = post_olpay([
                     'money'=>$need_money-$this->user['rmb'],     //有部分余额的话,就不用充值那么多
+                    'totalmoney'=>$need_money,   //实际需要花费金额
                     'return_url'=>url('buy',['gid'=>$gid,'day'=>$day]),
                     'banktype'=>'',
                     'numcode'=>'g'.date('ymdHis').rands(3),
@@ -141,6 +142,7 @@ class Group extends MemberBase
                 if($this->user['rmb']<$money){
                     $payurl = post_olpay([
                             'money'=>$money-$this->user['rmb'],     //有部分余额的话,就不用充值那么多
+                            'totalmoney'=>$money,   //实际需要花费金额
                             'return_url'=>$payurl,
                             'banktype'=>'',
                             'numcode'=>'g'.date('ymdHis').rands(3),

+ 9 - 3
template/index_style/default/index/pay/index.htm

@@ -61,7 +61,7 @@ div, p, dl, dt, dd,td,span,li,a,h3,h4{font-family: Arial, Helvetica, sans-serif,
 		  <li {if $money>0&&!in_weixin()}class='ck'{/if}><em><input type='radio' name='paytype' value='alipay' {if $money>0&&!in_weixin()}checked{/if} /></em><span style="color:#059CD8;" class="fa fa-buysellads">支付宝</span></li>
 {/if}
 
-{if $userdb.rmb>=$money}
+{if $userdb.rmb>=$money&&$userdb.rmb>=$totalmoney}
 		  <li {if $money==0}class='ck'{/if}><em><input type='radio' name='paytype' value='rmb' {if $money==0}checked{/if} {if $money>$userdb.rmb} onclick="layer.alert('你余额不足,不能使用余额支付!')" {/if}/></em><span style="color:#B94303;" class="glyphicon glyphicon-yen">余额(可用:{$userdb.rmb}元)</span></li>
 {/if}
       </ul>
@@ -70,10 +70,11 @@ div, p, dl, dt, dd,td,span,li,a,h3,h4{font-family: Arial, Helvetica, sans-serif,
 </div>
 <script language="JavaScript">
 
-{if in_weixin()&&$money>$userdb['rmb']}
+{if in_weixin()&&($money>$userdb['rmb']||$totalmoney>$userdb['rmb'])}
 	paytype();
 {/if}
 
+
 function paytype(){
 	var type='';
 	$(".payList input").each(function(i){
@@ -83,7 +84,12 @@ function paytype(){
 		alert("请选择一种支付类型!");
 		return ;
 	}
-	window.location.href="{$weburl}&banktype="+type;
+
+	if(window.self!=window.top && type=="weixin" && "{:in_weixin()?1:0}"!="0"){
+		window.parent.location.href = "{$weburl}&banktype="+type;	//跳出框架,因为微信各种接口不能在框架中使用
+	}else{
+		window.location.href="{$weburl}&banktype="+type;
+	}
 }
 
 $(".payList li").click(function(){