...
|
...
|
@@ -51,6 +51,8 @@ class UnionTrans |
|
|
*/
|
|
|
public static function set($uid, $order_code, $order_amount)
|
|
|
{
|
|
|
$debug = false;
|
|
|
|
|
|
do {
|
|
|
/* 判断是否是友盟过来的用户 */
|
|
|
if (empty($_COOKIE['_QYH_UNION'])) {
|
...
|
...
|
@@ -63,7 +65,7 @@ class UnionTrans |
|
|
}
|
|
|
|
|
|
/* 解密客户端联盟信息 */
|
|
|
$unionKey = AuthCode::decode($_COOKIE['_QYH_UNION'], 'q_union_yohobuy');
|
|
|
$unionKey = AuthCode::decode($_COOKIE['_QYH_UNION'], 'q_union_yohobuy');
|
|
|
if (empty($unionKey)) {
|
|
|
break;
|
|
|
}
|
...
|
...
|
@@ -73,11 +75,14 @@ class UnionTrans |
|
|
if (empty($unionInfo['client_id'])) {
|
|
|
break;
|
|
|
}
|
|
|
if ($debug) {
|
|
|
var_dump('union info: ', $unionInfo);
|
|
|
}
|
|
|
|
|
|
/* 通过用户下单量判断新老客户 (有下单1, 没有0) */
|
|
|
$is_old_user = 0;
|
|
|
try {
|
|
|
$orderList = OrderData::getOrderData(1, 1, 10, '1,2,3', 1, $uid);
|
|
|
$orderList = OrderData::getOrderData(1, 1, 2, '1,2,3', 1, $uid);
|
|
|
if (!empty($orderList['data']['total']) && intval($orderList['data']['total']) > 1) {
|
|
|
$is_old_user = 1;
|
|
|
}
|
...
|
...
|
@@ -94,7 +99,7 @@ class UnionTrans |
|
|
|
|
|
/* 加入联盟订单库 */
|
|
|
$keyStr = 'client_id=' . $unionInfo['client_id'] . '&order_code=' . $order_code . '&orders_price=' . $order_amount . '&create_time=' . $create_times . '&channel_code=' . $channel_code . '&append=' . $append . '&mbr_name=' . $mbr_name . '&u_id=' . $u_id;
|
|
|
Yohobuy::get('http://union.yohobuy.com/order', array(
|
|
|
$result = Yohobuy::get('http://union.yohobuy.com/order', array(
|
|
|
'client_id' => $unionInfo['client_id'],
|
|
|
'order_code' => $order_code,
|
|
|
'orders_price' => $order_amount,
|
...
|
...
|
@@ -106,22 +111,28 @@ class UnionTrans |
|
|
'is_old_user' => $is_old_user,
|
|
|
'verify_code' => md5($keyStr)
|
|
|
));
|
|
|
if ($debug) {
|
|
|
var_dump('union:', $result, "++");
|
|
|
}
|
|
|
|
|
|
/* 通知新ERP (老的ERP http://192.168.200.102/CreateOrderUnion.aspx) */
|
|
|
Yohobuy::post('http://portal.admin.yohobuy.com/api/orderunion/updateunion', array(
|
|
|
$result = Yohobuy::post('http://portal.admin.yohobuy.com/api/orderunion/updateunion', array(
|
|
|
'data' => json_encode(array(
|
|
|
'order_code' => $order_code,
|
|
|
'unionid' => $unionInfo['client_id'],
|
|
|
'union_name' => isset(self::$unionNames[$clientId]) ? self::$unionNames[$clientId] : '',
|
|
|
))
|
|
|
));
|
|
|
if ($debug) {
|
|
|
var_dump('erp:', $result, '++');
|
|
|
}
|
|
|
|
|
|
/* 对接第三方联盟 */
|
|
|
|
|
|
// 亿起发
|
|
|
if ($unionInfo['client_id'] == 1001) {
|
|
|
$keyStr = 'client_id=' . $unionInfo['client_id'] . '&orders_id=' . $order_code . '&orders_price=' . $order_amount . '&create_time=' . $create_times . '&channel_code=' . $channel_code . '&append=' . $append . '&is_old_user=' . $is_old_user;
|
|
|
Yohobuy::get('http://o.yiqifa.com/adv/yoho.jsp', array(
|
|
|
$result = Yohobuy::get('http://o.yiqifa.com/adv/yoho.jsp', array(
|
|
|
'client_id' => $unionInfo['client_id'],
|
|
|
'orders_id' => $order_code,
|
|
|
'orders_price' => $order_amount,
|
...
|
...
|
@@ -131,13 +142,16 @@ class UnionTrans |
|
|
'is_old_user' => $is_old_user,
|
|
|
'verify_code' => md5($keyStr)
|
|
|
));
|
|
|
if ($debug) {
|
|
|
var_dump('yiqifa:', $result, '++');
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
// 亿起发wap
|
|
|
if ($unionInfo['client_id'] == 2995) {
|
|
|
$keyStr = 'client_id=' . $unionInfo['client_id'] . '&orders_id=' . $order_code . '&orders_price=' . $order_amount . '&create_time=' . $create_times . '&channel_code=' . $channel_code . '&append=' . $append . '&is_old_user=' . $is_old_user;
|
|
|
Yohobuy::get('http://o.yiqifa.com/adv/yoho.jsp', array(
|
|
|
$result = Yohobuy::get('http://o.yiqifa.com/adv/yoho.jsp', array(
|
|
|
'client_id' => $unionInfo['client_id'],
|
|
|
'orders_id' => $order_code,
|
|
|
'orders_price' => $order_amount,
|
...
|
...
|
@@ -148,6 +162,9 @@ class UnionTrans |
|
|
'dt' => 'm',
|
|
|
'verify_code' => md5($keyStr)
|
|
|
));
|
|
|
if ($debug) {
|
|
|
var_dump('yiqifa wap:', $result, '++');
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -158,10 +175,13 @@ class UnionTrans |
|
|
3057 => 'http://www.duomai.com/api/push/yohobuyroi.php',
|
|
|
);
|
|
|
if (array_key_exists($clientId, $clientUrls)) {
|
|
|
$urldata = self::getMaiDuoSplitData($order_code, $unionInfo['client_id'], $mbr_name);
|
|
|
Yohobuy::post($clientUrls[$clientId], array(
|
|
|
$urldata = self::getMaiDuoSplitData($order_code, $uid, $unionInfo['client_id'], $mbr_name, $is_old_user);
|
|
|
$result = Yohobuy::post($clientUrls[$clientId], array(
|
|
|
'content' => $urldata,
|
|
|
));
|
|
|
if ($debug) {
|
|
|
var_dump('duomai: ', $urldata, '++', $result);
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -169,11 +189,14 @@ class UnionTrans |
|
|
if ($unionInfo['client_id'] == 3001) {
|
|
|
$xmldata = self::getOrderXmlData($order_code, $uid, $unionInfo['client_id'], $u_id, $mbr_name, $channel_code);
|
|
|
$keyStr = 'content=' . $xmldata . '&shopid=690';
|
|
|
Yohobuy::post('http://union.fanli.com/dingdan/push?shopid=690', array(
|
|
|
$result = Yohobuy::post('http://union.fanli.com/dingdan/push?shopid=690', array(
|
|
|
'content' => $xmldata,
|
|
|
'shopid' => 690,
|
|
|
'verify_code' => md5($keyStr)
|
|
|
));
|
|
|
if ($debug) {
|
|
|
var_dump('fanli: ', $xmldata, '++', $result);
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -185,7 +208,7 @@ class UnionTrans |
|
|
3001 => 'http://union.fanli.com/dingdan/push?shopid=690',
|
|
|
);
|
|
|
if (array_key_exists($clientId, $clientUrls)) {
|
|
|
Yohobuy::post($clientUrls[$clientId], array(
|
|
|
$result = Yohobuy::post($clientUrls[$clientId], array(
|
|
|
'client_id' => $unionInfo['client_id'],
|
|
|
'order_id' => $order_code,
|
|
|
'create_time' => $create_times,
|
...
|
...
|
@@ -195,6 +218,9 @@ class UnionTrans |
|
|
'UID' => $u_id,
|
|
|
'is_old_user' => $is_old_user,
|
|
|
));
|
|
|
if ($debug) {
|
|
|
var_dump('other: ', $result);
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
} while (false);
|
...
|
...
|
@@ -215,18 +241,18 @@ class UnionTrans |
|
|
|
|
|
$orderDetail = $orderDetail['data'];
|
|
|
$amount = self::filterPrice($orderDetail['amount']) - self::filterPrice($orderDetail['shipping_cost']);
|
|
|
if (!empty($orderDetail['order_goods'])) {
|
|
|
if (empty($orderDetail['order_goods'])) {
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
$goodsAmount = $orderDetail['goods_total_amount'];
|
|
|
$goodsAmount = self::filterPrice($orderDetail['goods_total_amount']);
|
|
|
$goodsData = array();
|
|
|
|
|
|
|
|
|
foreach ($orderDetail['order_goods'] as $key => $val) {
|
|
|
$goodsData['goods' . $key] = array(
|
|
|
'pid' => $val['product_skn'],
|
|
|
'title' => $val['product_name'],
|
|
|
'category' => $val['color_name'],
|
|
|
'title' => '',//$val['product_name'],
|
|
|
'category' => '', //$val['color_name'],
|
|
|
'category_title' => '',
|
|
|
'url' => 'http://item.m.yohobuy.com/product/show_' . $val['product_skn'] . '.html',
|
|
|
'num' => $val['buy_number'],
|
...
|
...
|
@@ -251,7 +277,7 @@ class UnionTrans |
|
|
'locked' => '',
|
|
|
'lastmod' => '',
|
|
|
'is_newbuyer' => '',
|
|
|
'platform' => $client_type == 'h5' ? 2 : 1,
|
|
|
'platform' => ($client_type == 'h5') ? 2 : 1,
|
|
|
'code' => '',
|
|
|
'remark' => '',
|
|
|
'products' => $goodsData,
|
...
|
...
|
@@ -318,7 +344,7 @@ class UnionTrans |
|
|
'euid' => $mbr_name,
|
|
|
'order_sn' => $order_code,
|
|
|
'order_time' => date('Y-m-d H:i:s', $orderDetail['create_time']),
|
|
|
'orders_price' => sprintf('%.2f', $orderDetail['goods_total_amount']),
|
|
|
'orders_price' => sprintf('%.2f', self::filterPrice($orderDetail['goods_total_amount'])),
|
|
|
'promotion_code' => 0,
|
|
|
'is_new_custom' => $is_old_user ? 0 : 1,
|
|
|
'channel' => $channel,
|
...
|
...
|
|