| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php
- namespace App\Game\Services;
- use App\Game\Telegram\TelegramUser;
- class TelegramAppService
- {
- protected $client;
- protected $baseUrl;
- public $secretKey;
- public $token;
- public $salt;
- public function __construct()
- {
- }
- /**
- * @param string $hash
- * @return TelegramUser
- */
- public static function decodeHash(string $hash){
- $data=[];
- parse_str(urldecode($hash),$data);
- if(isset($data['user'])){
- $user=json_decode($data['user'],true);
- $user['chat_instance']=$data['chat_instance'];
- $user['chat_type']=$data['chat_type'];
- $teleUser=TelegramUser::query()->where('id',$user['id'])->first();
- if(!$teleUser)$teleUser=TelegramUser::create($user);
- $teleUser->increment('enter_times',1);
- // dd($teleUser);
- return $teleUser;
- }
- dd($data);
- }
- }
|