代码补全-sb 王鸣川

main
limu 11 months ago
parent 8d5bc01206
commit b2e91c6c71
  1. 54
      app/controller/api/user/User.php
  2. 3
      route/api.php

@ -322,11 +322,65 @@ class User extends BaseController
public function account() public function account()
{ {
$user = $this->user; $user = $this->user;
if (!$user->phone) return app('json')->fail('请绑定手机号'); if (!$user->phone) return app('json')->fail('请绑定手机号');
return app('json')->success($this->repository->selfUserList($user->phone)); return app('json')->success($this->repository->selfUserList($user->phone));
} }
public function getCheck()
{
$user = $this->user;
$data['card'] = $user->card ?? '';
$data['age'] = $user->age ?? '';
$data['spread_uid'] = $user->spread_uid ?? '';
$data['real_name'] = $user->real_name ?? '';
$b = '';
if(!empty($data['spread_uid'])){
$a = userModel::getDB()->where('uid',$data['spread_uid'])->find();
$b = $a->phone;
}
$data['spread_phone'] = $b ?? '';
return app('json')->success($data);
}
public function update()
{
$age = $this->request->param('age') ?? '';
$card = $this->request->param('card') ?? '';
$spread_phone = $this->request->param('spread_phone') ?? '';
$real_name = $this->request->param('real_name') ?? '';
$user = userModel::getDB()->where('uid',$this->user->uid)->find();
if(!empty($age)){
$user->age = $age;
}
if(!empty($card)){
$user->card = $card;
}
if(!empty($real_name)){
$user->real_name = $real_name;
}
if(!empty($spread_phone)){
$a = userModel::getDB()->where('phone',$spread_phone)->find();
if(!$a){
return app('json')->fail('查无此推荐人');
}
$user->spread_uid = $a->uid;
}
$user->save();
return app('json')->success('更新成功');
}
//wmc //wmc
//分享视频/推文增加品宣积分 //分享视频/推文增加品宣积分
public function brand() public function brand()

@ -117,6 +117,9 @@ Route::group('api/', function () {
Route::get('cashLog', 'User/cashLog'); Route::get('cashLog', 'User/cashLog');
Route::get('getAreaList', 'User/getAreaList'); Route::get('getAreaList', 'User/getAreaList');
Route::get('getCheck', 'User/getCheck');
Route::get('update', 'User/update');
Route::post('switch', 'User/switchUser'); Route::post('switch', 'User/switchUser');

Loading…
Cancel
Save