123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- package http
- import (
- "go-common/app/admin/ep/saga/model"
- bm "go-common/library/net/http/blademaster"
- "go-common/library/net/http/blademaster/binding"
- )
- //queryContactLogs queryContactLogs
- func queryContactLogs(c *bm.Context) {
- v := &model.QueryContactLogRequest{}
- if err := c.Bind(v); err != nil {
- return
- }
- if err := v.Verify(); err != nil {
- c.JSON(nil, err)
- return
- }
- c.JSON(srv.QueryContactLogs(c, v))
- }
- //queryContactLogs queryContactLogs
- func queryRedisdata(c *bm.Context) {
- v := &model.QueryContactLogRequest{}
- if err := c.Bind(v); err != nil {
- return
- }
- if err := v.Verify(); err != nil {
- c.JSON(nil, err)
- return
- }
- c.JSON(srv.QueryContactLogs(c, v))
- }
- // SyncContacts sync the wechat contacts 更新企业微信列表(用户信息和saga信息)
- func queryContacts(ctx *bm.Context) {
- var (
- req = &model.EmptyReq{}
- v = &model.Pagination{}
- err error
- )
- if err = ctx.Bind(req); err != nil {
- ctx.JSON(nil, err)
- return
- }
- if err = ctx.Bind(v); err != nil {
- return
- }
- ctx.JSON(srv.QueryContacts(ctx, v))
- }
- func createWechat(ctx *bm.Context) {
- var (
- username string
- err error
- )
- req := &model.CreateChatReq{}
- if err = ctx.BindWith(req, binding.JSON); err != nil {
- ctx.JSON(nil, err)
- return
- }
- if username, err = getUsername(ctx); err != nil {
- ctx.JSON(nil, err)
- return
- }
- ctx.JSON(srv.CreateWechat(ctx, req, username))
- }
- func queryWechatCreateLog(ctx *bm.Context) {
- var (
- req = &model.Pagination{}
- err error
- user string
- )
- if err = ctx.Bind(req); err != nil {
- return
- }
- if err = req.Verify(); err != nil {
- ctx.JSON(nil, err)
- return
- }
- if user, err = getUsername(ctx); err != nil {
- ctx.JSON(nil, err)
- return
- }
- ctx.JSON(srv.QueryWechatCreateLog(ctx, req, user))
- }
- func getWechat(ctx *bm.Context) {
- ctx.JSON(srv.WechatParams(ctx, ctx.Request.Form.Get("chatid")))
- }
- func sendGroupWechat(ctx *bm.Context) {
- req := &model.SendChatReq{}
- if err := ctx.BindWith(req, binding.JSON); err != nil {
- ctx.JSON(nil, err)
- return
- }
- ctx.JSON(srv.SendGroupWechat(ctx, req))
- }
- func sendWechat(ctx *bm.Context) {
- req := &model.SendMessageReq{}
- if err := ctx.BindWith(req, binding.JSON); err != nil {
- ctx.JSON(nil, err)
- return
- }
- ctx.JSON(srv.SendWechat(ctx, req))
- }
- func updateWechat(ctx *bm.Context) {
- req := &model.UpdateChatReq{}
- if err := ctx.BindWith(req, binding.JSON); err != nil {
- ctx.JSON(nil, err)
- return
- }
- ctx.JSON(srv.UpdateWechat(ctx, req))
- }
- func syncWechatContacts(ctx *bm.Context) {
- ctx.JSON(srv.SyncWechatContacts(ctx))
- }
|