Config.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. namespace app\controller\merchant\system\serve;
  3. use app\common\repositories\system\config\ConfigValueRepository;
  4. use app\common\repositories\system\serve\ServeOrderRepository;
  5. use ln\basic\BaseController;
  6. use app\common\repositories\system\merchant\MerchantRepository;
  7. use think\App;
  8. use think\facade\Cache;
  9. class Config extends BaseController
  10. {
  11. /**
  12. * @var ServeOrderRepository
  13. */
  14. protected $repository;
  15. /**
  16. * Merchant constructor.
  17. * @param App $app
  18. * @param ServeOrderRepository $repository
  19. */
  20. public function __construct(App $app, ServeOrderRepository $repository)
  21. {
  22. parent::__construct($app);
  23. $this->repository = $repository;
  24. }
  25. public function info()
  26. {
  27. $sms_info = Cache::get('serve_account');
  28. $mer_id = $this->request->merId();
  29. $ret = app()->make(MerchantRepository::class)->get($mer_id);
  30. $data['mer_id'] = $ret['mer_id'];
  31. $data = [
  32. 'info' =>$sms_info,
  33. 'copy_product_status' => systemConfig('copy_product_status'),
  34. 'copy_product_num' => $ret['copy_product_num'],
  35. 'crmeb_serve_dump' => systemConfig('crmeb_serve_dump'),
  36. 'export_dump_num' => $ret['export_dump_num'],
  37. ];
  38. return app('json')->success($data);
  39. }
  40. public function getConfig()
  41. {
  42. $merId = $this->request->merId();
  43. $config = [
  44. 'mer_from_com',
  45. 'mer_from_name',
  46. 'mer_from_tel',
  47. 'mer_from_addr',
  48. 'mer_config_siid',
  49. 'mer_config_temp_id'
  50. ];
  51. $data = merchantConfig($merId,$config);
  52. return app('json')->success($data);
  53. }
  54. public function setConfig()
  55. {
  56. $config = [
  57. 'mer_from_com',
  58. 'mer_from_name',
  59. 'mer_from_tel',
  60. 'mer_from_addr',
  61. 'mer_config_siid',
  62. 'mer_config_temp_id'
  63. ];
  64. $data = $this->request->params($config);
  65. app()->make(ConfigValueRepository::class)->setFormData($data,$this->request->merId());
  66. return app('json')->success('保存成功');
  67. }
  68. }