在轮询系统如何将A站订单在B站自动建立,并调用B站产品
在使用轮询AB站跳转时会遇到提现时银行和商户提供商需要对对接的网站后台订单进行核验,
这个时候,我们就需要上面的功能了
如何在wp中建立订单,先用过系统调出订单信息,通过订单信息来建立订单,具体核心代码如下!
<?php
require($_SERVER['DOCUMENT_ROOT'].'/wp-config.php');
$plex = "wp_";
$parm = json_decode(file_get_contents("php://input"),true);
//$parm = json_decode('{"oid":"312","order_currceny":"USD","order_amount":"85.00","oadmin_id":"20","order_product":"[{\"name\":\"D??ANGELICO PREMIER TD TEARDROP ELECTRIC GUITAR W\\\/GIG BAG, TRANS WINE (Copy)\",\"model\":\"\",\"price\":\"1.00\",\"quantity\":1,\"option\":[],\"weight\":0,\"products_image\":\"http:\\\/\\\/woo.weituanlianmeng.top\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/0ffc4f6048dec92699b5c58077af9750.jpg\"}]","billing_first_name":"tese@qq.com","order_number":"D202211231554089039","id":"315","billing_last_name":"tese@qq.com","billing_address1":"tese@qq.com","billing_address2":"","billing_city":"tese@qq.com","billing_state":"AZ","billing_country":"US","billing_zip":"10001","billing_email":"tese@test.com","billing_phone":"12361564312","shipping_first_name":"tese@qq.com","shipping_last_name":"tese@qq.com","shipping_address1":"tese@qq.com","shipping_address2":null,"shipping_city":"tese@qq.com","shipping_state":"AZ","shipping_country":"US","shipping_zip":"10001","shipping_email":"tese@test.com","shipping_phone":"12361564312","order_id":"312","datetime":"2022-11-23 15:54:08","ip":"185.127.19.127","lan":"en-GB,en;q=0.9","user_agent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/93.0.4577.82 Safari\/537.36","admin_id":"20","domain_name":"woo.weituanlianmeng.top","payment_form_uri":"https:\/\/info.suuerca.xyz\/Isabella"}');
$parm =(Object)$parm;
//var_dump($parm);die;
//var_dump($file_get_contents("php://input"));die;
$pro = [];
if((int)$parm->order_amount<10){
$pro = ['pro'=>['id'=>73,'price'=>6.00]];
}
if((int)$parm->order_amount>=10 && (int)$parm->order_amount<20){
$pro = [['id'=>160,'price'=>10.75],['id'=>17,'price'=>12.70],['id'=>33,'price'=>15.80]];
}
if((int)$parm->order_amount>=20 && (int)$parm->order_amount<30){
$pro = [['id'=>104,'price'=>26.00],['id'=>137,'price'=>26.00],['id'=>41,'price'=>28.70]];
}
if((int)$parm->order_amount>=30 && (int)$parm->order_amount<40){
$pro = [['id'=>104,'price'=>26.00],['id'=>137,'price'=>26.00],['id'=>41,'price'=>28.70]];
}
if((int)$parm->order_amount>=30 && (int)$parm->order_amount<40){
$pro = [[['id'=>104,'price'=>26.00],['id'=>160,'price'=>10.75]],
[['id'=>137,'price'=>26.00],['id'=>160,'price'=>10.75]],
[['id'=>41,'price'=>28.70],['id'=>160,'price'=>10.75]],
['id'=>152,'price'=>35.00],
['id'=>87,'price'=>35.20],
];
}
if((int)$parm->order_amount>=40 && (int)$parm->order_amount<50){
$pro = [
[['id'=>87,'price'=>35.20],['id'=>160,'price'=>10.75]],
[['id'=>152,'price'=>35.00],['id'=>160,'price'=>10.75]],
];
}
if((int)$parm->order_amount>=50 && (int)$parm->order_amount<60){
$pro = [
[['id'=>87,'price'=>35.20],['id'=>104,'price'=>26.00]],
[['id'=>152,'price'=>35.00],['id'=>104,'price'=>26.00]],
[['id'=>87,'price'=>35.20],['id'=>41,'price'=>28.70]],
[['id'=>152,'price'=>35.00],['id'=>144,'price'=>27.30]],
];
}
if((int)$parm->order_amount>=60 && (int)$parm->order_amount<70){
$pro = [
[['id'=>87,'price'=>35.20],['id'=>152,'price'=>35.00]],
['id'=>95,'price'=>70.00],
];
}
if((int)$parm->order_amount>=70 && (int)$parm->order_amount<80){
$pro = [
[['id'=>95,'price'=>70.00],['id'=>160,'price'=>10.75]],
[['id'=>95,'price'=>70.00],['id'=>33,'price'=>15.80],],
];
}
if((int)$parm->order_amount>=80 && (int)$parm->order_amount<100){
$pro = [
[['id'=>95,'price'=>70.00],['id'=>41,'price'=>28.70]],
[['id'=>95,'price'=>70.00],['id'=>137,'price'=>26.00]],
[['id'=>95,'price'=>70.00],['id'=>144,'price'=>27.30]],
];
}
$pros = $pro[array_rand($pro)];
//var_dump($pros);die;
global $wpdb;
if($parm->order_status ==1){
$order_status = 'wc-processing';
}else{
$order_status = 'wc-cancelled';
}
//$sql = "select wp.id,wp.post_name,price,wp.post_content,wp.post_title from ".$plex."posts wp left join (select post_id,meta_value price from ".$plex."postmeta where meta_key = '_price' ) pr on pr.post_id =wp.id group by wp.post_parent limit 1";
//var_dump($sql);
//$res =$wpdb->get_row($wpdb->prepare($sql));
// var_dump($res);die;
//var_dump("insert into ".$plex."wc_customer_lookup( `first_name`, `last_name`, `email`, `date_last_active`, `date_registered`, `country`, `postcode`, `city`, `state`) VALUES ('".$parm->billing_first_name."','".$parm->billing_last_name."','".$parm->billing_email."','".date('Y-m-d H:i:s')."','".date('Y-m-d H:i:s')."','".$parm->billing_country."','".$parm->billing_zip."','".$parm->billing_city."','".$parm->billing_state."')");die;
$data = ['first_name'=>$parm->billing_first_name,
'last_name'=>$parm->billing_last_name,
'email'=>$parm->billing_email,
'date_last_active'=>date('Y-m-d H:i:s'),
'date_registered'=>date('Y-m-d H:i:s'),
'country'=>$parm->billing_country,
'postcode'=>$parm->billing_zip,
'city'=>$parm->billing_city,
'state'=>$parm->billing_state
];
$wpdb->insert($plex."wc_customer_lookup",$data);
$custom_id = $wpdb->insert_id;
$key = 'wc_order_'.uniqid();
$data = ['post_author'=>1,
'post_date'=>date('Y-m-d H:i:s'),
'post_date_gmt'=>date('Y-m-d H:i:s'),
'post_content'=>'',
'post_title'=>'Order '.date('Y-m-d H:i:s'),
'post_excerpt'=>'',
'post_status'=>$order_status,
'comment_status'=>'open',
'ping_status'=>'closed',
'post_password'=>$key,
'post_name'=>'order-'.date('Y-m-d-H-i-s'),
'to_ping'=>'',
'pinged'=>'',
'post_modified'=>date('Y-m-d H:i:s'),
'post_modified_gmt'=>date('Y-m-d H:i:s'),
'post_content_filtered'=>'',
'post_parent'=>0,
'guid'=>'',
'menu_order'=>0,
'post_type'=>'shop_order',
'post_mime_type'=>'',
'comment_count'=>1
];
$wpdb->insert($plex."posts",$data);
$order_id = $wpdb->insert_id;
$wpdb-> query("update ".$plex."post` set guid = 'https://".$_SERVER['HTTP_HOST']."/?post_type=shop_order&p=".$order_id."'");
//$pros = (object)$pros;
//if(empty($res)){
//$sql = "select wp.id,wp.post_name,price,wp.post_content,wp.post_title from ".$plex."posts wp left join (select post_id,meta_value price from ".$plex."postmeta where meta_key = '_price' ) pr on pr.post_id =wp.id where wp.post_type='product' and wp.create_order ='0' group by wp.post_parent limit 1";
//$res =$wpdb->get_row($wpdb->prepare($sql));
//$wpdb-> query("update ".$plex."postmeta set meta_value = '".$parm->order_amount."' where meta_key='_price' and post_id='".$res->id."'");
//$wpdb-> query("update ".$plex."posts set create_order = '1' where post_id='".$res->id."'");
//var_dump("update ".$plex."postmeta set meta_value = '".$parm->order_amount."' where meta_key='_price' and post_id='".$res->id."'");die;
//}
//var_dump(($pros));die;
if( count($pros)== count($pros,1)){
$sql = "select wp.id,wp.post_name,price,wp.post_content,wp.post_title from ".$plex."posts wp left join (select post_id,meta_value price from ".$plex."postmeta where meta_key = '_price' ) pr on pr.post_id =wp.id where wp.post_type='product' and wp.id ='".$pros['id']."' group by wp.post_parent limit 1"; //and wp.create_order ='0'
$res =$wpdb->get_row($wpdb->prepare($sql));
$pros = (object)$pros;
$data = ['order_item_name'=>$res->post_title,
'order_item_type'=>'line_item',
'order_id'=>$order_id,
];
$order_item =$wpdb->insert($plex."woocommerce_order_items",$data);
$order_item_id = $wpdb->insert_id;
$data = [ 'order_item_id'=>$order_item_id,
'order_id'=>$order_id,
'product_id'=>$pros->id,
'variation_id'=>0,
'customer_id'=>$custom_id,
'date_created'=>date('Y-m-d H:i:s'),
'product_qty'=>1,
'product_net_revenue'=>$pros->price,
'product_gross_revenue'=>$pros->price,
'coupon_amount'=>0,
'tax_amount'=>0,
'shipping_amount'=>2.50,
'shipping_tax_amount'=>0
];
$wpdb->insert($plex."wc_order_product_lookup",$data);
$data = serialize(['total'=>0,
'subtotal'=>0
]);
$sql = "insert into ".$plex."woocommerce_order_itemmeta(`order_item_id`,`meta_key`,`meta_value`) VALUES
('".$order_item_id."','_product_id','".$pros->id."'),
('".$order_item_id."','_variation_id',0),
('".$order_item_id."','_qty',1),
('".$order_item_id."','_tax_class',''),
('".$order_item_id."','_line_subtotal','".$pros->price."'),
('".$order_item_id."','_line_subtotal_tax','0'),
('".$order_item_id."','_line_total','".$pros->price."'),
('".$order_item_id."','_line_tax','0'),
('".$order_item_id."','_line_tax_data','".$data."')
";
$wpdb-> query($sql);
$amount = round($parm->order_amount - $pros->price,2);
}else{
foreach($pros as $key =>$value){
$sql = "select wp.id,wp.post_name,price,wp.post_content,wp.post_title from ".$plex."posts wp left join (select post_id,meta_value price from ".$plex."postmeta where meta_key = '_price' ) pr on pr.post_id =wp.id where wp.post_type='product' and wp.id ='".$value['id']."' group by wp.post_parent limit 1"; //and wp.create_order ='0'
$res =$wpdb->get_row($wpdb->prepare($sql));
$data = ['order_item_name'=>$res->post_title,
'order_item_type'=>'line_item',
'order_id'=>$order_id,
];
$order_item =$wpdb->insert($plex."woocommerce_order_items",$data);
$order_item_id = $wpdb->insert_id;
//var_dump($order_item_id);
$data = [ 'order_item_id'=>$order_item_id,
'order_id'=>$order_id,
'product_id'=>$value['id'],
'variation_id'=>0,
'customer_id'=>$custom_id,
'date_created'=>date('Y-m-d H:i:s'),
'product_qty'=>1,
'product_net_revenue'=>$value['price'],
'product_gross_revenue'=>$value['price'],
'coupon_amount'=>0,
'tax_amount'=>0,
'shipping_amount'=>0,
'shipping_tax_amount'=>0
];
$wpdb->insert($plex."wc_order_product_lookup",$data);
$data = serialize(['total'=>0,
'subtotal'=>0
]);
$sql = "insert into ".$plex."woocommerce_order_itemmeta(`order_item_id`,`meta_key`,`meta_value`) VALUES
('".$order_item_id."','_product_id','".$value['id']."'),
('".$order_item_id."','_variation_id',0),
('".$order_item_id."','_qty',1),
('".$order_item_id."','_tax_class',''),
('".$order_item_id."','_line_subtotal','".$value['price']."'),
('".$order_item_id."','_line_subtotal_tax','0'),
('".$order_item_id."','_line_total','".$value['price']."'),
('".$order_item_id."','_line_tax','0'),
('".$order_item_id."','_line_tax_data','".$data."')
";
$wpdb-> query($sql);
}
//$amount = round($parm->order_amount - $pros->price,2);
}
//$amount=0;
//$cart_discount = 0;
//$order_shipping =0;
//if($amount<0){
// $cart_discount = $amount;
//}
//if($amount>0){
// $order_shipping = $amount;
//}
$sql = "insert into ".$plex."postmeta(`post_id`,`meta_key`,`meta_value`) VALUES
('".$order_id."','_order_key','".$key."'),
('".$order_id."','_customer_user','0'),
('".$order_id."','_payment_method','niumu_paypal'),
('".$order_id."','_payment_method_title','Paypal'),
('".$order_id."','_customer_ip_address','".$parm->ip."'),
('".$order_id."','_customer_user_agent','".$parm->user_agent."'),
('".$order_id."','_created_via','checkout'),
('".$order_id."','_cart_hash','".md5(date('Y-m-d H:i:s'))."'),
('".$order_id."','_billing_first_name','".$parm->billing_first_name."'),
('".$order_id."','_billing_last_name','".$parm->billing_last_name."'),
('".$order_id."','_billing_company',''),
('".$order_id."','_billing_address_1','".$parm->billing_address1."'),
('".$order_id."','_billing_address_2','".$parm->billing_address2."'),
('".$order_id."','_billing_city','".$parm->billing_city."'),
('".$order_id."','_billing_state','".$parm->billing_state."'),
('".$order_id."','_billing_postcod','".$parm->billing_zip."'),
('".$order_id."','_billing_country','".$parm->billing_country."'),
('".$order_id."','_billing_email','".$parm->billing_email."'),
('".$order_id."','_billing_phone','".$parm->billing_phone."'),
('".$order_id."','_order_currency','".$parm->order_currceny."'),
('".$order_id."','_cart_discount','0'),
('".$order_id."','_cart_discount_tax','0'),
('".$order_id."','_order_shipping','0'),
('".$order_id."','_order_shipping_tax','0'),
('".$order_id."','_order_tax','0'),
('".$order_id."','_order_total','".$parm->order_amount."'),
('".$order_id."','_order_version','6.7.0'),
('".$order_id."','_prices_include_tax','no'),
('".$order_id."','_billing_address_index','".$parm->billing_first_name.' '.$parm->billing_last_name.' '.$parm->billing_address1.' '.$parm->billing_address2.' '.$parm->billing_city.' '.$parm->billing_state.' '.$parm->billing_country.' '.$parm->billing_zip.' '.$parm->billing_email.' '.$parm->billing_phone."'),
('".$order_id."','_shipping_address_index',''),
('".$order_id."','is_vat_exempt','no')
";
//var_dump($sql);
$wpdb-> query($sql);
echo 'ok';
在轮询系统如何将A站订单在B站自动建立,并调用B站产品相关推荐
- paypal/stripe轮询系统中ab跳转能否被识别?
经过10来年疯狂野蛮式的拓荒,发展到现在应该算是快"城镇化",各种收款平台,建站平台该倒闭的倒闭,该合作的合作,各种跟外贸有关的渠道也机制建全,所以对于中小卖家来说步履维艰,新手想 ...
- 在Zephyr RTOS上实现一个轮询系统
近日在设计一个服务系统,使用的是RTOS,因为是实时操作系统,所以有时候需要进行切片,需要跑不同的任务,所以需要让它多线程起来,这里是我实现的一些思路,分享给大家,在实时RTOS上如何设计一款轮询系统 ...
- 单片机开发-软件架构与系统设计(工程实现使用的也是轮询系统、前后台系统和多任务系统)
目录 单片机开发1 轮询系统: 概述 详述 前后台系统 概述 详述 单片机开发1 单片机开发可以分为程序裸跑与多任务. 在单片机的工程使用中,可以分为裸机系统和多任务系统. 裸机系统一般被叫做裸跑,大 ...
- 适合单片机使用的一个短小精悍的时间片轮询系统
随着单片机外设的日益丰富,以及RAM,ROM的增大.RTOS实时操作系统被越来越广泛的使用.实时操作系统对任务的实时性高效处理是毋容置疑的! 但是有更多的情况我们仅仅需要一个短小精悍的轮询系统,比如实 ...
- ueeshop 如何对接IMPAY PayPal stripe 轮询系统?
ueeshop 如何对接IMPAY PayPal stripe 轮询系统? 1.如图:点击设置选项,进图收款选项 2.如图,点击自定义付款 3.如图写入下面信息 这样,只要在系统后台配置好账号,就可以 ...
- 嵌入式操作系统专题《基础概念1@轮询系统、前后台系统、多任务系统的区别》
轮询系统:即在裸机编程时,先初始化相关硬件,让主程序在一个死循环里面不断循环,顺序地处理各种事件.不能说轮询是低端的,轮询系统是一种非常简单的软件结构,但适用于仅需要顺序执行代码且不需要外部事件来驱动 ...
- paypal轮询系统如何降低风控提高收款率
众所周知,paypal的风控越来越紧,接1单就死的paypal很正常,批量死号的也很正常. 轮询给出多种支付模式,建议不要一种提交模式一直用,这样很可能被paypal发现异常,我们可以将paypal使 ...
- UeeShop 如何对接轮询系统
很多人使用UeeShop系统,但是Ueeshop系统不支持轮询,下面,我们将介绍如何用UeeShop对接IMPAY 添加好即可
- 什么情况需要使用Stripe/PayPal轮询系统
1.没有自己的商业外贸网站,但拥有较多的PayPal和Stripe资源的外贸从业人员,想通过收单赚取差价 2.希望控制收款的,比如通过金额,单数,货币,国家等来控制账户收款 3.实时监控收款账户状态的 ...
最新文章
- Android网络编程系列 一 Socket抽象层
- Ubuntu13.04 下源码安装Rapidsvn
- 政企应用如何构筑安全合规的互联内容分发加速?
- 形象的解释神经网络激活函数的作用是什么
- 信息学奥赛一本通C++语言——1125:矩阵乘法
- swift获取图片像素颜色值
- python之 turtle好例子集锦
- uniapp怎么使用阿里矢量图标,阿里矢量图标下载,阿里矢量图标应用,改变iconfont,uniapp 引用阿里矢量图标
- SOME/IP与DDS对比及DDS测试策略和方案探讨
- 文化财经SAR指标计算(一)
- 牛客网--14405--齐齐录成绩
- 树莓派4B:智能植物管家
- OpenStack安装部署报错记录,Error processing default value xxx for Opt type of HostAddress
- 给一个长度为n的字符串,找出长度为m的最小字典子序列【单调栈】
- 移动宽带连接电信服务器不稳定,移动宽带速度为啥与电信差距那么大?工信部官宣告诉你...
- 【下载Tomcat旧版本】
- NIB 和 XIB 的区别 转载
- 赛尔号桌面版_4399赛尔号官方版下载-4399赛尔号经典版电脑版 - 极光下载站
- 幂函数 、 指数 、 对数 、底数
- 《Java编程思想》读书笔记之第7章-复用类