alexzy 3 years ago
commit
28b9569276
4 changed files with 76 additions and 0 deletions
  1. 4 0
      .gitignore
  2. 19 0
      composer.json
  3. 18 0
      composer.lock
  4. 35 0
      src/RechargeServiceInterface.php

+ 4 - 0
.gitignore

@@ -0,0 +1,4 @@
+.idea/
+.git/
+
+vendor/

+ 19 - 0
composer.json

@@ -0,0 +1,19 @@
+{
+    "name": "qingcai/service",
+    "description": "青菜手游服务接口",
+    "type": "library",
+    "authors": [
+        {
+            "name": "alexzy",
+            "email": "1003057931@qq.com"
+        }
+    ],
+    "require": {
+        "php": ">=7.4"
+    },
+    "autoload": {
+        "psr-4": {
+            "Qingcai\\Service\\": "src/"
+        }
+    }
+}

+ 18 - 0
composer.lock

@@ -0,0 +1,18 @@
+{
+    "_readme": [
+        "This file locks the dependencies of your project to a known state",
+        "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
+        "This file is @generated automatically"
+    ],
+    "content-hash": "b8a90c2ce9a23797f35fa2c67b15e704",
+    "packages": [],
+    "packages-dev": [],
+    "aliases": [],
+    "minimum-stability": "stable",
+    "stability-flags": [],
+    "prefer-stable": false,
+    "prefer-lowest": false,
+    "platform": [],
+    "platform-dev": [],
+    "plugin-api-version": "2.0.0"
+}

+ 35 - 0
src/RechargeServiceInterface.php

@@ -0,0 +1,35 @@
+<?php
+
+namespace Qingcai\Service;
+
+interface RechargeServiceInterface
+{
+    /**
+     * 获取平台币余额
+     * @param int $platform_id 平台ID
+     * @return array {"balance":"59.00"}
+     * @example {"balance":"59.00"}
+     */
+    public function getBalance(int $platform_id): array;
+
+    /**
+     * 充值游戏
+     * @param int $platform_id 平台ID
+     * @param string $game_name 游戏名称
+     * @param string $user_name 用户名
+     * @param float $num 充值金额
+     * @return array
+     * @example {"order_number":"TD_20220906165238KvgL"}
+     */
+    public function recharge(int $platform_id, string $game_name, string $user_name, float $num): array;
+
+    /**
+     * 检查用户是否有归属
+     * @param int $platform_id 平台ID
+     * @param string $game_name 游戏名称
+     * @param string $user_name 用户名称
+     * @return array
+     * @example {"status":1}
+     */
+    public function checkAccount(int $platform_id, string $game_name, string $user_name): array;
+}