Mqtt.go 453 B

123456789101112131415161718192021222324
  1. package Stock
  2. import (
  3. "ERP_storage/logs"
  4. "git.baozhida.cn/ERP_libs/lib"
  5. orm2 "github.com/beego/beego/v2/client/orm"
  6. )
  7. type Mqtt struct {
  8. Username string
  9. Iccid string
  10. Imei string
  11. }
  12. func Read_MqttUser(T_sn string) (r Mqtt) {
  13. o := orm2.NewOrmUsingDB("mqtt")
  14. err := o.Raw("SELECT username,iccid,imei FROM mqtt_user WHERE username = '" + T_sn + "'").QueryRow(&r)
  15. if err != nil {
  16. logs.Error(lib.FuncName(), err)
  17. return
  18. }
  19. return r
  20. }