|
@@ -2,6 +2,7 @@
|
|
|
|
|
|
|
|
namespace app\index\controller;
|
|
namespace app\index\controller;
|
|
|
|
|
|
|
|
|
|
+use think\db\Where;
|
|
|
use think\facade\Db;
|
|
use think\facade\Db;
|
|
|
use app\middleware\Log;
|
|
use app\middleware\Log;
|
|
|
use think\facade\Cache;
|
|
use think\facade\Cache;
|
|
@@ -71,12 +72,26 @@ class Index extends Controller
|
|
|
}
|
|
}
|
|
|
FacadeLog::info($sub);
|
|
FacadeLog::info($sub);
|
|
|
$userInfoRes = (new WeiboService($uid))->userinfo($sub);
|
|
$userInfoRes = (new WeiboService($uid))->userinfo($sub);
|
|
|
- if (empty($userInfoRes) || $userInfoRes['code'] != 10000) {
|
|
|
|
|
|
|
+ if (empty($userInfoRes) || $userInfoRes['ok'] != 1) {
|
|
|
return $this->response(403, $userInfoRes['msg'] ?? '没有登录');
|
|
return $this->response(403, $userInfoRes['msg'] ?? '没有登录');
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
// 使用客户端信息生成token
|
|
// 使用客户端信息生成token
|
|
|
$token = md5($_SERVER['HTTP_USER_AGENT'] . $_SERVER['HTTP_ACCEPT_ENCODING'] . $_SERVER['HTTP_ACCEPT_LANGUAGE'] . $_SERVER['HTTP_REFERER'] . get_client_ip(0) . $userInfoRes['data']['uid']);
|
|
$token = md5($_SERVER['HTTP_USER_AGENT'] . $_SERVER['HTTP_ACCEPT_ENCODING'] . $_SERVER['HTTP_ACCEPT_LANGUAGE'] . $_SERVER['HTTP_REFERER'] . get_client_ip(0) . $userInfoRes['data']['uid']);
|
|
|
$user = $userInfoRes['data'];
|
|
$user = $userInfoRes['data'];
|
|
|
|
|
+
|
|
|
|
|
+ $userInfo = Db::table('awards_user_info')->where('uid', $user['uid'])->find();
|
|
|
|
|
+ if (empty($userInfo)) {
|
|
|
|
|
+ $userAttr = [
|
|
|
|
|
+ 'uid' => $user['uid'],
|
|
|
|
|
+ 'portrait' => $user['profile_image_url'],
|
|
|
|
|
+ 'nickname' => $user['name']
|
|
|
|
|
+ ];
|
|
|
|
|
+ if (0 == Db::table('awards_user_info')->insert($userAttr)) {
|
|
|
|
|
+ return $this->response(5001, '系统错误,请稍后再试~');
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 生成加密用的密钥和向量
|
|
// 生成加密用的密钥和向量
|
|
|
$cipher = "aes-256-gcm";
|
|
$cipher = "aes-256-gcm";
|
|
|
$ivlen = openssl_cipher_iv_length($cipher);
|
|
$ivlen = openssl_cipher_iv_length($cipher);
|
|
@@ -117,12 +132,12 @@ class Index extends Controller
|
|
|
return $this->response(5001, '系统错误,请稍后再试~');
|
|
return $this->response(5001, '系统错误,请稍后再试~');
|
|
|
}
|
|
}
|
|
|
} else if ($userTask['finish_state'] == 0 && $userTask['share_add_votes'] == 0) {
|
|
} else if ($userTask['finish_state'] == 0 && $userTask['share_add_votes'] == 0) {
|
|
|
- $count = Db::table('awards_user_task_log')->where('uid', Safe::$user['uid'])->where('date', $date)->count('id');
|
|
|
|
|
|
|
+ $count = Db::table('awards_user_task_log')->where('uid', $user['uid'])->where('date', $date)->count('id');
|
|
|
if ($count < 1) {
|
|
if ($count < 1) {
|
|
|
$first = 1;
|
|
$first = 1;
|
|
|
}
|
|
}
|
|
|
} else if ($userTask['finish_state'] > 0 && $userTask['share_add_votes'] > 0) {
|
|
} else if ($userTask['finish_state'] > 0 && $userTask['share_add_votes'] > 0) {
|
|
|
- $count = Db::table('awards_user_task_log')->where('uid', Safe::$user['uid'])->where('date', $date)->count('id');
|
|
|
|
|
|
|
+ $count = Db::table('awards_user_task_log')->where('uid', $user['uid'])->where('date', $date)->count('id');
|
|
|
if ($count < 2) {
|
|
if ($count < 2) {
|
|
|
$first = 1;
|
|
$first = 1;
|
|
|
}
|
|
}
|