转发回调信息

mobile-first
cyc 6 years ago
parent 4d057930b0
commit 66d50aebf9

@ -6,27 +6,28 @@ if (!defined('BASEPATH'))
class index extends CI_Controller {
function __construct() {
parent::__construct();
header('Access-Control-Allow-Origin:*');
header('Access-Control-Allow-Methods:POST, GET');
header('Access-Control-Max-Age:0');
header('Access-Control-Allow-Headers:x-requested-with, Content-Type');
header('Access-Control-Allow-Credentials:true');
$this->load->helper('dingtools');
$this->AppKey = 'dingjcbxgidah9uspeuc';
$this->AppSecret = 'C4-8rUDK1u5Twpsw7U3yo42s_bbYxFIqzLMp2j7uI80Sa8D-OPbtSoCMgZxHxo2d';
$this->load->model('dingtools_model');
}
public function index(){
echo json_encode(array('https://data.chinahighlights.com/pic/logo/logo-132x104.png','https://data.chinahighlights.com/image/homepage/holding-panda.jpg'));
exit('前方高能!!!');
}
public function sendApproval(){
header('Access-Control-Allow-Origin:*');
header('Access-Control-Allow-Methods:POST, GET');
header('Access-Control-Max-Age:0');
header('Access-Control-Allow-Headers:x-requested-with, Content-Type');
header('Access-Control-Allow-Credentials:true');
//接收数据
$img = $this->input->post('img');
$money = $this->input->post('money');
$postunionid = $this->input->post('postunionid');
$approvers = $this->input->post('approvers');
$message = $this->input->post('message');
if(empty($postunionid)){
exit('参数错误');
@ -40,7 +41,16 @@ class index extends CI_Controller {
$originator_user_id = $this->getuserid($postunionid);
$dept_id = $this->getdeptid($originator_user_id);
$approversid = $this->getuserid($approvers);
$user_list = explode(',',$approvers);
$approversidstr = '';
if(count($user_list) > 1){
foreach($user_list as $userid){
$approversidstr .= $this->getuserid($userid).',';
}
$approversidstr = substr($approversidstr,0,strlen($approversidstr) - 1);
}else{
$approversidstr = $this->getuserid($user_list['0']);
}
$postData = array();
//表单code
@ -50,16 +60,22 @@ class index extends CI_Controller {
//发起人部门id
$postData['dept_id'] = $dept_id;
//审批人id
$postData['approvers'] = $approversid;
$postData['approvers'] = $approversidstr;
$postData['form_component_values'] = array();
$postData['form_component_values']['0']['name'] = '报账金额';
$postData['form_component_values']['0']['value'] = $money;
$postData['form_component_values']['1']['name'] = '附件';
$postData['form_component_values']['1']['value'] = json_decode($img);
$postData['form_component_values']['1']['name'] = '备注';
$postData['form_component_values']['1']['value'] = $message;
$postData['form_component_values']['2']['name'] = '附件';
$postData['form_component_values']['2']['value'] = json_decode($img);
//print_r(json_encode($postData));die();
$approoval = GetPost_http($url,json_encode($postData),'json');
print_r($approoval);
$response = GetPost_http($url,json_encode($postData),'json');
if(!empty($response)){
echo $response;
}
}
public function sendRefund(){
@ -135,14 +151,8 @@ class index extends CI_Controller {
}
public function recivecallback(){
/*$recivejson = file_get_contents('php://input');
$encrypt = json_decode($recivejson)->encrypt;
$signature = $_GET['signature'];
$timestamp = $_GET['timestamp'];
$nonce = $_GET['nonce'];
log_message('error','dingding回调'.$recivejson);
log_message('error','signature'.$_GET['signature']);
log_message('error','timestamp'.$_GET['timestamp']);
log_message('error','nonce'.$_GET['nonce']);*/
$recivejson = file_get_contents('php://input');
log_message('error',$recivejson);
}
}

@ -0,0 +1,10 @@
<?php
class dingtools_model extends CI_Model {
function __construct() {
parent::__construct();
$this->HT = $this->load->database('HT', TRUE);
}
}
Loading…
Cancel
Save