wugg 2 gadi atpakaļ
vecāks
revīzija
a1db3cb074

+ 26 - 0
app/admin/controller/OrderInv.php

@@ -1906,4 +1906,30 @@ class OrderInv extends BaseController{
         ->toArray();
         return app_show(0,"获取成功",["list"=>$list,"count"=>$count]);
     }
+
+	/**
+	* @return \think\response\Json|void
+	* @throws \think\db\exception\DataNotFoundException
+	* @throws \think\db\exception\DbException
+	* @throws \think\db\exception\ModelNotFoundException
+	*/
+    public function tikcetList(){
+    	$post=$this->request->only(["invNo"=>"","page"=>1,"size"=>15],"post","trim");
+    	$where=[];
+    	if($post["invNo"]!="") $where[]=["invNo","=",$post['invNo']];
+    	 $count=Db::name("invoice_ticket")->where($where)->count();
+    	 $total =ceil($count/$post['size']);
+    	 $page= $post['page']>$total ? intval($total):intval($post['page']);
+    	 $list = Db::name("invoice_ticket")
+    	 ->where($where)
+    	 ->json(["item"])
+    	 ->page($page,intval($post['size']))
+    	 ->order("id desc")
+    	 ->select()->toArray();
+    	 $typename=["004"=>"增值税专用发票",'007'=>"增值税普通发票",'026'=>'增值税电子普通发票','028'=>'增值税电子专用发票'];
+    	  foreach ($list as &$value){
+    	 	    $value['invtype_name'] = $typename[$value['inv_type']]??"";
+    	 }
+    	 return app_show(0,"获取成功",["list"=>$list,"count"=>$count]);
+    }
 }

+ 24 - 0
app/admin/controller/Payment.php

@@ -1378,4 +1378,28 @@ class Payment extends BaseController
 		}
 		return empty($info)?error_show(1005,"为找到数据"):app_show(0,"获取成功",$info);
     }
+	/**
+	* @return \think\response\Json|void
+	* @throws \think\db\exception\DataNotFoundException
+	* @throws \think\db\exception\DbException
+	* @throws \think\db\exception\ModelNotFoundException
+    */
+    public function hpinvList(){
+    	$post=$this->request->only(["hpNo"=>"","page"=>1,"size"=>15],"post","trim");
+    	$where=[];
+    	if($post["hpNo"]!="") $where[]=["hpNo","=",$post['hpNo']];
+    	 $count=Db::name("invoice_info")->where($where)->count();
+    	 $total =ceil($count/$post['size']);
+    	 $page= $post['page']>$total ? intval($total):intval($post['page']);
+    	 $list = Db::name("invoice_info")
+    	 ->where($where)
+    	 ->json(["item_list"])
+    	 ->page($page,intval($post['size']))
+    	 ->order("id desc")
+    	 ->select()->toArray();
+    	 foreach ($list as &$value){
+    	 	    $value['type_name'] = $this->invoiceType[$value['type']]??"";
+    	 }
+    	 return app_show(0,"获取成功",["list"=>$list,"count"=>$count]);
+    }
 }

+ 3 - 1
app/admin/route/app.php

@@ -178,7 +178,9 @@ route::rule('deleteDataShare', 'admin/DataShare/deleteDataShare');//删除数据
 route::rule('statusDataShare', 'admin/DataShare/statusDataShare');//启/禁用数据共享
 
 
-route::rule('login', 'admin/Login/login');//启/禁用数据共享
+route::rule('login', 'admin/Login/login');//登录接口
+route::rule('ticketlist', 'admin/OrderInv/tikcetList');//订单发票查询
+route::rule('hpinvlist', 'admin/Payment/hpinvList');//采购单发票查询
 
 
 

+ 15 - 2
app/common.php

@@ -235,14 +235,27 @@ function addacount($condition){
 }
 if(!function_exists("headerSign")){
 
-	function headerSign($post,$headerArr){
-
+	function headerSign($post){
+		$config = Config::get("sign");
+		$appid=$config['appid'];
+		$appkey=$config['appkey'];
+		$headerArr=["appid"=>'123',"noce"=>randomkeys(16),"sign"=>'',"timestamp"=>time()];
+		$value =array_merge($post,$headerArr);
+        $Sign= new \Sign($appid,$appkey);
+        $headerArr['sign'] = $Sign->makeSign($value);
+        $list=[];
+        foreach ($headerArr as $key=>$value){
+			$list[]=$key.":".$value;
+        }
+        return $list;
 	}
 }
 
 //参数1:访问的URL,参数2:post数据(不填则为GET),参数3:提交的$cookies,参数4:是否返回$cookies
 function curl_request($url,$post='',$header=["Content-Type: multipart/json;charset=utf-8"]){
 	$header = empty($header) ? '' : $header;
+	$singHead = headerSign($post);
+
 	if(is_array($post)) $post=json_encode($post,JSON_UNESCAPED_UNICODE);
     $curl = curl_init();
     curl_setopt($curl, CURLOPT_URL, $url);

+ 5 - 0
config/sign.php

@@ -0,0 +1,5 @@
+<?php
+return [
+	"appid"=>"123",
+	"appkey"=>"12345"
+];