Skip to content

Commit

Permalink
add msg audit
Browse files Browse the repository at this point in the history
  • Loading branch information
DoveChen committed May 28, 2020
1 parent b3dbbe9 commit 43d091a
Show file tree
Hide file tree
Showing 4 changed files with 198 additions and 0 deletions.
26 changes: 26 additions & 0 deletions Work.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use dovechen\yii2\weWork\src\dataStructure\ExternalContactWay;
use dovechen\yii2\weWork\src\dataStructure\LinkedcorpMessage;
use dovechen\yii2\weWork\src\dataStructure\Message;
use dovechen\yii2\weWork\src\dataStructure\MsgAuditCheckAgree;
use dovechen\yii2\weWork\src\dataStructure\Tag;
use dovechen\yii2\weWork\src\dataStructure\User;
use dovechen\yii2\weWork\src\dataStructure\UserInfoByCode;
Expand Down Expand Up @@ -939,4 +940,29 @@ public function AgentList ()

return $this->repJson;
}

public function GetPermitUserList ()
{
self::_HttpCall(self::GET_PERMIT_USER_LIST);

return $this->repJson;
}

public function CheckSingleAgree (MsgAuditCheckAgree $msgAuditCheck)
{
MsgAuditCheckAgree::CheckSingleAgreeArgs($msgAuditCheck);
$args = MsgAuditCheckAgree::SetSingleAgreeArgs($msgAuditCheck);
self::_HttpCall(self::CHECK_SINGLE_AGREE, 'POST', $args);

return $this->repJson;
}

public function CheckRoomAgree (MsgAuditCheckAgree $msgAuditCheck)
{
MsgAuditCheckAgree::CheckRoomAgreeArgs($msgAuditCheck);
$args = MsgAuditCheckAgree::SetRoomAgreeArgs($msgAuditCheck);
self::_HttpCall(self::CHECK_ROOM_AGREE, 'POST', $args);

return $this->repJson;
}
}
6 changes: 6 additions & 0 deletions components/BaseWork.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,12 @@ abstract class BaseWork extends Component
const GET_JSAPI_TICKET = '/cgi-bin/get_jsapi_ticket?access_token=ACCESS_TOKEN'; // 获取企业的jsapi_ticket
const TICKET_GET = '/cgi-bin/ticket/get?access_token=ACCESS_TOKEN'; // 获取应用的jsapi_ticket

/* 会话存档内容 */
const GET_PERMIT_USER_LIST = '/cgi-bin/msgaudit/get_permit_user_list?access_token=ACCESS_TOKEN'; // 获取会话内容存档开启成员列表
/* 获取会话同意情况 */
const CHECK_SINGLE_AGREE = '/cgi-bin/msgaudit/check_single_agree?access_token=ACCESS_TOKEN'; // 单聊请求地址
const CHECK_ROOM_AGREE = '/cgi-bin/msgaudit/check_room_agree?access_token=ACCESS_TOKEN'; // 群聊请求地址

protected function GetAccessToken ($force = false)
{
}
Expand Down
63 changes: 63 additions & 0 deletions src/dataStructure/CheckSingleAgree.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?php
/**
* Create by PhpStorm
* User: dovechen
* Date: 2020/5/28
* Time: 10:07
*/

namespace dovechen\yii2\weWork\src\dataStructure;

use dovechen\yii2\weWork\components\Utils;

/**
* Class CheckSingleAgree
*
* @property string userid 内部成员的userid
* @property string exteranalopenid 外部成员的externalopenid
*
* @package dovechen\yii2\weWork\src\dataStructure
*/
class CheckSingleAgree
{
/**
* @param $arr
*
* @return CheckSingleAgree
*/
public static function parseFromArray ($arr)
{
$checkSingleAgree = new self();

$checkSingleAgree->userid = Utils::arrayGet($arr, 'userid');
$checkSingleAgree->exteranalopenid = Utils::arrayGet($arr, 'exteranalopenid');

return $checkSingleAgree;
}

/**
* @param CheckSingleAgree $checkSingleAgree
*
* @return array
*/
public static function ToArray ($checkSingleAgree)
{
$args = [];

Utils::setIfNotNull($checkSingleAgree->userid, 'userid', $args);
Utils::setIfNotNull($checkSingleAgree->exteranalopenid, 'exteranalopenid', $args);

return $args;
}

/**
* @param CheckSingleAgree $checkSingleAgree
*
* @throws \ParameterError
*/
public static function CheckArgs ($checkSingleAgree)
{
Utils::checkNotEmptyStr($checkSingleAgree->userid, 'userid');
Utils::checkNotEmptyStr($checkSingleAgree->exteranalopenid, 'exteranalopenid');
}
}
103 changes: 103 additions & 0 deletions src/dataStructure/MsgAuditCheckAgree.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<?php
/**
* Create by PhpStorm
* User: dovechen
* Date: 2020/5/28
* Time: 09:52
*/

namespace dovechen\yii2\weWork\src\dataStructure;

use dovechen\yii2\weWork\components\Utils;
use SebastianBergmann\CodeCoverage\Util;

/**
* Class MsgAudit
*
* @property array info 待查询的会话信息,数组
* @property string roomid 待查询的roomid
*
* @package dovechen\yii2\weWork\src\dataStructure
*/
class MsgAuditCheckAgree
{
/**
* @param $arr
*
* @return MsgAuditCheckAgree
*/
public static function parseFromArray ($arr)
{
$msgAuditCheckAgree = new self();

$checkSingle = Utils::arrayGet($arr, 'info');
if (!is_null($checkSingle)) {
$msgAuditCheckAgree->info = [];
foreach ($checkSingle as $singleInfo) {
array_push($msgAuditCheckAgree->info, CheckSingleAgree::parseFromArray($singleInfo));
}
}

$checkRoom = Utils::arrayGet($arr, 'roomid');
if (!is_null($checkRoom)) {
$msgAuditCheckAgree->roomid = $checkRoom;
}

return $msgAuditCheckAgree;
}

/**
* @param MsgAuditCheckAgree $msgAuditCheckAgree
*
* @return array
*/
public static function SetSingleAgreeArgs ($msgAuditCheckAgree)
{
$args = [
'info' => []
];

foreach ($msgAuditCheckAgree->info as $item) {
array_push($args['info'], CheckSingleAgree::ToArray($item));
}

return $args;
}

/**
* @param MsgAuditCheckAgree $msgAuditCheckAgree
*
* @throws \ParameterError
*/
public static function CheckSingleAgreeArgs ($msgAuditCheckAgree)
{
Utils::checkNotEmptyArray($msgAuditCheckAgree->info, 'info');
foreach ($msgAuditCheckAgree->info as $info) {
CheckSingleAgree::CheckArgs($info);
}
}

/**
* @param MsgAuditCheckAgree $msgAuditCheckAgree
*
* @return array
*/
public static function SetRoomAgreeArgs ($msgAuditCheckAgree)
{
$args = [];

Utils::setIfNotNull($msgAuditCheckAgree->roomid, 'roomid', $args);

return $args;
}

/**
* @param MsgAuditCheckAgree $msgAuditCheckAgree
*
* @throws \ParameterError
*/
public static function CheckRoomAgreeArgs ($msgAuditCheckAgree)
{
Utils::checkNotEmptyStr($msgAuditCheckAgree->roomid, 'roomid');
}
}

0 comments on commit 43d091a

Please sign in to comment.