Goods.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /**
  3. * Niushop商城系统 - 团队十年电商经验汇集巨献!
  4. * =========================================================
  5. * Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
  6. * ----------------------------------------------
  7. * 官方网址: https://www.niushop.com
  8. * =========================================================
  9. */
  10. namespace addon\goodscircle\api\controller;
  11. use addon\goodscircle\model\GoodsCircle;
  12. use app\api\controller\BaseApi;
  13. use addon\goodscircle\model\Config as ConfigModel;
  14. /**
  15. * 好物圈
  16. */
  17. class Goods extends BaseApi
  18. {
  19. /**
  20. * 将商品同步到好物圈
  21. */
  22. public function sync()
  23. {
  24. $config_model = new ConfigModel();
  25. $config = $config_model->getGoodscircleConfig($this->site_id);
  26. $config = $config[ 'data' ];
  27. if (isset($config[ 'is_use' ]) && $config[ 'is_use' ]) {
  28. $goods_circle = new GoodsCircle($this->site_id);
  29. $res = $goods_circle->importProduct($this->params[ 'goods_id' ]);
  30. return $this->response($res);
  31. } else {
  32. return $this->response($this->error());
  33. }
  34. }
  35. }