This commit is contained in:
richboo111
2023-09-20 11:10:12 +08:00
parent c76c787b46
commit d201a02816
5 changed files with 89 additions and 7 deletions

View File

@@ -31,6 +31,44 @@ var rdb = redis.NewClient(&redis.Options{
DB: 0,
})
type UserMessageList struct {
VendorID int `json:"vendorID"` //平台品牌 1-美团 3-饿了么
UserID string `json:"userID"` //用户ID
NewMessageNum int `json:"NewMessageNum"` //新消息数量
LatestMsg string `json:"latestMsg"` //最新一条消息
LatestTime int `json:"latestTime"` //最新一条消息发送时间
}
//测试redis的set
func TestRdbSet(t *testing.T) {
retVal := UserMessageList{}
key := "testAddSet"
ans := make(map[int][]interface{}, 0)
val := []string{"{\"vendorID\":1,\"userID\":\"11555094096\",\"NewMessageNum\":0,\"latestMsg\":\"e3nfwts/Ibi9y+kbb28FFIfoNRDLajJQzUT0DpTkWtY=\",\"latestTime\":1694163546}", "{\"vendorID\":2,\"userID\":\"11555094096\",\"NewMessageNum\":0,\"latestMsg\":\"e3nfwts/Ibi9y+kbb28FFIfoNRDLajJQzUT0DpTkWtY=\",\"latestTime\":1694684389}", "{\"vendorID\":3,\"userID\":\"11555094096\",\"NewMessageNum\":0,\"latestMsg\":\"e3nfwts/Ibi9y+kbb28FFIfoNRDLajJQzUT0DpTkWtY=\",\"latestTime\":1694684389}"}
for k, v := range val {
_ = json.Unmarshal([]byte(v), &retVal)
if time.Now().Unix()-int64(retVal.LatestTime) < 3600*6 {
ans[k] = append(ans[k], v)
//rdb.SAdd(key, v)
} else {
continue
}
}
fmt.Printf("all 1=%s", rdb.SMembers(key).Val())
//for _, v := range rdb.SMembers(key).Val() {
// _ = json.Unmarshal([]byte(v), &retVal)
// if time.Now().Unix()-int64(retVal.LatestTime) < 3600*6 {
// //ans[k] = append(ans[k], v)
// rdb.SAdd(key, v)
// } else {
// rdb.SRem(key, v)
// }
//}
//fmt.Printf("all 2=%s", rdb.SMembers(key).Val())
//fmt.Printf("ans=%s", utils.Format4Output(ans, false))
}
func TestSendMsg(t *testing.T) {
data := PushContentReq{
AppID: 589,

View File

@@ -12,9 +12,11 @@ import (
)
const (
MtwmSCTag = "13030000"
MtwmC4Tag = "11010000"
MtwmSGTag = "10010000"
MtwmSCTag = "13030000"
MtwmC4Tag = "11010000"
MtwmSGTag = "10010000"
AuditTypeStore = 1 //审核类型1-门店入驻2-门店logo(头图)
AuditTypeStoreLogo = 2
)
type PoiCategoryInfo struct {
@@ -364,3 +366,36 @@ func (a *API) GetBoundList(otherStoreId string) ([]*AuthorizationStatus, error)
return data, nil
}
type SettleAuditList struct {
AppPoiCode string `json:"app_poi_code"`
Status int `json:"status"` //任务状态:0-待完善1-审核中2-已驳回4-待提审5-审核通过7-暂不合作9-创建失败
//audit_type=1时有效
BaseStatus int `json:"base_status"` //基本信息模块0-待录入1-已录入2-审核中3-已驳回4-签约中5-签约失败6-已生效7-缺失
LegalPersonStatus int `json:"legal_person_status"` //法人信息模块(仅单店)
ShippingStatus int `json:"shipping_status"` //配送信息模块
QualificationStatus int `json:"qualification_status"` //资质信息模块
SettlementStatus int `json:"settlement_status"` //结算信息模块(仅连锁门店)
//audit_type=2时有效
LogoStatus int `json:"logo_status"` //门店logo审核结果1-审核中2-审核通过3-已驳回
Reason string `json:"reason"` //审核描述
}
// GetSettleAuditList 批量查询门店审核状态,目前只用
func (a *API) GetSettleAuditList(appPoiCodes string) ([]*SettleAuditList, error) {
param := make(map[string]interface{}, 0)
param["app_poi_codes"] = appPoiCodes
param["audit_type"] = AuditTypeStoreLogo
result, err := a.AccessAPI("ecommerce/poi/settle/audit/list", true, param)
if err != nil {
return nil, err
}
var data []*SettleAuditList
if err := utils.Map2StructByJson(result, &data, false); err != nil {
return nil, err
}
return data, nil
}

View File

@@ -44,10 +44,10 @@ func TestPoiSave(t *testing.T) {
//}
poiParams := map[string]interface{}{}
//utils.FilterMapNilMembers(utils.Struct2FlatMap(result[0]))
poiParams["address"] = "北京市朝阳区百子湾路32号院6号楼-1层C3-1号"
//poiParams["pic_url"] = "http://image.jxc4.com/image/5c9fc4fffb4d5ff1aecf85a2d2543e00.jpg"
//poiParams["address"] = "北京市朝阳区百子湾路32号院6号楼-1层C3-1号"
poiParams["pic_url"] = "https://image.jxc4.com/image/259873ec6392f963d2f3d30669d1c0a9.jpg"
//poiParams["name"] = "京西菜市(礼嘉桥村市场店)"
err := api.PoiSave("18830143", poiParams)
err := api.PoiSave("15070168", poiParams)
fmt.Println(err)
}
@@ -169,6 +169,14 @@ func TestGetBoundList(t *testing.T) {
t.Log(utils.Format4Output(result, false))
}
func TestGetSettleAuditList(t *testing.T) {
result, err := api.GetSettleAuditList("15478260,18830667")
if err != nil {
t.Fatal(err)
}
t.Log(utils.Format4Output(result, false))
}
type Name struct {
Name string `json:"name"`
Description string `json:"description"`

View File

@@ -387,7 +387,7 @@ func TestCategoryAttrList(t *testing.T) {
//特殊属性查询
func TestCategoryAttrValueList(t *testing.T) {
result, err := api.CategoryAttrValueList(1200000088, "【常用调味】干花椒 红花椒 ")
result, err := api.CategoryAttrValueList(1200000088, "海天")
if len(result) > 0 {
fmt.Println("jejeje")
}

View File

@@ -81,6 +81,7 @@ var SFCityStoreIDs = map[string]string{
"海口市": "3270650813681",
"柳州市": "3270650844193",
"北海市": "3270650890577",
"贵港市": "3270650914065",
}
const (