Install.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace addons\HuijuBill;
  3. use Yii;
  4. use yii\db\Migration;
  5. use common\helpers\MigrateHelper;
  6. use common\interfaces\AddonWidget;
  7. use common\logic\middleground\Core;
  8. use Exception;
  9. /**
  10. * 安装
  11. *
  12. * Class Install
  13. * @package addons\HuijuBill
  14. */
  15. class Install extends Migration implements AddonWidget
  16. {
  17. /**
  18. * @param $addon
  19. * @return mixed|void
  20. * @throws \yii\base\InvalidConfigException
  21. * @throws \yii\web\NotFoundHttpException
  22. * @throws \yii\web\UnprocessableEntityHttpException
  23. */
  24. public function run($addon)
  25. {
  26. // MigrateHelper::upByPath([
  27. // '@addons/HuijuBill/console/migrations/'
  28. // ]);
  29. }
  30. public function runApp($mall_id, $addons_name)
  31. {
  32. // 商城应用市场安装时的初始化
  33. try {
  34. (new Core())->check($mall_id);
  35. } catch (Exception $e) {
  36. $msg = "安装插件初始化错误:" . $e->getMessage();
  37. Yii::error($msg);
  38. throw new Exception($msg);
  39. }
  40. }
  41. }