-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
42 changed files
with
890 additions
and
293 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Build | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.22 | ||
|
||
- name: Build | ||
run: | | ||
go install src.techknowlogick.com/xgo@latest | ||
xgo -out 4uonline --targets=*/amd64 . | ||
- name: Archive Output | ||
run: | | ||
mkdir -p artifacts | ||
mv 4uonline* artifacts/ | ||
cp README.md artifacts/ | ||
cp config.example.yaml artifacts/config.yaml | ||
- name: Upload Artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: build-output | ||
path: artifacts/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package counterName | ||
|
||
// 定义要统计的字段 | ||
|
||
const ( | ||
// QrcodeScan 权益码扫描次数 | ||
QrcodeScan string = "qrcode_scan" | ||
// Feedback 问题反馈数量 | ||
Feedback string = "feedback_scan" | ||
// FeedbackHandle 处理问题反馈数量 | ||
FeedbackHandle string = "feedback_handle" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package feedbackType | ||
|
||
// FeedbackType | ||
const ( | ||
Activities uint = iota // 校园活动 | ||
DiningAndShops // 食堂及商铺 | ||
Dormitories // 宿舍 | ||
Academic // 教学服务(选课、转专业等) | ||
Facilities // 校园设施 | ||
Classrooms // 教室 | ||
Library // 图书馆 | ||
Transportation // 交通 | ||
Security // 安保 | ||
HealthCare // 医疗服务 | ||
Policies // 学院相关政策(如综测等) | ||
Others // 其他服务 | ||
) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package qrcodeController | ||
|
||
import ( | ||
"errors" | ||
|
||
"4u-go/app/apiException" | ||
"4u-go/app/services/qrcodeService" | ||
"4u-go/app/utils" | ||
"github.com/gin-gonic/gin" | ||
"gorm.io/gorm" | ||
) | ||
|
||
type scanCountData struct { | ||
ID uint `form:"id" binding:"required"` | ||
} | ||
|
||
// ScanCount 更新权益码扫码次数 | ||
func ScanCount(c *gin.Context) { | ||
var data scanCountData | ||
if err := c.ShouldBind(&data); err != nil { | ||
apiException.AbortWithException(c, apiException.ParamError, err) | ||
return | ||
} | ||
if err := qrcodeService.AddScanCount(data.ID); err != nil { | ||
if errors.Is(err, gorm.ErrRecordNotFound) { | ||
apiException.AbortWithException(c, apiException.ResourceNotFound, nil) | ||
} else { | ||
apiException.AbortWithException(c, apiException.ServerError, err) | ||
} | ||
return | ||
} | ||
utils.JsonSuccessResponse(c, nil) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package qrcodeController | ||
|
||
import ( | ||
"4u-go/app/apiException" | ||
"4u-go/app/models" | ||
"4u-go/app/services/qrcodeService" | ||
"4u-go/app/utils" | ||
"github.com/gin-gonic/gin" | ||
) | ||
|
||
type createQrcodeData struct { | ||
College uint `json:"college"` | ||
Department string `json:"department" binding:"required"` | ||
Description string `json:"description"` | ||
FeedbackType uint `json:"feedback_type"` | ||
Location string `json:"location" binding:"required"` | ||
} | ||
|
||
// CreateQrcode 创建一个权益码 | ||
func CreateQrcode(c *gin.Context) { | ||
var data createQrcodeData | ||
err := c.ShouldBindJSON(&data) | ||
if err != nil { | ||
apiException.AbortWithException(c, apiException.ParamError, err) | ||
return | ||
} | ||
|
||
err = qrcodeService.SaveQrcode(models.Qrcode{ | ||
Status: true, | ||
College: data.College, | ||
Department: data.Department, | ||
Description: data.Description, | ||
FeedbackType: data.FeedbackType, | ||
Location: data.Location, | ||
}) | ||
|
||
if err != nil { | ||
apiException.AbortWithException(c, apiException.ServerError, err) | ||
return | ||
} | ||
|
||
utils.JsonSuccessResponse(c, nil) | ||
} |
Oops, something went wrong.