Commit 46efb559 by mushishixian

添加是否允许后天下单

parent edf4de5c
...@@ -24,6 +24,6 @@ func Boot(configPath string) (err error) { ...@@ -24,6 +24,6 @@ func Boot(configPath string) (err error) {
panic(err) panic(err)
return return
} }
logger.Loginit() logger.LogInit()
return return
} }
...@@ -3,6 +3,7 @@ package main ...@@ -3,6 +3,7 @@ package main
import ( import (
"flag" "flag"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
logger "github.com/ichunt2019/log"
"github.com/micro/go-micro/v2/web" "github.com/micro/go-micro/v2/web"
"go_sku_server/boot" "go_sku_server/boot"
"go_sku_server/pkg/config" "go_sku_server/pkg/config"
......
...@@ -6,6 +6,7 @@ type Activity struct { ...@@ -6,6 +6,7 @@ type Activity struct {
SupplierIdList []string SupplierIdList []string
SupplierType int `json:"supplier_type"` SupplierType int `json:"supplier_type"`
UserScope int `json:"user_scope"` UserScope int `json:"user_scope"`
CanAdminOrder int `json:"can_admin_order"`
SignText string `json:"sign_text"` SignText string `json:"sign_text"`
BrandIds string `json:"brand_ids"` BrandIds string `json:"brand_ids"`
BrandIdList []string BrandIdList []string
......
...@@ -77,7 +77,8 @@ type PriceActivity struct { ...@@ -77,7 +77,8 @@ type PriceActivity struct {
type GiftActivity struct { type GiftActivity struct {
ActivityCommon ActivityCommon
ItemList []ActivityItem `json:"items,omitempty"` CanAdminOrder int `json:"can_admin_order,omitempty"`
ItemList []ActivityItem `json:"items,omitempty"`
} }
type ActivityCommon struct { type ActivityCommon struct {
......
...@@ -21,34 +21,33 @@ var ( ...@@ -21,34 +21,33 @@ var (
logD map[string]logger.LogInterface logD map[string]logger.LogInterface
) )
var once sync.Once var once sync.Once
func Loginit() {
func LogInit() {
once.Do(func() { once.Do(func() {
fmt.Print("日志初始化开始") fmt.Print("日志初始化开始")
configs:=config.GetSectionValues("log_config") configs := config.GetSectionValues("log_config")
logD=make(map[string]logger.LogInterface) logD = make(map[string]logger.LogInterface)
for _,configOne:=range configs{ for _, configOne := range configs {
sliceConfig:=strings.Split(configOne, ",") sliceConfig := strings.Split(configOne, ",")
log:=getLog(sliceConfig[0],sliceConfig[1],"0") log := getLog(sliceConfig[0], sliceConfig[1], "0")
logD[sliceConfig[0]]=log logD[sliceConfig[0]] = log
} }
}) })
} }
/** /**
@param path 路径 比如sku_save 即文件夹是 sku 文件名类似 是save_2020-12-10.log @param path 路径 比如sku_save 即文件夹是 sku 文件名类似 是save_2020-12-10.log
@param msg 错误文本 @param msg 错误文本
@Level 默认是 logger.LogLevelInfo @Level 默认是 logger.LogLevelInfo
示例 示例
*/ */
func SyncInsert(path string,msg string,Levels ...int) { func SyncInsert(path string, msg string, Levels ...int) {
log:=getLog(path,"10","1") log := getLog(path, "10", "1")
level:=LogLevelInfo level := LogLevelInfo
if(len(Levels)>0){ if len(Levels) > 0 {
level=Levels[0] level = Levels[0]
} }
switch level { switch level {
case LogLevelDebug: case LogLevelDebug:
...@@ -72,32 +71,32 @@ func SyncInsert(path string,msg string,Levels ...int) { ...@@ -72,32 +71,32 @@ func SyncInsert(path string,msg string,Levels ...int) {
//入口 //入口
func Select(logFiled string) logger.LogInterface { func Select(logFiled string) logger.LogInterface {
log, ok := logD[logFiled] log, ok := logD[logFiled]
if(!ok){ if !ok {
panic("log配置:"+logFiled+"不存在") panic("log配置:" + logFiled + "不存在")
} }
if log,ok:=log.(logger.LogInterface);ok{ if log, ok := log.(logger.LogInterface); ok {
return log return log
} }
panic("type not logger.LogInterface") panic("type not logger.LogInterface")
} }
//内部方法,获取log //内部方法,获取log
func getLog(path string,chan_size string,openSync string) logger.LogInterface { func getLog(path string, chan_size string, openSync string) logger.LogInterface {
logConfig := make(map[string]string) logConfig := make(map[string]string)
logConfig["log_chan_size"]="10" logConfig["log_chan_size"] = "10"
slicePath:=strings.Split(path, "_") slicePath := strings.Split(path, "_")
if(slicePath[0]=="" || slicePath[1]==""){ if slicePath[0] == "" || slicePath[1] == "" {
panic("配置文件出错:文件/路径配置出错;提示:第一个参数格式应为A_B") panic("配置文件出错:文件/路径配置出错;提示:第一个参数格式应为A_B")
} }
logConfig["log_path"] = "logs/"+slicePath[0] logConfig["log_path"] = "logs/" + slicePath[0]
logConfig["log_name"] = slicePath[1] logConfig["log_name"] = slicePath[1]
if(openSync=="1"){ if openSync == "1" {
logConfig["open_sync"] = "1" logConfig["open_sync"] = "1"
} }
if(chan_size!=""){ if chan_size != "" {
logConfig["log_chan_size"]=chan_size logConfig["log_chan_size"] = chan_size
} }
log,err:= logger.InitLogger("file", logConfig) log, err := logger.InitLogger("file", logConfig)
if err != nil { if err != nil {
panic("初始化log包出错:") panic("初始化log包出错:")
} }
...@@ -116,5 +115,3 @@ func SetUp() (err error) { ...@@ -116,5 +115,3 @@ func SetUp() (err error) {
logger.Init() logger.Init()
return return
} }
...@@ -98,6 +98,7 @@ func (as *ActivityService) GetGiftActivity(checkData model.ActivityCheckData, ac ...@@ -98,6 +98,7 @@ func (as *ActivityService) GetGiftActivity(checkData model.ActivityCheckData, ac
giftActivity.ActivityName = activity.ActivityName giftActivity.ActivityName = activity.ActivityName
giftActivity.ActivityId = activity.ActivityId giftActivity.ActivityId = activity.ActivityId
giftActivity = model.GiftActivity{ giftActivity = model.GiftActivity{
CanAdminOrder: activity.CanAdminOrder,
ItemList: activity.ItemList, ItemList: activity.ItemList,
ActivityCommon: model.ActivityCommon{ ActivityCommon: model.ActivityCommon{
HasActivity: hasActivity, HasActivity: hasActivity,
......
package service package service
import ( import (
"fmt"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/gomodule/redigo/redis" "github.com/gomodule/redigo/redis"
"github.com/iancoleman/orderedmap" "github.com/iancoleman/orderedmap"
...@@ -100,8 +99,6 @@ func (qs *ZiyingService) HDActivityPrice(SkuInfo string) *orderedmap.OrderedMap ...@@ -100,8 +99,6 @@ func (qs *ZiyingService) HDActivityPrice(SkuInfo string) *orderedmap.OrderedMap
A.Set("has_gift_activity", 1) A.Set("has_gift_activity", 1)
A.Set("gift_activity", giftActivity) A.Set("gift_activity", giftActivity)
} }
fmt.Println(priceActivity.AllowCoupon)
fmt.Println(giftActivity.AllowCoupon)
//其中一类活动不允许优惠券,这个商品就不允许使用优惠券 //其中一类活动不允许优惠券,这个商品就不允许使用优惠券
var allowCoupon int var allowCoupon int
if priceActivity.HasActivity && priceActivity.AllowCoupon == 2 { if priceActivity.HasActivity && priceActivity.AllowCoupon == 2 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment