123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- <?php
- namespace app\api\controller;
- use app\common\controller\Api;
- use GatewayClient\Gateway;
- use think\Request;
- use Redis;
- class Gatewayworker extends Api
- {
- protected $noNeedLogin = ["userIsOnline","clearCharm","test"];
- protected $noNeedRight = ['*'];
- public function __construct(Request $request = null) {
- parent::__construct($request);
- $params_from = $this->request->request('params_from');
- if($params_from == "wxmin") {
- Gateway::$registerAddress = "127.0.0.1:1239";
- } else {
- Gateway::$registerAddress = "127.0.0.1:1238";
- }
- }
- public function test() {
- $client_id = $this->request->request('client_id');
- print_r(Gateway::getAllUidCount());exit;
- }
-
- public function bind() {
- $client_id = $this->request->request('client_id');
- if(!$client_id) {
- $this->error("请传入客户端ID");
- }
- $user_id = $this->auth->id;
-
- Gateway::bindUid($client_id, $user_id);
-
- \app\common\model\User::update(["is_online"=>1],["id"=>$user_id]);
- $this->success("绑定成功!");
- }
-
-
- public function userIsOnline() {
- }
-
- public function clearCharm() {
-
-
- }
-
- }
|