/b2b/core/model/service/mdl.certificate.php
http://phpfor.googlecode.com/ · PHP · 860 lines · 683 code · 96 blank · 81 comment · 82 complexity · 60ee391ba942f673fc29f99469f6d4ca MD5 · raw file
- <?php
- /******************
- Certificate ??
- ******************/
- class mdl_certificate extends modelFactory {
- function get_app_instance_id($app_id){
- if(empty($this->app_instance_id)){
- $return = "";
- $post = array(
- 'certi_app' => 'app.get_instance_list',
- 'app_id' => VERIFY_APP_ID,
- 'version' => '1.0',
- 'certi_url' => $this->system->base_url(),
- 'certi_session' => $this->get_sess(),
- 'certi_validate_url' => $this->system->base_url() . "shopadmin/index.php?ctl=passport&act=certi_validate",
- 'format' => 'json'
- );
- $post['certi_ac'] = $this->make_shopex_ac($post,$this->getToken());
- $instance_list = $this->read_shopex_server($post);
- if($instance_list['res'] == 'succ'){
- $return = implode("|",$instance_list['info']);
- }else{
- $return = "";
- }
- $this->app_instance_id = $return;
- }else{
- $return = $this->app_instance_id;
- }
- return $return;
- }
- function to_shopex_certificate($certi_app,$certificate_id=NULL,$token=NULL,$identifier=NULL,$password=NULL,$certi_session=NULL,$version=NULL,$app_id=NULL,$app_instance_id=NULL,$certi_url=NULL,$certi_validate_url=NULL,$shop_version=NULL,$format='json'){
- $certificate_id = is_null($certificate_id)?$this->getCerti():$certificate_id;
- $token = is_null($token)?$this->getToken():$token;
- $identifier = is_null($identifier)?$this->getIdentifier():$identifier;
- $password = is_null($password)?$this->getPassword():$password;
- $certi_session = is_null($certi_session)?STORE_KEY:$certi_session;
- $version = is_null($version)?'1.2':$version;
- $app_id = is_null($app_id)?VERIFY_APP_ID:$app_id;
- $app_instance_id = is_null($app_instance_id)?$this->get_app_instance_id(VERIFY_APP_ID):$app_instance_id;
- //??base_url ?????????????url add liuguoqing
- $base_url = $this->system->getConf('store.shop_url')?$this->system->getConf('store.shop_url'):$this->system->base_url();
- $certi_url = is_null($certi_url)?$base_url:$certi_url;
- $certi_validate_url = is_null($certi_validate_url)?$base_url . "shopadmin/index.php?ctl=passport&act=certi_validate":$certi_validate_url;
- $format = empty($format)?'json':$format;
- $shop_version = is_null($shop_version)?$this->getVersion():$shop_version;
- $post = array(
- 'certi_app' => $certi_app,
- 'certificate_id' => $certificate_id,
- 'identifier' => $identifier,
- 'password' => $password,
- 'app_id' => $app_id,
- 'app_instance_id' => $app_instance_id,
- 'version' => $version,
- 'certi_url' => $certi_url,
- 'certi_session' => $certi_session,
- 'certi_validate_url' => $certi_validate_url,
- 'shop_version' => $shop_version,
- 'refer' => 'shopex',
- 'format' => $format
- );
- $post['certi_ac'] = $this->make_shopex_ac($post,$token);
- return $this->read_shopex_server($post);
- }
- function make_shopex_ac($temp_arr,$token){
- ksort($temp_arr);
- $str = '';
- foreach($temp_arr as $key=>$value){
- if($key!='certi_ac') {
- $str.=$value;
- }
- }
- return md5($str.$token);
- }
-
- function read_shopex_server($post){
- $url=SERVICE_HOST."/openapi/api.php";
- $net = $this->system->network();
- $net->agent="ShopEx_Cert_Client";
- $net->submit($url,$post);
- $debug_info['url']=$url;
- $debug_info['request']=$post;
- $results=$net->results;
- $debug_info['result']=$results;
- if( @constant( "DEBUG_API" ) ){
- error_log(date("c")."\t".print_r($debug_info,true),3,HOME_DIR."/logs/certificate_".date("Y-m-d").".log");
- }
- return json_decode($results,true);
- }
-
- function read_shopex_accountserver($post){
- $url=ACCOUNT_HOST."/api.php";
- $net = $this->system->network();
- //$net->agent="ShopEx_Cert_Client";
- $net->submit($url,$post);
- $results=$net->results;
- return json_decode($results,true);
- }
- function checkValid($sStr){
- if($sStr == 'valid'){
- return '??';
- }
- else{
- return '???';
- }
- }
- function delLicense(){
- $this->system->setConf('certificate.id','');
- $this->system->setConf('certificate.token','');
- $this->system->setConf('certificate.node_id','');
- }
- function explodeStr($sStr){
- $aTmp = explode("|||", $sStr);
- return $aTmp;
- }
- /**
- * ??license_id
- * @param $certi_id
- */
- function setCerti($certi_id){
- return $this->system->setConf('certificate.id',$certi_id,true);
- }
- /**
- * ??token
- * @param $token
- */
- function setToken($token){
- return $this->system->setConf('certificate.token',$token,true);
- }
- /**
- * ??shopex???ID
- * @param $nodeid
- */
- function setNodeId($nodeid){
- return $this->system->setConf('certificate.node_id',$nodeid,true);
- }
-
- /**
- * ??shopex???identifier(???ID?)
- * @param $identifier
- */
- function setIdentifier($identifier){
- return $this->system->setConf('shopexuser.identifier',$identifier,true);
- }
-
- /**
- * ??shopex?????
- * @param $email
- */
- function setIdentEmail($identemail){
- return $this->system->setConf('shopexuser.identemail',$identemail,true);
- }
-
- /**
- * ??shopex???????
- * @param $password
- */
- function setPassword($password){
- return $this->system->setConf('shopexuser.password',md5($password.ACCOUNT_PASS_HASH),true);
- }
-
- function setStr($str){
- $this->system->setConf('certificate.str',$str);
- }
- function setFormal($state){
- $this->system->setConf('certificate.formal',$state);
- }
- function set_channel_url($url){
- $this->system->setConf('certificate.channel.url',$url);
- }
- function set_channel_name($name){
- $this->system->setConf('certificate.channel.name',$name);
- }
- function set_channel_is($status){
- $this->system->setConf('certificate.channel.status',$status);
- }
- function set_channel_service($service){
- $this->system->setConf('certificate.channel.service',$service);
- }
-
- //????????node id ???????????
- function setTaoNodeId($node_id){
- $this->system->setConf('taofenxiao.node_id',$node_id);
- $status = $node_id ? 1 : 0;
- $this->db->exec('update sdb_application set status = \''.$status.'\' where act=\'app_taofenxiao\'');
- }
- function getTaoNodeId(){
- if($this->system->getConf('taofenxiao.node_id')){
- return $this->system->getConf('taofenxiao.node_id');
- }else{
- return false;
- }
- }
- // [node_id] => 1735373339
- // [status] => true
- // [session] => 405251265ec118214dekWJLWlSz0c17055f5a6f636d44e74670275721
- // [nickname] => ????
- //?????????????
- function set_taobao_session_status($status){
- $this->system->setConf('taofenxiao.taobao_session_status',$status);
- }
- function get_taobao_session_status(){
- if($this->system->getConf('taofenxiao.taobao_session_status')){
- return $this->system->getConf('taofenxiao.taobao_session_status');
- }else{
- return false;
- }
- }
- //??????????
- function set_taobao_nickname($nickname){
- $this->system->setConf('taofenxiao.taobao_nickname',$nickname);
- }
-
- function get_taobao_nickname($nickname){
- if($this->system->getConf('taofenxiao.taobao_nickname')){
- return $this->system->getConf('taofenxiao.taobao_nickname');
- }else{
- return false;
- }
- }
- //????????? taobao session
- function set_taobao_session($taobao_session){
- $this->system->setConf("taofenxiao.taobao_session",$taobao_session);
- }
-
- function get_taobao_session(){
- if($this->system->getConf("taofenxiao.taobao_session")){
- return $this->system->getConf("taofenxiao.taobao_session");
- }else{
- return false;
- }
- }
-
- function updateSess($op_id,$sess_id){
- $sSql = "update sdb_op_sessions set op_id = '$op_id' where sess_id = '$sess_id'";
- $this->db->query($sSql);
- }
- function get_sess(){
- $sql = "select sess_id from sdb_op_sessions WHERE status=1 ORDER BY last_time DESC";
- $data=$this->db->selectrow($sql);
- return $data['sess_id'];
- }
-
- function getCerti(){
- if($this->system->getConf('certificate.id')){
- return $this->system->getConf('certificate.id');
- }else{
- return false;
- }
- }
-
- function getToken(){
- if($this->system->getConf('certificate.token')){
- return $this->system->getConf('certificate.token');
- }else{
- return false;
- }
- }
-
- function getNoteId(){
- if($this->system->getConf('certificate.node_id')){
- return $this->system->getConf('certificate.node_id');
- }else{
- return false;
- }
- }
-
- function getIdentifier(){
- if($this->system->getConf('shopexuser.identifier')){
- return $this->system->getConf('shopexuser.identifier');
- }else{
- return false;
- }
- }
-
- function getIdentEmail(){
- if($this->system->getConf('shopexuser.identemail')){
- return $this->system->getConf('shopexuser.identemail');
- }else{
- return false;
- }
- }
-
- function getPassword(){
- if($this->system->getConf('shopexuser.password')){
- return $this->system->getConf('shopexuser.password');
- }else{
- return false;
- }
- }
-
- function get_channel_url(){
- return $this->system->getConf('certificate.channel.url');
- }
- function get_channel_name($name){
- return $this->system->getConf('certificate.channel.name');
- }
- function get_channel_is(){
- return $this->system->getConf('certificate.channel.status');
- }
- function get_channel_service(){
- return $this->system->getConf('certificate.channel.service');
- }
- function getName(){
- if($this->system->getConf('system.shopname')){
- return $this->system->getConf('system.shopname');
- }
- }
- function getSess($sess_id){
- $sSql="select * from sdb_op_sessions where sess_id='$sess_id'";
- if ($this->db->selectrow($sSql)) {
- return true;
- }else{
- return false;
- }
- }
- function setEncode($sess_id,$certi_id){
- $ENCODEKEY='ShopEx@License';
- $confirmkey = md5($sess_id.$ENCODEKEY.$certi_id);
- return $confirmkey;
- }
- function checkFile($files){
- if(empty($files)){
- return false;
- }else{
- return true;
- }
- }
- function checkPass($aIn){
- $sSql = "select * from sdb_operators where username = '".$aIn['username']."' and userpass = md5('".$aIn['userpass']."') and super=1 and status=1";
- if($this->db->selectrow($sSql)){
- return true;
- }else{
- return false;
- }
- }
- function upload($tmp){
- if(!$this->checkFile($tmp)){
- return false;
- }
- $certInfo = @file($tmp);
- $line = $certInfo[0];
- $result=$this->checkCerti($line,'check');
- if(!$result){
- return false;
- }
- $expTmp = explode('|||',$line);
- if(!$this->checkCerti($expTmp[0],'id')){
- return false;
- }
- if(!$this->checkCerti($expTmp[1],'token')){
- return false;
- }
- if( $cerinfo=$this->to_shopex_certificate('certi.login',$expTmp[0],$expTmp[1]) ){
- if($cerinfo['res'] == 'succ'){
- if( $cerinfo['info']['open'] == 'false' ){
- return false;
- }
- }else{
- return false;
- }
- }
- $this->delLicense();
- $_r1=$this->setCerti($expTmp[0]);
- $_r2=$this->setToken($expTmp[1]);
- if($_r1&&$_r2){
- return true;
- }
- return false;
- }
- function checkCerti($certi , $action){
- switch($action) {
- case 'check':
- if(strtok($certi, "|||")){
- return true;
- }
- else{
- return false;
- }
- break;
- case 'id':
- if(strlen($certi) < 12){
- return true;
- }else{
- return false;
- }
- break;
- case 'token':
- if(strlen($certi) == 64){
- return true;
- }else{
- return false;
- }
- break;
- }
- }
- function msg_pack(){
- $data['ip'] = remote_addr();
- $data['url'] = $this->system->base_url();
- $data['login_time'] = mktime();
- $data['certificate_id'] = $this->getCerti();
- $data['shopname'] = $this->system->getConf('system.shopname');
- $data['ac'] = $this->make_shopex_ac($data,'ShopEx_LOG');
- return $data;
- }
- function post_data($data){
- $url = SERVICE_HOST.'/class.license_log.php';
- $httpd=$this->system->network();
- $httpd->submit($url,$data);
- return $httpd->results;
- }
- function show_pack_data(){
- $data = array();
- $tmp=$this->db->selectrow("select count(product_id) as product_num from sdb_products as aProducts
- left join sdb_goods as aGoods on aProducts.goods_id=aGoods.goods_id where aProducts.goods_id=aGoods.goods_id and aGoods.disabled='false' and aProducts.disabled='false'");
- $data['goodnum'] = $tmp['product_num'];
- $sql = "select count(*) as categorynum from sdb_goods_type";
- $tmp = $this->db->selectrow($sql);
- $data['categorynum'] = $tmp['categorynum'];
- $sql = "select count(*) as membernum from sdb_members where disabled='false'";
- $tmp = $this->db->selectrow($sql);
- $data['membernum'] = $tmp['membernum'];
- $tmp=$this->db->selectrow("select count(order_id) as order_num,sum(total_amount) as order_total_count from sdb_orders where version_id=0 and ship_status=1 and (pay_status=1 or pay_status=2) and disabled='false'");
- $data['ordernum'] = $tmp['order_num'];
- $data['orderprice'] = $tmp['order_total_count'];
- return $data['goodnum'].'###'.$data['categorynum'].'###'.$data['ordernum'].'###'.$data['membernum'].'###'.$data['orderprice'];
- }
- function b2b_show_pack_data(){
- $data = array();
- $tmp=$this->db->selectrow("select count(DISTINCT aProducts.goods_id) as product_num from sdb_products as aProducts
- left join sdb_goods as aGoods on aProducts.goods_id=aGoods.goods_id where aProducts.goods_id=aGoods.goods_id and aGoods.disabled='false' and aProducts.disabled='false'");
- $data['goodnum'] = $tmp['product_num'];
- $sql = "select count(*) as categorynum from sdb_goods_type";
- $tmp = $this->db->selectrow($sql);
- $data['categorynum'] = $tmp['categorynum'];
- $sql = "select count(*) as distribution_membernum from sdb_members where certificate_id>0 and disabled='false'";
- $tmp = $this->db->selectrow($sql);
- $data['membernum']['distribution'] = $tmp['distribution_membernum'];
- $sql = "select count(*) as local_membernum from sdb_members where certificate_id=0 and disabled='false'";
- $tmp = $this->db->selectrow($sql);
- $data['membernum']['local'] = $tmp['local_membernum'];
- $tmp=$this->db->selectrow("select count(order_id) as distribution_order_num,sum(total_amount) as distribution_order_total_count from sdb_orders where version_id=0 and ship_status=1 and (pay_status=1 or pay_status=2) and is_remote='true' and disabled='false'");
- $data['ordernum']['distribution'] = $tmp['distribution_order_num'];
- $data['orderprice']['distribution'] = $tmp['distribution_order_total_count'];
- $tmp=$this->db->selectrow("select count(order_id) as local_order_num,sum(total_amount) as local_order_total_count from sdb_orders where version_id=0 and ship_status=1 and (pay_status=1 or pay_status=2) and is_remote='false' and disabled='false'");
- $data['ordernum']['local'] = $tmp['local_order_num'];
- $data['orderprice']['local'] = $tmp['local_order_total_count'];
- return $data;
- }
- function check_api(){
- ksort($_POST);
- $str = '';
- //????get?
- foreach($_POST as $key=>$value){
- if($key!='ac'){
- $str.=$value;
- }
- }
- if(md5($str) == $_POST['ac']){
- return true;
- }
- return false;
- }
- function show_channel(){
- $httpd = $this->system->network();
- $url = SERVICE_HOST.'/class.channel.php';
- $certificate_id=$this->getCerti();
- $ac = md5($certificate_id.'ShopEx_CHANNEL');
- $data= array('certificate_id'=>$certificate_id,
- 'ac'=>$ac
- );
- $httpd->submit($url,$data);
- $msg = $httpd->results;
- if(!(strpos($msg, 'true') === false)){
- $tmp=$this->explodeStr($msg);
- $this->set_channel_name($tmp[1]);
- $this->set_channel_url($tmp[2]);
- $this->set_channel_service($tmp[3]);
- $this->set_channel_is(true);
- }else{
- $this->set_channel_is(false);
- }
- }
- function getInfo(){
- set_time_limit(0);
- $this->Certi = $this->getCerti();
- $this->Token = $this->getToken();
- $this->Noteid = $this->getNoteid();
- $this->setFormal($state);
- if($this->Certi && $this->Token && $this->Noteid){
- $this->sendmsg();
- $this->show_channel();
- $this->setStr($str);
- $_r=$this->toLogin();
- }else{
- $this->delLicense();
- $_r=$this->toReg();
- $this->Certi = $this->getCerti();
- $this->Token = $this->getToken();
- $this->Noteid = $this->getNoteId();
- }
- //$str=$this->getUrl($_r);
- $str=$_r;
- $this->system->output($str);
- }
- function toLogin(){
- $loginToShopEx = $this->to_shopex_certificate('certi.login');
- $login_t = time();
- $this->system->setConf('certificate.login_t',$login_t,true);
- if($loginToShopEx['res'] == 'succ'){
- if( $loginToShopEx['info']['open'] != 'false' ){
- $str = $loginToShopEx['info']['service'][VERIFY_APP_ID]['cert_auth']['auth_strname'] . '[' . $loginToShopEx['info']['service'][VERIFY_APP_ID]['cert_auth']['auth_typename'] . ']';
- $license_info = array(
- 'certificate_id' => $this->getCerti(),
- 'token' => $this->getToken(),
- 'auth_str' => $loginToShopEx['info']['service'][VERIFY_APP_ID]['cert_auth']['auth_str'],
- 'auth_type' => $loginToShopEx['info']['service'][VERIFY_APP_ID]['cert_auth']['auth_type'],
- 'btime' => $loginToShopEx['info']['service'][VERIFY_APP_ID]['cert_auth']['service_time']['btime'],
- 'etime' => $loginToShopEx['info']['service'][VERIFY_APP_ID]['cert_auth']['service_time']['etime'],
- 'login_t' => $login_t,
- 'retry' => 0
- );
- }else{
- $license_info = array(
- 'certificate_id' => '',
- 'token' => '',
- 'auth_str' => '',
- 'auth_type' => '',
- 'btime' => '',
- 'etime' => '',
- 'login_t' => '',
- 'retry' => ''
- );
- $str = "[?????]";
- $this->setCerti("");
- $this->setToken("");
- $this->setNodeId("");
- }
- }else if($loginToShopEx['res'] == 'fail'){
- if( $loginToShopEx['msg'] == 'domain_error' ){
- $license_info = array(
- 'certificate_id' => '',
- 'token' => '',
- 'auth_str' => '',
- 'auth_type' => '',
- 'btime' => '',
- 'etime' => '',
- 'login_t' => '',
- 'retry' => ''
- );
- $str = "[?????]";
- $this->setCerti("");
- $this->setToken("");
- $this->setNodeId("");
- }else{
- $str = $loginToShopEx['info']['service'][VERIFY_APP_ID]['cert_auth']['auth_strname'] . '[' . $loginToShopEx['info']['service'][VERIFY_APP_ID]['cert_auth']['auth_typename'] . ']';
- $license_info = array(
- 'certificate_id' => $this->getCerti(),
- 'token' => $this->getToken(),
- 'auth_str' => 'free',
- 'auth_type' => 'no',
- 'btime' => NULL,
- 'etime' => NULL,
- 'login_t' => $login_t,
- 'retry' => 0
- );
- }
- }
- // else{
- // $str = "";
- // $license = $this->getLicenseFile();
- // $license_info = array(
- // 'certificate_id' => $license['certificate_id'],
- // 'token' => $license['token'],
- // 'auth_str' => $license['auth_str'],
- // 'auth_type' => $license['auth_type'],
- // 'btime' => $license['btime'],
- // 'etime' => $license['etime'],
- // 'login_t' => $login_t,
- // 'retry' => isset($license['retry'])?($license['retry']+1):1
- // );
- // }
- //??license????????????license????????????
- $this->setLicenseFile($license_info);
- return $str;
- }
- function toReg(){
- $regToShopEx = $this->to_shopex_certificate('certi.reg');
- if($regToShopEx['res'] == 'succ'){
-
- // $this->setCerti($regToShopEx['info']['certificate_id']);
- // $this->setToken($regToShopEx['info']['token']);
- // $this->setNodeId($regToShopEx['info']['node_id']);
- $_r=$this->toLogin();
- return $_r;
- }else{
- return $regToShopEx['info'];
- }
- }
- function getUrl($str){
- $this->certi_id= $this->getCerti();
- $sess_id =$this->get_sess();
- if(empty($this->certi_id)){
- $this->certi_id='error';
- }
- if(empty($sess_id)){
- $this->system->session->sess_id='error';
- }
- $confirmkey=$this->setEncode($sess_id,$this->certi_id);
- $url = '?sess_id='.urlencode($sess_id).'&certi_id='.urlencode($this->certi_id).'&version='.urlencode($this->getVersion()).'&confirmkey='.$confirmkey;
- $url = SERVICE_HOST.'/info.php'.$url.'&_key_=do';
- $prefix='<a href="'.$url.'" target="_blank" title="'.$this->certi_id.'">'.$str.'</a>';
- return $prefix;
- }
- function getVersion(){
- $version =$this->system->version();
- return $version['app'].'#'.$version['rev'];
- }
- /**
- * to send message to shopex log server
- */
- function sendmsg(){
- $data=$this->msg_pack();
- $date=$this->post_data($data);
- return true;
- }
-
- /**
- * ??license????
- * @param string $msg ????
- *
- * @return boolean true:????????????false:???????????
- */
- function checkLincense(&$msg){return true;
- $license_file = HOME_DIR . '/license';
- $time = time();
- $this->Certi = $this->getCerti();
- $this->Token = $this->getToken();
- $this->Noteid = $this->getNoteId();
- if(empty($this->Certi) || empty($this->Token) || empty($this->Noteid)){
- $this->delLicense();
- $this->toReg();
- $this->Certi = $this->getCerti();
- $this->Token = $this->getToken();
- $this->Noteid = $this->getNoteId();
- }
-
- if(empty($this->Certi) || empty($this->Token)){
- $msg = "???????????????!";
- return false;
- }
-
- if(!file_exists($license_file)){
- $this->toLogin(); //?????license??
- }
-
- $license = $this->getLicenseFile();
-
- //???????????
- $loginToShopEx = $this->to_shopex_certificate('certi.login');
- if($loginToShopEx['res'] == 'succ'){
- $auth_str = $loginToShopEx['info']['service'][VERIFY_APP_ID]['cert_auth']['auth_str'];
- $auth_type = $loginToShopEx['info']['service'][VERIFY_APP_ID]['cert_auth']['auth_type'];
- $btime = $loginToShopEx['info']['service'][VERIFY_APP_ID]['cert_auth']['service_time']['btime'];
- $etime = $loginToShopEx['info']['service'][VERIFY_APP_ID]['cert_auth']['service_time']['etime'];
- }else{
- $auth_str = NULL;
- $auth_type = NULL;
- $btime = NULL;
- $etime = NULL;
- }
-
- /*if(!empty($license) && is_array($license) && $license['login_t'] == $this->system->getConf('certificate.login_t')){*/
- if(!empty($license) && is_array($license)){ //??$license['login_t'] == $this->system->getConf('certificate.login_t')???getconf????
- //NOTICE:??license??????????retry?????license????????????????3?retry??????????????????????license?????????retry?1????????retry
-
- //?????license??????????
- if($loginToShopEx['res'] == 'succ'){
- if($auth_str == 'distribute'){
- if($time < $btime || $time > $etime){
- $msg = "??????????????????!";
- return false;
- }else{
- if($auth_type != 'no'){
- return true;
- }else{
- $msg = "???????????????!";
- return false;
- }
- }
- }else if($auth_str == 'free'){
- if($time < $btime || $time > $etime){
- $msg = "??????????????????!";
- }else{
- $msg = "???????????????!";
- }
- return false;
- }else{
- $msg = "???????????????!";
- return false;
- }
- }else if($loginToShopEx['res'] == 'fail'){
- $msg = "???????????????!";
- return false;
- }else{
- if($license['retry'] >= 3){
- $msg = "???????????????!";
- return false;
- }else{
- return true;
- }
- }
-
- }else{
- $msg = "??????!";
- return false;
- }
- }
-
- function checkIdentifier($certi_app,$account,$password,$version=NULL,$format=NULL,$isHash=false){
- $version = is_null($version)?'1.0':$version;
- $format = empty($format)?'json':$format;
-
- $post = array(
- 'certi_app' => $certi_app,
- 'identifier' => $account,
- 'password' => $isHash ? $password : md5($password.ACCOUNT_PASS_HASH),
- 'version' => $version,
- 'format' => $format
- );
- $post['certi_ac'] = $this->make_shopex_ac($post,ACCOUNT_TOKEN);
-
- return $this->read_shopex_accountserver($post);
- }
- /**
- * ?????license??
- *
- * @param array $license_info
- */
- function setLicenseFile($license_info){
- $license_file = HOME_DIR . '/license';
- include_once(CORE_DIR.'/lib/AES.php');
- $aes = new AES(true);// ?????????????????
- $key = STORE_KEY;// ??
- $keys = $aes->makeKey($key);
- $encode = serialize($license_info);
- $ct = $aes->encryptString($encode, $keys);
- file_put_contents($license_file,$ct);
- }
- /**
- * ?????license??
- *
- * @return array
- */
- function getLicenseFile(){
- $license_file = HOME_DIR . '/license';
- include_once(CORE_DIR.'/lib/AES.php');
- $aes = new AES(true);// ?????????????????
- $key = STORE_KEY;// ??
- $keys = $aes->makeKey($key);
- if(file_exists($license_file)){
- $license_info = file_get_contents($license_file);
- $license_info = $aes->decryptString($license_info, $keys);
- $license = unserialize($license_info);
- }else{
- $license = array();
- }
- return $license;
- }
-
- function setOmeNodeId($nodeid){
- $this->system->setConf('omeinfo.node_id',$nodeid,true);
- return $this->system->setConf('certificate.ome_node_id',$nodeid,true);
- }
-
- function getOmeNoteId(){
- if($this->system->getConf('certificate.ome_node_id')){
- return $this->system->getConf('certificate.ome_node_id');
- }elseif( $this->system->getConf('omeinfo.node_id') ){
- return $this->system->getConf('omeinfo.node_id');
- }else{
- return false;
- }
- }
-
- function set_taobao_login_status($status){
- $this->system->setConf('taobao.taobao_login_status',$status);
- }
- function get_taobao_login_status(){
- if($this->system->getConf('taobao.taobao_login_status')){
- return $this->system->getConf('taobao.taobao_login_status');
- }else{
- return false;
- }
- }
- }