123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- // Copyright 2019 github.com. All rights reserved.
- // Use of this source code is governed by github.com.
- package impl
- import (
- "context"
- "smart-thirdparty/impl/v1/alarm"
- "smart-thirdparty/impl/v1/email"
- "smart-thirdparty/impl/v1/notify"
- "smart-thirdparty/impl/v1/provincial_department"
- "smart-thirdparty/impl/v1/vcode"
- "smart-thirdparty/impl/v1/weather"
- "smart-thirdparty/pb"
- pb_v1 "smart-thirdparty/pb/v1"
- "github.com/jaryhe/gopkgs/tasker/rpctasker"
- "google.golang.org/grpc"
- )
- // 具体实现
- type Rcvr struct {
- }
- func Register(s *grpc.Server) {
- pb.RegisterSmartSiteThirdpartyServer(s, &Rcvr{})
- }
- func (c *Rcvr) GetVcode(ctx context.Context, req *pb_v1.GetVcodeRequest) (reply *pb_v1.GetVcodeReply, err error) {
- t1 := func() error {
- reply, err = vcode.GetVcode(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- func (c *Rcvr) CheckVcode(ctx context.Context, req *pb_v1.CheckVcodeRequest) (reply *pb_v1.CheckVcodeReply, err error) {
- t1 := func() error {
- reply, err = vcode.CheckVcode(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- func (c *Rcvr) SendEmail(ctx context.Context, req *pb_v1.SendEmailRequest) (reply *pb_v1.SendEmailReply, err error) {
- t1 := func() error {
- reply, err = email.SendEmail(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- // 发送告警
- func (c *Rcvr) SendAlarm(ctx context.Context, req *pb_v1.SendAlarmRequest) (reply *pb_v1.SendAlarmReply, err error) {
- t1 := func() error {
- reply, err = alarm.SendAlarm(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- // 发送审核通过通知
- func (c *Rcvr) SendThroughVerify(ctx context.Context, req *pb_v1.SendThroughVerifyRequest) (reply *pb_v1.SendThroughVerifyReply, err error) {
- t1 := func() error {
- reply, err = notify.SendThroughVerify(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- // 获取实时天气
- func (c *Rcvr) WeatherCondition(ctx context.Context, req *pb_v1.WeatherConditionRequest) (reply *pb_v1.WeatherConditionReply, err error) {
- t1 := func() error {
- reply, err = weather.WeatherCondition(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- // 获取空气质量指数
- func (c *Rcvr) WeatherEnviroment(ctx context.Context, req *pb_v1.WeatherEnviromentRequest) (reply *pb_v1.WeatherEnviromentReply, err error) {
- t1 := func() error {
- reply, err = weather.WeatherEnviroment(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- // 获取近15天天气预报
- func (c *Rcvr) WeatherForecast15(ctx context.Context, req *pb_v1.WeatherForecast15Request) (reply *pb_v1.WeatherForecast15Reply, err error) {
- t1 := func() error {
- reply, err = weather.WeatherForecast15(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- // 省厅获取项目编码
- func (c *Rcvr) ProvincialGetProjectCode(ctx context.Context, req *pb_v1.ProvincialGetProjectCodeRequest) (reply *pb_v1.ProvincialGetProjectCodeReply, err error) {
- t1 := func() error {
- reply, err = provincial_department.ProvincialGetProjectCode(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- // 提交项目信息
- func (c *Rcvr) ProvincialPostProject(ctx context.Context, req *pb_v1.ProvincialPostProjectRequest) (reply *pb_v1.ProvincialPostProjectReply, err error) {
- t1 := func() error {
- reply, err = provincial_department.ProvincialPostProject(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- // 提交扬尘设备信息
- func (c *Rcvr) ProvincialPostDustDevice(ctx context.Context, req *pb_v1.ProvincialPostDustDeviceRequest) (reply *pb_v1.ProvincialPostDustDeviceReply, err error) {
- t1 := func() error {
- reply, err = provincial_department.ProvincialPostDustDevice(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- // 提交扬尘监测数据
- func (c *Rcvr) ProvincialPostDustData(ctx context.Context, req *pb_v1.ProvincialPostDustDataRequest) (reply *pb_v1.ProvincialPostDustDataReply, err error) {
- t1 := func() error {
- reply, err = provincial_department.ProvincialPostDustData(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- func (c *Rcvr) ProvincialVerifyData(ctx context.Context, req *pb_v1.ProvincialVerifyDataRequest) (reply *pb_v1.ProvincialVerifyDataReply, err error) {
- t1 := func() error {
- reply, err = provincial_department.ProvincialVerifyData(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- func (c *Rcvr) ProvincialPostTeam(ctx context.Context, req *pb_v1.ProvincialPostTeamRequest) (reply *pb_v1.ProvincialPostTeamReply, err error) {
- t1 := func() error {
- reply, err = provincial_department.ProvincialPostTeam(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- func (c *Rcvr) ProvincialPostStaff(ctx context.Context, req *pb_v1.ProvincialPostStaffRequest) (reply *pb_v1.ProvincialPostStaffReply, err error) {
- t1 := func() error {
- reply, err = provincial_department.ProvincialPostStaff(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
- func (c *Rcvr) ProvincialPostStaffAttendance(ctx context.Context, req *pb_v1.ProvincialPostStaffAttendanceRequest) (reply *pb_v1.ProvincialPostStaffAttendanceReply, err error) {
- t1 := func() error {
- reply, err = provincial_department.ProvincialPostStaffAttendance(ctx, req)
- return err
- }
- return reply, rpctasker.Exec(ctx, t1)
- }
|