广告平台(站长使用)
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.
 
 
 
 
 

51 lines
1.2 KiB

  1. package youlianghui
  2. import (
  3. "applet/app/cfg"
  4. )
  5. type ApiService struct {
  6. MemberId string `json:"member_id"`
  7. Secret string `json:"secret"`
  8. Host string `json:"host"`
  9. }
  10. func NewApiService(memberId, secret string) (apiService ApiService, err error) { // set方法
  11. apiService.MemberId = memberId
  12. apiService.Secret = secret
  13. apiService.Host = "https://test-api.adnet.qq.com/open/v1.1"
  14. if cfg.Prd {
  15. apiService.Host = "http://api.adnet.qq.com/open/v1.1"
  16. }
  17. return
  18. }
  19. // MediumAdd 创建媒体
  20. // func (apiService *ApiService) MediumAdd() (appId string, err error) { // set方法
  21. // token := GetToken(apiService.MemberId, apiService.Secret)
  22. // url := apiService.Host + "/medium/add"
  23. // params := map[string]interface{}{
  24. // "name": name,
  25. // "type": string(adunitType),
  26. // }
  27. // if adunitType == enum.AdunitTypeForVideoFeeds {
  28. // params["video_duration_min"] = 6
  29. // params["video_duration_max"] = 60
  30. // }
  31. // postBody, err := utils.CurlPost(url, utils.SerializeStr(params), nil)
  32. // if err != nil {
  33. // return
  34. // }
  35. // var resp md.AgencyCreateAdunit
  36. // err = json.Unmarshal(postBody, &resp)
  37. // if err != nil {
  38. // return
  39. // }
  40. // if resp.Ret != 0 {
  41. // err = errors.New(resp.ErrMsg)
  42. // }
  43. // adUnitId = resp.AdUnitId
  44. // return
  45. // }