首页 > 代码库 > tpshop使用中遇到的问题

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(‘该订单支付方式不支持在线退回‘);
        }
    }

 


tpshop使用中遇到的问题