商品rpc数据格式及调用方法
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.

43 lines
663 B

  1. package productrpc
  2. import (
  3. "strconv"
  4. )
  5. /**
  6. * 收藏
  7. * 2021/10/14
  8. * GZ
  9. */
  10. func Favorite(site_id, dbname, product_id string, user_id string, url ...string) (int64, error) {
  11. conn, err := rpc_server_conn(url...)
  12. if err != nil {
  13. return 0, err
  14. }
  15. defer conn.Close()
  16. arg := FavoriteParam{site_id, dbname, product_id, user_id}
  17. req, err := SetReqData(arg)
  18. if err != nil {
  19. return 0, err
  20. }
  21. res := &Response{}
  22. err = conn.FavoriteProduct(req, res)
  23. if err != nil {
  24. return 0, err
  25. }
  26. res_data_de, err := GetResData(res)
  27. if err != nil {
  28. return 0, err
  29. }
  30. if res_data_de == "" {
  31. return 0, nil
  32. }
  33. return strconv.ParseInt(res_data_de, 10, 64)
  34. }