123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224 |
- // Copyright 2019 github.com. All rights reserved.
- // Use of this source code is governed by github.com.
- package impl
- import (
- "context"
- "smart-supplier-management/pb"
- "smart-supplier-management/pb/v1"
- "github.com/jaryhe/gopkgs/tasker/rpctasker"
- "google.golang.org/grpc"
- "smart-supplier-management/impl/v1/user"
- "smart-supplier-management/impl/v1/device"
- )
- // 具体实现
- type Rcvr struct {
- }
- func Register(s *grpc.Server) {
- pb.RegisterSmartSiteSupplierServer(s, &Rcvr{})
- }
- func (c *Rcvr) Register(ctx context.Context, req *v1.RegisterRequest) (reply *v1.RegisterReply, err error) {
- t1 := func() error {
- reply, err = user.Register(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- func (c *Rcvr) EmailUpdate(ctx context.Context, req *v1.EmailUpdateRequest) (reply *v1.EmailUpdateReply, err error) {
- t1 := func() error {
- reply, err = user.EmailUpdate(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- func (c *Rcvr) EmailPrepare(ctx context.Context, req *v1.EmailPrepareRequest) (reply *v1.EmailPrepareReply, err error) {
- t1 := func() error {
- reply, err = user.EmailPrepare(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- func (c *Rcvr) PhoneUpdate(ctx context.Context, req *v1.PhoneUpdateRequest) (reply *v1.PhoneUpdateReply, err error) {
- t1 := func() error {
- reply, err = user.PhoneUpdate(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- func (c *Rcvr) UserInfo(ctx context.Context, req *v1.UserInfoRequest) (reply *v1.UserInfoReply, err error) {
- t1 := func() error {
- reply, err = user.UserInfo(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- func (c *Rcvr) ProviderApproveStatus(ctx context.Context, req *v1.ProviderApproveStatusRequest) (reply *v1.ProviderApproveStatusReply, err error) {
- t1 := func() error {
- reply, err = user.ProviderApproveStatus(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- func (c *Rcvr) Login(ctx context.Context, req *v1.LoginRequest) (reply *v1.LoginReply, err error) {
- t1 := func() error {
- reply, err = user.Login(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- func (c *Rcvr) Publicity(ctx context.Context, req *v1.PublicityRequest) (reply *v1.PublicityReply, err error) {
- t1 := func() error {
- reply, err = user.Publicity(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- func (c *Rcvr) DeviceDocking(ctx context.Context, req *v1.DeviceDockingRequest) (reply *v1.DeviceDockingReply, err error) {
- t1 := func() error {
- reply, err = device.DeviceDocking(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- func (c *Rcvr) DeviceAdd(ctx context.Context, req *v1.DeviceAddRequest) (reply *v1.DeviceAddReply, err error) {
- t1 := func() error {
- reply, err = device.DeviceAdd(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- func (c *Rcvr) DeviceDel(ctx context.Context, req *v1.DeviceDelRequest) (reply *v1.DeviceDelReply, err error) {
- t1 := func() error {
- reply, err = device.DeviceDel(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- func (c *Rcvr) DeviceDelJobList(ctx context.Context, req *v1.DeviceDelJobListRequest) (reply *v1.DeviceDelJobListReply, err error) {
- t1 := func() error {
- reply, err = device.DeviceDelJobList(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- func (c *Rcvr) DeviceTypeList(ctx context.Context, req *v1.DeviceTypeListRequest) (reply *v1.DeviceTypeListReply, err error) {
- t1 := func() error {
- reply, err = device.DeviceTypeList(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- func (c *Rcvr) DeviceList(ctx context.Context, req *v1.DeviceListRequest) (reply *v1.DeviceListReply, err error) {
- t1 := func() error {
- reply, err = device.DeviceList(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- func (c *Rcvr) VedioList(ctx context.Context, req *v1.VedioListRequest) (reply *v1.VedioListReply, err error) {
- t1 := func() error {
- reply, err = device.VedioList(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- func (c *Rcvr) ProjectList(ctx context.Context, req *v1.ProjectListRequest) (reply *v1.ProjectListReply, err error) {
- t1 := func() error {
- reply, err = device.ProjectList(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- func (c *Rcvr) SetPasswd(ctx context.Context, req *v1.SetPasswdRequest) (reply *v1.SetPasswdReply, err error) {
- t1 := func() error {
- reply, err = user.SetPasswd(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- func (c *Rcvr) ChannelList(ctx context.Context, req *v1.ChannelListRequest) (reply *v1.ChannelListReply, err error) {
- t1 := func() error {
- reply, err = device.ChannelList(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- func (c *Rcvr) ChannelAdd(ctx context.Context, req *v1.ChannelAddRequest) (reply *v1.ChannelAddReply, err error) {
- t1 := func() error {
- reply, err = device.ChannelAdd(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- func (c *Rcvr) ChannelUpdate(ctx context.Context, req *v1.ChannelUpdateRequest) (reply *v1.ChannelUpdateReply, err error) {
- t1 := func() error {
- reply, err = device.ChannelUpdate(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- func (c *Rcvr) VedioAdd(ctx context.Context, req *v1.VedioAddRequest) (reply *v1.VedioAddReply, err error) {
- t1 := func() error {
- reply, err = device.VedioAdd(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- func (c *Rcvr) ChangePasswd(ctx context.Context, req *v1.ChangePasswdRequest) (reply *v1.ChangePasswdReply, err error) {
- t1 := func() error {
- reply, err = user.ChangePasswd(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
|