You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
<?php
namespace App\Service\v3\Implementations;
use App\Constants\v3\ErrorCode;use App\Exception\ErrorCodeException;use App\Model\v3\User;use App\Service\v3\Interfaces\UserInfoServiceInterface;
class UserInfoService implements UserInfoServiceInterface{
/** * 更新 * @param $userId * @param $data * @return int */ public function do($userId, $data) { $user = User::query()->find($userId); $res = $user->fill($data)->save();
if (!$res) { throw new ErrorCodeException(ErrorCode::USER_INFO_UPDATE_ERROR); }
return $res; }
public function check($userId) { return User::query()->where(['status' => 1, 'id' => $userId])->exists(); }
public function undo($userId) { // TODO: Implement undo() method.
}
public function detail($userId) { return User::query() ->select(['id', 'nick_name', 'avatar', 'openid', 'total_score', 'real_name']) ->where(['status' => 1, 'id' => $userId]) ->first()->toArray(); }}
|