TaskService.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | Niucloud-admin 企业快速开发的saas管理平台
  4. // +----------------------------------------------------------------------
  5. // | 官方网址:https://www.niucloud.com
  6. // +----------------------------------------------------------------------
  7. // | niucloud团队 版权所有 开源版本可自由商用
  8. // +----------------------------------------------------------------------
  9. // | Author: Niucloud Team
  10. // +----------------------------------------------------------------------
  11. namespace app\service\api\sys;
  12. use app\service\core\member\CoreMemberConfigService;
  13. use app\service\core\member\CoreMemberService;
  14. use app\service\core\scan\CoreScanService;
  15. use core\base\BaseApiService;
  16. use core\dict\DictLoader;
  17. /**
  18. * Class BaseService
  19. * @package app\service
  20. */
  21. class TaskService extends BaseApiService
  22. {
  23. public function __construct()
  24. {
  25. parent::__construct();
  26. }
  27. /**
  28. * 获取成长值任务
  29. * @param string $key
  30. * @return mixed
  31. */
  32. public function getGrowthTask()
  33. {
  34. $growth_config = (new CoreMemberConfigService())->getGrowthRuleConfig();
  35. if (!empty($growth_config)) {
  36. $growth_config = CoreMemberService::getGrowthRuleContent($this->site_id, $growth_config, 'task');
  37. $growth_config = array_values(array_filter(array_map(function ($item) {
  38. if ($item['content']) return $item['content'];
  39. }, $growth_config)));
  40. }
  41. return $growth_config;
  42. }
  43. /**
  44. * 获取积分任务
  45. * @param string $key
  46. * @return mixed
  47. */
  48. public function getPointTask()
  49. {
  50. $point_config = (new CoreMemberConfigService())->getPointRuleConfig()['grant'] ?? [];
  51. if (!empty($point_config)) {
  52. $point_config = CoreMemberService::getPointGrantRuleContent($this->site_id, $point_config, 'task');
  53. $point_config = array_values(array_filter(array_map(function ($item) {
  54. if ($item['content']) return $item['content'];
  55. }, $point_config)));
  56. }
  57. return $point_config;
  58. }
  59. }