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