Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 55638aee29 |
@@ -155,7 +155,7 @@ type AutomationAction struct {
|
|||||||
type AutomationTask struct {
|
type AutomationTask struct {
|
||||||
Id uint32 `json:"id"` // ID
|
Id uint32 `json:"id"` // ID
|
||||||
Title string `json:"title"` // 标题
|
Title string `json:"title"` // 标题
|
||||||
CreateUserId uint32 `json:"create_user_id"` // 创建用户ID
|
FamilyId uint32 `json:"family_id"` // 家庭ID
|
||||||
EffectivePeriod uint8 `json:"effective_period"` // 生效时段
|
EffectivePeriod uint8 `json:"effective_period"` // 生效时段
|
||||||
PeriodBeginTime *string `json:"period_begin_time,omitempty"` // 时段开始时间
|
PeriodBeginTime *string `json:"period_begin_time,omitempty"` // 时段开始时间
|
||||||
PeriodEndTime *string `json:"period_end_time,omitempty"` // 时段结束时间
|
PeriodEndTime *string `json:"period_end_time,omitempty"` // 时段结束时间
|
||||||
@@ -182,3 +182,12 @@ type UserDetail struct {
|
|||||||
QQ *string `json:"qq,omitempty"` // QQ
|
QQ *string `json:"qq,omitempty"` // QQ
|
||||||
Status uint8 `json:"status"` // 状态
|
Status uint8 `json:"status"` // 状态
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 家庭详情
|
||||||
|
type UserFamilyDetail struct {
|
||||||
|
Name string `json:"name"` // 名称
|
||||||
|
Latitude *float64 `json:"latitude,omitempty"` //纬度
|
||||||
|
Longitude *float64 `json:"longitude,omitempty"` // 经度
|
||||||
|
Address *string `json:"address,omitempty"` // 地址
|
||||||
|
CityAdCode *string `json:"city_ad_code,omitempty"` // 城市地理编码
|
||||||
|
}
|
||||||
|
|||||||
48
pkg/rpc/user_family.go
Normal file
48
pkg/rpc/user_family.go
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
package rpc
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
// 用户家庭相关RPC
|
||||||
|
type UserFamily struct{}
|
||||||
|
|
||||||
|
// 获取家庭详情
|
||||||
|
func (uf *UserFamily) GetDetail(familyId uint32) (*UserFamilyDetail, error) {
|
||||||
|
body := map[string]any{
|
||||||
|
"family_id": familyId,
|
||||||
|
"field_list": []string{"name", "latitude", "longitude", "address", "city_ad_code"},
|
||||||
|
}
|
||||||
|
result := &Result[UserFamilyDetail]{}
|
||||||
|
if err := GetRequest().Send("user_family.get_detail", body, result); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if result.Code != 0 {
|
||||||
|
return nil, fmt.Errorf("%s", result.Message)
|
||||||
|
}
|
||||||
|
return &result.Data, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// 发送通知
|
||||||
|
func (uf *UserFamily) SendNotice(familyId uint32, content string) error {
|
||||||
|
body := map[string]any{
|
||||||
|
"family_id": familyId,
|
||||||
|
"content": content,
|
||||||
|
}
|
||||||
|
result := &Result[any]{}
|
||||||
|
if err := GetRequest().Send("user_family.send_notice", body, result); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if result.Code != 0 {
|
||||||
|
return fmt.Errorf("%s", result.Message)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var userFamily *UserFamily
|
||||||
|
|
||||||
|
// 获取用户相关RPC
|
||||||
|
func GetUserFamily() *UserFamily {
|
||||||
|
if userFamily == nil {
|
||||||
|
userFamily = &UserFamily{}
|
||||||
|
}
|
||||||
|
return userFamily
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user