52 lines
1.1 KiB
PHP
52 lines
1.1 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Http\Controllers\Wx;
|
||
|
|
|
||
|
|
use App\BaseApp\BaseController;
|
||
|
|
use App\Service\wx\WxUserCenterService;
|
||
|
|
use Illuminate\Http\JsonResponse;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 小程序「我的」
|
||
|
|
*/
|
||
|
|
class UserController extends BaseController
|
||
|
|
{
|
||
|
|
protected array $exceptRoute = ['list', 'option', 'detail', 'create', 'update', 'delete'];
|
||
|
|
|
||
|
|
public function __construct()
|
||
|
|
{
|
||
|
|
parent::__construct();
|
||
|
|
$this->service = WxUserCenterService::getInstance();
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 我的信息
|
||
|
|
* @Method GET
|
||
|
|
*/
|
||
|
|
public function myInfo(): JsonResponse
|
||
|
|
{
|
||
|
|
return jok($this->service->myInfo());
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 绑定手机号
|
||
|
|
* @Method POST
|
||
|
|
*/
|
||
|
|
public function bandPhone(): JsonResponse
|
||
|
|
{
|
||
|
|
return jok($this->service->bandPhone(request()->post()), '绑定成功');
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 修改昵称
|
||
|
|
* @Method POST
|
||
|
|
*/
|
||
|
|
public function updateNickName(): JsonResponse
|
||
|
|
{
|
||
|
|
return jok(
|
||
|
|
$this->service->updateNickName((string) request()->post('nick_name', '')),
|
||
|
|
'保存成功'
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|