CustomerServiceLogic.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeadmin快速开发前后端分离管理后台(PHP版)
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
  8. // | github下载:https://github.com/likeshop-github/likeadmin
  9. // | 访问官网:https://www.likeadmin.cn
  10. // | likeadmin团队 版权所有 拥有最终解释权
  11. // +----------------------------------------------------------------------
  12. // | author: likeadminTeam
  13. // +----------------------------------------------------------------------
  14. namespace app\adminapi\logic\setting;
  15. use app\common\logic\BaseLogic;
  16. use app\common\service\ConfigService;
  17. use app\common\service\FileService;
  18. /**
  19. * 客服设置逻辑
  20. * Class CustomerServiceLogic
  21. * @package app\adminapi\logic\setting
  22. */
  23. class CustomerServiceLogic extends BaseLogic
  24. {
  25. /**
  26. * @notes 获取客服设置
  27. * @return array
  28. * @author ljj
  29. * @date 2022/2/15 12:05 下午
  30. */
  31. public static function getConfig()
  32. {
  33. $qrCode = ConfigService::get('customer_service', 'qr_code');
  34. $qrCode = empty($qrCode) ? '' : FileService::getFileUrl($qrCode);
  35. $config = [
  36. 'qr_code' => $qrCode,
  37. 'wechat' => ConfigService::get('customer_service', 'wechat', ''),
  38. 'phone' => ConfigService::get('customer_service', 'phone', ''),
  39. 'service_time' => ConfigService::get('customer_service', 'service_time', ''),
  40. ];
  41. return $config;
  42. }
  43. /**
  44. * @notes 设置客服设置
  45. * @param $params
  46. * @author ljj
  47. * @date 2022/2/15 12:11 下午
  48. */
  49. public static function setConfig($params)
  50. {
  51. $allowField = ['qr_code','wechat','phone','service_time'];
  52. foreach($params as $key => $value) {
  53. if(in_array($key, $allowField)) {
  54. if ($key == 'qr_code') {
  55. $value = FileService::setFileUrl($value);
  56. }
  57. ConfigService::set('customer_service', $key, $value);
  58. }
  59. }
  60. }
  61. }