trans_existTel.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package transaction
  2. import (
  3. "runtime/debug"
  4. "bet24.com/database"
  5. "bet24.com/log"
  6. )
  7. // 判断手机号是否存在
  8. type (
  9. trans_existTel_in struct {
  10. Tel string // 手机号
  11. CodeType int
  12. }
  13. trans_existTel_out struct {
  14. RetCode int // 操作结果
  15. }
  16. trans_existTel struct {
  17. database.Trans_base
  18. In trans_existTel_in
  19. Out trans_existTel_out
  20. }
  21. )
  22. func NewTransExistTel() *trans_existTel {
  23. return &trans_existTel{}
  24. }
  25. func (this *trans_existTel) DoAction(ch chan<- interface{}) {
  26. defer func() {
  27. if err := recover(); err != nil {
  28. log.Error("transaction recover err %v", err)
  29. log.Error("%s", debug.Stack())
  30. }
  31. if ch != nil {
  32. ch <- this
  33. }
  34. }()
  35. statement := database.NewStatement()
  36. statement.SetNeedReturnValue(false)
  37. statement.SetOpenRecordSet(true)
  38. statement.SetProcName("WS_UserTel_Exist")
  39. statement.AddParamter("@Tel", database.AdParamInput, database.AdVarChar, 32, this.In.Tel)
  40. statement.AddParamter("@RetCode", database.AdParamOutput, database.AdInteger, 4, this.Out.RetCode)
  41. sqlstring := statement.GenSql()
  42. retRows := CenterDB.ExecSql(sqlstring)
  43. if len(retRows) <= 0 {
  44. return
  45. }
  46. this.Out.RetCode = int((retRows[0][0]).(int64))
  47. }