100], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'mall_id' => 'Mall ID', 'store_id' => 'Store ID', 'user_id' => 'User ID', 'order_no' => 'Order No', 'order_money' => 'Order Money', 'pay_money' => 'Pay Money', 'discount_money' => 'Discount Money', 'service_charge' => 'Service Charge', 'amount_received' => 'Amount Received', 'is_settlement' => 'Is Settlement', 'created_at' => 'Created At', 'updated_at' => 'Updated At', 'status' => 'Status', 'settle_type' => 'Settle Type', 'type' => 'Type No', 'all_commission' => 'All Commission', 'share_commission' => 'Share Commission', 'store_share_commission' => 'Store Share Commission', 'store_scale' => 'Store Scale' ]; } public function getUser() { return $this->hasOne(User::class, ['id' => 'user_id']); } public static function setData(array $params) { try { if (!empty($params['mall_id']) && !empty($params['id'])) { $model = self::findOne(['mall_id' => $params['mall_id'], 'id' => $params['id']]); if (empty($model)) { $model = new self(); $model->loadDefaultValues(); } } else { $model = new self(); $model->loadDefaultValues(); } if (!$model->load($params, '')) throw new \Exception($model->getErrorMessage()); if (!$model->save()) throw new \Exception($model->getErrorMessage()); return $model; } catch (\Exception $e) { self::$static_error = $e->getMessage(); return false; } } }