public function __construct() { $this->definition = new ObjectType(array('name' => 'query', 'fields' => ['user_by_id' => ['type' => Types::user(), 'description' => '查询用户的综合信息,参数为id', 'args' => ['id' => Types::nonNull(Types::id())]], 'user_by_username' => ['type' => Types::user(), 'description' => '查询用户综合信息,参数为用户名,模糊匹配', 'args' => ['username_like' => Types::nonNull(Types::string())]], 'users_by_ids' => ['type' => Types::listOf(Types::user()), 'description' => '通过逗号分隔的ID来批量查询用户综合信息', 'args' => ['ids' => Types::nonNull(Types::string())]]], 'resolveField' => function ($value, $args, $context, ResolveInfo $info) { if (method_exists($this, $info->fieldName)) { return $this->{$info->fieldName}($value, $args, $context, $info); } else { return $value->{$info->fieldName}; } })); }
public function __construct() { $this->definition = new ObjectType(array('name' => 'auth', 'description' => '用户认证表', 'fields' => function () { return ['id' => Types::id(), 'username' => Types::string(), 'email' => Types::email(), 'mobile' => Types::string(), 'status' => Types::int()]; })); }
public function __construct() { $this->definition = new ObjectType(array('name' => 'profile', 'description' => '用户资料表', 'fields' => function () { return ['id' => Types::id(), 'nickname' => Types::string(), 'full_name' => Types::string(), 'first_name' => Types::string(), 'last_name' => Types::string(), 'birth_year' => Types::int(), 'birth_month' => Types::int(), 'birth_day' => Types::int(), 'avatar' => Types::url(), 'qq' => Types::string(), 'wechat' => Types::string(), 'weibo_name' => Types::string(), 'weibo_url' => Types::url(), 'country' => Types::string(), 'province' => Types::string(), 'city' => Types::string(), 'address' => Types::string(), 'language' => Types::string(), 'timezone' => Types::string(), 'slogan' => Types::string(), 'summary' => Types::string()]; })); }