This commit is contained in:
suyl
2021-06-01 15:54:26 +08:00
parent 92d8144065
commit 588a2a1f72
3 changed files with 54 additions and 0 deletions

View File

@@ -1214,6 +1214,37 @@ func CreateStore(ctx *jxcontext.Context, storeExt *StoreExt, userName string) (i
return 0, err
}
func CreateStoreByUser(ctx *jxcontext.Context, mobile string) (id int, err error) {
store := &model.Store{}
db := dao.GetDB()
store.Lng = jxutils.StandardCoordinate2Int(104.3975)
store.Lat = jxutils.StandardCoordinate2Int(30.504679)
store.Address = "成都市简阳市简阳市"
store.Name = "无名称" + utils.Int64ToStr(time.Now().Unix())
store.DeliveryRangeType = model.DeliveryRangeTypeRadius
store.DeliveryRange = "3000"
store.PayPercentage = 100
store.Status = model.StoreStatusClosed
store.OpenTime1 = 700
store.CloseTime1 = 1900
store.Tel1 = mobile
store.CityCode = 510100
store.DistrictCode = 510185
store.BrandID = 1
if store.StoreLevel == "" {
store.StoreLevel = "C"
}
dao.WrapAddIDCULDEntity(store, ctx.GetUserName())
if err = dao.CreateEntity(db, store); err == nil {
if globals.IsAddEvent {
err = AddEventDetail(db, ctx, model.OperateAdd, store.ID, model.ThingTypeStore, store.ID, "", "")
}
TryAddStoreBossRole4StoreByMobile(ctx, store.ID, []string{mobile})
return store.ID, err
}
return 0, err
}
func GetStoreVendorMaps(ctx *jxcontext.Context, db *dao.DaoDB, storeID int, vendorID int) (storeMaps []*model.StoreMap, err error) {
cond := map[string]interface{}{
model.FieldStoreID: storeID,