代码增加注释

This commit is contained in:
Anyon 2020-10-24 15:36:54 +08:00
parent e62246c6b2
commit 34f9926d7e
3 changed files with 9 additions and 9 deletions

View File

@ -34,7 +34,7 @@ class FansService extends Service
* @throws \think\db\exception\DbException * @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
*/ */
public function set(array $user, $appid = '') public function set(array $user, string $appid = '')
{ {
if (!empty($user['subscribe_time'])) { if (!empty($user['subscribe_time'])) {
$user['subscribe_at'] = date('Y-m-d H:i:s', $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\DbException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
*/ */
public function get($openid) public function get(string $openid)
{ {
return $this->app->db->name('WechatFans')->where(['openid' => $openid])->find(); return $this->app->db->name('WechatFans')->where(['openid' => $openid])->find();
} }

View File

@ -61,7 +61,7 @@ class MediaService extends Service
* @throws \think\db\exception\DbException * @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException * @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()]; $map = ['md5' => md5($url), 'appid' => WechatService::instance()->getAppid()];
if (($mediaId = $this->app->db->name('WechatMedia')->where($map)->value('media_id'))) return $mediaId; if (($mediaId = $this->app->db->name('WechatMedia')->where($map)->value('media_id'))) return $mediaId;
@ -79,7 +79,7 @@ class MediaService extends Service
* @return string * @return string
* @throws \WeChat\Exceptions\LocalCacheException * @throws \WeChat\Exceptions\LocalCacheException
*/ */
private function _buildCurlFile($local) private function _buildCurlFile(string $local)
{ {
if (file_exists($local)) { if (file_exists($local)) {
return new MyCurlFile($local); return new MyCurlFile($local);

View File

@ -95,7 +95,7 @@ class WechatService extends Service
* @throws \think\db\exception\DbException * @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException * @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); [$type, $class, $classname] = self::paraseName($name);
if ("{$type}{$class}" !== $name) { if ("{$type}{$class}" !== $name) {
@ -132,7 +132,7 @@ class WechatService extends Service
* @param string $name * @param string $name
* @return array * @return array
*/ */
private static function paraseName($name) private static function paraseName(string $name)
{ {
foreach (['WeChat', 'WeMini', 'WeOpen', 'WePay', 'ThinkService'] as $type) { foreach (['WeChat', 'WeMini', 'WeOpen', 'WePay', 'ThinkService'] as $type) {
if (strpos($name, $type) === 0) { if (strpos($name, $type) === 0) {
@ -220,7 +220,7 @@ class WechatService extends Service
* @throws \think\db\exception\DbException * @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException * @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(); $appid = $this->getAppid();
$openid = $this->app->session->get("{$appid}_openid"); $openid = $this->app->session->get("{$appid}_openid");
@ -265,7 +265,7 @@ class WechatService extends Service
/** /**
* 获取微信网页JSSDK * 获取微信网页JSSDK
* @param string $location JS签名地址 * @param null|string $location 签名地址
* @return array * @return array
* @throws \WeChat\Exceptions\InvalidResponseException * @throws \WeChat\Exceptions\InvalidResponseException
* @throws \WeChat\Exceptions\LocalCacheException * @throws \WeChat\Exceptions\LocalCacheException
@ -274,7 +274,7 @@ class WechatService extends Service
* @throws \think\db\exception\DbException * @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException * @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; $location = is_null($location) ? $this->app->request->url(true) : $location;
if ($this->getType() === 'api') { if ($this->getType() === 'api') {