提交 beacb1a8 authored 作者: fengzy's avatar fengzy

费用报销脚本

上级 5c6d26b9
......@@ -159,4 +159,50 @@ class CommonClassModel extends Model
$data = m('c_cbzx')->getall(' type=0 and status = 1', 'id as value,CONCAT(code, "(",name,")") as name');
return $data;
}
public function getprojcbzx()
{
$aDt = $this->getAccessData();
$map = '';
if(is_array($aDt['data']) && !empty($aDt['data'])){
foreach ($aDt['data'] as $k => $value) {
$and = ' and ';
if($k == count($aDt['data'])- 1) $and = '';
$map .= $value[0].' '.$value[1].' ('.$value[2].') '.$and;
}
}
$data = m('c_project_numbs')->getall($map, 'id as value,CONCAT(project_numb, "(",project_name,")") as name');
return $data;
}
private function getToken(){
$url = 'http://jz.gonn.com.cn/v1/token?app_id=b617866c20482d133d5de66fceb37da3&timestamp=1588055274&sign=91ffa6ef3eef7ec6231ddb16532c39e1';
$res = curlGet($url);
return json_decode($res,true);
}
private function getAccessData(){
$tData = $this->getToken();
$uid = $this->getJzUid();
if($tData['message'] == "SUCCESS") $url = 'http://jz.gonn.com.cn/v1/permission?uid='.$uid.'&token='.$tData['data']['token'];
$res = curlGet($url);
return json_decode($res,true);
}
private function getJzUid(){
$adminid = $this->adminid;
$user = m('admin')->getone(' id = '.$adminid,'user');
$email = $user['user'].'@gonn.com.cn';
$tData = $this->getToken();
if($tData['message'] == "SUCCESS") $url = 'http://jz.gonn.com.cn/v1/email?email='.$email.'&token='. $tData['data']['token'];
$res = curlGet($url);
$uData = json_decode($res,true);
return $uData['data']['id'];
}
}
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论