Servicer.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /**
  3. * Niushop商城系统 - 团队十年电商经验汇集巨献!
  4. * =========================================================
  5. * Copy right 2019-2029 山西牛酷信息科技有限公司, 保留所有权利。
  6. * ----------------------------------------------
  7. * 官方网址: https://www.niushop.com
  8. * =========================================================
  9. */
  10. namespace app\model\system;
  11. use app\model\BaseModel;
  12. use app\model\system\Config as ConfigModel;
  13. /**
  14. * 客服配置
  15. */
  16. class Servicer extends BaseModel
  17. {
  18. /**
  19. * 设置客服配置
  20. * @param $data
  21. * @return array
  22. */
  23. public function setServicerConfig($data)
  24. {
  25. $config_model = new ConfigModel();
  26. $res = $config_model->setConfig($data, '客服配置', 1, [ [ 'site_id', '=', 1 ], [ 'app_module', '=', 'shop' ], [ 'config_key', '=', 'SRRVICER_ROOT_CONFIG' ] ]);
  27. return $res;
  28. }
  29. /**
  30. * 获取客服配置
  31. */
  32. public function getServicerConfig()
  33. {
  34. $config_model = new ConfigModel();
  35. $res = $config_model->getConfig([ [ 'site_id', '=', 1 ], [ 'app_module', '=', 'shop' ], [ 'config_key', '=', 'SRRVICER_ROOT_CONFIG' ] ]);
  36. if (empty($res[ 'data' ][ 'value' ])) {
  37. $res[ 'data' ][ 'value' ] = [
  38. 'h5' => [
  39. 'type' => 'none'
  40. ],
  41. 'weapp' => [
  42. 'type' => 'none'
  43. ],
  44. 'pc' => [
  45. 'type' => 'none'
  46. ],
  47. 'aliapp' => [
  48. 'type' => 'none'
  49. ],
  50. ];
  51. }
  52. $res[ 'data' ][ 'value' ][ 'h5' ][ 'type' ] = $res[ 'data' ][ 'value' ][ 'h5' ][ 'type' ] ?? 'none';
  53. $res[ 'data' ][ 'value' ][ 'weapp' ][ 'type' ] = $res[ 'data' ][ 'value' ][ 'weapp' ][ 'type' ] ?? 'none';
  54. $res[ 'data' ][ 'value' ][ 'pc' ][ 'type' ] = $res[ 'data' ][ 'value' ][ 'pc' ][ 'type' ] ?? 'none';
  55. $res[ 'data' ][ 'value' ][ 'aliapp' ][ 'type' ] = $res[ 'data' ][ 'value' ][ 'aliapp' ][ 'type' ] ?? 'none';
  56. return $res;
  57. }
  58. }