xcx_mobile_api_service.go 735B

123456789101112131415161718192021222324252627282930313233
  1. package service
  2. import (
  3. "Xcx_New/models"
  4. "github.com/jinzhu/gorm"
  5. )
  6. func GetXcxMobileInformation(mobile string) (*models.XcxAdminUserRole, error) {
  7. role := models.XcxAdminUserRole{}
  8. err := XTReadDB().Model(&role).Where("mobile = ? and status = 1", mobile).Find(&role).Error
  9. if err == gorm.ErrRecordNotFound {
  10. return nil, err
  11. }
  12. if err != nil {
  13. return nil, err
  14. }
  15. return &role, nil
  16. }
  17. func CreateXcxAdminUser(role models.XcxAdminUserRole) error {
  18. err := XTWriteDB().Create(&role).Error
  19. return err
  20. }
  21. func GetLoginInfor(mobile string) (models.XcxAdminUserRole, error) {
  22. role := models.XcxAdminUserRole{}
  23. err := XTReadDB().Model(&role).Where("mobile = ? and status = 1", mobile).Find(&role).Error
  24. return role, err
  25. }