作者 Cool
1 个管道 的构建 通过 耗费 0 秒

退单接口群聊禁言功能调试

... ... @@ -619,9 +619,13 @@ class Order extends Api
if(empty($order)){
$this->error('查询为空');
}
if($order['status'] != 2 || $order['finish_status'] != 1){
$this->error('非法的订单状态');
}
if($order['expirationtime'] < time()) {
$this->error('该订单已到期');
}
$pay = new WeixinRefund();
$openid = Db::name('third')->where('user_id',$order['user_id'])->find();
... ... @@ -634,16 +638,10 @@ class Order extends Api
}else{
Db::name('order')->where('id',$param['order_id'])->update(['status'=>3,'finish_status'=>3,'is_chargeback'=>1]);
// 应用配置参数
$config = config('rongyun.config');
$RongSDK = new RongCloud($config['appkey'],$config['appsecret']);
$orders = Db::name('order')->whereBetween('id',$param['order_id'])->find(); // 查询群聊
$Group = $RongSDK->getGroup()->MuteAllMembers();
$params = [
'id'=> $orders['chat_id'],//群组 id
];
$return = $Group->add($params);
Log::write(date('Y-m-d H:i') . '添加指定群组全部禁言成功,返回结果:' . json_encode($return, JSON_UNESCAPED_UNICODE), 'rongyun_log');
// 群组禁言
$return = rongyun_ban($order);
Log::write(date('Y-m-d H:i') . '添加指定群组全部禁言成功,返回结果:' . $order['chat_id'] . json_encode($return, JSON_UNESCAPED_UNICODE), 'rongyun_log');
$this->success('success');
}
}
... ...
... ... @@ -2,6 +2,9 @@
// 公共助手函数
use RongCloud\RongCloud;
use think\Db;
if (!function_exists('__')) {
/**
... ... @@ -362,3 +365,30 @@ if (!function_exists('hsv2rgb')) {
];
}
}
if (!function_exists('rongyun_ban')) {
function rongyun_ban($order) {
// 应用配置参数
$config = config('rongyun.config');
$RongSDK = new RongCloud($config['appkey'],$config['appsecret']);
$Group = $RongSDK->getGroup()->Gag();
$student = Db::name('user')->where('id',$order['user_id'])->value('rongyun_id'); // 查询提问用户融云id
// 查询老师融云id
$teacher = Db::name('teacher')->alias('t')
->join('__USER__ u','t.user_id = u.id')
->field('u.rongyun_id')
->where('t.id',$order['teacher_id'])
->find();
$params = [
'id'=> $order['chat_id'],//群组 id
'members'=>[ //禁言人员列表
['id'=> $student],
['id'=> $teacher['rongyun_id']],
],
'minute'=>0 // 禁言时长
];
$return = $Group->add($params);
return $return;
}
}
\ No newline at end of file
... ...