tpshop使用中遇到的問題


1.短信配置里:商家發貨時是否給客戶發短信  配置了 開啟   如果購買者個人資料里的電話沒填寫,商家點擊發貨時, 程序會掛掉

解決方法:修改application\common\logic\SmsLogic.php

//modify by houdianjing at 2017-07-03 desc:修復如果客戶沒填寫電話號碼 報錯的bug
        if($sender<>'' && strlen($sender)==11){
            $resp = $this->realSendSms($sender, $smsTemp['sms_sign'], $smsParam, $smsTemp['sms_tpl_code']);
            if ($resp['status'] == 1) {
                M('sms_log')->where(array('id' => $log_id))->save(array('status' => 1)); //修改發送狀態為成功
            }else{
                M('sms_log')->where(array('id' => $log_id))->update(array('error_msg'=>$resp['msg'])); //發送失敗, 將發送失敗信息保存數據庫
            }
        }else{
            M('sms_log')->where(array('id' => $log_id))->update(array('error_msg'=>'用戶電話號碼錯誤')); //發送失敗, 將發送失敗信息保存數據庫
        }
        //modify end

2、訂單原路退款無法退回

1.payment_refund方法中的WxPayRefund::MCHID改成了WxPayConfig::$mchid

2.微信證書路徑改成絕對路徑(我是linux系統,相對路徑提示curl錯誤58)

3.微信退款金額單位改為分,現在沒有轉換成分

4.退款成功,修改狀態有誤,退款方法如下

public function refund(){
        $return_id = I('id');
        $return_goods = M('return_goods')->where("id= $return_id")->find();
        $rec_goods = M('order_goods')->where(array('order_id'=>$return_goods['order_id'],'goods_id'=>$return_goods['goods_id']))->find();
        $order = M('order')->where(array('order_id'=>$rec_goods['order_id']))->find();
        if($order['pay_code'] == 'weixin' || $order['pay_code'] == 'alipay' || $order['pay_code'] == 'alipayMobile'){
            $return_money = $rec_goods['goods_price']*$rec_goods['goods_num'];
            $prom_amount = $order['coupon_price'] + $order['order_prom_amount'];
            if($prom_amount>0){
                $return_money = $return_money - round($prom_amount*$return_money/$order['order_amount'],2);
            }
            if($order['pay_code'] == 'weixin'){
                include_once  PLUGIN_PATH."payment/weixin/weixin.class.php";
                $payment_obj =  new \weixin();
                $data = array('transaction_id'=>$order['transaction_id'],'total_fee'=>$order['order_amount'],'refund_fee'=>$return_money);
                $result = $payment_obj->payment_refund($data);
                if($result['return_code'] == 'SUCCESS'){
                    //modify by houdianjing at 2017-07-03 desc:改變訂單狀態,status->is_send
                    M('order_goods')->where(array('rec_id'=>$rec_goods['rec_id']))->save(array('is_send'=>3));
                    //modify end
                    //add by houdianjing at 2017-07-03 desc:退款成功后,改變退款狀態,訂單表狀態
                    M('return_goods')->where(array('order_id'=>$rec_goods['order_id']))->save(array('status'=>3));
                    M('order')->where(array('order_id'=>$rec_goods['order_id']))->save(array('order_status'=>4));
                    //add end
                    $this->success('退款成功');
                }else{
                    $this->error($result['return_msg']);
                }
            }else{
                include_once  PLUGIN_PATH."payment/alipay/alipay.class.php";
                $payment_obj = new \alipay();
                $detail_data = $order['transaction_id'].'^'.$return_money.'^'.'用戶申請訂單退款';
                $data = array('batch_no'=>date('YmdHi').$rec_goods['rec_id'],'batch_num'=>1,'detail_data'=>$detail_data);
                $payment_obj->payment_refund($data);
            }
        }else{
            $this->error('該訂單支付方式不支持在線退回');
        }
    }

 



免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM