---
# System prepended metadata

title: 3️⃣1️⃣ APPAPI新增客戶腳本
tags: [Script, Json, APPAPI, '31', CLI]

---

APPAPI新增客戶腳本
===
###### tags: `Json` `Script`

- Redis Key: `csharp.cli:add-customer`

```json=
[
    {
        "action": "COPY",
        "source": "resource/AdminAPI_Core5/Controllers/Game/",
        "destination": "AdminAPI_Core5/Controllers/Game/",
        "fileName": "Game##CUSTOMER1##ApiController.cs"
    },
    {
        "action": "COPY",
        "source": "resource/AdminAPI_Core5/Controllers/Report/",
        "destination": "AdminAPI_Core5/Controllers/Report/",
        "fileName": "Report##CUSTOMER1##GameController.cs"
    },
    {
        "action": "COPY",
        "source": "resource/AdminAPI_Core5/Models/Game/",
        "destination": "AdminAPI_Core5/Models/Game/",
        "fileName": "##CUSTOMER1##ApiModel.cs"
    },
    {
        "action": "COPY",
        "source": "resource/AdminAPI_Core5/Services/DataLayer/Api/",
        "destination": "AdminAPI_Core5/Services/DataLayer/Api/",
        "fileName": "##CUSTOMER1##ApiDataLayer.cs"
    },
    {
        "action": "INSERT",
        "source": "//##新增客戶代碼##",
        "destination": "AdminAPI_Core5/",
        "fileName": "AppSetting.cs",
        "content": [
            "\t\t/// <summary>",
            "\t\t/// ##CUSTOMER##",
            "\t\t/// </summary>",
            "\t\tpublic string ##CUSTOMER## { get; set; }"
        ]
    },
    {
        "action": "INSERT",
        "source": "//##新增客戶代碼1##",
        "destination": "AdminAPI_Core5/Controllers/Game/",
        "fileName": "GameController.cs",
        "content": [
            "\t\tprivate ##CUSTOMER1##ApiDataLayer _##CUSTOMER2##ApiDataLayer;"
        ]
    },
    {
        "action": "INSERT",
        "source": "//##新增客戶代碼2##",
        "destination": "AdminAPI_Core5/Controllers/Game/",
        "fileName": "GameController.cs",
        "content": [
            "\t\t/// <param name=\"##CUSTOMER2##ApiDataLayer\"></param>"
        ]
    },
    {
        "action": "INSERT",
        "source": "//##新增客戶代碼3##",
        "destination": "AdminAPI_Core5/Controllers/Game/",
        "fileName": "GameController.cs",
        "content": [
            "\t\t\t##CUSTOMER1##ApiDataLayer ##CUSTOMER2##ApiDataLayer,"
        ]
    },
    {
        "action": "INSERT",
        "source": "//##新增客戶代碼4##",
        "destination": "AdminAPI_Core5/Controllers/Game/",
        "fileName": "GameController.cs",
        "content": [
            "\t\t\tthis._##CUSTOMER2##ApiDataLayer = ##CUSTOMER2##ApiDataLayer;"
        ]
    },
    {
        "action": "INSERT",
        "source": "//##新增客戶代碼1##",
        "destination": "AdminAPI_Core5/Controllers/Report/",
        "fileName": "ReportController.cs",
        "content": [
            "\t\tprivate ##CUSTOMER1##ApiDataLayer _##CUSTOMER2##ApiDataLayer;"
        ]
    },
    {
        "action": "INSERT",
        "source": "//##新增客戶代碼2##",
        "destination": "AdminAPI_Core5/Controllers/Report/",
        "fileName": "ReportController.cs",
        "content": [
            "\t\t/// <param name=\"##CUSTOMER2##ApiDataLayer\"></param>"
        ]
    },
    {
        "action": "INSERT",
        "source": "//##新增客戶代碼3##",
        "destination": "AdminAPI_Core5/Controllers/Report/",
        "fileName": "ReportController.cs",
        "content": [
            "\t\t\t##CUSTOMER1##ApiDataLayer ##CUSTOMER2##ApiDataLayer,"
        ]
    },
    {
        "action": "INSERT",
        "source": "//##新增客戶代碼4##",
        "destination": "AdminAPI_Core5/Controllers/Report/",
        "fileName": "ReportController.cs",
        "content": [
            "\t\t\tthis._##CUSTOMER2##ApiDataLayer = ##CUSTOMER2##ApiDataLayer;"
        ]
    },
    {
        "action": "INSERT",
        "source": "//##新增客戶代碼1##",
        "destination": "AdminAPI_Core5/",
        "fileName": "Startup.cs",
        "content": [
            "\t\t\tservices.AddScoped<LogHelper<##CUSTOMER1##ApiDataLayer>>();"
        ]
    },
    {
        "action": "INSERT",
        "source": "//##新增客戶代碼2##",
        "destination": "AdminAPI_Core5/",
        "fileName": "Startup.cs",
        "content": [
            "\t\t\tservices.AddScoped<##CUSTOMER1##ApiDataLayer>();"
        ]
    },
    {
        "action": "INSERT",
        "source": "//##新增客戶代碼##",
        "destination": "AdminAPI_Core5/Models/Game/",
        "fileName": "GameModel.cs",
        "content": [
            "\t\t/// <summary>",
            "\t\t/// ##CUSTOMER## Game",
            "\t\t/// </summary>",
            "\t\tpublic bool ##CUSTOMER1##Room_StartFlag { get; set; }"
        ]
    },
    {
        "action": "INSERT",
        "source": "//##新增客戶代碼1##",
        "destination": "AdminAPI_Core5/Models/Game/",
        "fileName": "W1WalletApiModel.cs",
        "content": [
            "\t/// <summary>",
            "\t/// W1 取得遊戲入口連結 Config ##CUSTOMER##",
            "\t/// </summary>",
            "\tpublic class W1ForwardGameConfig##CUSTOMER## : W1ForwardGameConfigBase",
            "\t{",
            "\t\t/// <summary>",
            "\t\t/// 玩家IP",
            "\t\t/// </summary>",
            "\t\tpublic string clientIP { get; set; }",
            "\t\t/// <summary>",
            "\t\t/// 遊戲代碼",
            "\t\t/// </summary>",
            "\t\tpublic string gameCode { get; set; }",
            "\t}"
        ]
    },
    {
        "action": "INSERT",
        "source": "//##新增客戶代碼2##",
        "destination": "AdminAPI_Core5/Models/Game/",
        "fileName": "W1WalletApiModel.cs",
        "content": [
            "\t/// <summary>",
            "\t/// TODO: W1 查詢彙總注單 ##CUSTOMER##",
            "\t/// </summary>",
            "\tpublic class W1GetBetRecordData##CUSTOMER##",
            "\t{",
            "\t\t/// <summary>",
            "\t\t/// 交易單號",
            "\t\t/// </summary>",
            "\t\tpublic string recordId { get; set; }",
            "\t\t/// <summary>",
            "\t\t/// 下注時間",
            "\t\t/// </summary>",
            "\t\tpublic string betTime { get; set; }",
            "\t\t/// <summary>",
            "\t\t/// 結算時間",
            "\t\t/// </summary>",
            "\t\tpublic string settleTime { get; set; }",
            "\t\t/// <summary>",
            "\t\t/// 遊戲類型 (slot:老虎機, fishing:捕魚, chess:棋牌)",
            "\t\t/// </summary>",
            "\t\tpublic string gameType { get; set; }",
            "\t\t/// <summary>",
            "\t\t/// 遊戲代碼",
            "\t\t/// </summary>",
            "\t\tpublic string gameId { get; set; }",
            "\t\t/// <summary>",
            "\t\t/// 下注金額",
            "\t\t/// </summary>",
            "\t\tpublic string betAmount { get; set; }",
            "\t\t/// <summary>",
            "\t\t/// 有效下注金額",
            "\t\t/// </summary>",
            "\t\tpublic string betValidAmount { get; set; }",
            "\t\t/// <summary>",
            "\t\t/// 贏分",
            "\t\t/// </summary>",
            "\t\tpublic string betWin { get; set; }",
            "\t\t/// <summary>",
            "\t\t/// 注單輸贏金額",
            "\t\t/// </summary>",
            "\t\tpublic string netWin { get; set; }",
            "\t\t/// <summary>",
            "\t\t/// 彩金金額",
            "\t\t/// </summary>",
            "\t\tpublic string jackpot { get; set; }",
            "\t\t/// <summary>",
            "\t\t/// 注單狀態(UnSellte(未結算)、Sellte(已結算)、Invalid(無效))",
            "\t\t/// </summary>",
            "\t\tpublic string betStatus { get; set; }",
            "\t}"
        ]
    },
    {
        "action": "INSERT",
        "source": "//##新增客戶代碼##",
        "destination": "AdminAPI_Core5/Models/",
        "fileName": "GameClubNameModel.cs",
        "content": [
            "\t\t/// <summary>",
            "\t\t/// ##CUSTOMER##",
            "\t\t/// </summary>",
            "\t\tpublic const string ##CUSTOMER## = \"##CUSTOMER##\";"
        ]
    },
    {
        "action": "INSERT",
        "source": "//##新增客戶代碼##",
        "destination": "AdminAPI_Core5/Services/CronJob/",
        "fileName": "CronJobService.cs",
        "content": [
            "\t\t\t\t\t\t{ \"##CUSTOMER##\", \"##CUSTOMER##\" },"
        ]
    },
    {
        "action": "INSERT",
        "source": "//##新增客戶代碼##",
        "destination": "AdminAPI_Core5/Services/CronJob/",
        "fileName": "CronJobService_GameClubStartFlagStatus.cs",
        "content": [
            "\t\t\t\t\t\t##CUSTOMER1##Room_StartFlag = Convert.ToBoolean(dbResult.data.SingleOrDefault(x => x.Param_Key.ToLower() == \"##CUSTOMER##Room_StartFlag\".ToLower())?.Param_Value ?? 0),"
        ]
    }
]
```
