| 12345678910111213141516171819202122232425262728293031 |
- <?php
- namespace addons\Community\common\service;
- use addons\Community\common\enums\CommunityEnum;
- use common\models\common\Region;
- use yii\helpers\Json;
- class InitService
- {
- /**
- * @param int $mall_id
- * @return void
- */
- public static function init(int $mall_id)
- {
- $config = (new SettingService())->get($mall_id);
- if (empty($config) || empty($config['area']) || $config['area'] == '[]') {
- $regionIds = Region::find()->where(['level' => [1,2,3]])
- ->select('id')
- ->orderBy('id asc')
- ->column();
- \Yii::$app->services->setting->addons->set($mall_id, CommunityEnum::ADDONS_NAME, ['basic' => [
- 'area' => Json::encode($regionIds)
- ]]);
- }
- }
- }
|