| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- namespace app\extra\douyin;
- use yzh52521\EasyHttp\Http;
- class Crypt extends Base
- {
- public function getSessionKey(string $code = "")
- {
- $url = "https://developer.toutiao.com/api/apps/v2/jscode2session";
- $param = [
- "appid" => $this->config['appid'],
- "secret" => $this->config['secret'],
- "code" => $code
- ];
- $resp = Http::asJson()->post($url,$param)->array();
- print_r($resp);
- if ($resp['err_no'] == 0) {
- return $resp['data'];
- }
- return [];
- }
- /**
- * 查询标签组信息 - 用于支付
- * @param int $goods_type
- */
- public function getTagGroupId(int $goods_type)
- {
- $url = $this->gateway."api/trade_basic/v1/developer/tag_query/";
- $param = [
- "goods_type" => $goods_type
- ];
- $resp = Http::asJson()->withHeaders($this->header)->post($url,$param)->array();
- if ($resp['err_no'] == 0) {
- return $resp['data'];
- }
- return [];
- }
- /**
- * 小程序获取手机号码
- * @param string $code
- * @return string
- */
- public function getMobile(string $code = ""):string
- {
- $url = $this->gateway."api/apps/v1/get_phonenumber_info/";
- $param = [
- "code" => $code
- ];
- $resp = Http::asJson()->withHeaders($this->header)->post($url,$param)->array();
- if ($resp['err_no'] == 0) {
- return $resp['data'];
- }
- return "";
- }
- }
|