create(); // $this->login(); // $this->charge(); echo 'test'; exit; } /** * 添加游戏 */ public function addGame() { } /** * 创建账号 * * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException */ public function create() { $_map['create_time'] = ['between', ['1527782400', '2527782400']]; $_map = []; $_data = (new MemberModel())->with('ext')->where($_map)->field('id,username,app_id,create_time,update_time') ->select(); $_cnt = 0; foreach ($_data as $_k => $_v) { $_v = $_v->toArray(); print_r($_v['id'].' '); // print_r('
'); $_game_rq = $this->setGameData(); $_channel_rq = $this->setChannelData(); $_device_rq = $this->setDeviceData(); $_mem_rq = $this->setMemData(); $_mem_rq->setMemId($_v['id']); /* 异步处理数据 */ $_mem_rq->setRegTime($_v['create_time']); $_mem_rq->setLoginTime($_v['ext']['last_login_time']); $_channel_rq->setCh($_v['agent_id']); $_game_rq->setHAppId($_v['app_id']); (new \huo\controller\queue\Mem($_game_rq->getHAppId()))->create( $_device_rq, $_game_rq, $_channel_rq, $_mem_rq ); $_cnt++; } $this->g_i += $_cnt; print_r('create ok'.PHP_EOL.$_cnt); } /** * 玩家登陆 * * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException */ public function login() { $_cnt = 0; for ($_i = 5; $_i < 7; $_i++) { $_date = '2018-0'.$_i; $_data = (new MemLoginLogModel())->computeTable($_date)->where('mem_id>0')->select(); foreach ($_data as $_k => $_v) { $_v = $_v->toArray(); print_r($_v['id'].' '); $_game_rq = $this->setGameData(); $_channel_rq = $this->setChannelData(); $_device_rq = $this->setDeviceData(); $_mem_rq = $this->setMemData(); /* 异步处理数据 */ $_mem_rq->setMemId($_v['mem_id']); $_mem_rq->setMgMemId($_v['mg_mem_id']); $_mem_rq->setRegTime($_v['reg_time']); $_mem_rq->setLoginTime($_v['create_time']); $_channel_rq->setCh($_v['agent_id']); $_game_rq->setHAppId($_v['app_id']); (new \huo\controller\queue\Mem($_game_rq->getHAppId()))->online( $_device_rq, $_game_rq, $_channel_rq, $_mem_rq ); $_cnt++; } } $this->g_i += $_cnt; print_r('login ok'.PHP_EOL.$_cnt); } /** * 玩家充值 */ public function charge() { $_map['status'] = 2; $_order_ids = (new OrderModel())->where($_map)->limit(0, 100000)->order('id asc')->column('order_id'); foreach ($_order_ids as $_k => $order_id) { print_r($order_id.' '); (new \huo\controller\queue\Order())->fromSdkOrder($order_id); } $this->g_i += count($_order_ids); $_map['order_id'] = ['in', $_order_ids]; print_r((new OrderModel())->where($_map)->order('id asc')->sum('amount')); print_r(PHP_EOL.'g_i='.$this->g_i); } /** * @return Device */ public function setDeviceData() { $_device = new Device(); return $_device; } /** * @return Game */ public function setGameData() { $_game = new Game(); return $_game; } /** * @return Channel * */ public function setChannelData() { $_channel = new Channel(); return $_channel; } /** * 设置玩家入参 * * @param bool $is_reg * * @return Mem */ public function setMemData($is_reg = false) { $_mem = new Mem(); return $_mem; } }