فهرست منبع

feat(core): 添加 hello 扩展

- 创建了 hello 扩展的基本结构和功能
- 添加了扩展信息文件、路由配置和示例控制器
- 实现了一个简单的 API 接口,返回欢迎信息
- 编写了扩展的安装说明和使用文档
runphp 7 ماه پیش
کامیت
b2e9196ec5
10فایلهای تغییر یافته به همراه1137 افزوده شده و 0 حذف شده
  1. 8 0
      .idea/.gitignore
  2. 32 0
      README.md
  3. 31 0
      composer.json
  4. 915 0
      config.php
  5. 58 0
      database/migrations/20250702075858_hello.php
  6. 38 0
      database/migrations/20250702093625_hello2.php
  7. 17 0
      info.php
  8. 7 0
      route/api.php
  9. 16 0
      src/Controller/IndexController.php
  10. 15 0
      src/Extension.php

+ 8 - 0
.idea/.gitignore

@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml

+ 32 - 0
README.md

@@ -0,0 +1,32 @@
+# Hello Extension
+
+这是一个演示扩展,用于展示如何创建和使用Sixshop扩展。
+
+## 功能说明
+
+该扩展提供一个简单的API端点,返回欢迎信息。
+
+## 安装
+
+```shell
+composer require six-shop/hello
+```
+
+## API接口
+
+### 获取欢迎信息
+- **URL**: `https://sixshop.ddev.site/api/hello`
+- **方法**: GET
+- **描述**: 返回简单的欢迎信息
+
+## 响应示例
+
+```json
+{
+    "code": 0,
+    "status": "ok",
+    "msg": "success",
+    "data": "hello world"
+}
+```
+    

+ 31 - 0
composer.json

@@ -0,0 +1,31 @@
+{
+  "name": "six-shop/hello",
+  "description": "hello扩展",
+  "type": "sixshop-extension",
+  "keywords": [
+    "sixshop",
+    "thinkphp"
+  ],
+  "require": {
+    "php": ">=8.3",
+    "six-shop/core": "^v0.3"
+  },
+  "authors": [
+    {
+      "name": "hui he",
+      "email": "runphp@qq.com"
+    }
+  ],
+  "license": "MIT",
+  "autoload": {
+    "psr-4": {
+      "SixShop\\Hello\\": "src"
+    }
+  },
+  "extra": {
+    "sixshop": {
+      "id": "hello",
+      "class": "SixShop\\Hello\\Extension"
+    }
+  }
+}

+ 915 - 0
config.php

@@ -0,0 +1,915 @@
+<?php
+declare(strict_types=1);
+
+return json_decode(<<<'JSON'
+[
+  {
+    "type": "input",
+    "field": "Ftpkmcfxgdv6abc",
+    "title": "输入框",
+    "info": "",
+    "$required": false,
+    "_fc_id": "id_Ftjlmcfxgdv6acc",
+    "name": "ref_F5gtmcfxgdv6adc",
+    "display": true,
+    "hidden": false,
+    "_fc_drag_tag": "input"
+  },
+  {
+    "type": "input",
+    "field": "Fr3tmcfxgng8aec",
+    "title": "多行输入框",
+    "info": "",
+    "$required": false,
+    "props": {
+      "type": "textarea"
+    },
+    "_fc_id": "id_Fss5mcfxgng8afc",
+    "name": "ref_F2lomcfxgng8agc",
+    "display": true,
+    "hidden": false,
+    "_fc_drag_tag": "textarea"
+  },
+  {
+    "type": "input",
+    "field": "Fmkamcfxgowcahc",
+    "title": "密码输入框",
+    "info": "",
+    "$required": false,
+    "props": {
+      "type": "password"
+    },
+    "_fc_id": "id_Fvstmcfxgowcaic",
+    "name": "ref_Fo74mcfxgowcajc",
+    "display": true,
+    "hidden": false,
+    "_fc_drag_tag": "password"
+  },
+  {
+    "type": "inputNumber",
+    "field": "Fu76mcfxgqyyakc",
+    "title": "计数器",
+    "info": "",
+    "$required": false,
+    "_fc_id": "id_F229mcfxgqyyalc",
+    "name": "ref_Fl2smcfxgqyyamc",
+    "display": true,
+    "hidden": false,
+    "_fc_drag_tag": "inputNumber"
+  },
+  {
+    "type": "radio",
+    "field": "Fj5smcfxgshnanc",
+    "title": "单选框",
+    "info": "",
+    "effect": {
+      "fetch": ""
+    },
+    "$required": false,
+    "options": [
+      {
+        "label": "选项01",
+        "value": "1"
+      },
+      {
+        "label": "选项02",
+        "value": "2"
+      },
+      {
+        "label": "选项03",
+        "value": "3"
+      }
+    ],
+    "_fc_id": "id_Fnxemcfxgshnaoc",
+    "name": "ref_Fqhqmcfxgshnapc",
+    "display": true,
+    "hidden": false,
+    "_fc_drag_tag": "radio"
+  },
+  {
+    "type": "checkbox",
+    "field": "Fl8wmcfxgxzoaqc",
+    "title": "多选框",
+    "info": "",
+    "effect": {
+      "fetch": ""
+    },
+    "$required": false,
+    "options": [
+      {
+        "label": "选项01",
+        "value": "1"
+      },
+      {
+        "label": "选项02",
+        "value": "2"
+      },
+      {
+        "label": "选项03",
+        "value": "3"
+      }
+    ],
+    "_fc_id": "id_Fy3hmcfxgxzoarc",
+    "name": "ref_Fm0hmcfxgxzoasc",
+    "display": true,
+    "hidden": false,
+    "_fc_drag_tag": "checkbox"
+  },
+  {
+    "type": "select",
+    "field": "Fosbmcfxh084atc",
+    "title": "选择器",
+    "info": "",
+    "effect": {
+      "fetch": ""
+    },
+    "$required": false,
+    "options": [
+      {
+        "label": "选项01",
+        "value": "1"
+      },
+      {
+        "label": "选项02",
+        "value": "2"
+      },
+      {
+        "label": "选项03",
+        "value": "3"
+      }
+    ],
+    "_fc_id": "id_Fbftmcfxh084auc",
+    "name": "ref_F13rmcfxh084avc",
+    "display": true,
+    "hidden": false,
+    "_fc_drag_tag": "select"
+  },
+  {
+    "type": "switch",
+    "field": "F9ytmcfxh634awc",
+    "title": "开关",
+    "info": "",
+    "$required": false,
+    "props": {
+      "activeValue": true,
+      "inactiveValue": false
+    },
+    "_fc_id": "id_Fji6mcfxh634axc",
+    "name": "ref_F8dvmcfxh634ayc",
+    "display": true,
+    "hidden": false,
+    "_fc_drag_tag": "switch"
+  },
+  {
+    "type": "rate",
+    "field": "Fs6rmcfxh75eazc",
+    "title": "评分",
+    "info": "",
+    "$required": false,
+    "_fc_id": "id_Ffnpmcfxh75eb0c",
+    "name": "ref_Fu1zmcfxh75eb1c",
+    "display": true,
+    "hidden": false,
+    "_fc_drag_tag": "rate",
+    "value": 0
+  },
+  {
+    "type": "timePicker",
+    "field": "Fhbumcfxh8tkb2c",
+    "title": "时间",
+    "info": "",
+    "$required": false,
+    "_fc_id": "id_Fmzpmcfxh8tkb3c",
+    "name": "ref_Fbvhmcfxh8tkb4c",
+    "display": true,
+    "hidden": false,
+    "_fc_drag_tag": "timePicker"
+  },
+  {
+    "type": "timePicker",
+    "field": "F4xrmcfxhfs4b5c",
+    "title": "时间区间",
+    "info": "",
+    "$required": false,
+    "props": {
+      "isRange": true
+    },
+    "_fc_id": "id_Fxo8mcfxhfs4b6c",
+    "name": "ref_Fpzzmcfxhfs4b7c",
+    "display": true,
+    "hidden": false,
+    "_fc_drag_tag": "timeRange"
+  },
+  {
+    "type": "slider",
+    "field": "Fnphmcfxhhk0b8c",
+    "title": "滑块",
+    "info": "",
+    "$required": false,
+    "_fc_id": "id_Faoymcfxhhk0b9c",
+    "name": "ref_Fpclmcfxhhk0bac",
+    "display": true,
+    "hidden": false,
+    "_fc_drag_tag": "slider"
+  },
+  {
+    "type": "datePicker",
+    "field": "F98bmcfxhiy9bbc",
+    "title": "日期",
+    "info": "",
+    "$required": false,
+    "_fc_id": "id_Flofmcfxhiy9bcc",
+    "name": "ref_Fid0mcfxhiy9bdc",
+    "display": true,
+    "hidden": false,
+    "_fc_drag_tag": "datePicker"
+  },
+  {
+    "type": "datePicker",
+    "field": "Fcpkmcfxhl99bec",
+    "title": "日期区间",
+    "info": "",
+    "$required": false,
+    "props": {
+      "type": "datetimerange"
+    },
+    "_fc_id": "id_Fmktmcfxhl99bfc",
+    "name": "ref_Fdaumcfxhl99bgc",
+    "display": true,
+    "hidden": false,
+    "_fc_drag_tag": "dateRange"
+  },
+  {
+    "type": "colorPicker",
+    "field": "Fkp8mcfxhna4bhc",
+    "title": "颜色选择器",
+    "info": "",
+    "$required": false,
+    "_fc_id": "id_Fsjkmcfxhna4bic",
+    "name": "ref_F7p6mcfxhna4bjc",
+    "display": true,
+    "hidden": false,
+    "_fc_drag_tag": "colorPicker"
+  },
+  {
+    "type": "cascader",
+    "field": "F7j3mcfxhpkbbkc",
+    "title": "级联选择器",
+    "info": "",
+    "effect": {
+      "fetch": ""
+    },
+    "$required": false,
+    "props": {
+      "options": [
+        {
+          "label": "选项201",
+          "value": "1",
+          "children": [
+            {
+              "label": "选项101",
+              "value": "2",
+              "children": [
+                {
+                  "label": "选项01",
+                  "value": "3"
+                },
+                {
+                  "label": "选项02",
+                  "value": "4"
+                },
+                {
+                  "label": "选项03",
+                  "value": "5"
+                }
+              ]
+            },
+            {
+              "label": "选项102",
+              "value": "6",
+              "children": [
+                {
+                  "label": "选项01",
+                  "value": "7"
+                },
+                {
+                  "label": "选项02",
+                  "value": "8"
+                },
+                {
+                  "label": "选项03",
+                  "value": "9"
+                }
+              ]
+            },
+            {
+              "label": "选项103",
+              "value": "10",
+              "children": [
+                {
+                  "label": "选项01",
+                  "value": "11"
+                },
+                {
+                  "label": "选项02",
+                  "value": "12"
+                },
+                {
+                  "label": "选项03",
+                  "value": "13"
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "label": "选项202",
+          "value": "14",
+          "children": [
+            {
+              "label": "选项101",
+              "value": "15",
+              "children": [
+                {
+                  "label": "选项01",
+                  "value": "16"
+                },
+                {
+                  "label": "选项02",
+                  "value": "17"
+                },
+                {
+                  "label": "选项03",
+                  "value": "18"
+                }
+              ]
+            },
+            {
+              "label": "选项102",
+              "value": "19",
+              "children": [
+                {
+                  "label": "选项01",
+                  "value": "20"
+                },
+                {
+                  "label": "选项02",
+                  "value": "21"
+                },
+                {
+                  "label": "选项03",
+                  "value": "22"
+                }
+              ]
+            },
+            {
+              "label": "选项103",
+              "value": "23",
+              "children": [
+                {
+                  "label": "选项01",
+                  "value": "24"
+                },
+                {
+                  "label": "选项02",
+                  "value": "25"
+                },
+                {
+                  "label": "选项03",
+                  "value": "26"
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "label": "选项203",
+          "value": "27",
+          "children": [
+            {
+              "label": "选项101",
+              "value": "28",
+              "children": [
+                {
+                  "label": "选项01",
+                  "value": "29"
+                },
+                {
+                  "label": "选项02",
+                  "value": "30"
+                },
+                {
+                  "label": "选项03",
+                  "value": "31"
+                }
+              ]
+            },
+            {
+              "label": "选项102",
+              "value": "32",
+              "children": [
+                {
+                  "label": "选项01",
+                  "value": "33"
+                },
+                {
+                  "label": "选项02",
+                  "value": "34"
+                },
+                {
+                  "label": "选项03",
+                  "value": "35"
+                }
+              ]
+            },
+            {
+              "label": "选项103",
+              "value": "36",
+              "children": [
+                {
+                  "label": "选项01",
+                  "value": "37"
+                },
+                {
+                  "label": "选项02",
+                  "value": "38"
+                },
+                {
+                  "label": "选项03",
+                  "value": "39"
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
+    "_fc_id": "id_F484mcfxhpkbblc",
+    "name": "ref_Fmvgmcfxhpkbbmc",
+    "display": true,
+    "hidden": false,
+    "_fc_drag_tag": "cascader"
+  },
+  {
+    "type": "upload",
+    "field": "F4lsmcfxhrphbnc",
+    "title": "上传",
+    "info": "",
+    "$required": false,
+    "props": {
+      "action": "/",
+      "onSuccess": "[[FORM-CREATE-PREFIX-function anonymous(res,file\n) {\nfile.url = res.data.url;\n}-FORM-CREATE-SUFFIX]]"
+    },
+    "_fc_id": "id_F1ngmcfxhrphboc",
+    "name": "ref_Ftf3mcfxhrphbpc",
+    "display": true,
+    "hidden": false,
+    "_fc_drag_tag": "upload"
+  },
+  {
+    "type": "elTransfer",
+    "field": "Fjcnmcfxhwzybqc",
+    "title": "穿梭框",
+    "info": "",
+    "$required": false,
+    "props": {
+      "data": [
+        {
+          "label": "选项01",
+          "key": "1"
+        },
+        {
+          "label": "选项02",
+          "key": "2"
+        },
+        {
+          "label": "选项03",
+          "key": "3"
+        }
+      ]
+    },
+    "_fc_id": "id_Flx7mcfxhwzybrc",
+    "name": "ref_F2n4mcfxhwzybsc",
+    "display": true,
+    "hidden": false,
+    "_fc_drag_tag": "elTransfer"
+  },
+  {
+    "type": "tree",
+    "field": "F51amcfxi2isbtc",
+    "title": "树形控件",
+    "info": "",
+    "effect": {
+      "fetch": ""
+    },
+    "$required": false,
+    "props": {
+      "props": {
+        "label": "label"
+      },
+      "showCheckbox": true,
+      "nodeKey": "id",
+      "data": [
+        {
+          "label": "选项201",
+          "id": "1",
+          "children": [
+            {
+              "label": "选项101",
+              "id": "2",
+              "children": [
+                {
+                  "label": "选项01",
+                  "id": "3"
+                },
+                {
+                  "label": "选项02",
+                  "id": "4"
+                },
+                {
+                  "label": "选项03",
+                  "id": "5"
+                }
+              ]
+            },
+            {
+              "label": "选项102",
+              "id": "6",
+              "children": [
+                {
+                  "label": "选项01",
+                  "id": "7"
+                },
+                {
+                  "label": "选项02",
+                  "id": "8"
+                },
+                {
+                  "label": "选项03",
+                  "id": "9"
+                }
+              ]
+            },
+            {
+              "label": "选项103",
+              "id": "10",
+              "children": [
+                {
+                  "label": "选项01",
+                  "id": "11"
+                },
+                {
+                  "label": "选项02",
+                  "id": "12"
+                },
+                {
+                  "label": "选项03",
+                  "id": "13"
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "label": "选项202",
+          "id": "14",
+          "children": [
+            {
+              "label": "选项101",
+              "id": "15",
+              "children": [
+                {
+                  "label": "选项01",
+                  "id": "16"
+                },
+                {
+                  "label": "选项02",
+                  "id": "17"
+                },
+                {
+                  "label": "选项03",
+                  "id": "18"
+                }
+              ]
+            },
+            {
+              "label": "选项102",
+              "id": "19",
+              "children": [
+                {
+                  "label": "选项01",
+                  "id": "20"
+                },
+                {
+                  "label": "选项02",
+                  "id": "21"
+                },
+                {
+                  "label": "选项03",
+                  "id": "22"
+                }
+              ]
+            },
+            {
+              "label": "选项103",
+              "id": "23",
+              "children": [
+                {
+                  "label": "选项01",
+                  "id": "24"
+                },
+                {
+                  "label": "选项02",
+                  "id": "25"
+                },
+                {
+                  "label": "选项03",
+                  "id": "26"
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "label": "选项203",
+          "id": "27",
+          "children": [
+            {
+              "label": "选项101",
+              "id": "28",
+              "children": [
+                {
+                  "label": "选项01",
+                  "id": "29"
+                },
+                {
+                  "label": "选项02",
+                  "id": "30"
+                },
+                {
+                  "label": "选项03",
+                  "id": "31"
+                }
+              ]
+            },
+            {
+              "label": "选项102",
+              "id": "32",
+              "children": [
+                {
+                  "label": "选项01",
+                  "id": "33"
+                },
+                {
+                  "label": "选项02",
+                  "id": "34"
+                },
+                {
+                  "label": "选项03",
+                  "id": "35"
+                }
+              ]
+            },
+            {
+              "label": "选项103",
+              "id": "36",
+              "children": [
+                {
+                  "label": "选项01",
+                  "id": "37"
+                },
+                {
+                  "label": "选项02",
+                  "id": "38"
+                },
+                {
+                  "label": "选项03",
+                  "id": "39"
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
+    "_fc_id": "id_F24hmcfxi2itbuc",
+    "name": "ref_F99imcfxi2itbvc",
+    "display": true,
+    "hidden": false,
+    "_fc_drag_tag": "tree"
+  },
+  {
+    "type": "elTreeSelect",
+    "field": "Fi81mcfxi6hqbwc",
+    "title": "树形选择",
+    "info": "",
+    "effect": {
+      "fetch": ""
+    },
+    "$required": false,
+    "props": {
+      "nodeKey": "value",
+      "showCheckbox": true,
+      "data": [
+        {
+          "label": "选项201",
+          "value": "1",
+          "children": [
+            {
+              "label": "选项101",
+              "value": "2",
+              "children": [
+                {
+                  "label": "选项01",
+                  "value": "3"
+                },
+                {
+                  "label": "选项02",
+                  "value": "4"
+                },
+                {
+                  "label": "选项03",
+                  "value": "5"
+                }
+              ]
+            },
+            {
+              "label": "选项102",
+              "value": "6",
+              "children": [
+                {
+                  "label": "选项01",
+                  "value": "7"
+                },
+                {
+                  "label": "选项02",
+                  "value": "8"
+                },
+                {
+                  "label": "选项03",
+                  "value": "9"
+                }
+              ]
+            },
+            {
+              "label": "选项103",
+              "value": "10",
+              "children": [
+                {
+                  "label": "选项01",
+                  "value": "11"
+                },
+                {
+                  "label": "选项02",
+                  "value": "12"
+                },
+                {
+                  "label": "选项03",
+                  "value": "13"
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "label": "选项202",
+          "value": "14",
+          "children": [
+            {
+              "label": "选项101",
+              "value": "15",
+              "children": [
+                {
+                  "label": "选项01",
+                  "value": "16"
+                },
+                {
+                  "label": "选项02",
+                  "value": "17"
+                },
+                {
+                  "label": "选项03",
+                  "value": "18"
+                }
+              ]
+            },
+            {
+              "label": "选项102",
+              "value": "19",
+              "children": [
+                {
+                  "label": "选项01",
+                  "value": "20"
+                },
+                {
+                  "label": "选项02",
+                  "value": "21"
+                },
+                {
+                  "label": "选项03",
+                  "value": "22"
+                }
+              ]
+            },
+            {
+              "label": "选项103",
+              "value": "23",
+              "children": [
+                {
+                  "label": "选项01",
+                  "value": "24"
+                },
+                {
+                  "label": "选项02",
+                  "value": "25"
+                },
+                {
+                  "label": "选项03",
+                  "value": "26"
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "label": "选项203",
+          "value": "27",
+          "children": [
+            {
+              "label": "选项101",
+              "value": "28",
+              "children": [
+                {
+                  "label": "选项01",
+                  "value": "29"
+                },
+                {
+                  "label": "选项02",
+                  "value": "30"
+                },
+                {
+                  "label": "选项03",
+                  "value": "31"
+                }
+              ]
+            },
+            {
+              "label": "选项102",
+              "value": "32",
+              "children": [
+                {
+                  "label": "选项01",
+                  "value": "33"
+                },
+                {
+                  "label": "选项02",
+                  "value": "34"
+                },
+                {
+                  "label": "选项03",
+                  "value": "35"
+                }
+              ]
+            },
+            {
+              "label": "选项103",
+              "value": "36",
+              "children": [
+                {
+                  "label": "选项01",
+                  "value": "37"
+                },
+                {
+                  "label": "选项02",
+                  "value": "38"
+                },
+                {
+                  "label": "选项03",
+                  "value": "39"
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    },
+    "_fc_id": "id_Fw27mcfxi6hqbxc",
+    "name": "ref_Fwobmcfxi6hqbyc",
+    "display": true,
+    "hidden": false,
+    "_fc_drag_tag": "elTreeSelect"
+  },
+  {
+    "type": "fcEditor",
+    "field": "Fl51mcfxi9aubzc",
+    "title": "富文本框",
+    "info": "",
+    "$required": false,
+    "_fc_id": "id_Fakqmcfxi9auc0c",
+    "name": "ref_Fg9mmcfxi9auc1c",
+    "display": true,
+    "hidden": false,
+    "_fc_drag_tag": "fcEditor"
+  }
+]
+JSON,true);

+ 58 - 0
database/migrations/20250702075858_hello.php

@@ -0,0 +1,58 @@
+<?php
+
+use think\migration\Migrator;
+use think\migration\db\Column;
+
+class Hello extends Migrator
+{
+    /**
+     * Change Method.
+     *
+     * Write your reversible migrations using this method.
+     *
+     * More information on writing migrations is available here:
+     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
+     *
+     * The following commands can be used in this method and Phinx will
+     * automatically reverse them when rolling back:
+     *
+     *    createTable
+     *    renameTable
+     *    addColumn
+     *    renameColumn
+     *    addIndex
+     *    addForeignKey
+     *
+     * Remember to call "create()" or "update()" and NOT "save()" when working
+     * with the Table class.
+     */
+    public function change()
+    {
+        $table = $this->table('extension_hello', [
+            'comment' => 'hello测试表',
+            'engine' => 'InnoDB',
+            'collation' => 'utf8mb4_general_ci',
+            'id' => false,
+            'primary_key' => 'id'
+        ]);
+
+        $table->addColumn('id', 'string', [
+            'limit' => 50,
+            'null' => false,
+            'comment' => '唯一标识符'
+        ])->addColumn('name', 'string', [
+            'limit' => 100,
+            'null' => false,
+            'comment' => '名称'
+        ])->addColumn('update_time', 'datetime', [
+            'null' => true,
+            'comment' => '更新时间'
+        ])->addColumn('delete_time', 'datetime', [
+            'null' => true,
+            'comment' => '删除时间'
+        ])->addIndex(['id'], [
+            'unique' => true,
+            'name' => 'uniq_id'
+        ])->create();
+    }
+}

+ 38 - 0
database/migrations/20250702093625_hello2.php

@@ -0,0 +1,38 @@
+<?php
+
+use think\migration\Migrator;
+use think\migration\db\Column;
+
+class Hello2 extends Migrator
+{
+    /**
+     * Change Method.
+     *
+     * Write your reversible migrations using this method.
+     *
+     * More information on writing migrations is available here:
+     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
+     *
+     * The following commands can be used in this method and Phinx will
+     * automatically reverse them when rolling back:
+     *
+     *    createTable
+     *    renameTable
+     *    addColumn
+     *    renameColumn
+     *    addIndex
+     *    addForeignKey
+     *
+     * Remember to call "create()" or "update()" and NOT "save()" when working
+     * with the Table class.
+     */
+    public function change()
+    {
+        $table = $this->table('extension_hello');
+        $table->addColumn('age', 'integer', [
+            'limit' => 100,
+            'null' => false,
+            'comment' => '年龄'
+        ])->save();
+    }
+}

+ 17 - 0
info.php

@@ -0,0 +1,17 @@
+<?php
+declare(strict_types=1);
+
+
+return [
+    'id' => 'hello',
+    'name' => 'Hello Extension',
+    'category' => 'other', # 扩展的分类 core:核心扩展,other:其他扩展
+    'description' => '这是一个示例扩展,用于展示如何创建和使用扩展。',
+    'version' => '1.0.0',
+    'core_version' => '^1.0',
+    'author' => 'runphp', # 作者
+    'email' => 'runphp@qq.com', # 作者的邮箱
+    'website' => '', # 扩展的地址,可以是扩展的仓库地址,帮助用户寻找扩展,安装扩展等网络地址
+    'image' => '', # 扩展的图片,用于展示扩展的图标,或者是扩展的截图等图片地址
+    'license' => 'MIT', # 扩展的开源协议
+];

+ 7 - 0
route/api.php

@@ -0,0 +1,7 @@
+<?php
+declare(strict_types=1);
+
+use SixShop\hello\Controller\IndexController;
+use think\facade\Route;
+
+Route::resource('', IndexController::class);

+ 16 - 0
src/Controller/IndexController.php

@@ -0,0 +1,16 @@
+<?php
+declare(strict_types=1);
+
+namespace SixShop\hello\Controller;
+
+use SixShop\Core\Helper;
+use think\Response;
+
+
+class IndexController
+{
+    public function index(): Response
+    {
+        return Helper::success_response('hello world');
+    }
+}

+ 15 - 0
src/Extension.php

@@ -0,0 +1,15 @@
+<?php
+declare(strict_types=1);
+
+namespace SixShop\hello;
+
+use SixShop\Core\ExtensionAbstract;
+
+class Extension extends ExtensionAbstract
+{
+
+    protected function getBaseDir(): string
+    {
+        return dirname(__DIR__);
+    }
+}