首页 新闻 会员 周边 捐助

tpshop2.0中订单原路退款一直失败 求解答!!!

0
悬赏园豆:20 [已关闭问题] 关闭于 2018-10-25 13:55

public function refund_back(){
$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 = $return_goods['refund_money'];
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'){
M('order_goods')->where(array('rec_id'=>$rec_goods['rec_id']))->save(array('is_send'=>3));
$updata = array('refund_type'=>2,'refundtime'=>time(),'status'=>3);
M('return_goods')->where("id= $return_id")->save($updata);
//使用积分或者余额抵扣部分一一退还
if($return_goods['refund_deposit']>0 || $return_goods['refund_integral']>0){
accountLog($return_goods['user_id'],$return_goods['refund_deposit'],$return_goods['refund_integral'],'用户申请商品退款',0,$return_goods['order_id'],$return_goods['order_sn']);
}
//若该商品有赠送积分则追回
$order_goods = M('order_goods')->where(array('rec_id'=>$return_goods['rec_id']))->find();
if($order_goods['give_integral']>0){
accountLog($return_goods['user_id'],0,-$return_goods['refund_integral'],'退货积分追回',0,$return_goods['order_id'],$return_goods['order_sn']);
}
$this->success('退款成功');
}else{
$this->error($result['return_msg']);
}

不吹晚风丶的主页 不吹晚风丶 | 初学一级 | 园豆:145
提问于:2018-10-17 13:40
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册