更新门店cid
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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"},
|
||||
}
|
||||
|
||||
@@ -825,3 +825,18 @@ func (c *StoreController) GetJdDeliveryArea() {
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 修改门店对应Cid(个推推送uniapp消息用)
|
||||
// @Description 修改门店对应Cid(个推推送uniapp消息用)
|
||||
// @Param token header string true "认证token"
|
||||
// @Param storeID formData int true "门店ID"
|
||||
// @Param clientID formData string true "cID"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /UpdateStorePushClient [post]
|
||||
func (c *StoreController) UpdateStorePushClient() {
|
||||
c.callUpdateStorePushClient(func(params *tStoreUpdateStorePushClientParams) (retVal interface{}, errCode string, err error) {
|
||||
err = cms.UpdateStorePushClient(params.Ctx, params.StoreID, params.ClientID)
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ func Init() {
|
||||
orm.RegisterModel(&model.SkuCategory{})
|
||||
orm.RegisterModel(&model.ThingMap{})
|
||||
orm.RegisterModel(&model.SkuExinfoMap{})
|
||||
orm.RegisterModel(&model.StorePushClient{})
|
||||
|
||||
orm.RegisterModel(&model.AuthBind{}, &model.User{})
|
||||
|
||||
|
||||
@@ -2079,6 +2079,15 @@ func init() {
|
||||
Filters: nil,
|
||||
Params: nil})
|
||||
|
||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreController"],
|
||||
beego.ControllerComments{
|
||||
Method: "UpdateStorePushClient",
|
||||
Router: `/UpdateStorePushClient`,
|
||||
AllowHTTPMethods: []string{"post"},
|
||||
MethodParams: param.Make(),
|
||||
Filters: nil,
|
||||
Params: nil})
|
||||
|
||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreController"],
|
||||
beego.ControllerComments{
|
||||
Method: "UpdateStoreVendorMap",
|
||||
|
||||
Reference in New Issue
Block a user