---
title: "3.2.业务逻辑"
url: "https://goframe.org/course/proxima-book/word-logic"
markdown_url: "https://goframe.org/course/proxima-book/word-logic.md"
locale: "zh-Hans"
version: "2.10.x(Latest)"
section: "实战教程"
category: "实战教程 / proxima-book / 第三章-单词服务"
published: "2024-12-17"
updated: "2024-12-17"
description: "介绍了单词服务的核心业务逻辑实现，包括单词的创建、查询等基本功能的代码实现。"
keywords: ["GoFrame", "business logic", "word management", "CRUD operations", "microservices logic", "vocabulary service"]
---

# 3.2.业务逻辑

和前文一样，这里简单做个样子

*app/word/internal/logic/words/words.go*
```go
package words  
  
import (  
    "context"  
  
    "github.com/gogf/gf/v2/os/gtime"
    "proxima/app/word/internal/model/entity"
)  
  
func Create(ctx context.Context) (id uint, err error) {  
    return 1, nil  
}  
  
func Get(ctx context.Context) (word *entity.Words, err error) {  
    return &entity.Words{  
       Id:                 1,  
       Uid:                1,  
       Word:               "hello",  
       Definition:         "used as a greeting when you meet somebody.",  
       ExampleSentence:    "Hello, I am oldme!",  
       ChineseTranslation: "你好",  
       Pronunciation:      "həˈləʊ",  
       CreatedAt:          gtime.New("2024-12-05 22:00:00"),  
       UpdatedAt:          gtime.New("2024-12-05 22:00:00"),  
    }, nil  
}
```
