|
@@ -1,10 +1,12 @@
|
|
package rpc
|
|
package rpc
|
|
|
|
|
|
import (
|
|
import (
|
|
|
|
+ "app.yhyue.com/moapp/jyMarketing/rpc/activityclient"
|
|
"app.yhyue.com/moapp/jyPoints/rpc/integral"
|
|
"app.yhyue.com/moapp/jyPoints/rpc/integral"
|
|
"app.yhyue.com/moapp/jyPoints/rpc/integralclient"
|
|
"app.yhyue.com/moapp/jyPoints/rpc/integralclient"
|
|
"app.yhyue.com/moapp/jybase/date"
|
|
"app.yhyue.com/moapp/jybase/date"
|
|
"app.yhyue.com/moapp/jybase/go-logger/logger"
|
|
"app.yhyue.com/moapp/jybase/go-logger/logger"
|
|
|
|
+ "context"
|
|
"fmt"
|
|
"fmt"
|
|
"github.com/gogf/gf/v2/os/gcfg"
|
|
"github.com/gogf/gf/v2/os/gcfg"
|
|
"github.com/gogf/gf/v2/os/gctx"
|
|
"github.com/gogf/gf/v2/os/gctx"
|
|
@@ -15,6 +17,7 @@ import (
|
|
)
|
|
)
|
|
|
|
|
|
var zrpcClient zrpc.Client
|
|
var zrpcClient zrpc.Client
|
|
|
|
+var activeLib activityclient.Activity
|
|
|
|
|
|
func init() {
|
|
func init() {
|
|
var err error
|
|
var err error
|
|
@@ -27,6 +30,15 @@ func init() {
|
|
if err != nil {
|
|
if err != nil {
|
|
log.Fatalln(err)
|
|
log.Fatalln(err)
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ client := zrpc.MustNewClient(zrpc.RpcClientConf{
|
|
|
|
+ Etcd: discov.EtcdConf{
|
|
|
|
+ Hosts: gcfg.Instance().MustGet(gctx.New(), "etcd.activeServer.integral.address", nil).Strings(),
|
|
|
|
+ Key: gcfg.Instance().MustGet(gctx.New(), "etcd.activeServer.integral.key", nil).String(),
|
|
|
|
+ },
|
|
|
|
+ })
|
|
|
|
+ // defer client.Conn().Close()
|
|
|
|
+ activeLib = activityclient.NewActivity(client)
|
|
}
|
|
}
|
|
|
|
|
|
// IntegralHarvest 积分奖励发放
|
|
// IntegralHarvest 积分奖励发放
|
|
@@ -51,3 +63,15 @@ func IntegralHarvest(userId string, pNum, pType, dateStamp int64) error {
|
|
return fmt.Errorf(fmt.Sprintf("%+v", req), "增加", pNum, "积分失败", "Code", resp.Code, "Message", resp.Message)
|
|
return fmt.Errorf(fmt.Sprintf("%+v", req), "增加", pNum, "积分失败", "Code", resp.Code, "Message", resp.Message)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+type UserLottery struct{}
|
|
|
|
+
|
|
|
|
+var UserHarvest *UserLottery
|
|
|
|
+
|
|
|
|
+func (this *UserLottery) HarvestFunc(activeReq activityclient.Request) (resp activityclient.ActivityLotteryResp) {
|
|
|
|
+ _resp, err := activeLib.UserLottery(context.Background(), &activeReq)
|
|
|
|
+ if err != nil {
|
|
|
|
+ log.Println("UserHarvest error:", err)
|
|
|
|
+ }
|
|
|
|
+ return *_resp
|
|
|
|
+}
|