100], ]; } public function attributeLabels() { return [ 'orderId' => '订单ID', 'weight' => '重量', 'remark' => '备注', 'price' => '配送费用', 'pickupTime' => '取件时间', 'allParams' => '配送参数', ]; } /** * 验证订单ID是否存在且属于当前商户 * @param $attribute */ public function validateOrderId($attribute) { if (!$this->hasErrors()) { $order = OrderClass::getById($this->orderId, false, 'id, mainId, sendStatus'); if (empty($order)) { $this->addError($attribute, '订单不存在'); return; } if ($order['mainId'] != Yii::$app->controller->mainId) { $this->addError($attribute, '订单不属于当前商户'); return; } // 检查订单是否已发过跑腿 if (!in_array($order['sendStatus'], [-4, -2, -1])) { $this->addError($attribute, '订单已经发过跑腿'); } } } }