<?php
 namespace App\Http\Controllers\Main; use App\Helpers\MailHelper; use App\Helpers\SmsHelper; use App\Http\Controllers\BaseController; use Illuminate\Support\Facades\Input; use TechOnline\Laravel\Http\Request; use TechOnline\Laravel\Http\Response; use TechSoft\Laravel\Member\Interfaces\MemberLoginCheck; use TechSoft\Laravel\Member\MemberUtil; use TechSoft\Laravel\Member\Traits\MemberProfileWebControllerTrait; class MemberProfileController extends BaseController implements MemberLoginCheck { public function index() { if (!$this->isMobile()) { return Response::send(0, null, null, '/member/profile_basic'); } return $this->_view('memberProfile.index'); } public function basic() { if (Request::isPost()) { $data = []; $data['gender'] = intval(Input::get('gender')); $data['realname'] = trim(Input::get('realname')); $data['signature'] = trim(Input::get('signature')); $memberUser = $this->memberUser(); if (empty($memberUser['username'])) { $username = trim(Input::get('username')); if ($username) { $existsMemberUser = MemberUtil::getByUsername($username); if (!empty($existsMemberUser)) { return Response::send(-1, '用户名已被占用'); } $data['username'] = $username; } } MemberUtil::update($this->memberUserId(), $data); return Response::send(0, '保存成功'); } return $this->_view('memberProfile.basic'); } }