Relay.go 702 B

12345678910111213141516171819202122232425262728293031
  1. package Handle
  2. import (
  3. "Yunlot/models/Device"
  4. "Yunlot/models/Product"
  5. "encoding/json"
  6. "fmt"
  7. "strings"
  8. )
  9. func Relay(Device_r Device.Device, ProductType_r Product.ProductType, JointTab string, ArticleSlide map[string]interface{}) {
  10. ProductRelay_r := Product.ProductRelay{T_ProductID: Device_r.T_ProductID,T_rtab: JointTab}
  11. if ProductRelay_r.Read() {
  12. datajson, _ := json.Marshal(ArticleSlide)
  13. fmt.Println(string(datajson))
  14. // 替换发布号变量
  15. ProductRelay_r.T_pub = strings.Replace(ProductRelay_r.T_pub, "{sn}", Device_r.T_sn, -1)
  16. if len(ProductRelay_r.T_pub) == 0 {
  17. println("订阅号错误!")
  18. return
  19. }
  20. switch ProductRelay_r.T_mode {
  21. case 0:
  22. break
  23. }
  24. }
  25. }