diff --git a/app/wechat/service/FansService.php b/app/wechat/service/FansService.php index 841e0674c..c92beeafa 100644 --- a/app/wechat/service/FansService.php +++ b/app/wechat/service/FansService.php @@ -34,7 +34,7 @@ class FansService extends Service * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ - public function set(array $user, $appid = '') + public function set(array $user, string $appid = '') { if (!empty($user['subscribe_time'])) { $user['subscribe_at'] = date('Y-m-d H:i:s', $user['subscribe_time']); @@ -55,7 +55,7 @@ class FansService extends Service * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ - public function get($openid) + public function get(string $openid) { return $this->app->db->name('WechatFans')->where(['openid' => $openid])->find(); } diff --git a/app/wechat/service/MediaService.php b/app/wechat/service/MediaService.php index ba0ee3f7c..632adac9b 100644 --- a/app/wechat/service/MediaService.php +++ b/app/wechat/service/MediaService.php @@ -61,7 +61,7 @@ class MediaService extends Service * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ - public function upload($url, $type = 'image', $video = []) + public function upload(string $url, string $type = 'image', array $video = []) { $map = ['md5' => md5($url), 'appid' => WechatService::instance()->getAppid()]; if (($mediaId = $this->app->db->name('WechatMedia')->where($map)->value('media_id'))) return $mediaId; @@ -79,7 +79,7 @@ class MediaService extends Service * @return string * @throws \WeChat\Exceptions\LocalCacheException */ - private function _buildCurlFile($local) + private function _buildCurlFile(string $local) { if (file_exists($local)) { return new MyCurlFile($local); diff --git a/app/wechat/service/WechatService.php b/app/wechat/service/WechatService.php index f7810d82b..68f7ac93f 100644 --- a/app/wechat/service/WechatService.php +++ b/app/wechat/service/WechatService.php @@ -95,7 +95,7 @@ class WechatService extends Service * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ - public static function __callStatic($name, $arguments) + public static function __callStatic(string $name, array $arguments) { [$type, $class, $classname] = self::paraseName($name); if ("{$type}{$class}" !== $name) { @@ -132,7 +132,7 @@ class WechatService extends Service * @param string $name * @return array */ - private static function paraseName($name) + private static function paraseName(string $name) { foreach (['WeChat', 'WeMini', 'WeOpen', 'WePay', 'ThinkService'] as $type) { if (strpos($name, $type) === 0) { @@ -220,7 +220,7 @@ class WechatService extends Service * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ - public function getWebOauthInfo($source, $isfull = 0, $redirect = true) + public function getWebOauthInfo(string $source, $isfull = 0, $redirect = true) { $appid = $this->getAppid(); $openid = $this->app->session->get("{$appid}_openid"); @@ -265,7 +265,7 @@ class WechatService extends Service /** * 获取微信网页JSSDK - * @param string $location JS签名地址 + * @param null|string $location 签名地址 * @return array * @throws \WeChat\Exceptions\InvalidResponseException * @throws \WeChat\Exceptions\LocalCacheException @@ -274,7 +274,7 @@ class WechatService extends Service * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ - public function getWebJssdkSign($location = null) + public function getWebJssdkSign(?string $location = null) { $location = is_null($location) ? $this->app->request->url(true) : $location; if ($this->getType() === 'api') {