1、接码服务返回 续费金额
This commit is contained in:
		| @ -111,13 +111,14 @@ func (s *SmsServicesDeleteReq) GetId() interface{} { | |||||||
| } | } | ||||||
|  |  | ||||||
| type SmsServicesGetListResp struct { | type SmsServicesGetListResp struct { | ||||||
| 	PlatformCode string          `json:"platformCode" comment:"平台编码"` | 	PlatformCode   string          `json:"platformCode" comment:"平台编码"` | ||||||
| 	PlatformName string          `json:"platformName" comment:"平台名称"` | 	PlatformName   string          `json:"platformName" comment:"平台名称"` | ||||||
| 	Code         string          `json:"code" comment:"编码"` | 	Code           string          `json:"code" comment:"编码"` | ||||||
| 	Name         string          `json:"name" comment:"服务名称"` | 	Name           string          `json:"name" comment:"服务名称"` | ||||||
| 	Status       int             `json:"status" comment:"状态"` | 	Status         int             `json:"status" comment:"状态"` | ||||||
| 	Price        decimal.Decimal `json:"price" comment:"价格"` | 	Price          decimal.Decimal `json:"price" comment:"价格"` | ||||||
| 	LongPrice    decimal.Decimal `json:"longPrice" comment:"长号码价格"` | 	LongPrice      decimal.Decimal `json:"longPrice" comment:"长号码价格"` | ||||||
|  | 	RenewLongPrice decimal.Decimal `json:"renewLongPrice" comment:"续费长号码价格"` | ||||||
| } | } | ||||||
|  |  | ||||||
| type SmsGetPriceReq struct { | type SmsGetPriceReq struct { | ||||||
|  | |||||||
| @ -115,7 +115,9 @@ func (e SmsServices) GetList(resp *[]dto.SmsServicesGetListResp) error { | |||||||
| 	dictService := SysDictData{Service: e.Service} | 	dictService := SysDictData{Service: e.Service} | ||||||
| 	dictDatas, _ := dictService.GetMapByType("sms_platform") | 	dictDatas, _ := dictService.GetMapByType("sms_platform") | ||||||
|  |  | ||||||
| 	keys := []string{"number_premium_daisysms", "number_premium_textverified", "long_number_premium_daisysms", "long_number_premium_textverified"} | 	keys := []string{"number_premium_daisysms", "number_premium_textverified", | ||||||
|  | 		"long_number_premium_daisysms", "long_number_premium_textverified", | ||||||
|  | 		"renew_number_premium_daisysms", "renew_number_premium_textverified"} | ||||||
| 	configService := SysConfig{Service: e.Service} | 	configService := SysConfig{Service: e.Service} | ||||||
| 	mapConfigs, err := configService.GetWithKeyForMap(keys) | 	mapConfigs, err := configService.GetWithKeyForMap(keys) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| @ -125,12 +127,13 @@ func (e SmsServices) GetList(resp *[]dto.SmsServicesGetListResp) error { | |||||||
|  |  | ||||||
| 	for _, item := range data { | 	for _, item := range data { | ||||||
| 		respItem := dto.SmsServicesGetListResp{ | 		respItem := dto.SmsServicesGetListResp{ | ||||||
| 			Name:         item.Name, | 			Name:           item.Name, | ||||||
| 			Code:         item.Code, | 			Code:           item.Code, | ||||||
| 			Status:       item.Status, | 			Status:         item.Status, | ||||||
| 			PlatformCode: item.PlatformCode, | 			PlatformCode:   item.PlatformCode, | ||||||
| 			Price:        item.Price, | 			Price:          item.Price, | ||||||
| 			LongPrice:    item.LongPrice, | 			LongPrice:      item.LongPrice, | ||||||
|  | 			RenewLongPrice: item.LongPrice, | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if dict, ok := dictDatas[respItem.PlatformCode]; ok { | 		if dict, ok := dictDatas[respItem.PlatformCode]; ok { | ||||||
| @ -157,6 +160,15 @@ func (e SmsServices) GetList(resp *[]dto.SmsServicesGetListResp) error { | |||||||
| 					respItem.LongPrice = respItem.LongPrice.Mul(decimal.NewFromInt(100).Add(premium).Div(decimal.NewFromInt(100))).Truncate(2) | 					respItem.LongPrice = respItem.LongPrice.Mul(decimal.NewFromInt(100).Add(premium).Div(decimal.NewFromInt(100))).Truncate(2) | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
|  | 			if config, ok := mapConfigs["renew_number_premium_daisysms"]; ok { | ||||||
|  | 				premium, err := decimal.NewFromString(config.ConfigValue) | ||||||
|  | 				if err != nil || premium.IsZero() { | ||||||
|  | 					e.Log.Errorf("浮动百分比为0,或者是转换错误 %s", config.ConfigValue) | ||||||
|  | 				} | ||||||
|  |  | ||||||
|  | 				respItem.RenewLongPrice = respItem.LongPrice.Mul(decimal.NewFromInt(100).Add(premium).Div(decimal.NewFromInt(100))).Truncate(2) | ||||||
|  | 			} | ||||||
| 		case global.SmsPlatformTextVerified: | 		case global.SmsPlatformTextVerified: | ||||||
| 			if config, ok := mapConfigs["number_premium_textverified"]; ok { | 			if config, ok := mapConfigs["number_premium_textverified"]; ok { | ||||||
| 				premium, err := decimal.NewFromString(config.ConfigValue) | 				premium, err := decimal.NewFromString(config.ConfigValue) | ||||||
| @ -176,6 +188,17 @@ func (e SmsServices) GetList(resp *[]dto.SmsServicesGetListResp) error { | |||||||
| 					respItem.LongPrice = respItem.LongPrice.Mul(decimal.NewFromInt(100).Add(premium).Div(decimal.NewFromInt(100))).Truncate(2) | 					respItem.LongPrice = respItem.LongPrice.Mul(decimal.NewFromInt(100).Add(premium).Div(decimal.NewFromInt(100))).Truncate(2) | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
|  | 			//续期价格浮动 | ||||||
|  | 			if config, ok := mapConfigs["renew_number_premium_textverified"]; ok { | ||||||
|  | 				premium, err := decimal.NewFromString(config.ConfigValue) | ||||||
|  |  | ||||||
|  | 				if err != nil || premium.IsZero() { | ||||||
|  | 					e.Log.Errorf("浮动百分比为0,或者是转换错误 %s", config.ConfigValue) | ||||||
|  | 				} | ||||||
|  |  | ||||||
|  | 				respItem.RenewLongPrice = respItem.LongPrice.Mul(decimal.NewFromInt(100).Add(premium).Div(decimal.NewFromInt(100))).Truncate(2) | ||||||
|  | 			} | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		*resp = append(*resp, respItem) | 		*resp = append(*resp, respItem) | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user