| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- <?php
- namespace App\Http\Controllers\Api;
- use App\Service\qyWechatService;
- use App\Service\TestService;
- use Illuminate\Http\Request;
- use Illuminate\Support\Str;
- class TestController extends BaseController
- {
- public function testdwy(Request $request){
- list($bool, $data) = (new TestService())->testdwy($request->all());
- if($bool){
- return $this->json_return(200,'',$data);
- }else{
- return $this->json_return(201,$data);
- }
- }
- public function testdwyget(Request $request){
- list($bool, $data) = (new TestService())->testdwyget($request->all());
- if($bool){
- return $this->json_return(200,'',$data);
- }else{
- return $this->json_return(201,$data);
- }
- }
- public function testdwyput(Request $request){
- list($bool, $data) = (new TestService())->testdwyput($request->all());
- if($bool){
- return $this->json_return(200,'',$data);
- }else{
- return $this->json_return(201,$data);
- }
- }
- public function test(){
- dd(env("maycur_appcode"),env("maycur_appsercet"),getenv("maycur_appcode"),getenv("maycur_appsercet"));
- }
- public function salesOrderGet(Request $request){
- $common_array = $request->common_param;
- list($bool, $data) = (new TestService())->salesOrderGet($request->all(),$common_array);
- if($bool){
- return $this->json_return(200,'',$data);
- }else{
- return $this->json_return(201,$data);
- }
- }
- public function materialAddU8(Request $request){
- $common_array = $request->common_param;
- list($bool, $data) = (new TestService())->materialAddU8($request->all(), $common_array);
- if($bool){
- return $this->json_return(200,'',$data);
- }else{
- return $this->json_return(201,$data);
- }
- }
- public function productInAddU8(Request $request){
- $common_array = $request->common_param;
- list($bool, $data) = (new TestService())->ProductInAddU8($request->all(), $common_array);
- if($bool){
- return $this->json_return(200,'',$data);
- }else{
- return $this->json_return(201,$data);
- }
- }
- public function dispatchAddU8(Request $request){
- $common_array = $request->common_param;
- list($bool, $data) = (new TestService())->DispatchAddU8($request->all(), $common_array);
- if($bool){
- return $this->json_return(200,'',$data);
- }else{
- return $this->json_return(201,$data);
- }
- }
- public function recordList(Request $request){
- list($bool, $data) = (new TestService())->recordList($request->all());
- if($bool){
- return $this->json_return(200,'',$data);
- }else{
- return $this->json_return(201,$data);
- }
- }
- // 仓库档案 http://localhost:8060/api/WareHouse/Get ?CodeorName=0501 为空返回所有数据
- // 部门档案 http://localhost:8060/api/Department/Get ?CodeorName=0501 为空返回所有数据
- // 人员档案 http://localhost:8060/api/Person/Get ?CodeorName=00043&bPsnPerson=1(是否业务员) 为空返回所有数据
- // 客户分类 http://localhost:8060/api/Customer/GetCustomerClass ?cCCCode=01 为空返回所有数据
- // 客户档案 http://localhost:8060/api/Customer/GetCustomerClass ?cCCCode=01 为空返回所有数据
- // 存货分类 http://localhost:8060/api/Inventory/GetInventoryClass ?CodeorName=0101 为空返回所有
- // 存货档案 http://localhost:8060/api/System/SqlQuery
- //{
- // "customSQLFileName": "U8SQL",
- // "customSQLPath": "U8API/Inventory/Get",
- // "paramObj": {
- // "@pagesize": 25,
- // "@codeorname": "0301",
- // "@where": "AND cInvCode = 'BB01' AND cInvName like '%交换机%'",
- // "@version": "7098847"
- // }
- //}
- // 计量单位 http://localhost:8060/api/Inventory/GetComputationUnit ?CodeorName=0502 为空返回所有数据
- public function getSignatures(Request $request)
- {
- $data = $request->all();
- $url = $data['url'];
- if(empty($url)) return $this->json_return(201, 'URL不能为空');
- $nonceStr = Str::random();
- $timestamp = time();
- // 1. 企业级签名 (wx.config)
- $wechat = new qyWechatService();
- list($status, $ticket) = $wechat->getJsApiTicket();
- if(! $status) {
- return $this->json_return(201, $ticket);
- }
- $configSignature = $wechat->makeSignature($ticket, $nonceStr, $timestamp, $url);
- // 2. 应用级签名 (wx.agentConfig)
- list($status, $agentTicket) = $wechat->getAgentTicket();
- if(! $status) {
- return $this->json_return(201, $agentTicket);
- }
- $agentSignature = $wechat->makeSignature($agentTicket, $nonceStr, $timestamp, $url);
- $return = [
- 'corpid' => $wechat->corpId,
- 'agentid' => $wechat->agentId,
- 'timestamp' => $timestamp,
- 'nonceStr' => $nonceStr,
- 'configSignature' => $configSignature,
- 'agentSignature' => $agentSignature,
- ];
- return $this->json_return(200,'',$return);
- }
- }
|