搜尋
首頁php教程php手册ECSHOP 支付宝无商家支付

此功能用于ECSHOP无支付宝商家账号支付、并实现支付结果回写ECSHOP。此功能的目的是让那些无法申请支付宝商家支付接口的用户,可以通过支付宝进行收款,从而绕过支付宝商家认证。功能特点如下,1、抓取远程邮箱的支付宝交易记录。2、提取支付宝交易记录中的交

此功能用于ECSHOP无支付宝商家账号支付、并实现支付结果回写ECSHOP。此功能的目的是让那些无法申请支付宝商家支付接口的用户,可以通过支付宝进行收款,从而绕过支付宝商家认证。功能特点如下,1、抓取远程邮箱的支付宝交易记录。2、提取支付宝交易记录中的交易信息。3、将此交易信息匹配ECSHOP数据库中已存在订单,若匹配成功则直接修改订单状态、并且更新账户余额状态。最终完成无支付宝商家支付。
卓流应用网(http://360cd.cn/) 专业的ECMALL、ECSHOP二次开发及服务
<?php
header("Content-type:text/html;charset=utf-8");
//error_reporting(0);
define('IN_ECS', true);

require(dirname(dirname(__FILE__)) . '/includes/init.php');
//require(dirname(dirname(__FILE__)) . '/includes/lib_common.php');
global $db,$ecs;

include("mail.php");
include(ROOT_PATH."data/zconfig.php");

$user=$recive_info['email'];
$pwd=$recive_info['pwd'];
$pop=$recive_info['host'];
$port=$recive_info['port'];

$obj = new receiveMail($user,$pwd,$user,$pop,'pop3',$port,false);
$obj->connect();         //If connection fails give error message and exit
$tot = $obj->getTotalMails(); //Total Mails in Inbox Return integer value
$mail_list=array();
for($i=$tot;$i>0;$i--)
{

	    $head=$obj->getHeaders($i);  
		if($head['from']=='service@mail.alipay.com' )
		{
		  $mail_list[]= getInfo($obj->getBody($i));  
		}
	
}
$obj->close_mailbox();   
$result= updateOrder($mail_list);
if($result)
{
echo "<a href='/mail/index.php?order=".$_GET['order']."'>支付未完成点此查看</a>";
}else{
echo "<a href='/user.php'>支付成功点此跳转</a>";
}

function updateOrder($mail_list)
{
  global $db,$ecs;
  if(is_array($mail_list) && count($mail_list))
  {
    foreach($mail_list as $mail)
	{
	 if(!empty($mail['order']) && !empty($mail['price']))
	 {
	    $order=str_replace(":",'',$mail['order']);
		
	    $account = array();
        $account = $db->getRow("SELECT * FROM " .$ecs->table('user_account'). " WHERE out_sn = '".trim($order)."'");
		if(is_array($account) && count($account))
		{
		  $price=str_replace("元",'',$mail['price']);
		   $price=str_replace(":",'',$price);
		  if(floatval($price)==floatval($account['amount']) && $account['is_paid']==0 )
		  {
		    update_user_account($account['id'], $account['amount'], '系统自动充值', 1);
		    log_account_change($account['user_id'], $account['amount'], 0, 0, 0, $_LANG['surplus_type_1'], ACT_DRAWING);
             return 1;
		  }else{
		    return 0;
		  }
		}else{
		  return 0;
		}	
		
	 }	
	}
	
  }
  return 0;
 
}



function update_user_account($id, $amount, $admin_note, $is_paid)
{
    $sql = "UPDATE " .$GLOBALS['ecs']->table('user_account'). " SET ".
           "admin_user  = '$_SESSION[admin_name]', ".
           "amount      = '$amount', ".
           "paid_time   = '".gmtime()."', ".
           "admin_note  = '$admin_note', ".
           "is_paid     = '$is_paid' WHERE id = '$id'";
    return $GLOBALS['db']->query($sql);
}

function getInfo($content)
{
       $content=strip_tags($content);
		$name_start=stripos($content,'商品名称');		
		$name_end=stripos($content,'交易对方');		
		$price_start=stripos($content,'购买总价');		
		$price_end=stripos($content,'卖家折扣');
		if($name_start && $name_end && $price_end && $price_start)
		{
		   $name_len=$name_end-($name_start+12);
		   $price_len=$price_end-($price_start+12);
		
			$name=substr($content,$name_start+12,$name_len);
			$price=substr($content,$price_start+12,$price_len);
		}

	return array('order'=>$name,'price'=>$price);

}
?>
陳述
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

AI Hentai Generator

AI Hentai Generator

免費產生 AI 無盡。

熱門文章

R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
4 週前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.最佳圖形設置
4 週前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.如果您聽不到任何人,如何修復音頻
1 個月前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.聊天命令以及如何使用它們
1 個月前By尊渡假赌尊渡假赌尊渡假赌

熱工具

WebStorm Mac版

WebStorm Mac版

好用的JavaScript開發工具

EditPlus 中文破解版

EditPlus 中文破解版

體積小,語法高亮,不支援程式碼提示功能

Dreamweaver Mac版

Dreamweaver Mac版

視覺化網頁開發工具

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

將Eclipse與SAP NetWeaver應用伺服器整合。