Setting.php 769 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /**
  3. *
  4. * @copyright ©2020 点小铺
  5. * @author hanj
  6. * @link: https://dyuit.com
  7. * Created by VSCode
  8. */
  9. namespace app\admin\model;
  10. use app\common\model\Setting as SettingModel;
  11. /**
  12. * 商城设置模型
  13. * Class Setting
  14. * @package app\admin\model
  15. */
  16. class Setting extends SettingModel
  17. {
  18. /**
  19. * 新增默认配置
  20. * @param $wxapp_id
  21. * @param $store_name
  22. * @return array|false
  23. * @throws \Exception
  24. */
  25. public function insertDefault($wxapp_id, $store_name)
  26. {
  27. // 添加商城默认设置记录
  28. $data = [];
  29. foreach ($this->defaultData($store_name) as $key => $item) {
  30. $data[] = array_merge($item, ['wxapp_id' => $wxapp_id]);
  31. }
  32. return $this->saveAll($data);
  33. }
  34. }