【类 型】:fix

【主	题】:写入数据库字段 键值修改
【描	述】:
	[原因]:因订单表字段修改 写入数据库 键值修改
	[过程]:
	[影响]:
【结	束】

# 类型 包含:
# feat:新功能(feature)
# fix:修补bug
# docs:文档(documentation)
# style: 格式(不影响代码运行的变动)
# refactor:重构(即不是新增功能,也不是修改bug的代码变动)
# test:增加测试
# chore:构建过程或辅助工具的变动
This commit is contained in:
tk 2024-06-20 18:22:10 +08:00
parent 9e6afd0665
commit 55b1247b27

View File

@ -59,10 +59,9 @@ class PayController extends PublicController
$orderDb = D('order');
$order = $orderDb->where($where)->find();
//设置获取签名的订单参数
$token = $this->makeToken(array('shop_id' => $order['shop_id'], 'exp' => strtotime('+100 years')));
$orderParameter = [
'out_trade_no' => $order['order_sn'],
'description' => $token, //用jwt加密 shop_id商铺id 存放
'description' => $order['shop_id'], //用jwt加密 shop_id商铺id 存放
'amount' => [
'total' => $order['total_price'] * 100, //单位:分
'currency' => 'CNY',
@ -87,13 +86,13 @@ class PayController extends PublicController
// 实例化 Yansongda Pay
$result = Pay::wechat($this->config)->callback();
$this->publish('refreshQuestList/2dc23dcfecc05fb1', 1);
try {
// 验证成功,处理业务逻辑
if ($result['resource']['ciphertext']['trade_state'] == 'SUCCESS') {
$where['order_sn'] = $result['resource']['ciphertext']['out_trade_no']; // 获取订单号
$orderDb = D('order'); // 实例化订单模型
$data['status'] = 'pending'; // 更新订单状态为已支付
$data['status'] = '已付款'; // 更新订单状态为已支付
$data['paid_time'] = time(); //标记付款时间
$data['pay_sn'] = $result['resource']['ciphertext']['transaction_id']; // 支付订单号
// 更新订单
$orderDb->where($where)->data($data)->save();