123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216 |
- <?php
- /**
- * Driver.php UTF-8
- * 实名认证接口驱动
- *
- * @date : 2019/12/2 16:31
- *
- * @license 这不是一个自由软件,未经授权不许任何使用和传播。
- * @author : chenbingling <cbl@huosdk.com>
- * @version : HUOSDK 8.5
- */
- namespace huoIdentify\identifyDriver;
- use huolib\constant\IdentifyConst;
- use huolib\status\CommonStatus;
- abstract class Driver {
- protected $config = []; //配置信息
- protected $identify_from = 'alipay'; //认证来源 支付宝 alipay 微信 wxpay
- protected $identify_type = IdentifyConst::ITYPE_MAINLAND; //认证证件类型 1 身份证
- protected $mem_id = 0; //当前玩家id
- protected $real_name = ''; //真实姓名
- protected $id_card = ''; //证件号
- protected $mg_mem_id = 0; //当前玩家小号id--提供给游戏方的id可能与玩家id一致
- protected $pf = 0; //平台标识 1 安卓 2 IOS
- protected $pi = ''; //中宣部的pi
- protected $user_token = ''; //用户标识
- public function __construct($config = []) {
- $this->config = $config;
- }
- /**
- * 移动APP支付函数
- *
- * @access public
- *
- */
- abstract public function identify();
- /**
- * 返回错误信息
- *
- * @param int $code
- * @param string $msg
- * @param array $data
- *
- * @return array
- */
- public function huoError($code = 400, $msg = '', $data = []) {
- return $this->huoSuccess($code, $msg, $data);
- }
- /**
- * 逻辑处理返回信息
- *
- * @param int $code
- * @param string $msg
- * @param array $data
- *
- * @return array
- */
- public function huoSuccess($code = 200, $msg = '', $data = []) {
- $_rdata['code'] = $code;
- $_rdata['msg'] = $msg;
- $_rdata['data'] = $data;
- return $_rdata;
- }
- /**
- * @param mixed $_data
- */
- public function huoReturn($_data) {
- return $this->huoSuccess($_data['code'], $_data['msg'], $_data['data']);
- }
- /**
- * @return string
- */
- public function getIdentifyFrom() {
- return $this->identify_from;
- }
- /**
- * @param string $identify_from
- */
- public function setIdentifyFrom($identify_from) {
- $this->identify_from = $identify_from;
- }
- /**
- * @return int
- */
- public function getIdentifyType() {
- return $this->identify_type;
- }
- /**
- * @param int $identify_type
- */
- public function setIdentifyType($identify_type) {
- $this->identify_type = $identify_type;
- }
- /**
- * @return string
- */
- public function getRealName() {
- return $this->real_name;
- }
- /**
- * @param string $real_name
- */
- public function setRealName($real_name) {
- $this->real_name = $real_name;
- }
- /**
- * @return string
- */
- public function getIdCard() {
- return $this->id_card;
- }
- /**
- * @param string $id_card
- */
- public function setIdCard($id_card) {
- $this->id_card = strtoupper($id_card);
- }
- /**
- * @return int
- */
- public function getMemId() {
- return $this->mem_id;
- }
- /**
- * @param int $mem_id
- */
- public function setMemId($mem_id) {
- $this->mem_id = $mem_id;
- }
- public function loginBehavior($identify_pi) {
- $_code = CommonStatus::NO_ERROR;
- return $this->huoSuccess($_code, CommonStatus::getMsg($_code));
- }
- public function logoutBehavior($identify_pi) {
- $_code = CommonStatus::NO_ERROR;
- return $this->huoSuccess($_code, CommonStatus::getMsg($_code));
- }
- /**
- * @return int
- */
- public function getMgMemId() {
- return $this->mg_mem_id;
- }
- /**
- * @param int $mg_mem_id
- */
- public function setMgMemId($mg_mem_id) {
- $this->mg_mem_id = $mg_mem_id;
- }
- /**
- * @return int
- */
- public function getPf() {
- return $this->pf;
- }
- /**
- * @param int $pf
- */
- public function setPf($pf) {
- $this->pf = $pf;
- }
- /**
- * @return string
- */
- public function getPi() {
- return $this->pi;
- }
- /**
- * @param string $pi
- */
- public function setPi($pi) {
- $this->pi = $pi;
- }
- /**
- * @return string
- */
- public function getUserToken() {
- return $this->user_token;
- }
- /**
- * @param string $user_token
- */
- public function setUserToken($user_token) {
- $this->user_token = $user_token;
- }
- }
|