123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- /**
- * Created by PhpStorm.
- * User: stanley-king
- * Date: 2017/12/24
- * Time: 下午1:05
- */
- namespace room;
- use search\tcp_client;
- class access_client extends tcp_client
- {
- protected static $stInstance;
- public function __construct()
- {
- parent::__construct();
- $this->mBodyType = tcp_client::JsonType;
- }
- public static function instance()
- {
- if(self::$stInstance == null) {
- self::$stInstance = new factory_client();
- }
- return self::$stInstance;
- }
- public function __destruct()
- {
- parent::__destruct();
- }
- public function remote_addr()
- {
- global $config;
- $host = $config['room_srv']['host'];
- $port = $config['room_srv']['port'];
- return "{$host}:{$port}";
- }
- public function join($room,$room_key)
- {
- $param = ["act" => 'factory','op' => 'create', "type" => 'bargain_goods','params' => ['goods_id' => $goods_id,'user' => $user]];
- $result = $this->request($param);
- if(empty($result)) return false;
- $code = intval($result['code']);
- if($code != 200) {
- return false;
- }
- else {
- return true;
- }
- }
- }
|