获取某个商品平台价,商品名前缀

This commit is contained in:
苏尹岚
2019-12-19 18:40:46 +08:00
parent a3c236d281
commit dad7a5a926
17 changed files with 293 additions and 68 deletions

View File

@@ -327,9 +327,9 @@ func FloatWeight2Int(weight float32) int {
return int(math.Round(float64(weight * 1000)))
}
func ComposeSkuName(prefix, name, comment, unit string, spec_quality float32, spec_unit string, maxLen int, exPrefix string, exPrefixBegin, exPrefixEnd time.Time) (skuName string) {
if exPrefix != "" && !utils.IsTimeZero(exPrefixBegin) && !utils.IsTimeZero(exPrefixEnd) {
if time.Now().After(exPrefixBegin) && time.Now().Before(exPrefixEnd) {
func ComposeSkuName(prefix, name, comment, unit string, spec_quality float32, spec_unit string, maxLen int, exPrefix string, exPrefixBegin, exPrefixEnd *time.Time) (skuName string) {
if exPrefix != "" && exPrefixBegin != nil && exPrefixEnd != nil {
if time.Now().After(*exPrefixBegin) && time.Now().Before(*exPrefixEnd) {
skuName = exPrefix
}
}
@@ -353,12 +353,12 @@ func ComposeSkuName(prefix, name, comment, unit string, spec_quality float32, sp
return skuName
}
func ComposeSkuNameSync(prefix, name, comment, unit string, spec_quality float32, spec_unit string, maxLen int, exPrefix string, exPrefixBegin, exPrefixEnd time.Time) (skuName string) {
if exPrefix != "" && !utils.IsTimeZero(exPrefixBegin) && !utils.IsTimeZero(exPrefixEnd) {
if time.Now().Add(6*time.Hour).After(exPrefixBegin) && time.Now().Before(exPrefixEnd) {
func ComposeSkuNameSync(prefix, name, comment, unit string, spec_quality float32, spec_unit string, maxLen int, exPrefix string, exPrefixBegin, exPrefixEnd *time.Time) (skuName string) {
if exPrefix != "" && exPrefixBegin != nil && exPrefixEnd != nil {
if utils.Time2Date(time.Now().Add(6*time.Hour)).Sub(*exPrefixBegin) >= 0 && utils.Time2Date(time.Now()).Sub(*exPrefixEnd) < 0 {
skuName = exPrefix
}
if time.Now().Add(6 * time.Hour).After(exPrefixEnd) {
if utils.Time2Date(time.Now().Add(6*time.Hour)).Sub(*exPrefixEnd) >= 0 {
skuName = ""
}
}