You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
748 B
30 lines
748 B
package dao |
|
|
|
import ( |
|
"context" |
|
"fmt" |
|
"net/url" |
|
"strconv" |
|
|
|
"go-common/app/job/main/sms/model" |
|
"go-common/library/log" |
|
) |
|
|
|
// UserMobile get user mobile |
|
func (d *Dao) UserMobile(c context.Context, mid int64) (*model.UserMobile, error) { |
|
res := struct { |
|
Code int `json:"code"` |
|
Data model.UserMobile `json:"data"` |
|
}{} |
|
params := url.Values{} |
|
params.Set("mid", strconv.FormatInt(mid, 10)) |
|
if err := d.httpClient.Get(c, d.c.Sms.PassportMobileURL, "", params, &res); err != nil { |
|
log.Error("d.GetUserMobile(%d) error(%v)", mid, err) |
|
return nil, err |
|
} |
|
if res.Code != 0 { |
|
return nil, fmt.Errorf("GetUserMobile(%d) error, res(%+v)", mid, &res) |
|
} |
|
log.Info("GetUserMobile(%d) res(%+v)", mid, &res) |
|
return &res.Data, nil |
|
}
|
|
|