12345678910111213141516171819 |
- <?php
- namespace App\JsonRpc;
- use App\Model\District;
- use Hyperf\RpcServer\Annotation\RpcService;
- use App\Tools\Result;
- #[RpcService(name: "PublicRpcService", protocol: "jsonrpc-http", server: "jsonrpc-http")]
- class PublicRpcService implements PublicRpcServiceInterface
- {
- /**
- * @param array $data
- * @return array
- */
- public function getDistrictList(array $data): array
- {
- $result = District::where($data)->orderBy("code","asc")->get();
- return $result?Result::success($result->toArray()):Result::error("没有查到数据");
- }
- }
|