Compare commits

...

2 Commits

Author SHA1 Message Date
tk
88030c0580 【类 型】:fix
【主	题】:修改 飞机控制端 设置订单状态接口
【描	述】:
	[原因]:数据库订单表  数据接口调整
	[过程]:修改函数的字段 的键值等
	[影响]:
【结	束】

# 类型 包含:
# feat:新功能(feature)
# fix:修补bug
# docs:文档(documentation)
# style: 格式(不影响代码运行的变动)
# refactor:重构(即不是新增功能,也不是修改bug的代码变动)
# test:增加测试
# chore:构建过程或辅助工具的变动
2024-06-21 19:23:19 +08:00
tk
28ef6da15e 【类 型】:fix
【主	题】:支付接口 修改
【描	述】:
	[原因]:支付接口 通过attch字段来保存商铺id 回调中 拿这个id 来发mqtt
	[过程]:
	[影响]:
【结	束】

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

View File

@ -76,7 +76,7 @@ class PayController extends PublicController
$orderParameter = [
'out_trade_no' => $order['order_sn'],
'description' => '餐品', //存商品名称吧 后期在做调整
'attach' => strval($order['shop_id']), // 将 shop_id 转为字符串
'attach' => strval($order['shop_id']), // 将 shop_id 转为字符串 回调中用来发mqtt的主题
'amount' => [
'total' => $order['total_price'] * 100, //单位:分
'currency' => 'CNY',
@ -100,7 +100,6 @@ class PayController extends PublicController
{
// 实例化 Yansongda Pay
$result = Pay::wechat($this->config)->callback();
$this->publish('refreshQuestList/2dc23dcfecc05fb1', $result['resource']['ciphertext']['attach']);
try {
// 验证成功,处理业务逻辑
if ($result['resource']['ciphertext']['trade_state'] == 'SUCCESS') {
@ -113,8 +112,8 @@ class PayController extends PublicController
$orderDb->where($where)->data($data)->save();
}
// 构建发布主题 并向地面终端提示刷新信息
// $topic = 'refreshQuestList/2dc23dcfecc05fb1';
// $this->publish('refreshQuestList/2dc23dcfecc05fb1', $result['resource']['ciphertext']['description']);
$topic = 'refreshQuestList/' . $result['resource']['ciphertext']['attach'];
$this->publish($topic, 1);
} catch (\Exception $e) {
// 捕获并记录可能的异常
error_log('支付回调处理错误:' . $e->getMessage());

View File

@ -526,7 +526,7 @@ class PlaneController extends PublicController
}
}
/**
* @description: 改变订单状态或退款字段 不处理 已取消 未付款 交易关闭的订单
* @description: 只处理 主状态 已付款 的订单
*/
public function questAss()
{
@ -539,9 +539,8 @@ class PlaneController extends PublicController
$orderDb = D('order');
$field = array('status', 'back', 'openid');
$order = $orderDb->where($where)->field($field)->find();
//不处理订单状态处于 已取消 未付款 交易关闭的情况
//不处理订单退款状态处于 主动退款 已退款 拒绝退款的状况
if ($order['status'] == 'canceled' || $order['status'] == 'unpaid' || $order['status'] == 'closed' || $order['back'] == 'actively' || $order['back'] == 'rejected' || $order['back'] == 'rejected' || $order['back'] == 'refunded') {
//只处理主状态已付款的订单 其他状态跳出
if ($order['main_status'] != '已付款') {
echo json_encode(array('status' => 0, 'msg' => '参数有误'));
exit();
}
@ -550,14 +549,16 @@ class PlaneController extends PublicController
exit();
}
//操作数据库
if ($_REQUEST['state'] == 'status') {
$data['status'] = $_REQUEST['val']; //改变订单状态
} elseif ($_REQUEST['state'] == 'back') {
$data['back'] = $_REQUEST['val']; //改变订单状态
if ($_REQUEST['state'] == 'main_status') {
$data['main_status'] = $_REQUEST['val'];
} elseif ($_REQUEST['state'] == 'shipment_status') {
$data['shipment_status'] = $_REQUEST['val'];
} elseif ($_REQUEST['state'] == 'refund_status') {
$data['refund_status'] = $_REQUEST['val'];
}
if ($orderDb->where($where)->save($data)) { //修改数据
$topicPrefix = makeTopicPrefix($order['openid']); //小程序端用户订阅主题的前缀 ps:订单对应的用户的openid算出来的
// 提醒小程序端 刷新订单列表
// 提醒小程序端 刷新订单列表(mqtt)
$this->publish('refreshOrderList/' . $topicPrefix, 1);
echo json_encode(array('status' => 1, 'msg' => '订单修改成功'));
} else {