255] ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'store_id' => 'Store ID', 'order_no' => 'Order No', 'total_num' => 'Total Num', 'leave_num' => 'Leave Num', 'user_name' => 'User Name', 'mobile' => 'Mobile', 'address' => 'Address', 'order_status' => 'Order Status', 'status' => 'Status', 'mall_id' => 'Mall ID', 'remark' => 'Remark', 'created_at' => 'Created At', 'updated_at' => 'Updated At', ]; } public function getStore() { return $this->hasOne(HappinessStore::className(), ['id' => 'store_id']); } public function getGoods() { return $this->hasMany(HappinessVoucherGoods::className(), ['order_id' => 'id']); } public static function setData(array $params) { try { if(isset($params['id']) && !empty($params['id'])) $model = self::findOne($params['id']); else { $model = new self(); $model->loadDefaultValues(); } if(!$model) { $model = new self(); $model->loadDefaultValues(); } if (!$model->load($params, '') || !$model->save()) { throw new \Exception($model->getErrorMessage()); } return $model; } catch (\Exception $e) { self::$static_error = $e->getMessage(); return false; } } }