PluginController.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. /**
  3. * 重庆赤晓店信息科技有限公司
  4. * https://www.chixiaodian.com
  5. * Copyright (c) 2023 赤店商城 All rights reserved.
  6. */
  7. namespace app\modules\admin\controllers;
  8. use app\modules\admin\models\PluginForm;
  9. class PluginController extends BaseController
  10. {
  11. /**
  12. * 插件列表
  13. */
  14. public function actionList() {
  15. // TODO:请求授权服务器,然后做缓存
  16. $pluginForm = new PluginForm();
  17. $pluginForm->store_id = get_store_id();
  18. $pluginForm->pageNo = (int)get_params('pageNo');
  19. $pluginForm->pageSize = (int)get_params('pageSize', \Yii::$app->params['pageSize']);
  20. return $this->asJson($pluginForm->getList());
  21. }
  22. /**
  23. * 状态更改
  24. */
  25. public function actionStatus() {
  26. $pluginForm = new PluginForm();
  27. $pluginForm->store_id = get_store_id();
  28. $pluginForm->id = post_params('id');
  29. $pluginForm->status = post_params('status');
  30. return $this->asJson($pluginForm->changeStatus());
  31. }
  32. /**
  33. * 下载安装
  34. */
  35. public function actionInstall() {
  36. $pluginForm = new PluginForm();
  37. $pluginForm->store_id = get_store_id();
  38. $pluginForm->key = post_params('key');
  39. $pluginForm->version = post_params('version');
  40. $pluginForm->main_version = post_params('main_version');
  41. $pluginForm->is_can_install = post_params('is_can_install');
  42. return $this->asJson($pluginForm->install());
  43. }
  44. /**
  45. * 更新
  46. */
  47. public function actionUpdate() {
  48. $pluginForm = new PluginForm();
  49. $pluginForm->store_id = get_store_id();
  50. $pluginForm->key = post_params('key');
  51. $pluginForm->version = post_params('version');
  52. $pluginForm->main_version = post_params('main_version');
  53. $pluginForm->is_can_update = post_params('is_can_update');
  54. return $this->asJson($pluginForm->update());
  55. }
  56. /**
  57. * 卸载
  58. */
  59. public function actionUninstall() {
  60. $pluginForm = new PluginForm();
  61. $pluginForm->store_id = get_store_id();
  62. $pluginForm->id = post_params('id');
  63. $pluginForm->status = post_params('status');
  64. return $this->asJson($pluginForm->changeStatus());
  65. }
  66. }