Files
OMS/app/channel/lib/rpc/response/crm.php
2025-12-28 23:13:25 +08:00

49 lines
1.5 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
/**
* Copyright © ShopeX http://www.shopex.cn. All rights reserved.
* See LICENSE file for license details.
*/
class channel_rpc_response_crm extends ome_rpc_response{
public function crm_callback($result){
// 验证签名
$data = $_POST;
if (empty($data['certi_ac'])) {
die('0'); // certi_ac 不存在
}
$certi_ac = $data['certi_ac'];
unset($data['certi_ac']);
$sign = base_certificate::getCertiAC($data);
if ($certi_ac != $sign) {
die('0'); // 签名错误
}
$channel_id = $result['channel_id'];
$nodes = $_POST;
$status = $nodes['status'];
$node_id = $nodes['node_id'];
$node_type = $nodes['node_type'];
$api_v = $nodes['api_v'];
$filter = array('channel_id'=>$channel_id);
$Obj_channel = app::get('ome')->model('channel');
$shopdetail = $Obj_channel->dump(array('node_id'=>$node_id), 'node_id');
if ($status=='bind' and !$shopdetail['node_id']){
if ($node_id){
$data = array('api_version'=>$api_v,'node_id'=>$node_id,'node_type'=>$node_type,'addon'=>$nodes);
$Obj_channel->update($data, $filter);
die('1');
}
}elseif ($status=='unbind'){
$data = array('node_id'=>'');
$Obj_channel->update($data, $filter);
die('1');
}
die('0');
}
}