修改数据库,添加短信日志接口

This commit is contained in:
Kayee 2025-12-16 16:57:27 +08:00
parent 3e8f494cb9
commit bae43b5a4e
13 changed files with 3863 additions and 12 deletions

View File

@ -19,7 +19,7 @@ MaxThread = 2
[Logger.Hooks.Options]
Debug = "false"
DBType = "mysql" # sqlite3/mysql/postgres
DSN = "haibei:haibei@tcp(115.239.217.220:3306)/haibei?charset=utf8mb4&parseTime=True&loc=Local"
DSN = "haibei:haibei@tcp(36.133.78.46:3306)/haibei?charset=utf8mb4&parseTime=True&loc=Local"
MaxOpenConns = "16"
MaxIdleConns = "4"
MaxLifetime = "86400"

View File

@ -43,7 +43,7 @@ CleanupInterval = 60 # seconds
Path = "data/auth"
[Middleware.Auth.Store.Redis]
Addr = "115.239.217.220:6379" # If empty, then use the same configuration as Storage.Cache.Redis
Addr = "36.133.78.46:6379" # If empty, then use the same configuration as Storage.Cache.Redis
Username = ""
Password = "123456"
DB = 2
@ -62,7 +62,7 @@ Expiration = 3600
CleanupInterval = 60
[Middleware.RateLimiter.Store.Redis]
Addr = "115.239.217.220:6379" # If empty, then use the same configuration as Storage.Cache.Redis
Addr = "36.133.78.46:6379" # If empty, then use the same configuration as Storage.Cache.Redis
Username = ""
Password = "123456"
DB = 10

View File

@ -36,7 +36,7 @@ CleanupInterval = 60
[Storage.Cache.Badger]
Path = "data/cache"
[Storage.Cache.Redis]
Addr = "115.239.217.220:6379"
Addr = "36.133.78.46:6379"
Username = ""
Password = "123456"
DB = 0
@ -46,7 +46,7 @@ Type = "mysql" # sqlite3/mysql/postgres
# SQLite3 DSN
#DSN = "data/haibei.db"
# MySQL DSN
DSN = "haibei:haibei@tcp(115.239.217.220:3306)/haibei?charset=utf8mb4&parseTime=True&loc=Local"
DSN = "haibei:haibei@tcp(36.133.78.46:3306)/haibei?charset=utf8mb4&parseTime=True&loc=Local"
# PostgreSQL DSN
# DSN = "host=db user=postgres password=123456 dbname=haibei port=5432 sslmode=disable TimeZone=Asia/Shanghai"
MaxLifetime = 86400
@ -63,7 +63,7 @@ Height = 160
CacheType = "memory" # memory/redis
[Util.Captcha.Redis]
Addr = "115.239.217.220:6379" # If empty, then use the same configuration as Storage.Cache.Redis
Addr = "36.133.78.46:6379" # If empty, then use the same configuration as Storage.Cache.Redis
Username = ""
Password = "123456"
DB = 1

View File

@ -0,0 +1,116 @@
package api
import (
"github.com/gin-gonic/gin"
"github.guxuan/haibei/internal/mods/common/biz"
"github.guxuan/haibei/internal/mods/common/schema"
"github.guxuan/haibei/pkg/util"
)
// Defining the `SMSLog` api.
type SMSLog struct {
SMSLogBIZ *biz.SMSLog
}
// @Tags 短信日志模块
// @Security ApiKeyAuth
// @Summary Query smsLog list
// @Param current query int true "pagination index" default(1)
// @Param pageSize query int true "pagination size" default(10)
// @Success 200 {object} util.ResponseResult{data=[]schema.SMSLog}
// @Failure 401 {object} util.ResponseResult
// @Failure 500 {object} util.ResponseResult
// @Router /api/v1/smsLogs [get]
func (a *SMSLog) Query(c *gin.Context) {
ctx := c.Request.Context()
var params schema.SMSLogQueryParam
if err := util.ParseQuery(c, &params); err != nil {
util.ResError(c, err)
return
}
result, err := a.SMSLogBIZ.Query(ctx, params)
if err != nil {
util.ResError(c, err)
return
}
util.ResPage(c, result.Data, result.PageResult)
}
// @Tags 短信日志模块
// @Security ApiKeyAuth
// @Summary Get smsLog record by ID
// @Param id path string true "unique id"
// @Success 200 {object} util.ResponseResult{data=schema.SMSLog}
// @Failure 401 {object} util.ResponseResult
// @Failure 500 {object} util.ResponseResult
// @Router /api/v1/smsLogs/{id} [get]
func (a *SMSLog) Get(c *gin.Context) {
ctx := c.Request.Context()
id, err := util.GetQueryID(c)
if err != nil {
util.ResError(c, err)
return
}
item, err := a.SMSLogBIZ.Get(ctx, id)
if err != nil {
util.ResError(c, err)
return
}
util.ResSuccess(c, item)
}
// @Tags 短信日志模块
// @Security ApiKeyAuth
// @Summary Update smsLog record by ID
// @Param id path string true "unique id"
// @Param body body schema.SMSLogForm true "Request body"
// @Success 200 {object} util.ResponseResult
// @Failure 400 {object} util.ResponseResult
// @Failure 401 {object} util.ResponseResult
// @Failure 500 {object} util.ResponseResult
// @Router /api/v1/smsLogs/{id} [put]
func (a *SMSLog) Update(c *gin.Context) {
ctx := c.Request.Context()
item := new(schema.SMSLogForm)
if err := util.ParseJSON(c, item); err != nil {
util.ResError(c, err)
return
} else if err := item.Validate(); err != nil {
util.ResError(c, err)
return
}
id, err := util.GetQueryID(c)
if err != nil {
util.ResError(c, err)
return
}
err = a.SMSLogBIZ.Update(ctx, id, item)
if err != nil {
util.ResError(c, err)
return
}
util.ResOK(c)
}
// @Tags 短信日志模块
// @Security ApiKeyAuth
// @Summary Delete smsLog record by ID
// @Param id path string true "unique id"
// @Success 200 {object} util.ResponseResult
// @Failure 401 {object} util.ResponseResult
// @Failure 500 {object} util.ResponseResult
// @Router /api/v1/smsLogs/{id} [delete]
func (a *SMSLog) Delete(c *gin.Context) {
ctx := c.Request.Context()
id, err := util.GetQueryID(c)
if err != nil {
util.ResError(c, err)
return
}
err = a.SMSLogBIZ.Delete(ctx, id)
if err != nil {
util.ResError(c, err)
return
}
util.ResOK(c)
}

View File

@ -0,0 +1,103 @@
package biz
import (
"context"
"github.guxuan/haibei/internal/mods/common/dal"
"github.guxuan/haibei/internal/mods/common/schema"
"github.guxuan/haibei/pkg/errors"
"github.guxuan/haibei/pkg/util"
"time"
)
// Defining the `SMSLog` business logic.
type SMSLog struct {
Trans *util.Trans
SMSLogDAL *dal.SMSLog
}
// 查询SMSLog列表
func (a *SMSLog) Query(ctx context.Context, params schema.SMSLogQueryParam) (*schema.SMSLogQueryResult, error) {
params.Pagination = true
result, err := a.SMSLogDAL.Query(ctx, params, schema.SMSLogQueryOptions{
QueryOptions: util.QueryOptions{
OrderFields: []util.OrderByParam{
{Field: "created_at", Direction: util.DESC},
},
},
})
if err != nil {
return nil, err
}
return result, nil
}
// 获取单条SMSLog
func (a *SMSLog) Get(ctx context.Context, id uint) (*schema.SMSLog, error) {
smsLog, err := a.SMSLogDAL.Get(ctx, id)
if err != nil {
return nil, err
} else if smsLog == nil {
return nil, errors.NotFound("", "SMSLog not found")
}
return smsLog, nil
}
// 创建SMSLog
func (a *SMSLog) Create(ctx context.Context, formItem *schema.SMSLogForm) (*schema.SMSLog, error) {
smsLog := &schema.SMSLog{}
if err := formItem.FillTo(smsLog); err != nil {
return nil, err
}
err := a.Trans.Exec(ctx, func(ctx context.Context) error {
if err := a.SMSLogDAL.Create(ctx, smsLog); err != nil {
return err
}
return nil
})
if err != nil {
return nil, err
}
return smsLog, nil
}
// 修改SMSLog
func (a *SMSLog) Update(ctx context.Context, id uint, formItem *schema.SMSLogForm) error {
smsLog, err := a.SMSLogDAL.Get(ctx, id)
if err != nil {
return err
} else if smsLog == nil {
return errors.NotFound("", "SMSLog not found")
}
if err := formItem.FillTo(smsLog); err != nil {
return err
}
smsLog.UpdatedAt = time.Now()
return a.Trans.Exec(ctx, func(ctx context.Context) error {
if err := a.SMSLogDAL.Update(ctx, smsLog); err != nil {
return err
}
return nil
})
}
// 删除SMSLog
func (a *SMSLog) Delete(ctx context.Context, id uint) error {
exists, err := a.SMSLogDAL.Exists(ctx, id)
if err != nil {
return err
} else if !exists {
return errors.NotFound("", "SMSLog not found")
}
return a.Trans.Exec(ctx, func(ctx context.Context) error {
if err := a.SMSLogDAL.Delete(ctx, id); err != nil {
return err
}
return nil
})
}

View File

@ -0,0 +1,82 @@
package dal
import (
"context"
"github.guxuan/haibei/internal/mods/common/schema"
"github.guxuan/haibei/pkg/errors"
"github.guxuan/haibei/pkg/util"
"gorm.io/gorm"
)
// Get smsLog storage instance
func GetSMSLogDB(ctx context.Context, defDB *gorm.DB) *gorm.DB {
return util.GetDB(ctx, defDB).Model(new(schema.SMSLog))
}
// Defining the `SMSLog` data access object.
type SMSLog struct {
DB *gorm.DB
}
// 查询SMSLog列表
func (a *SMSLog) Query(ctx context.Context, params schema.SMSLogQueryParam, opts ...schema.SMSLogQueryOptions) (*schema.SMSLogQueryResult, error) {
var opt schema.SMSLogQueryOptions
if len(opts) > 0 {
opt = opts[0]
}
db := GetSMSLogDB(ctx, a.DB)
var list schema.SMSLogs
pageResult, err := util.WrapPageQuery(ctx, db, params.PaginationParam, opt.QueryOptions, &list)
if err != nil {
return nil, errors.WithStack(err)
}
queryResult := &schema.SMSLogQueryResult{
PageResult: pageResult,
Data: list,
}
return queryResult, nil
}
// 获取单条SMSLog
func (a *SMSLog) Get(ctx context.Context, id uint, opts ...schema.SMSLogQueryOptions) (*schema.SMSLog, error) {
var opt schema.SMSLogQueryOptions
if len(opts) > 0 {
opt = opts[0]
}
item := new(schema.SMSLog)
ok, err := util.FindOne(ctx, GetSMSLogDB(ctx, a.DB).Where("id=?", id), opt.QueryOptions, item)
if err != nil {
return nil, errors.WithStack(err)
} else if !ok {
return nil, nil
}
return item, nil
}
// 检查是否存在
func (a *SMSLog) Exists(ctx context.Context, id uint) (bool, error) {
ok, err := util.Exists(ctx, GetSMSLogDB(ctx, a.DB).Where("id=?", id))
return ok, errors.WithStack(err)
}
// 创建SMSLog
func (a *SMSLog) Create(ctx context.Context, item *schema.SMSLog) error {
result := GetSMSLogDB(ctx, a.DB).Create(item)
return errors.WithStack(result.Error)
}
// 修改SMSLog
func (a *SMSLog) Update(ctx context.Context, item *schema.SMSLog) error {
result := GetSMSLogDB(ctx, a.DB).Where("id=?", item.ID).Select("*").Omit("created_at").Updates(item)
return errors.WithStack(result.Error)
}
// 删除SMSLog
func (a *SMSLog) Delete(ctx context.Context, id uint) error {
result := GetSMSLogDB(ctx, a.DB).Where("id=?", id).Delete(new(schema.SMSLog))
return errors.WithStack(result.Error)
}

View File

@ -20,10 +20,11 @@ type Common struct {
AreaAPI *api.Area
UploadAPI *api.Upload
ReceptionCenterAPI *api.ReceptionCenter
SMSLogAPI *api.SMSLog
}
func (a *Common) AutoMigrate(ctx context.Context) error {
return a.DB.AutoMigrate(new(schema.Common), new(schema.Banner), new(schema.Notice), new(schema.Company), new(schema.Area), new(schema.ReceptionCenter), new(schema.SignIn))
return a.DB.AutoMigrate(new(schema.Common), new(schema.Banner), new(schema.Notice), new(schema.Company), new(schema.Area), new(schema.ReceptionCenter), new(schema.SignIn), new(schema.SMSLog))
}
func (a *Common) Init(ctx context.Context) error {
@ -91,6 +92,13 @@ func (a *Common) RegisterV1Routers(ctx context.Context, v1 *gin.RouterGroup) err
reception.PUT(":id", a.ReceptionCenterAPI.Update)
reception.DELETE(":id", a.ReceptionCenterAPI.Delete)
}
smsLog := v1.Group("smsLogs")
{
smsLog.GET("", a.SMSLogAPI.Query)
smsLog.GET(":id", a.SMSLogAPI.Get)
smsLog.PUT(":id", a.SMSLogAPI.Update)
smsLog.DELETE(":id", a.SMSLogAPI.Delete)
}
return nil
}

View File

@ -0,0 +1,62 @@
package schema
import (
"github.guxuan/haibei/pkg/util"
"time"
)
// Defining the `SmsLog` struct.
type SMSLog struct {
util.BaseModel
CustomerName string `json:"customerName" gorm:"index;comment:客户姓名"` //客户姓名
Phone string `json:"phone" gorm:"size:20;index;comment:手机号"` //手机号
SMSContent string `json:"SMSContent" gorm:"size:128;comment:短信内容"` //短信内容
SMSType string `json:"smsType" gorm:"size:20;comment:短信类型"` ///短信类型
SendAt time.Time `json:"sendAt" gorm:"size:32;comment:发送时间"` //发送时间
}
// Defining the query parameters for the `SmsLog` struct.
type SMSLogQueryParam struct {
util.PaginationParam
LikeName string `form:"likeName"` //客户姓名
Phone string `form:"phone"` //手机号
SMSType string `form:"smsType"` ///短信类型
}
// Defining the query options for the `SmsLog` struct.
type SMSLogQueryOptions struct {
util.QueryOptions
}
// Defining the query result for the `SmsLog` struct.
type SMSLogQueryResult struct {
Data SMSLogs
PageResult *util.PaginationResult
}
// Defining the slice of `SmsLog` struct.
type SMSLogs []*SMSLog
// Defining the data structure for creating a `SmsLog` struct.
type SMSLogForm struct {
CustomerName string `json:"customerName"` //客户姓名
Phone string `json:"phone"` //手机号
SMSContent string `json:"SMSContent"` //短信内容
SMSType string `json:"smsType"` ///短信类型
SendAt time.Time `json:"sendAt"` //发送时间
}
// A validation function for the `SmsLogForm` struct.
func (a *SMSLogForm) Validate() error {
return nil
}
// Convert `SmsLogForm` to `SmsLog` object.
func (a *SMSLogForm) FillTo(smsLog *SMSLog) error {
smsLog.CustomerName = a.CustomerName
smsLog.Phone = a.Phone
smsLog.SMSContent = a.SMSContent
smsLog.SMSType = a.SMSType
smsLog.SendAt = a.SendAt
return nil
}

View File

@ -28,4 +28,9 @@ var Set = wire.NewSet(
wire.Struct(new(dal.Area), "*"),
wire.Struct(new(biz.Area), "*"),
wire.Struct(new(api.Area), "*"),
wire.Struct(new(dal.SMSLog), "*"),
wire.Struct(new(biz.SMSLog), "*"),
wire.Struct(new(api.SMSLog), "*"),
wire.Struct(new(biz.Upload), "*"),
wire.Struct(new(api.Upload), "*"),
)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -121,6 +121,15 @@ definitions:
title:
type: string
type: object
schema.Adviser:
properties:
avatar:
type: string
name:
type: string
phone:
type: string
type: object
schema.Area:
properties:
createdAt:
@ -239,6 +248,25 @@ definitions:
status:
type: string
type: object
schema.BasicInfo:
properties:
address:
type: string
area:
type: string
buildingarea:
type: string
masterType:
type: string
showAddress:
type: string
status:
type: string
type:
type: string
unitStruct:
type: string
type: object
schema.Captcha:
properties:
captcha_id:
@ -259,6 +287,27 @@ definitions:
type: object
schema.CommonForm:
type: object
schema.CommunityInfo:
properties:
greeningRate:
type: string
packingNum:
type: string
propertyName:
type: string
propertyPrice:
type: string
propertyType:
type: string
r19009Ratio:
type: string
r19010Ratio:
type: string
r19011Ratio:
type: string
roomNUM:
type: string
type: object
schema.Company:
properties:
areaId:
@ -357,6 +406,15 @@ definitions:
wxSign:
type: string
type: object
schema.Detail:
properties:
basicInfo:
$ref: '#/definitions/schema.BasicInfo'
communityInfo:
$ref: '#/definitions/schema.CommunityInfo'
salesInfo:
$ref: '#/definitions/schema.SalesInfo'
type: object
schema.Grade:
properties:
createdAt:
@ -399,6 +457,195 @@ definitions:
status:
type: string
type: object
schema.House:
properties:
address:
type: string
advisers:
items:
$ref: '#/definitions/schema.Adviser'
type: array
area:
type: number
areaId:
type: integer
cover:
type: string
createdAt:
type: string
createdId:
type: integer
deletedAt:
type: integer
deletedId:
type: integer
detail:
$ref: '#/definitions/schema.Detail'
id:
type: integer
images:
items:
type: string
type: array
labels:
items:
type: string
type: array
latitude:
type: number
layOuts:
items:
$ref: '#/definitions/schema.LayOut'
type: array
longitude:
type: number
masterType:
type: string
name:
type: string
openAt:
type: string
price:
type: integer
status:
type: string
surroundings:
$ref: '#/definitions/schema.Surroundings'
title:
type: string
updatedAt:
type: string
videos:
items:
type: string
type: array
watchAvatars:
items:
type: string
type: array
watchNum:
type: integer
type: object
schema.HouseArticle:
properties:
content:
type: string
cover:
type: string
createdAt:
type: string
createdId:
type: integer
deletedAt:
type: integer
deletedId:
type: integer
houseId:
type: integer
id:
type: integer
name:
type: string
pushAt:
type: string
status:
type: string
title:
type: string
updatedAt:
type: string
type: object
schema.HouseArticleForm:
properties:
content:
type: string
cover:
type: string
houseId:
type: integer
name:
type: string
pushAt:
type: string
status:
type: string
title:
type: string
type: object
schema.HouseForm:
properties:
address:
type: string
advisers:
items:
$ref: '#/definitions/schema.Adviser'
type: array
area:
type: number
areaId:
type: integer
cover:
type: string
detail:
$ref: '#/definitions/schema.Detail'
images:
items:
type: string
type: array
labels:
items:
type: string
type: array
latitude:
type: number
layOuts:
items:
$ref: '#/definitions/schema.LayOut'
type: array
longitude:
type: number
masterType:
type: string
name:
type: string
openAt:
type: string
price:
type: integer
status:
type: string
surroundings:
$ref: '#/definitions/schema.Surroundings'
title:
type: string
videos:
items:
type: string
type: array
watchAvatars:
items:
type: string
type: array
watchNum:
type: integer
type: object
schema.LayOut:
properties:
area:
type: number
direction:
type: string
img:
type: string
labels:
items:
type: string
type: array
price:
type: string
title:
type: string
type: object
schema.Logger:
properties:
created_at:
@ -1034,6 +1281,80 @@ definitions:
description: Update time
type: string
type: object
schema.SMSLog:
properties:
SMSContent:
description: 短信内容
type: string
createdAt:
type: string
createdId:
type: integer
customerName:
description: 客户姓名
type: string
deletedAt:
type: integer
deletedId:
type: integer
id:
type: integer
phone:
description: 手机号
type: string
sendAt:
description: 发送时间
type: string
smsType:
description: /短信类型
type: string
updatedAt:
type: string
type: object
schema.SMSLogForm:
properties:
SMSContent:
description: 短信内容
type: string
customerName:
description: 客户姓名
type: string
phone:
description: 手机号
type: string
sendAt:
description: 发送时间
type: string
smsType:
description: /短信类型
type: string
type: object
schema.SalesInfo:
properties:
duration:
type: string
salesAddress:
type: string
salesPhone:
type: string
salesType:
type: string
status:
type: string
type: object
schema.Surroundings:
properties:
busNum:
type: integer
hospitalNum:
type: integer
lifeNum:
type: integer
metroNum:
type: integer
schoolNum:
type: integer
type: object
schema.UpdateCurrentUser:
properties:
email:
@ -1563,6 +1884,26 @@ paths:
summary: 小程序绑定手机号
tags:
- APP端
/api/v1/apps/home:
post:
responses:
"200":
description: OK
schema:
$ref: '#/definitions/util.ResponseResult'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/util.ResponseResult'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/util.ResponseResult'
security:
- ApiKeyAuth: []
summary: 首页接口
tags:
- APP端
/api/v1/apps/login:
post:
responses:
@ -1583,6 +1924,26 @@ paths:
summary: 小程序登陆
tags:
- APP端
/api/v1/apps/mine:
post:
responses:
"200":
description: OK
schema:
$ref: '#/definitions/util.ResponseResult'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/util.ResponseResult'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/util.ResponseResult'
security:
- ApiKeyAuth: []
summary: 首页接口
tags:
- APP端
/api/v1/apps/sms/{phone}:
get:
responses:
@ -2958,6 +3319,338 @@ paths:
summary: Update grade record by ID
tags:
- 权益模块
/api/v1/house_articles:
get:
parameters:
- default: 1
description: pagination index
in: query
name: current
required: true
type: integer
- default: 10
description: pagination size
in: query
name: pageSize
required: true
type: integer
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/util.ResponseResult'
- properties:
data:
items:
$ref: '#/definitions/schema.HouseArticle'
type: array
type: object
"401":
description: Unauthorized
schema:
$ref: '#/definitions/util.ResponseResult'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/util.ResponseResult'
security:
- ApiKeyAuth: []
summary: Query house list
tags:
- 房刊模块
post:
parameters:
- description: Request body
in: body
name: body
required: true
schema:
$ref: '#/definitions/schema.HouseArticleForm'
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/util.ResponseResult'
- properties:
data:
$ref: '#/definitions/schema.HouseArticle'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/util.ResponseResult'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/util.ResponseResult'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/util.ResponseResult'
security:
- ApiKeyAuth: []
summary: Create house record
tags:
- 房刊模块
/api/v1/house_articles/{id}:
delete:
parameters:
- description: unique id
in: path
name: id
required: true
type: string
responses:
"200":
description: OK
schema:
$ref: '#/definitions/util.ResponseResult'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/util.ResponseResult'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/util.ResponseResult'
security:
- ApiKeyAuth: []
summary: Delete house record by ID
tags:
- 房刊模块
get:
parameters:
- description: unique id
in: path
name: id
required: true
type: string
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/util.ResponseResult'
- properties:
data:
$ref: '#/definitions/schema.HouseArticle'
type: object
"401":
description: Unauthorized
schema:
$ref: '#/definitions/util.ResponseResult'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/util.ResponseResult'
security:
- ApiKeyAuth: []
summary: Get house record by ID
tags:
- 房刊模块
put:
parameters:
- description: unique id
in: path
name: id
required: true
type: string
- description: Request body
in: body
name: body
required: true
schema:
$ref: '#/definitions/schema.HouseArticleForm'
responses:
"200":
description: OK
schema:
$ref: '#/definitions/util.ResponseResult'
"400":
description: Bad Request
schema:
$ref: '#/definitions/util.ResponseResult'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/util.ResponseResult'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/util.ResponseResult'
security:
- ApiKeyAuth: []
summary: Update house record by ID
tags:
- 房刊模块
/api/v1/houses:
get:
parameters:
- default: 1
description: pagination index
in: query
name: current
required: true
type: integer
- default: 10
description: pagination size
in: query
name: pageSize
required: true
type: integer
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/util.ResponseResult'
- properties:
data:
items:
$ref: '#/definitions/schema.House'
type: array
type: object
"401":
description: Unauthorized
schema:
$ref: '#/definitions/util.ResponseResult'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/util.ResponseResult'
security:
- ApiKeyAuth: []
summary: Query house list
tags:
- 房源模块
post:
parameters:
- description: Request body
in: body
name: body
required: true
schema:
$ref: '#/definitions/schema.HouseForm'
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/util.ResponseResult'
- properties:
data:
$ref: '#/definitions/schema.House'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/util.ResponseResult'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/util.ResponseResult'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/util.ResponseResult'
security:
- ApiKeyAuth: []
summary: Create house record
tags:
- 房源模块
/api/v1/houses/{id}:
delete:
parameters:
- description: unique id
in: path
name: id
required: true
type: string
responses:
"200":
description: OK
schema:
$ref: '#/definitions/util.ResponseResult'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/util.ResponseResult'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/util.ResponseResult'
security:
- ApiKeyAuth: []
summary: Delete house record by ID
tags:
- 房源模块
get:
parameters:
- description: unique id
in: path
name: id
required: true
type: string
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/util.ResponseResult'
- properties:
data:
$ref: '#/definitions/schema.House'
type: object
"401":
description: Unauthorized
schema:
$ref: '#/definitions/util.ResponseResult'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/util.ResponseResult'
security:
- ApiKeyAuth: []
summary: Get house record by ID
tags:
- 房源模块
put:
parameters:
- description: unique id
in: path
name: id
required: true
type: string
- description: Request body
in: body
name: body
required: true
schema:
$ref: '#/definitions/schema.HouseForm'
responses:
"200":
description: OK
schema:
$ref: '#/definitions/util.ResponseResult'
"400":
description: Bad Request
schema:
$ref: '#/definitions/util.ResponseResult'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/util.ResponseResult'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/util.ResponseResult'
security:
- ApiKeyAuth: []
summary: Update house record by ID
tags:
- 房源模块
/api/v1/loggers:
get:
parameters:
@ -4562,6 +5255,7 @@ paths:
- properties:
data:
items:
format: int32
type: integer
type: array
type: object
@ -4752,6 +5446,137 @@ paths:
summary: Update role record by ID
tags:
- RoleAPI
/api/v1/smsLogs:
get:
parameters:
- default: 1
description: pagination index
in: query
name: current
required: true
type: integer
- default: 10
description: pagination size
in: query
name: pageSize
required: true
type: integer
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/util.ResponseResult'
- properties:
data:
items:
$ref: '#/definitions/schema.SMSLog'
type: array
type: object
"401":
description: Unauthorized
schema:
$ref: '#/definitions/util.ResponseResult'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/util.ResponseResult'
security:
- ApiKeyAuth: []
summary: Query smsLog list
tags:
- 短信日志模块
/api/v1/smsLogs/{id}:
delete:
parameters:
- description: unique id
in: path
name: id
required: true
type: string
responses:
"200":
description: OK
schema:
$ref: '#/definitions/util.ResponseResult'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/util.ResponseResult'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/util.ResponseResult'
security:
- ApiKeyAuth: []
summary: Delete smsLog record by ID
tags:
- 短信日志模块
get:
parameters:
- description: unique id
in: path
name: id
required: true
type: string
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/util.ResponseResult'
- properties:
data:
$ref: '#/definitions/schema.SMSLog'
type: object
"401":
description: Unauthorized
schema:
$ref: '#/definitions/util.ResponseResult'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/util.ResponseResult'
security:
- ApiKeyAuth: []
summary: Get smsLog record by ID
tags:
- 短信日志模块
put:
parameters:
- description: unique id
in: path
name: id
required: true
type: string
- description: Request body
in: body
name: body
required: true
schema:
$ref: '#/definitions/schema.SMSLogForm'
responses:
"200":
description: OK
schema:
$ref: '#/definitions/util.ResponseResult'
"400":
description: Bad Request
schema:
$ref: '#/definitions/util.ResponseResult'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/util.ResponseResult'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/util.ResponseResult'
security:
- ApiKeyAuth: []
summary: Update smsLog record by ID
tags:
- 短信日志模块
/api/v1/users:
get:
parameters:

View File

@ -108,11 +108,15 @@ func BuildInjector(ctx context.Context) (*Injector, func(), error) {
apiUser := &api.User{
UserBIZ: bizUser,
}
dalCustomer := &dal2.Customer{
DB: db,
}
login := &biz.Login{
Cache: cacher,
Auth: auther,
UserDAL: user,
UserRoleDAL: userRole,
CustomerDAL: dalCustomer,
MenuDAL: menu,
UserBIZ: bizUser,
}
@ -143,9 +147,6 @@ func BuildInjector(ctx context.Context) (*Injector, func(), error) {
LoggerAPI: apiLogger,
Casbinx: casbinx,
}
dalCustomer := &dal2.Customer{
DB: db,
}
bizCustomer := &biz2.Customer{
Cache: cacher,
Trans: trans,
@ -231,6 +232,13 @@ func BuildInjector(ctx context.Context) (*Injector, func(), error) {
apiArea := &api3.Area{
AreaBIZ: bizArea,
}
upload := &biz3.Upload{
Cache: cacher,
Trans: trans,
}
apiUpload := &api3.Upload{
UploadBIZ: upload,
}
receptionCenter := &dal3.ReceptionCenter{
DB: db,
}
@ -241,6 +249,16 @@ func BuildInjector(ctx context.Context) (*Injector, func(), error) {
apiReceptionCenter := &api3.ReceptionCenter{
ReceptionCenterBIZ: bizReceptionCenter,
}
smsLog := &dal3.SMSLog{
DB: db,
}
bizSMSLog := &biz3.SMSLog{
Trans: trans,
SMSLogDAL: smsLog,
}
apiSMSLog := &api3.SMSLog{
SMSLogBIZ: bizSMSLog,
}
commonCommon := &common.Common{
DB: db,
CommonAPI: apiCommon,
@ -248,7 +266,9 @@ func BuildInjector(ctx context.Context) (*Injector, func(), error) {
NoticeAPI: apiNotice,
CompanyAPI: apiCompany,
AreaAPI: apiArea,
UploadAPI: apiUpload,
ReceptionCenterAPI: apiReceptionCenter,
SMSLogAPI: apiSMSLog,
}
dalProduct := &dal4.Product{
DB: db,