CorrectMemCnt.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /**
  3. * CorrectMemCnt.php UTF-8
  4. * 玩家风险数据
  5. *
  6. * @date : 2018/10/24 10:37
  7. *
  8. * @license 这不是一个自由软件,未经授权不许任何使用和传播。
  9. * @author : chenbingling <cbl@huosdk.com>
  10. * @version : HuoMap 1.0
  11. */
  12. namespace console\index\controller;
  13. use huo\controller\agent\AgentCache;
  14. use huo\model\member\MemberModel;
  15. use huo\model\user\UserModel;
  16. use think\console\Command;
  17. use think\console\Input;
  18. use think\console\Output;
  19. class CorrectMemCnt extends Command {
  20. protected function configure() {
  21. $this->setName('correct_mem_cnt')->setDescription('玩家邀请数量修正');
  22. }
  23. protected function execute(Input $input, Output $output) {
  24. set_time_limit(0);
  25. $_member_model = new MemberModel();
  26. $_user_model = new UserModel();
  27. $_agent_cache = AgentCache::ins();
  28. $_member_model->chunk(
  29. 10, function ($members) use ($_member_model, $_user_model, $_agent_cache) {
  30. foreach ($members as $member) {
  31. /* 数据报表 */
  32. $_agent_id = $_user_model->getIdByMemId($member['id']);
  33. if (empty($_agent_id)) {
  34. continue;
  35. }
  36. $_user_cnt = $_member_model->where(['parent_mem_id' => $member['id']])->count('id');
  37. if (false != $_user_cnt) {
  38. $ae_data['reg_cnt'] = $_user_cnt;
  39. $_agent_cache->updateAgentExt($_agent_id, $ae_data, true);
  40. }
  41. }
  42. }
  43. );
  44. }
  45. }