Config.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <?php
  2. /**
  3. * Niushop商城系统 - 团队十年电商经验汇集巨献!
  4. * =========================================================
  5. * Copy right 2019-2029 山西牛酷信息科技有限公司, 保留所有权利。
  6. * ----------------------------------------------
  7. * 官方网址: https://www.niushop.com.cn
  8. * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用。
  9. * 任何企业和个人不允许对程序代码以任何形式任何目的再发布。
  10. * =========================================================
  11. */
  12. namespace app\model\express;
  13. use app\model\system\Config as ConfigModel;
  14. use app\model\BaseModel;
  15. /**
  16. * 配送配置
  17. */
  18. class Config extends BaseModel
  19. {
  20. /*********************************************************************** 物流配送 start ***********************************************************************/
  21. /**
  22. * 物流配送配置
  23. * @param $site_id
  24. * @return \multitype
  25. */
  26. public function getExpressConfig($site_id){
  27. $config = new ConfigModel();
  28. $res = $config->getConfig([['site_id', '=', $site_id], ['app_module', '=', 'shop'], ['config_key', '=', 'EXPRESS_CONFIG']]);
  29. return $res;
  30. }
  31. /**
  32. * 设置物流配送配置
  33. * @param $data
  34. * @return \multitype
  35. */
  36. public function setExpressConfig($data, $is_use, $site_id)
  37. {
  38. if ($site_id === '') {
  39. return $this->error('', 'REQUEST_SITE_ID');
  40. }
  41. $config = new ConfigModel();
  42. $res = $config->setConfig($data, '物流配送设置', $is_use, [['site_id', '=', $site_id], ['app_module', '=', 'shop'], ['config_key', '=', 'EXPRESS_CONFIG']]);
  43. return $res;
  44. }
  45. /*********************************************************************** 物流配送 end ***********************************************************************/
  46. /*********************************************************************** 门店自提 start ***********************************************************************/
  47. /**
  48. * 门店自提配置
  49. * @param $site_id
  50. * @return \multitype
  51. */
  52. public function getStoreConfig($site_id){
  53. $config = new ConfigModel();
  54. $res = $config->getConfig([['site_id', '=', $site_id], ['app_module', '=', 'shop'], ['config_key', '=', 'EXPRESS_STORE_CONFIG']]);
  55. return $res;
  56. }
  57. /**
  58. * 设置门店自提配置
  59. * @param $data
  60. * @return \multitype
  61. */
  62. public function setStoreConfig($data, $is_use, $site_id)
  63. {
  64. if ($site_id === '') {
  65. return $this->error('', 'REQUEST_SITE_ID');
  66. }
  67. $config = new ConfigModel();
  68. $res = $config->setConfig($data, '门店自提配置设置', $is_use, [['site_id', '=', $site_id], ['app_module', '=', 'shop'], ['config_key', '=', 'EXPRESS_STORE_CONFIG']]);
  69. return $res;
  70. }
  71. /*********************************************************************** 门店自提 end ***********************************************************************/
  72. /*********************************************************************** 外卖配送 start ***********************************************************************/
  73. /**
  74. * 外卖配送配置
  75. * @param $site_id
  76. * @return \multitype
  77. */
  78. public function getLocalDeliveryConfig($site_id){
  79. $config = new ConfigModel();
  80. $res = $config->getConfig([['site_id', '=', $site_id], ['app_module', '=', 'shop'], ['config_key', '=', 'EXPRESS_LOCAL_DELIVERY_CONFIG']]);
  81. return $res;
  82. }
  83. /**
  84. * 设置外卖配送配置
  85. * @param $data
  86. * @return \multitype
  87. */
  88. public function setLocalDeliveryConfig($data, $is_use, $site_id)
  89. {
  90. if ($site_id === '') {
  91. return $this->error('', '缺少必须参数站点id');
  92. }
  93. $config = new ConfigModel();
  94. $res = $config->setConfig($data, '外卖配送配置设置', $is_use, [['site_id', '=', $site_id], ['app_module', '=', 'shop'], ['config_key', '=', 'EXPRESS_LOCAL_DELIVERY_CONFIG']]);
  95. return $res;
  96. }
  97. /*********************************************************************** 外卖配送 end ***********************************************************************/
  98. }