20], ]; } public function attributeLabels() { return [ 'ghsOrderId' => '批发订单ID', 'orderId' => '平台订单ID', 'platform' => '配送平台', 'order_cancel_code' => '取消原因代码', 'order_cancel_reason' => '取消原因', ]; } /** * 验证批发订单ID * @param $attribute */ public function validateGhsOrderId($attribute) { if (!$this->hasErrors()) { // 检查配送订单是否存在 $gdo = GhsDeliveryOrderClass::getByCondition( ['mainId' => Yii::$app->controller->mainId, 'ghsOrderId' => $this->ghsOrderId, 'orderStatus' => ['not in', [-1, -2]]], false, 'orderId, deliveryId' ); if (empty($gdo)) { $this->addError($attribute, '未找到对应的配送订单'); } } } }