[fix] NotLoginError fixed#184

This commit is contained in:
Lkeme 2022-08-31 17:23:50 +08:00
parent 0faf5baf64
commit 0c32ce0256
2 changed files with 11 additions and 8 deletions

View File

@ -111,15 +111,20 @@ class MainSite extends BasePlugin
* 投币
* @param string $aid
* @return void
* @throws NoLoginException
*/
protected function reward(string $aid): void
{
$response = ApiCoin::coin($aid);
//
if ($response['code']) {
Log::warning("主站任务: $aid 投币失败 {$response['code']} -> {$response['message']}");
} else {
Log::notice("主站任务: $aid 投币成功");
switch ($response['code']) {
case -101:
throw new NoLoginException($response['message']);
case 0:
Log::notice("主站任务: $aid 投币成功");
break;
default:
Log::warning("主站任务: $aid 投币失败 {$response['code']} -> {$response['message']}");
}
}
@ -280,7 +285,7 @@ class MainSite extends BasePlugin
//
$response = ApiShare::share($aid);
switch ($response['code']) {
case 137004:
case -101:
throw new NoLoginException($response['message']);
case 0:
Log::notice("主站任务: $aid 分享成功");

View File

@ -25,7 +25,6 @@ class ApiShare
/**
* 分享视频
* @param string $aid
* @param string $cid
* @return array
*/
public static function share(string $aid): array
@ -37,7 +36,6 @@ class ApiShare
//
$payload = [
'aid' => $aid,
'jsonp' => "jsonp",
'csrf' => $user['csrf'],
];
$headers = [
@ -48,4 +46,4 @@ class ApiShare
return Request::postJson(true, 'pc', $url, $payload, $headers);
}
}
}