|
@@ -11,7 +11,6 @@ use think\Validate;
|
|
|
|
|
|
use app\common\library\Token;
|
|
|
use think\Db;
|
|
|
-use app\common\model\UserDeviceInfo;
|
|
|
use onlogin\onlogin;
|
|
|
|
|
|
use addons\epay\library\Service;
|
|
@@ -220,7 +219,7 @@ class User extends Api
|
|
|
|
|
|
|
|
|
if ($ret) {
|
|
|
- $this->success(__('Logged in successful'), $this->auth->getUserinfo());
|
|
|
+ $this->success(__('Logged in successful'), $this->auth->getUserinfo_simple());
|
|
|
} else {
|
|
|
$this->error($this->auth->getError());
|
|
|
}
|
|
@@ -251,7 +250,7 @@ class User extends Api
|
|
|
$ret = $this->auth->direct($user['id']);
|
|
|
|
|
|
if ($ret) {
|
|
|
- $userInfo = $this->auth->getUserinfo();
|
|
|
+ $userInfo = $this->auth->getUserinfo_simple();
|
|
|
$userInfo['is_register'] = 0;
|
|
|
$userInfo['ios_user_id'] = $iosUserId;
|
|
|
$this->success(__('Logged in successful'), $userInfo);
|
|
@@ -309,7 +308,7 @@ class User extends Api
|
|
|
*/
|
|
|
public function profile()
|
|
|
{
|
|
|
- $field_array = ['nickname','introcode','gender','birthday','height','weight','provincename','cityname','bio','audio_bio','video_bio','avatar','photo_images','marital_id','job_id','wages_id','suqiu_id','tag_ids','hobby_ids','hide_is_finishinfo'];
|
|
|
+ $field_array = ['nickname','gender','birthday','height','weight','provincename','cityname','bio','audio_bio','video_bio','avatar','photo_images','marital_id','job_id','wages_id','suqiu_id','tag_ids','hobby_ids','hide_is_finishinfo'];
|
|
|
|
|
|
$data = [];
|
|
|
foreach($field_array as $key => $field){
|
|
@@ -335,26 +334,71 @@ class User extends Api
|
|
|
}
|
|
|
|
|
|
//关于我,是否需要审核
|
|
|
- $user_bio_audit_switch = config('site.user_bio_audit_switch');
|
|
|
- if(isset($data['bio']) && !empty($data['bio']) && $user_bio_audit_switch == 1){
|
|
|
+ $user_audit_switch = config('site.user_audit_switch');
|
|
|
+ if(isset($data['video_bio']) && !empty($data['video_bio']) && $user_audit_switch == 1){
|
|
|
+
|
|
|
+ $check_exist = Db::name('user_audit')->where('user_id',$this->auth->id)->where('type','video_bio')->where('status',0)->find();
|
|
|
+ if(!empty($check_exist)){
|
|
|
+ $this->error('信息已提交等待审核,请勿重复提交');
|
|
|
+ }
|
|
|
+
|
|
|
+ if($data['video_bio'] != $this->auth->video_bio){
|
|
|
+ $bio_data = [
|
|
|
+ 'user_id' => $this->auth->id,
|
|
|
+ 'type' => 'video_bio',
|
|
|
+ 'old_data' => $this->auth->video_bio,
|
|
|
+ 'new_data' => $data['video_bio'],
|
|
|
+ 'createtime' => time(),
|
|
|
+ ];
|
|
|
+ Db::name('user_audit')->insertGetId($bio_data);
|
|
|
+
|
|
|
+ $this->error('信息已提交,审核通过后即可正常展示');//正确不弹出,只能用error
|
|
|
+ }
|
|
|
+ unset($data['video_bio']);
|
|
|
+ }
|
|
|
+ //关于我,是否需要审核
|
|
|
+ if(isset($data['photo_images']) && !empty($data['photo_images']) && $user_audit_switch == 1){
|
|
|
+
|
|
|
+ $check_exist = Db::name('user_audit')->where('user_id',$this->auth->id)->where('type','photo_images')->where('status',0)->find();
|
|
|
+ if(!empty($check_exist)){
|
|
|
+ $this->error('信息已提交等待审核,请勿重复提交');
|
|
|
+ }
|
|
|
+
|
|
|
+ if($data['photo_images'] != $this->auth->photo_images){
|
|
|
+ $bio_data = [
|
|
|
+ 'user_id' => $this->auth->id,
|
|
|
+ 'type' => 'photo_images',
|
|
|
+ 'old_data' => $this->auth->photo_images,
|
|
|
+ 'new_data' => $data['photo_images'],
|
|
|
+ 'createtime' => time(),
|
|
|
+ ];
|
|
|
+ Db::name('user_audit')->insertGetId($bio_data);
|
|
|
+
|
|
|
+ $this->error('信息已提交,审核通过后即可正常展示');//正确不弹出,只能用error
|
|
|
+ }
|
|
|
+ unset($data['photo_images']);
|
|
|
+ }
|
|
|
+ //关于我,是否需要审核
|
|
|
+ if(isset($data['audio_bio']) && !empty($data['audio_bio']) && $user_audit_switch == 1){
|
|
|
|
|
|
- $check_exist = Db::name('user_audit')->where('user_id',$this->auth->id)->where('status',0)->find();
|
|
|
+ $check_exist = Db::name('user_audit')->where('user_id',$this->auth->id)->where('type','audio_bio')->where('status',0)->find();
|
|
|
if(!empty($check_exist)){
|
|
|
$this->error('信息已提交等待审核,请勿重复提交');
|
|
|
}
|
|
|
|
|
|
- if($data['bio'] != $this->auth->bio){
|
|
|
+ if($data['audio_bio'] != $this->auth->audio_bio){
|
|
|
$bio_data = [
|
|
|
'user_id' => $this->auth->id,
|
|
|
- 'bio' => $this->auth->bio,
|
|
|
- 'new_bio' => $data['bio'],
|
|
|
+ 'type' => 'audio_bio',
|
|
|
+ 'old_data' => $this->auth->audio_bio,
|
|
|
+ 'new_data' => $data['audio_bio'],
|
|
|
'createtime' => time(),
|
|
|
];
|
|
|
Db::name('user_audit')->insertGetId($bio_data);
|
|
|
|
|
|
$this->error('信息已提交,审核通过后即可正常展示');//正确不弹出,只能用error
|
|
|
}
|
|
|
- unset($data['bio']);
|
|
|
+ unset($data['audio_bio']);
|
|
|
}
|
|
|
|
|
|
//
|
|
@@ -424,10 +468,10 @@ class User extends Api
|
|
|
*/
|
|
|
public function setpower()
|
|
|
{
|
|
|
- $is_vip = $this->is_vip($this->auth->id);
|
|
|
+ /*$is_vip = $this->is_vip($this->auth->id);
|
|
|
if(!$is_vip){
|
|
|
$this->error('VIP才能设置隐私权限');
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
$field_array = ['meili','weizhi','giftwall'];
|
|
|
|
|
@@ -454,11 +498,10 @@ class User extends Api
|
|
|
* 修改用户的坐标
|
|
|
* */
|
|
|
public function change_longlat(){
|
|
|
- $longitude = input_post('longitude',0);
|
|
|
- $latitude = input_post('latitude',0);
|
|
|
- $cityname = input_post('cityname','');
|
|
|
- $provincename = input_post('provincename','');
|
|
|
- $plat_unique_id = input_post('plat_unique_id','');
|
|
|
+ $longitude = input('longitude',0);
|
|
|
+ $latitude = input('latitude',0);
|
|
|
+ $cityname = input('cityname','');
|
|
|
+ $provincename = input('provincename','');
|
|
|
/*if(empty($longitude) || empty($latitude) || empty($cityname)){
|
|
|
$this->error();
|
|
|
}*/
|
|
@@ -469,7 +512,6 @@ class User extends Api
|
|
|
$latitude && $data['latitude'] = $latitude;
|
|
|
$cityname && $data['cityname'] = $cityname;
|
|
|
$provincename && $data['provincename'] = $provincename;
|
|
|
- $plat_unique_id && $data['plat_unique_id'] = $plat_unique_id;
|
|
|
|
|
|
//传入了城市,但是没传入省,直接省名改空
|
|
|
if(isset($data['cityname']) && !isset($data['provincename'])){
|
|
@@ -488,7 +530,7 @@ class User extends Api
|
|
|
|
|
|
//修改用户设备id
|
|
|
public function change_plat_unique_id(){
|
|
|
- $plat_unique_id = input_post('plat_unique_id','');
|
|
|
+ $plat_unique_id = input('plat_unique_id','');
|
|
|
|
|
|
$data = [
|
|
|
'plat_unique_id' => $plat_unique_id,
|
|
@@ -688,7 +730,7 @@ class User extends Api
|
|
|
*/
|
|
|
public function bindopenid()
|
|
|
{
|
|
|
- $wechat_openid = $this->request->request('wechat_openid');
|
|
|
+ $wechat_openid = input('wechat_openid');
|
|
|
if (!$wechat_openid) {
|
|
|
$this->error(__('Invalid parameters'));
|
|
|
}
|
|
@@ -786,46 +828,7 @@ class User extends Api
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 记录当前登陆的设备ID,设备信息,IP等
|
|
|
- */
|
|
|
- public function changeDeviceIp()
|
|
|
- {
|
|
|
- // 接口防并发
|
|
|
- if (!$this->apiLimit(1, 5000)) {
|
|
|
- return ;
|
|
|
- }
|
|
|
|
|
|
- $user = $this->auth->getUser();
|
|
|
- $ip = request()->ip();
|
|
|
- $deviceId = $this->request->request('device_id','');
|
|
|
- $phoneModel = $this->request->request('phone_model','');
|
|
|
- $brand = $this->request->request('brand','');
|
|
|
- $apiVersion = $this->request->request('api_version','');
|
|
|
- $deviceOs = $this->request->request('device_os','');
|
|
|
-
|
|
|
- if ($ip !== $user->loginip){
|
|
|
- $update = [];
|
|
|
- $update['id'] = $user->id;
|
|
|
- $update['loginip'] = $ip;
|
|
|
- \app\common\model\User::update($update);
|
|
|
- }
|
|
|
-
|
|
|
- $userDeviceInfo = UserDeviceInfo::get(['user_id'=>$user->u_id]);
|
|
|
- if (empty($userDeviceInfo)){
|
|
|
- $userDeviceInfo = new UserDeviceInfo();
|
|
|
- $userDeviceInfo->user_id = $user->u_id;
|
|
|
- }
|
|
|
- $userDeviceInfo->device_os = $deviceOs;
|
|
|
- $userDeviceInfo->device_id = $deviceId;
|
|
|
- $userDeviceInfo->phone_model = $phoneModel;
|
|
|
- $userDeviceInfo->brand = $brand;
|
|
|
- $userDeviceInfo->api_version = $apiVersion;
|
|
|
- $userDeviceInfo->save();
|
|
|
-
|
|
|
- //首页接口调用,这里不反回信息
|
|
|
-// $this->success("更新成功!");
|
|
|
- }
|
|
|
|
|
|
//假注销
|
|
|
public function cancleUser(){
|
|
@@ -842,26 +845,6 @@ class User extends Api
|
|
|
$this->success('注销成功');
|
|
|
}
|
|
|
|
|
|
- //公众号获取openid
|
|
|
- public function getUserOpenid_gzh(){
|
|
|
- $configValue = Service::getConfig('wechat');
|
|
|
-
|
|
|
- $wechat = new Wechat($configValue['app_id'],$configValue['app_secret']);
|
|
|
- $rs = $wechat->getOpenid();
|
|
|
- $this->success('success',$rs);
|
|
|
- }
|
|
|
- /**
|
|
|
- * 微信内H5-JSAPI支付
|
|
|
- */
|
|
|
- public function jssdkBuildConfig() {
|
|
|
- $url = $this->request->request("url");
|
|
|
-
|
|
|
- $configValue = Service::getConfig('wechat');
|
|
|
- $wechat = new Wechat($configValue['app_id'],$configValue['app_secret']);
|
|
|
-
|
|
|
- $sign = $wechat->getSignPackage(urldecode($url));
|
|
|
- $this->success("获取成功!",$sign);
|
|
|
- }
|
|
|
|
|
|
|
|
|
|