| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?php
- namespace addons\Boss;
- use Yii;
- use yii\db\Exception;
- use yii\db\Migration;
- use common\helpers\MigrateHelper;
- use common\interfaces\AddonWidget;
- use common\traits\ErrorTrait;
- /**
- * 安装
- *
- * Class Install
- * @package addons\Boss
- */
- class Install extends Migration implements AddonWidget
- {
- use ErrorTrait;
- /**
- * @param $addon
- * @return mixed|void
- * @throws \yii\base\InvalidConfigException
- * @throws \yii\web\NotFoundHttpException
- * @throws \yii\web\UnprocessableEntityHttpException
- */
- public function run($addon)
- {
- // MigrateHelper::upByPath([
- // '@addons/Boss/console/migrations/'
- // ]);
- }
- public function runApp($mall_id, $addons_name)
- {
- // 基础配置-初始化
- $config['basic'] = [
- 'is_enable' => 0,// 启用插件
- 'compute_type' => 0,//佣金计算方式
- 'compute_period' => 1,//结算周期
- 'settlement_method' => 0,//结算方式
- 'settlement_period' => 1,//佣金结算周期
- 'is_sediment' => 0,//是否开启股东分红沉淀池
- 'sediment_type' => 1,//沉淀池资金类型
- 'sediment_percent' => 0,//沉淀池比例
- 'detail' => '',//股东分红说明
- ];
- // 保存设置
- $res = Yii::$app->services->setting->addons->set($mall_id, $addons_name, $config);
- if ($res == false) throw new Exception('基础设置保存失败');
- return true;
- }
- }
|