|
|
|
@ -151,15 +151,18 @@ class index extends CI_Controller {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function recivecallback(){
|
|
|
|
|
log_message('error',$recivejson);
|
|
|
|
|
$recivejson = file_get_contents('php://input');
|
|
|
|
|
log_message('error',$recivejson);
|
|
|
|
|
$recivejson = '{"processInstanceId":"acedfcf9-143a-4bbc-9988-0ecdbfdf87cf","finishTime":1579072931000,"corpId":"ding48bce8fd3957c96b","EventType":"bpms_instance_change","businessId":"202001151140000168820","title":"秦乾胜提交的团款审批","type":"finish","url":"https://aflow.dingtalk.com/dingtalk/mobile/homepage.htm?corpid=ding48bce8fd3957c96b&dd_share=false&showmenu=true&dd_progress=false&back=native&procInstId=acedfcf9-143a-4bbc-9988-0ecdbfdf87cf&taskId=&swfrom=isv&dinghash=approval&dd_from=corp#approval","result":"refuse","createTime":1579059616000,"processCode":"PROC-9D90693F-DE34-423C-9B92-A19FFFC87577","bizCategoryId":"","staffId":"04405068399170"}';
|
|
|
|
|
$recivedata = json_decode($recivejson);
|
|
|
|
|
$data = array();
|
|
|
|
|
if(strpos($recivedata->title,'团款审批')){
|
|
|
|
|
$data['processInstanceId'] = $recivedata->processInstanceId;
|
|
|
|
|
$data['title'] = $recivedata->title;
|
|
|
|
|
$data['type'] = $recivedata->type;
|
|
|
|
|
$data['result'] = $recivedata->result;
|
|
|
|
|
$data['staffId'] = $recivedata->staffId;
|
|
|
|
|
$unionid = $this->get_unionid($recivedata->staffId);
|
|
|
|
|
$data['unionid'] = $unionid;
|
|
|
|
|
if(isset($recivedata->content)){
|
|
|
|
|
$data['content'] = $recivedata->content;
|
|
|
|
|
}else{
|
|
|
|
@ -168,4 +171,17 @@ class index extends CI_Controller {
|
|
|
|
|
|
|
|
|
|
$this->dingtools_model->add_instance_id($data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function get_unionid($userid){
|
|
|
|
|
$access_url = 'https://oapi.dingtalk.com/gettoken?appkey='.$this->AppKey.'&appsecret='.$this->AppSecret;
|
|
|
|
|
$access_token = GetPost_http($access_url,'','');
|
|
|
|
|
$access_token = json_decode($access_token)->access_token;
|
|
|
|
|
|
|
|
|
|
$user_detail_url = 'https://oapi.dingtalk.com/user/get?access_token='.$access_token.'&userid='.$userid;
|
|
|
|
|
$user_detail = GetPost_http($user_detail_url,'','get');
|
|
|
|
|
$unionid = json_decode($user_detail)->unionid;
|
|
|
|
|
return $unionid;
|
|
|
|
|
}
|
|
|
|
|
}
|