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.
32 lines
630 B
32 lines
630 B
package archive |
|
|
|
import ( |
|
"context" |
|
"fmt" |
|
"net/url" |
|
"strconv" |
|
|
|
"go-common/library/log" |
|
) |
|
|
|
// Stat get archive stat. |
|
func (d *Dao) Stat(c context.Context, aid int64) (click int, err error) { |
|
params := url.Values{} |
|
params.Set("aid", strconv.FormatInt(aid, 10)) |
|
var res struct { |
|
Code int `json:"code"` |
|
Data struct { |
|
Click int `json:"click"` |
|
} `json:"data"` |
|
} |
|
if err = d.client.Get(c, d.statURI, "", params, &res); err != nil { |
|
log.Error("archive stat url(%s) error(%v)", d.statURI, err) |
|
return |
|
} |
|
if res.Code != 0 { |
|
err = fmt.Errorf("archive stat call failed") |
|
return |
|
} |
|
click = res.Data.Click |
|
return |
|
}
|
|
|