123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- namespace app\Repositories\Eloquent;
- use App\Repositories\Eloquent\BaseRepository;
- use App\Repositories\Contracts\ThirdH5ChatInterface;
- /**
- *
- * @author lilin
- *
- */
- class ThirdH5ChatFacadeRepository extends BaseRepository implements ThirdH5ChatInterface
- {
- public function getChatUrl($uid, $nickname, $headUrl)
- {
- $this->setLog(self::TYPENAME.'getChatUrl step_1 开始', $this->startTime());
-
- $url = config('console.thirdH5Chat.url');
- $secret = config('console.thirdH5Chat.secret');
-
- $parameter = [
- 'appid' => config('console.thirdH5Chat.appid'),
- 'user_key' => urlencode($uid),
- 'nick_name' => $nickname,
- 'head_url' => urlencode($headUrl)
- ];
- $this->setLog(self::TYPENAME.'getChatUrl step_2 请求参数', $this->startTime, $parameter);
-
- //token算法是 appid+user_key+secret
- $str = $parameter['appid'].$uid.$secret;
- $parameter['token'] = md5($str);
-
- $this->setLog(self::TYPENAME.'getChatUrl step_3 加入token', $this->startTime, $parameter);
-
- $query = '';
- foreach ($parameter as $key => $value) {
- $query .= '&'.$key . '=' . $value;
- }
-
- return $this->response($url.$query);
- }
-
- }
|