'ID', 'mall_id' => 'Mall ID', 'store_id' => 'Store ID', 'setting' => 'Setting', 'status' => 'Status', 'created_at' => 'Created At', 'updated_at' => 'Updated At', ]; } public static function setData($params) { try { $where = ['store_id' => $params['store_id'], 'status' => StatusEnum::ENABLED]; $model = self::findOne($where); if (empty($model)){ $model = new self(); $model->loadDefaultValues(); $model->store_id = $params['store_id']; $model->mall_id = $params['mall_id']; } $params['setting'] = json_encode($params['setting'],JSON_UNESCAPED_UNICODE); if (!$model->load($params, '') || !$model->save()) { throw new \Exception($model->getErrorMessage()); } return $model; } catch (\Exception $e) { self::$static_error = $e->getMessage(); return false; } } }