| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 | <?php/** * Certify.php UTF-8 * 实名认证接口驱动 * * @date    : 2019/12/2 16:32 * * @license 这不是一个自由软件,未经授权不许任何使用和传播。 * @author  : chenbingling <cbl@huosdk.com> * @version : HUOSDK 8.5 */namespace huoIdentify\identifyDriver;use huolib\constant\IdentifyConst;use huolib\status\IdentifyStatus;use think\Exception;use think\Log;class Identify {    static  $ins;    private $identify_from        = [            'default'                           => IdentifyConst::DRIVER_NAME_ALIPAY,            IdentifyConst::DRIVER_KEY_ALIPAY    => IdentifyConst::DRIVER_NAME_ALIPAY,            IdentifyConst::DRIVER_KEY_WXPAY     => IdentifyConst::DRIVER_NAME_WXPAY,            IdentifyConst::DRIVER_KEY_FCMGAME   => IdentifyConst::DRIVER_NAME_FCMGAME,            IdentifyConst::DRIVER_KEY_YIWAN     => IdentifyConst::DRIVER_NAME_YIWAN,            IdentifyConst::DRIVER_KEY_HUOUNION  => IdentifyConst::DRIVER_NAME_HUOUNION,            IdentifyConst::DRIVER_KEY_GUOPAN    => IdentifyConst::DRIVER_NAME_GUOPAN,            IdentifyConst::DRIVER_KEY_JUEFENG   => IdentifyConst::DRIVER_NAME_JUEFENG,            IdentifyConst::DRIVER_KEY_QIANXI    => IdentifyConst::DRIVER_NAME_QIANXI,            IdentifyConst::DRIVER_KEY_YIXIN     => IdentifyConst::DRIVER_NAME_YIXIN,            IdentifyConst::DRIVER_KEY_LIEBAO    => IdentifyConst::DRIVER_NAME_LIEBAO,            IdentifyConst::DRIVER_KEY_TIANYU    => IdentifyConst::DRIVER_NAME_TIANYU,            IdentifyConst::DRIVER_KEY_KUCHANG   => IdentifyConst::DRIVER_NAME_KUCHANG,            IdentifyConst::DRIVER_KEY_MOXING    => IdentifyConst::DRIVER_NAME_MOXING,            IdentifyConst::DRIVER_KEY_HUANJUYOU => IdentifyConst::DRIVER_NAME_HUANJUYOU,            IdentifyConst::DRIVER_KEY_HAIQUYOU  => IdentifyConst::DRIVER_NAME_HAIQUYOU,        ];    public static function ins() {        if (self::$ins == null) {            self::$ins = new self();        }        return self::$ins;    }    /**     * @param string $identify_from     * @param array  $config     *     * @return mixed     * @throws Exception     */    public function get($identify_from = '', $config = []) {        if (empty($identify_from)) {            return $this->register('default');        }        $_pay_obj = $this->register($identify_from, $config);        if (!isset($_pay_obj)) {            Log::write(                "func=".__FUNCTION__."&class=".__CLASS__."&errmsg=registerError&identify_from=".$identify_from                .'objName='.$this->identify_from[$identify_from], 'info'            );            $_code = IdentifyStatus::IDENTIFY_FROM_INCORRECT;            throw new Exception(IdentifyStatus::getMsg($_code), $_code);        }        return $_pay_obj;    }    /**     * @param string $identify_from     * @param array  $config     *     * @return Driver     */    protected function register($identify_from = '', $config = []) {        $identify_from = strtolower($identify_from);        $_class = '\\huoIdentify\\identifyDriver\\driver\\'.$this->identify_from[$identify_from];        return new $_class($config);    }}
 |