Compare commits

...

2 Commits

Author SHA1 Message Date
air
c76f39f0d0 【类 型】:feat
【原  因】:数据库 订单表 新加 同意退款时间 字段,相应位置取的时候 获取此字段
【过  程】:字段里面 添加refundargee_time字段
【影  响】:

# 类型 包含:
# feat:新功能(feature)
# fix:修补bug
# docs:文档(documentation)
# style: 格式(不影响代码运行的变动)
# refactor:重构(即不是新增功能,也不是修改bug的代码变动)
# test:增加测试
# chore:构建过程或辅助工具的变动
2025-01-20 17:41:54 +08:00
air
78643ed01a 【类 型】:fix
【原  因】:改在同意退款 或者主动退款的时候 就要改变订单的退款状态为同意 或者主动退,而不是在支付成功回调时在改
【过  程】:在refund接口操作 订单退款状态字段 和 同意退款时间字段
【影  响】:

# 类型 包含:
# feat:新功能(feature)
# fix:修补bug
# docs:文档(documentation)
# style: 格式(不影响代码运行的变动)
# refactor:重构(即不是新增功能,也不是修改bug的代码变动)
# test:增加测试
# chore:构建过程或辅助工具的变动
2025-01-20 17:23:51 +08:00
3 changed files with 21 additions and 10 deletions

View File

@ -221,7 +221,7 @@ class CheckController extends PublicController
*/
public function getOrderList()
{
$field = array('order_sn,food_sn,total_weight,total_num,total_price,transport_price,pack_price,refund_price,receiver,tel,receive_site_id,receive_site_name,remark,product_snapshot,main_status,shipment_status,refund_status,refund_remark,order_time,paid_time,refunded_time,completed_time,received_time,shipped_time,delivered_time,refundapply_time,rejected_time');
$field = array('order_sn,food_sn,total_weight,total_num,total_price,transport_price,pack_price,refund_price,receiver,tel,receive_site_id,receive_site_name,remark,product_snapshot,main_status,shipment_status,refund_status,refund_remark,order_time,paid_time,refunded_time,completed_time,received_time,shipped_time,delivered_time,refundapply_time,refundagree_time,rejected_time');
$where['openid'] = $this->openid;
$where['main_status'] = array('neq', '已取消'); //排除已取消的订单
$orderDb = D('order');

View File

@ -740,7 +740,7 @@ class AdminController extends PublicController
->alias('o') // 别名为 o
->join('lr_receive_site rs ON o.receive_site_id = rs.id') // 关联 lr_receive_site 表
->field('o.id,o.
shop_id,o.order_sn,o.food_sn,o.total_weight,o.total_num,o.total_price,transport_price,pack_price,o.apply_price,o.receiver,o.tel,o.by_plane_id,o.receive_site_id,o.receive_site_name,o.remark,o.product_snapshot,o.main_status,o.shipment_status,o.refund_status,o.refund_remark,o.order_time,o.paid_time,o.refundapply_time,o.received_time,o.shipped_time, rs.bind_route, rs.runing') // 选择字段,包括 bind_route 和 runing
shop_id,o.order_sn,o.food_sn,o.total_weight,o.total_num,o.total_price,transport_price,pack_price,o.apply_price,o.receiver,o.tel,o.by_plane_id,o.receive_site_id,o.receive_site_name,o.remark,o.product_snapshot,o.main_status,o.shipment_status,o.refund_status,o.refund_remark,o.order_time,o.paid_time,o.refundapply_time,o.refundagree_time,o.received_time,o.shipped_time, rs.bind_route, rs.runing') // 选择字段,包括 bind_route 和 runing
->where($where)
->select();
@ -831,7 +831,7 @@ class AdminController extends PublicController
if ($_REQUEST['id']) {
$where['id'] = $_REQUEST['id'];
$orderDb = D('order');
$field = array('id', 'order_sn', 'food_sn', 'total_weight', 'total_num', 'total_price', 'transport_price', 'pack_price', 'refund_price', 'apply_price', 'receiver', 'tel', 'by_plane_id', 'receive_site_id', 'receive_site_name', 'remark', 'product_snapshot', 'main_status', 'shipment_status', 'refund_status', 'refund_remark', 'canceled_time', 'order_time', 'paid_time', 'refunded_time', 'completed_time', 'received_time', 'shipped_time', 'delivered_time', 'refundapply_time', 'rejected_time', 'describe');
$field = array('id', 'order_sn', 'food_sn', 'total_weight', 'total_num', 'total_price', 'transport_price', 'pack_price', 'refund_price', 'apply_price', 'receiver', 'tel', 'by_plane_id', 'receive_site_id', 'receive_site_name', 'remark', 'product_snapshot', 'main_status', 'shipment_status', 'refund_status', 'refund_remark', 'canceled_time', 'order_time', 'paid_time', 'refunded_time', 'completed_time', 'received_time', 'shipped_time', 'delivered_time', 'refundapply_time', 'refundagree_time', 'rejected_time', 'describe');
if ($orderDetails = $orderDb->where($where)->field($field)->find()) {
echo json_encode(array('status' => 1, 'msg' => '访问成功', 'orderDetails' => $orderDetails));
} else {

View File

@ -86,6 +86,17 @@ class PayController extends PublicController
exit();
}
// 更改订单状态 ps:此时只是商家同意申请 或 主动退 之后向微信服务器发起退款但不一定保证成功
if ($_REQUEST['refund_type'] == "buyer") { //买家申请
$data['refund_status'] = "已同意";
} elseif ($_REQUEST['refund_type'] == "seller") { //卖家主动退
$data['refund_status'] = "主动退";
}
$data['refundagree_time'] = time(); // 同意退款时间
if (!$orderDb->where($where)->data($data)->save()) {
echo json_encode(array('status' => 0, 'msg' => '操作退款失败'));
exit();
}
// 设置退款参数
$refundParameter = [
@ -123,13 +134,13 @@ class PayController extends PublicController
$data['refunded_time'] = time(); // 标记退款时间
$data['refund_sn'] = $result['resource']['ciphertext']['refund_id']; // 退款单号
$data['refund_price'] = $result['resource']['ciphertext']['amount']['refund'] / 100; // 退款金额,单位:元
$outRefundNo = $result['resource']['ciphertext']['out_refund_no'];
$refundType = substr($outRefundNo, strrpos($outRefundNo, '_') + 1); //截取退款类型
if ($refundType == "buyer") { //买家申请
$data['refund_status'] = "已同意";
} elseif ($refundType == "seller") { //卖家主动退
$data['refund_status'] = "主动退";
}
// $outRefundNo = $result['resource']['ciphertext']['out_refund_no'];
// $refundType = substr($outRefundNo, strrpos($outRefundNo, '_') + 1); //截取退款类型
// if ($refundType == "buyer") { //买家申请
// $data['refund_status'] = "已同意";
// } elseif ($refundType == "seller") { //卖家主动退
// $data['refund_status'] = "主动退";
// }
// 更新订单
$orderDb->where($where)->data($data)->save();