Config.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. /**
  3. * Niushop商城系统 - 团队十年电商经验汇集巨献!
  4. * =========================================================
  5. * Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
  6. * ----------------------------------------------
  7. * 官方网址: https://www.niushop.com
  8. * =========================================================
  9. */
  10. namespace addon\alioss\shop\controller;
  11. use addon\alioss\model\Config as ConfigModel;
  12. use app\shop\controller\BaseShop;
  13. /**
  14. * 七牛云上传管理
  15. */
  16. class Config extends BaseShop
  17. {
  18. /**
  19. * 云上传配置
  20. * @return mixed
  21. */
  22. public function config()
  23. {
  24. $config_model = new ConfigModel();
  25. if (request()->isAjax()) {
  26. $bucket = input("bucket", "");
  27. $access_key_id = input("access_key_id", "");
  28. $access_key_secret = input("access_key_secret", "");
  29. $endpoint = input("endpoint", "");
  30. $status = input("status", 0);
  31. $domain = input("domain", "");
  32. $is_domain = input("is_domain", 0);
  33. $data = array(
  34. "bucket" => $bucket,
  35. "access_key_id" => $access_key_id,
  36. "access_key_secret" => $access_key_secret,
  37. "endpoint" => $endpoint,
  38. "domain" => $domain,
  39. "is_domain" => $is_domain
  40. );
  41. $result = $config_model->setAliossConfig($data, $status, $this->site_id, $this->app_module);
  42. return $result;
  43. } else {
  44. $info_result = $config_model->getAliossConfig($this->site_id, $this->app_module);
  45. $info = $info_result["data"];
  46. $this->assign("info", $info);
  47. return $this->fetch("config/config");
  48. }
  49. }
  50. }