request->isAjax()) { $page = max(1, intval($this->request->get('page', 1))); $limit = max(1, min(100, intval($this->request->get('limit', 20)))); $status = trim($this->request->get('status', '')); $query = Db::name('shopro_wechat_trade_sync')->order('id', 'desc'); if ($status !== '') { $query->where('status', $status); } $total = $query->count(); $list = $query->page($page, $limit)->select(); return json(['total' => $total, 'rows' => $list]); } return $this->view->fetch(); } public function retry() { $id = intval($this->request->post('id')); $row = Db::name('shopro_wechat_trade_sync')->where('id', $id)->find(); if (!$row) { $this->error('记录不存在'); } try { $service = new WxShippingService(); if ($row['sync_type'] === 'confirm') { $service->syncOrderConfirm($row['order_id']); } else { $service->syncOrderShipping($row['order_id'], $row['order_item_id']); } $this->success('重试成功'); } catch (\Exception $e) { $this->error('重试失败:' . $e->getMessage()); } } }