Config.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /**
  3. * Niushop商城系统 - 团队十年电商经验汇集巨献!
  4. * =========================================================
  5. * Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
  6. * ----------------------------------------------
  7. * 官方网址: https://www.niushop.com
  8. * =========================================================
  9. */
  10. namespace addon\qiniu\shop\controller;
  11. use addon\qiniu\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 = input("access_key", "");
  28. $secret_key = input("secret_key", "");
  29. $domain = input("domain", "");
  30. $status = input("status", 0);
  31. $data = array(
  32. "bucket" => $bucket,
  33. "access_key" => $access_key,
  34. "secret_key" => $secret_key,
  35. "domain" => $domain,
  36. );
  37. $result = $config_model->setQiniuConfig($data, $status, $this->site_id, $this->app_module);
  38. return $result;
  39. } else {
  40. $info_result = $config_model->getQiniuConfig($this->site_id, $this->app_module);
  41. $info = $info_result["data"];
  42. $this->assign("info", $info);
  43. return $this->fetch("config/config");
  44. }
  45. }
  46. }