36 lines
		
	
	
		
			653 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
		
		
			
		
	
	
			36 lines
		
	
	
		
			653 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| 
								 | 
							
								<?php
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								namespace bw\lakala;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * 拉卡拉服务
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								class LakalaService
							 | 
						||
| 
								 | 
							
								{
							 | 
						||
| 
								 | 
							
								    //编写单例模式
							 | 
						||
| 
								 | 
							
								    private static $instance;
							 | 
						||
| 
								 | 
							
								    private $config;
							 | 
						||
| 
								 | 
							
								    private function __construct()
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        $this->init();
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								    private function __clone()
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        return;
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								    public static function getInstance()
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        if (!(self::$instance instanceof self)) {
							 | 
						||
| 
								 | 
							
								            self::$instance = new self();
							 | 
						||
| 
								 | 
							
								        }
							 | 
						||
| 
								 | 
							
								        return self::$instance;
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								    public function init()
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        $this->config = [
							 | 
						||
| 
								 | 
							
								            'merId' => '100000000000000',
							 | 
						||
| 
								 | 
							
								            'merKey' => '12345678901234567890123456789012',
							 | 
						||
| 
								 | 
							
								           ];
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								}
							 |