PHP

【PHP】管家婆各个大类的基础调用数据方法

小破孩
2025-04-23 / 0 评论 / 17 阅读 / 正在检测是否收录...
<?php


namespace app\common\lib\gjp\warehouse;


use think\Exception;

class Warehouse
{

    protected $dbName;

    public function __construct()
    {
        $this->dbName = "*****"; //
    }

    //查询单据
    public function getWarehouse($paramkey = "", $paramJson = "", $userId = "***********")//
    {

        $instanceGjpBasic = new \app\common\lib\gjp\Basic();

        $gjpSignInfo = $instanceGjpBasic->getSignKey();

        $instanceGjpApiUrl = new \app\common\lib\gjp\Apiurl($userId);

        $gjpApiUrlInfo = $instanceGjpApiUrl -> getApiUrl();

        $mobile    = empty($gjpApiUrlInfo['GraspCloudMobile'])   ? 0 : $gjpApiUrlInfo['GraspCloudMobile'];

        $serviceid = empty($gjpApiUrlInfo['GraspCloudServerId']) ? 0 : $gjpApiUrlInfo['GraspCloudServerId'];

        $requestUrl = $gjpApiUrlInfo['ApiServerAddress'];

        $md5BeforeStr = "apiparam".$gjpApiUrlInfo['ApiParam']."apitype".'query'."dbname".(string)$this->dbName."interiorapi"."1"."managename"."GraspCMServerApi.dll"."mobile".$mobile."paramjson".$paramJson."paramkey".$paramkey."serviceid".$serviceid.$gjpSignInfo['SignKey'];

        $data = [
            'managename'  => (string)"GraspCMServerApi.dll",
            'dbname'      => (string)$this->dbName,
            'paramkey'    => (string)$paramkey,
            'paramjson'   => (string)($paramJson),
            'apiparam'    => (string)$gjpApiUrlInfo['ApiParam'],
            'apitype'     => (string)"query",
            'sign'        => (string)md5($md5BeforeStr),
            'mobile'      => (string)$mobile,
            'serviceid'   => (string)$serviceid,
            'interiorapi' => (integer)1,
        ];

        $encodedParams = http_build_query($data);

        $result = $instanceGjpBasic->curlRequest($requestUrl,"POST",$encodedParams,true,false);

        if($result['code'] != 0){
            print_r($result);die;
        }

        return $result;
    }

    //生产单据
    public function setReceipts($vchtype = 0,$billdata = '',$userId = "*************"){
        $instanceGjpBasic = new \app\common\lib\gjp\Basic();
        $gjpSignInfo = $instanceGjpBasic->getSignKey();

        $instanceGjpApiUrl = new \app\common\lib\gjp\Apiurl($userId);
        $gjpApiUrlInfo = $instanceGjpApiUrl -> getApiUrl();

        $requestUrl = $gjpApiUrlInfo['ApiServerAddress'];
        $mobile    = empty($gjpApiUrlInfo['GraspCloudMobile'])   ? 0 : $gjpApiUrlInfo['GraspCloudMobile'];
        $serviceid = empty($gjpApiUrlInfo['GraspCloudServerId']) ? 0 : $gjpApiUrlInfo['GraspCloudServerId'];

        $md5BeforeStr = "apiparam".$gjpApiUrlInfo['ApiParam']."apitype".'process'."billdata". $billdata ."dbname".(string)$this->dbName."interiorapi"."1"."managename"."GraspCMServerApi.dll"."mobile".$mobile."processtype"."0"."serviceid".$serviceid."vchcode"."0"."vchtype".$vchtype.$gjpSignInfo['SignKey'];

        $data = [
            'managename'  => (string)"GraspCMServerApi.dll",
            'dbname'      => (string)$this->dbName,
            'processtype' => (integer)0,
            'vchtype'     => (integer)$vchtype,
            'vchcode'     => (integer)0,
            'billdata'    => (string)$billdata,
            'apiparam'    => (string)$gjpApiUrlInfo['ApiParam'],
            'apitype'     => (string)"process",
            'sign'        => (string)md5($md5BeforeStr),
            'mobile'      => (string)$mobile,
            'serviceid'   => (string)$serviceid,
            'interiorapi' => (integer)1,
        ];
//        print_r($data);die;
        $encodedParams = http_build_query($data);

        $result = $instanceGjpBasic->curlRequest($requestUrl,"POST",$encodedParams,true,false);

        return $result;
    }

    //新增或修改 基础资料新增
    public function businessBaseInfo($basetype = "", $baseinfodata = "", $rec = "", $type = 1, $userId = "*********"){
        if($type == 1){
            $typeName = "add";
        }else{
            $typeName = "modify";
        }
        if(empty($rec)){
            (string)$rec = "0";
        }

        $instanceGjpBasic = new \app\common\lib\gjp\Basic();
        $gjpSignInfo = $instanceGjpBasic->getSignKey();

        $instanceGjpApiUrl = new \app\common\lib\gjp\Apiurl($userId);
        $gjpApiUrlInfo = $instanceGjpApiUrl -> getApiUrl();
//        print_r($gjpApiUrlInfo);die;
        $mobile    = empty($gjpApiUrlInfo['GraspCloudMobile'])   ? 0 : $gjpApiUrlInfo['GraspCloudMobile'];
        $serviceid = empty($gjpApiUrlInfo['GraspCloudServerId']) ? 0 : $gjpApiUrlInfo['GraspCloudServerId'];
        $requestUrl = $gjpApiUrlInfo['ApiServerAddress'];

        $md5BeforeStr ="actiontype".$typeName."apiparam".$gjpApiUrlInfo['ApiParam']."apitype".'baseinfo'."baseinfodata".$baseinfodata."basetype".$basetype."dbname".(string)$this->dbName."interiorapi"."1"."managename"."GraspCMServerApi.dll"."mobile".$mobile."rec".$rec."serviceid".$serviceid.$gjpSignInfo['SignKey'];

//        "actiontype".$typeName."apiparam".$gjpApiUrlInfo['ApiParam']."apitype"."baseinfo"."basetype".$basetype."baseinfodata".$baseinfodata."dbname".$this->dbName."interiorapi".1."managename"."GraspCMServerApi.dll"."mobile".$mobile."serviceid".$serviceid."sign".md5($md5BeforeStr)

        $data = [
            'managename'   => (string)"GraspCMServerApi.dll",
            'dbname'       => (string)$this->dbName,
            'actiontype'   => (string)$typeName,
            'rec'          => (string)$rec,
            'basetype'     => (string)$basetype,
            'baseinfodata' => (string)$baseinfodata,
            'apiparam'     => (string)$gjpApiUrlInfo['ApiParam'],
            'apitype'      => (string)"baseinfo",
            'sign'         => (string)md5($md5BeforeStr),
            'mobile'       => (string)$mobile,
            'serviceid'    => (string)$serviceid,
            'interiorapi'  => (integer)1,
        ];

        $encodedParams = http_build_query($data);

        $result = $instanceGjpBasic->curlRequest($requestUrl,"POST",$encodedParams,true,false);

        if($result['code'] != 0){
            print_r($result);die;
        }

        return $result;
    }




}
0

评论 (0)

取消