Coder Social home page Coder Social logo

dingtalk's Introduction

EasyDingTalk

Build Status Scrutinizer Code Quality Latest Stable Version Total Downloads License

介绍

EasyDingTalk 封装了钉钉身份验证、通讯录管理、消息通知、审批、群机器人、业务事件回调管理等服务端接口,让开发者可以使用简单的配置,提供简洁的 API 以供方便快速地调用钉钉接口。

环境要求

安装

composer require mingyoung/dingtalk:^2.0

使用

use EasyDingTalk\Application;

$config = [
    'corp_id' => 'dingd3ir8195906jfo93',

    'app_key' => 'dingwu33fo1fjc0fszad',
    'app_secret' => 'RsuMFgEIY3jg5UMidkvwpzEobWjf9Fcu3oLqLyCUIgzULm54WcV7j9fi3fJlUshk',
];

$app = new Application($config);

文档

https://docs.easydingtalk.org

License

MIT

dingtalk's People

Contributors

calchen avatar garfielt avatar macroyep avatar mingyoung avatar nicolas-gong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dingtalk's Issues

响应钉钉服务器 {"errcode":71009,"errmsg":"返回文本非success"}

{
$app = init_ding();
$server = $app->server;
$server->push(function ($payload) {
// 此处 $payload 为钉钉推送事件解密后的内容,为数组形式
/**
* 比如测试回调 URL 事件,$payload 内容为:
*
* $payload = [
* "EventType" => "check_url",
* ]
*/
$type = $payload['EventType'];
// ...
// 可根据内容处理你对应的业务逻辑
});
$server->serve()->send(); // ThinkPHP 等框架使用
}
方法代码如上,用自定义类也是返回文本非success。
是我哪儿出错了吗?

根据手机号获取用户信息接口参数名错误

代码文件路径:vendor\mingyoung\dingtalk\src\User\Client.php

代码块:

 /**
     * 根据员工手机号获取 Userid
     *
     * @param string $phone
     *
     * @return mixed
     */
    public function getUserIdByPhone($phone = '')
    {
        return $this->client->get('user/get_by_mobile', compact('phone'));
    }

这里的 phone 参数名官方实际为 mobile ,使用 phone 参数名接口报错


官方接口说明

请求方式:GET(HTTPS)

请求地址:https://oapi.dingtalk.com/user/get_by_mobile?access_token=ACCESS_TOKEN&mobile=1xxxxxxxxxx

名称 类型 是否必须 说明
access_token String 必须 调用接口凭证,通过获取企业access_token获取
mobile String 必须 手机号码

参考资料-钉钉官方手册

关于 Travis CI 配置的问题

您好,我提交了一个 Pull #48 修改内容仅仅为增加注释,尝试了两次 Travis CI 始终报错,对比了一下这两次的 Job log 和 5个月前最后一次成功的 Job log,发现是有差异的。不过我不太熟悉 Travis CI,也无法明显看出错误原因,还望协助处理。

您好,请问消息通知以及机器人会集成到SDK里面吗?

所有的接口接入与验证,我已经做完了,这个SDK非常不错封装思路很清晰;另外 审核 最近钉钉的开发团队已经更新了部分接口;消息通知和机器人您有意封装到本SDK里面吗?如果没有我打算自己做这个轮子。期待你的回复

获取部门详情接口返回字段问题

获取部门详情接口返回的字段中是否是多了一个userPerimits字段?
image

是否没有返回sourceIdentifier字段,返回中的deptGroupChatId字段是什么意思,好像官方文档中并没有对应的字段?

钉钉扫码登陆第三方页面

图片
$app = new Application($this->config);
$response = $app->oauth->use('app-01')->withQrConnect()->redirect();
直接会报上面的错误

钉钉界面展示问题

在不定的时间里,钉钉的聊天框界面会模糊,请问下是什么原因呢,最近版本,mac pro

发送工作消息有bug

/** * 发送工作通知消息 * * @param array $params * * @return mixed */ public function sendCorporationMessage($params) { return $this->client->post('topapi/message/corpconversation/asyncsend_v2', $params); }
应该更改为
/** * 发送工作通知消息 * * @param array $params * * @return mixed */ public function sendCorporationMessage($params) { return $this->client->postJson('topapi/message/corpconversation/asyncsend_v2', $params); }

跳转方式第三方登录钉钉

我发现只能用
$response = $this->dingTalk->oauth->use('app-01')->withQrConnect()->redirect(); return $response;
该方法生成的页面才能正常使用下去,点击超链接后还会闪一下才会进入到扫码页面!
我想使用里面的$response->getTargetUrl()得到的链接作为超链接,会报错!

工作消息通知,总是提示{"errcode":40,"errmsg":"Missing required arguments:msg","request_id":"sq35gefm5b55"}

image
public function jobMsg(Request $request) { $params = $request->post(); $mcy_ding = new McyDing($this->_config); // $access_token = $mcy_ding->access_token->get(); $data = [ "agent_id"=> "626044106", "userid_list"=>$params['ding_userid'], "msg" =>[ "msgtype"=>'markdown', "markdown"=>[ "title"=>$params['title'].'接机工作任务', "text"=>$params['text'] ] ] ]; $result = $mcy_ding->conversation->sendCorporationMessage($data); return $result; }
已经传msg了,总是提示Missing required arguments:msg

钉钉更新

你好,钉钉官方已经更新说明,不再支持corpsecret获取,但已申请过的corpsecret仍可使用,将改为appkey和appsecret获取token,Kernel/Credential.php中的credentials方法建议调整一下,增加一个判断

支持symfony 5.0

您好,symfony 5.0相关依赖已经发布了,麻烦调整下依赖限制,以便支持升级

access_token的缓存是不是有问题?

PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 20480 bytes) in \dingtalk\vendor\guzzlehttp\psr7\src\MessageTrait.php on line 158
缓存是不是有问题?
access_token过期后再次请求一直都是报错的

可不可以增加一个日志的接口

因项目开发需要拉取钉钉用户提交的日志数据记录;我测试了一下您的包,只需要调用httpGetMethod()就可以拉取到日志数据,不知道您这边能不能把这个功能集成到这个包扩展里?

请问如何新建日历?"Invalid arguments:create_vo"

请问如何新建日历?

$params = [
            'create_vo' => [
                'summary' => '测试一个',
                'receiver_userids' => ["01040144291326"],
                'start_time' => time() * 1000 + 3600,
                'end_time' => time() * 1000 + 36000,
                'calendar_type' => 'notification',
                'source' => [
                    'title' => '测试的 呀',
                    'url' => 'http://www.dingtalk.com/page=xxx'
                ],
                'creator_userid' => "01040144291326",
                'uuid' => "01040144291326" . time(),
                'biz_id' => "123",
            ],
        ];
        dd($app->calendar->create($params));

提示错误:
array:3 [▼ "errcode" => 41 "errmsg" => "Invalid arguments:create_vo" "request_id" => "f87qrbvdj9rl" ]

代码有问题吗?麻烦看一下

你好,测试了一下不行,配置都是正确的,在官方SDK都可以获取数据
代码如下:

require 'vendor/autoload.php';

use EasyDingTalk\Application;

$app = new Application([
    // 以下为必传配置项
    'agent_id' => 'XXXX',
    'app_key' => 'dingXXXX',
    'app_secret' => 'XXXX-XXXX',

    // 以下为非必须传入配置,请根据实际情况传入
    'http' => [
        'response_type' => 'array'
    ]
]);

$userId = 'XXXX';
$tuseruser = $app->user->get($userId);
var_dump($tuseruser);

请问有多个钉钉切换的功能吗?

目前有个需求,就是会有多个钉钉配置,分别操作,这样就会造成access_token一直失效的情况,有没有方法我可以将access_token获取到,在实例化的时候再将access_token注入呢?

需要升级以兼容 Laravel 6.0

Laravel 6.0 下,monolog 是 v2.0 的。
当前使用的 monolog ^1.23 无法正常使用
当前使用的 overture/http 也是升级到 1.1.3 来兼容 Laravel 6.0

使用Conversation\Client时无法发送钉钉消息

`
$params = [
'agent_id'=> 'xxxxx',
'userid_list' => 'xxxxxx',
'msg'=> json_encode(['msgtype'=> "text", 'text'=>['content'=> '测试 ']])
];

$res = $app->conversation->sendCorporationMessage($params);
print_r($res);
`
得到的结果:
array:3 [
"errcode" => 41
"errmsg" => "Invalid arguments:msg"
"request_id" => "skkfp0mdzlns"
]

image

将其中的postJson改为post即可

扫码登录第三方网站回调报错

使用的版本 mingyoung/dingtalk是2.3.0
使用的框架是laravel5.8
采用$user = $app->oauth->use('app-01')->user();获取回调的用户信息
但是报错
{"exception":"[object] (EasyDingTalk\Auth\InvalidStateException(code: 0): at /mnt/www/passport/vendor/mingyoung/dingtalk/src/Auth/OAuthClient.php:108)

code和state都是拿到的

请问怎么解决这个问题呢

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.