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

View File

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