|
|
@ -0,0 +1,43 @@ |
|
|
|
package productrpc |
|
|
|
|
|
|
|
import ( |
|
|
|
"strconv" |
|
|
|
) |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取商品进行中活动 |
|
|
|
* 2021/10/06 |
|
|
|
* GZ |
|
|
|
*/ |
|
|
|
func Favorite(site_id, dbname, product_id string, user_id string, url ...string) (int64, error) { |
|
|
|
|
|
|
|
conn, err := rpc_server_conn(url...) |
|
|
|
if err != nil { |
|
|
|
return 0, err |
|
|
|
} |
|
|
|
defer conn.Close() |
|
|
|
|
|
|
|
arg := FavoriteParam{site_id, dbname, product_id, user_id} |
|
|
|
|
|
|
|
req, err := SetReqData(arg) |
|
|
|
if err != nil { |
|
|
|
return 0, err |
|
|
|
} |
|
|
|
|
|
|
|
res := &Response{} |
|
|
|
|
|
|
|
err = conn.FavoriteProduct(req, res) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
return 0, err |
|
|
|
} |
|
|
|
|
|
|
|
res_data_de, err := GetResData(res) |
|
|
|
if err != nil { |
|
|
|
return 0, err |
|
|
|
} |
|
|
|
if res_data_de == "" { |
|
|
|
return 0, nil |
|
|
|
} |
|
|
|
return strconv.ParseInt(res_data_de, 10, 64) |
|
|
|
} |