|
@@ -930,6 +930,19 @@ class User extends Api
|
|
|
$userInfo['wechat'] = '******';
|
|
|
}
|
|
|
|
|
|
+ //查询在线状态和活跃状态
|
|
|
+ $user_info = Db::name('user_info')->where(['user_id' => $user_id])->find();
|
|
|
+ $asktime = explode(',', $user_info['asktime']);
|
|
|
+ if ($user_info && $asktime && time() - $asktime[count($asktime) - 1] <= 3600) {
|
|
|
+ $userInfo['is_online'] = 1; //0离线 1在线
|
|
|
+ } else {
|
|
|
+ $userInfo['is_online'] = 0; //0离线 1在线
|
|
|
+ }
|
|
|
+ if ($user_info && count($asktime) >= 20 && $asktime[count($asktime) - 1] - $asktime[0] <= 86400) {
|
|
|
+ $userInfo['is_active'] = 1; //活跃
|
|
|
+ } else {
|
|
|
+ $userInfo['is_active'] = 0; //不活跃
|
|
|
+ }
|
|
|
// 获取已有标签以及数量
|
|
|
$userInfo['tagUser'] = \app\common\model\TagUser::alias('a')
|
|
|
->field('a.id,t.name,a.number')
|
|
@@ -978,6 +991,15 @@ class User extends Api
|
|
|
$userInfo['wechat_auth_stauts'] = \app\common\model\WechatAuth::getAuthStatus($userInfo['id'],$userInfo['wechat_auth']);
|
|
|
$userInfo['declaration_auth_stauts'] = $userInfo['declaration_auth'] !== '' ? \app\common\model\DeclarationAuth::getAuthStatus($userInfo['id'],$userInfo['declaration_auth']) : 1;
|
|
|
|
|
|
+ //查询在线状态和活跃状态
|
|
|
+ $user_info = Db::name('user_info')->where(['user_id' => $user_id])->find();
|
|
|
+ $asktime = explode(',', $user_info['asktime']);
|
|
|
+ $userInfo['is_online'] = time() - $asktime[count($asktime) - 1] > 3600 ? 0 : 1; //0离线 1在线
|
|
|
+ if (count($asktime) >= 20 && $asktime[count($asktime) - 1] - $asktime[0] <= 86400) {
|
|
|
+ $userInfo['is_active'] = 1; //活跃
|
|
|
+ } else {
|
|
|
+ $userInfo['is_active'] = 0; //不活跃
|
|
|
+ }
|
|
|
|
|
|
// $userInfo = $userInfo->toArray();
|
|
|
// $redis->hMSet('userInfo_'.$user_id,encodeArray($userInfo));
|
|
@@ -1355,4 +1377,42 @@ class User extends Api
|
|
|
|
|
|
$this->success('设置成功', $status);
|
|
|
}
|
|
|
+
|
|
|
+ //收集收集信息
|
|
|
+ public function collectmobileinfo() {
|
|
|
+ $system = input('system', '', 'trim'); //系统
|
|
|
+ $mobilemodel = input('mobilemodel', '', 'trim'); //手机型号
|
|
|
+ $mobilebrand = input('mobilebrand', '', 'trim'); //手机品牌
|
|
|
+
|
|
|
+ if (!$system || !$mobilemodel || !$mobilebrand) {
|
|
|
+ $this->error('参数缺失');
|
|
|
+ }
|
|
|
+ if (iconv_strlen($system, 'utf-8') > 255) {
|
|
|
+ $this->error('超出限制');
|
|
|
+ }
|
|
|
+ if (iconv_strlen($mobilemodel, 'utf-8') > 255) {
|
|
|
+ $this->error('超出限制');
|
|
|
+ }
|
|
|
+ if (iconv_strlen($mobilebrand, 'utf-8') > 255) {
|
|
|
+ $this->error('超出限制');
|
|
|
+ }
|
|
|
+
|
|
|
+ $data['system'] = $system;
|
|
|
+ $data['mobilemodel'] = $mobilemodel;
|
|
|
+ $data['mobilebrand'] = $mobilebrand;
|
|
|
+
|
|
|
+ $info = Db::name('user_info')->where(['user_id' => $this->auth->id])->find();
|
|
|
+ if (!$info) {
|
|
|
+ $data['user_id'] = $this->auth->id;
|
|
|
+ $rs = Db::name('user_info')->insertGetId($data);
|
|
|
+ } else {
|
|
|
+ $rs = Db::name('user_info')->where(['user_id' => $this->auth->id])->setField($data);
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($rs === false) {
|
|
|
+ $this->error('收集失败');
|
|
|
+ }
|
|
|
+
|
|
|
+ $this->success('收集成功');
|
|
|
+ }
|
|
|
}
|