RandFee.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace common\globals;
  3. use common\logic\common\AddonsLimit;
  4. /**
  5. * 随机减全局调用
  6. */
  7. class RandFee extends BaseGlobal
  8. {
  9. /**
  10. * Undocumented function
  11. *
  12. * @param array $invokes
  13. * @param array $params
  14. * @return void
  15. */
  16. public function getRandFee($invokes, $params = [])
  17. {
  18. foreach ($invokes as $invoke) {
  19. // 检查是否安装插件
  20. if (AddonsLimit::goodsModel($invoke['addons_name'], $params['mall_id']) == false) continue;
  21. // 获取跟人对应插件资产
  22. $params['addons_name'] = $invoke['addons_name'];
  23. $res = $this->invoke($invoke['class'], $invoke['method'], $params);
  24. if($res){
  25. $res = list($rand_fee, $models, $rand_rule) = $res;
  26. return [$rand_fee, $models, $rand_rule];
  27. }
  28. }
  29. return 0;
  30. }
  31. /**
  32. * 验证调用结果
  33. * @param mixed $return
  34. * @return boolean
  35. */
  36. protected function validateGetRandFee($return = null): bool
  37. {
  38. return true;
  39. }
  40. }