AbstractService.php 955 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace addons\WechatVideoShop\common\service;
  3. use addons\WechatVideoShop\common\enums\WechatVideoShopEnums;
  4. use addons\WechatVideoShop\common\models\WechatVideoShop;
  5. abstract class AbstractService
  6. {
  7. protected $shop_id = 0;
  8. protected $mall_id = 0;
  9. protected $customer_num = 0; // 消费次数
  10. protected $config = [];
  11. public function __construct(int $shop_id = 0, int $mall_id = 0, int $customer_num = 0)
  12. {
  13. $this->mall_id = $mall_id;
  14. $this->customer_num = $customer_num;
  15. if (!empty($shop_id)) {
  16. $this->shop_id = $shop_id;
  17. // 读取店铺ID
  18. $this->config = WechatVideoShop::getOne([
  19. ['id' => $shop_id]
  20. ], true);
  21. // 现在需要通过店铺去获取配置信息
  22. // $this->config = \Yii::$app->services->setting->addons->get($mall_id, WechatVideoShopEnums::ADDONS_NAME, 'basic') ?? [];
  23. }
  24. }
  25. }