GoodsSettingsLogic.php 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeshop100%开源免费商用商城系统
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | 商业版本务必购买商业授权,以免引起法律纠纷
  8. // | 禁止对系统程序代码以任何目的,任何形式的再发布
  9. // | gitee下载:https://gitee.com/likeshop_gitee
  10. // | github下载:https://github.com/likeshop-github
  11. // | 访问官网:https://www.likeshop.cn
  12. // | 访问社区:https://home.likeshop.cn
  13. // | 访问手册:http://doc.likeshop.cn
  14. // | 微信公众号:likeshop技术社区
  15. // | likeshop团队 版权所有 拥有最终解释权
  16. // +----------------------------------------------------------------------
  17. // | author: likeshopTeam
  18. // +----------------------------------------------------------------------
  19. namespace app\adminapi\logic\settings\goods;
  20. use app\common\logic\BaseLogic;
  21. use app\common\service\ConfigService;
  22. use app\common\service\FileService;
  23. class GoodsSettingsLogic extends BaseLogic
  24. {
  25. /**
  26. * @notes 设置商品配置
  27. * @param $params
  28. * @return bool
  29. * @author ljj
  30. * @date 2021/7/26 6:03 下午
  31. */
  32. public function setConfig($params)
  33. {
  34. ConfigService::set('goods_set', 'image', $params['image'] ?? '');
  35. ConfigService::set('goods_set', 'is_show', $params['is_show'] ?? '');
  36. ConfigService::set('goods_set', 'show_price', $params['show_price'] ?? '');
  37. return true;
  38. }
  39. /**
  40. * @notes 查看商品配置
  41. * @return array
  42. * @author ljj
  43. * @date 2021/7/26 6:15 下午
  44. */
  45. public function getConfig()
  46. {
  47. $image = ConfigService::get('goods_set', 'image', '');
  48. $image = empty($image) ? '' : FileService::getFileUrl($image);
  49. $config = [
  50. 'image' => $image,
  51. 'is_show' => ConfigService::get('goods_set', 'is_show', 1),
  52. 'show_price' => ConfigService::get('goods_set', 'show_price', 1)
  53. ];
  54. return $config;
  55. }
  56. /**
  57. * @notes 设置商品采集配置
  58. * @param $params
  59. * @return bool
  60. * @author ljj
  61. * @date 2023/3/13 3:42 下午
  62. */
  63. public function setGatherKey($params)
  64. {
  65. ConfigService::set('goods_gather', 'key_99api', $params['key_99api'] ?? '');
  66. return true;
  67. }
  68. /**
  69. * @notes 获取商品采集配置
  70. * @return array
  71. * @author ljj
  72. * @date 2023/3/13 3:41 下午
  73. */
  74. public function getGatherKey()
  75. {
  76. return [
  77. 'key_99api' => ConfigService::get('goods_gather', 'key_99api', '')
  78. ];
  79. }
  80. }