更新门店cid

This commit is contained in:
苏尹岚
2020-09-11 17:29:56 +08:00
parent 059b0c7557
commit 1d6ad5f06d
6 changed files with 70 additions and 2 deletions

View File

@@ -3534,3 +3534,22 @@ func GetJdDeliveryArea(ctx *jxcontext.Context, storeIDs []int) (err error) {
}
return err
}
func UpdateStorePushClient(ctx *jxcontext.Context, storeID int, cID string) (err error) {
var (
db = dao.GetDB()
)
storePushClients, err := dao.GetStorePushClient(db, storeID, cID)
if err != nil {
return err
}
if len(storePushClients) == 0 {
storePushClient := &model.StorePushClient{
StoreID: storeID,
ClientID: cID,
}
dao.WrapAddIDCULDEntity(storePushClient, ctx.GetUserName())
dao.CreateEntity(db, storePushClient)
}
return err
}

View File

@@ -813,3 +813,27 @@ func DeleteStoreCategroies(db *DaoDB, userName string, storeID int) (err error)
_, err = ExecuteSQL(db, sql, sqlParams)
return err
}
func GetStorePushClient(db *DaoDB, storeID int, cID string) (storePushClient []*model.StorePushClient, err error) {
sql := `
SELECT *
FROM store_push_client
WHERE deleted_at = ?
`
sqlParams := []interface{}{
utils.DefaultTimeValue,
}
if storeID > 0 {
sql += " AND store_id = ?"
sqlParams = append(sqlParams, storeID)
}
if cID != "" {
sql += " AND client_id = ?"
sqlParams = append(sqlParams, cID)
}
err = GetRows(db, &storePushClient, sql, sqlParams)
if err != nil {
return nil, err
}
return storePushClient, err
}

View File

@@ -686,13 +686,13 @@ func (*StoreCategoryMap) TableUnique() [][]string {
}
}
type StoreClientPush struct {
type StorePushClient struct {
ModelIDCULD
StoreID int `orm:"column(store_id)" json:"storeID"`
ClientID string `orm:"column(client_id);size(255)" json:"clientID"`
}
func (*StoreClientPush) TableUnique() [][]string {
func (*StorePushClient) TableUnique() [][]string {
return [][]string{
[]string{"StoreID", "ClientID"},
}