docker-webman-jsonrpc/app/jsonrpc/User.php
2023-10-19 15:12:20 +08:00

31 lines
718 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace app\jsonrpc;
use Wandoubaba\Res;
class User
{
/**
* 提供rpc调用的服务方法示例方法属性是public static
*
* @author Aaron <chenqiang@h024.cn>
*
* @param string $name
* @param string $password
*
* @return array Res转换的数组
*/
public static function login(string $name, string $password)
{
$res = new Res();
$correct = password_hash('123456', PASSWORD_DEFAULT);
if (password_verify($password, $correct)) {
$res->success()->setMsg("user {$name} login success.");
} else {
$res->failed()->setMsg("user {$name} login failed.");
}
return $res;
}
}