Exemplo n.º 1
0
 /**
  * 退款单发送矩阵请求
  * @param array 数组值
  * @return null
  */
 public function send_request(&$sdf)
 {
     $obj_members = $this->app->model('members');
     $arrPams = $obj_members->dump($sdf['member_id'], '*', array(':account@pam' => array('*')));
     $arr_data = array();
     $arr_data['tid'] = $sdf['order_id'];
     $arr_data['refund_id'] = $sdf['refund_id'];
     $arr_data['buyer_bank'] = $sdf['bank'];
     $arr_data['buyer_account'] = $sdf['account'];
     $arr_data['buyer_name'] = $arrPams['pam_account']['login_name'];
     $arr_data['refund_fee'] = $sdf['money'];
     $arr_data['currency'] = $sdf['currency'];
     $arr_data['currency_fee'] = $sdf['cur_money'];
     $arr_data['pay_type'] = $sdf['pay_type'];
     $arr_data['payway_name'] = $sdf['pay_name'];
     $arr_data['seller_account'] = $sdf['pay_account'];
     $arr_data['t_ready'] = date('Y-m-d H:i:s', $sdf['t_begin']);
     $arr_data['t_sent'] = date('Y-m-d H:i:s', $sdf['t_payed']);
     $arr_data['t_received'] = date('Y-m-d H:i:s', $sdf['t_confirm']);
     $arr_data['status'] = $sdf['status'] == 'succ' ? 'SUCC' : 'PROGRESS';
     $arr_data['memo'] = $sdf['memo'];
     $arr_data['outer_no'] = $sdf['trade_no'];
     $arr_callback = array('class' => 'b2c_api_callback_app', 'method' => 'callback', 'params' => array('method' => 'store.trade.refund.add', 'tid' => $arr_data['tid']));
     //$rst = $this->app->matrix()->call('store.trade.refund.add', $arr_data);
     parent::request('store.trade.refund.add', $arr_data, $arr_callback, 'Order Refund', 1);
 }
Exemplo n.º 2
0
 /**
  * 和中心交互
  *
  * @param int $member_id
  * @param string $method
  * @param array $arr_callback
  * @param string $title
  * @return void
  */
 public function member_rpc_request($member_id, $method, $arr_callback, $title)
 {
     $obj_member = $this->app->model('members');
     $member_sdf = $obj_member->dump($member_id, "*", array(':account@pam' => array('*'), ':member_lv' => '*'));
     $sex = $member_sdf['profile']['gender'];
     $sex = $sex == 'male' ? '1' : ($sex == 'female' ? '2' : '');
     $status = '';
     if ($member_sdf['state'] == '1') {
         $status = 'inactive';
     } elseif ($member_sdf['disabled'] == 'true') {
         $status = 'reeze';
     } else {
         $status = 'normal';
     }
     $area = $member_sdf['contact']['area'];
     $area_array = array();
     if ($area != '') {
         $area = explode(':', $area);
         if (isset($area[2]) && is_numeric($area[2])) {
             $area_array = explode('/', $area[1]);
         } else {
             $area_array = array($member_sdf['contact']['area']);
         }
     }
     $arr_data = array('userid' => $member_sdf['pam_account']['account_id'], 'uid' => $member_sdf['pam_account']['login_name'], 'nick_name' => $member_sdf['contact']['name'], 'sex' => $sex, 'buyer_credit' => '', 'seller_credit' => '', 'location' => json_encode(array('zip' => $member_sdf['contact']['zipcode'], 'address' => $member_sdf['contact']['addr'], 'city' => $area_array[1], 'state' => $area_array[0], 'county' => '', 'district' => $area_array[2])), 'created' => date('Y-m-d H:i:s', $member_sdf['regtime']), 'last_visit' => '', 'birthday' => $member_sdf['profile']['birthday'], 'promoted_type' => '', 'status' => $status, 'alipay_bind' => '', 'consumer_protection' => '', 'alipay_account' => '', 'alipay_no' => '', 'vip_info' => $member_sdf['member_lv']['name'], 'email' => $member_sdf['contact']['email'], 'marital' => '', 'mobile' => $member_sdf['contact']['phone']['mobile'], 'age' => '');
     // 回朔和请求
     parent::request($method, $arr_data, $arr_callback, $title, 1);
     return true;
 }
Exemplo n.º 3
0
 /**
  * 订单创建
  * @param array sdf
  * @return boolean success or failure
  */
 protected function request(&$sdf)
 {
     $arr_data['tid'] = $sdf['order_id'];
     $arr_data['status'] = 'TRADE_FINISHED';
     $arr_callback = array('class' => 'b2c_api_callback_app', 'method' => 'callback', 'params' => array('method' => 'store.trade.status.update', 'tid' => $arr_data['tid']));
     // 回朔待续...
     //$rst = $this->app->matrix()->call('store.trade.status.update', $arr_data);
     parent::request('store.trade.status.update', $arr_data, $arr_callback, 'Order Finish', 1);
     return true;
 }
Exemplo n.º 4
0
 /**
  * 订单取消事件埋点
  * @param array sdf
  * @param string method
  * @return boolean success or failure
  */
 protected function request(&$sdf, $method)
 {
     // 回朔待续...
     $arr_data['tid'] = $sdf['orderid'];
     $arr_data['flag'] = $this->arr_market_type[$sdf['mark_type']];
     $arr_data['memo'] = array('op_name' => $sdf['op_name'], 'op_time' => date('Y-m-d H:i:s'), 'op_content' => $sdf['mark_text']);
     $arr_data['memo'] = json_encode($arr_data['memo']);
     $arr_callback = array('class' => 'b2c_api_callback_app', 'method' => 'callback', 'params' => array('method' => $method, 'tid' => $sdf['orderid']));
     //$rst = $this->app->matrix()->set_callback('b2c_api_callback_app','callback',array('method'=>$method))->call($method, $arr_data);
     parent::request($method, $arr_data, $arr_callback, 'Order Remark', 1);
     return true;
 }
Exemplo n.º 5
0
 /**
  * 订单取消事件埋点
  * @param array sdf
  * @return boolean success or failure
  */
 protected function request(&$sdf)
 {
     // 回朔待续...
     $arr_data['tid'] = $sdf['msg']['orderid'];
     $arr_data['message'] = array('op_name' => $sdf['author'], 'op_time' => date('Y-m-d H:i:s'), 'op_content' => $sdf['msg']['message']);
     $arr_data['message'] = json_encode($arr_data['message']);
     $arr_callback = array('class' => 'b2c_api_callback_app', 'method' => 'callback', 'params' => array('method' => 'store.trade.buyer_message.add', 'tid' => $arr_data['tid']));
     // 待续...
     //$rst = $this->app->matrix()->call('store.trade.buyer_message.add', $arr_data);
     parent::request('store.trade.buyer_message.add', $arr_data, $arr_callback, 'Order Message', 1);
     return true;
 }
Exemplo n.º 6
0
 /**
  * ¶©µ¥Ö§¸¶
  * @param array sdf
  * @return boolean success or failure
  */
 protected function request(&$sdf)
 {
     $payments_status = array('succ' => 'SUCC', 'failed' => 'FAILED', 'cancel' => 'CANCEL', 'error' => 'ERROR', 'invalid' => 'INVALID', 'progress' => 'PROGRESS', 'timeout' => 'TIMEOUT', 'ready' => 'READY');
     $arr_data = array();
     $arr_data['tid'] = $sdf['order_id'];
     $arr_data['payment_id'] = $sdf['payment_id'];
     $arr_data['seller_bank'] = $sdf['bank'];
     $arr_data['seller_account'] = $sdf['account'];
     $arr_data['buyer_account'] = $sdf['pay_account'];
     $arr_data['currency'] = $sdf['currency'];
     $arr_data['pay_fee'] = $sdf['money'];
     $arr_data['paycost'] = $sdf['paycost'];
     $arr_data['currency_fee'] = $sdf['cur_money'];
     $arr_data['pay_type'] = $sdf['pay_app_id'] == 'deposit' ? 'deposit' : $sdf['pay_type'];
     $arr_data['payment_type'] = $sdf['pay_name'];
     $arr_data['payment_tid'] = $sdf['pay_app_id'];
     $arr_data['t_begin'] = date('Y-m-d H:i:s', $sdf['t_begin']);
     $arr_data['t_end'] = date('Y-m-d H:i:s', $sdf['t_payed']);
     $arr_data['status'] = $payments_status[$sdf['status']];
     $arr_data['memo'] = $sdf['memo'];
     $arr_data['outer_no'] = $sdf['trade_no'];
     $arr_callback = array('class' => 'b2c_api_callback_app', 'method' => 'callback', 'params' => array('method' => 'store.trade.payment.add', 'tid' => $arr_data['tid']));
     parent::request('store.trade.payment.add', $arr_data, $arr_callback, 'Payment Add', 1);
 }
Exemplo n.º 7
0
 /**
  * 订单取消事件埋点
  * @param array sdf
  * @return boolean success or failure
  */
 protected function request(&$sdf, $method = '')
 {
     $arr_data = array();
     $arr_data['tid'] = $sdf['order_id'];
     $arr_data['aftersale_id'] = $sdf['return_id'];
     if ($sdf['title']) {
         $arr_data['title'] = $sdf['title'];
     }
     if ($sdf['content']) {
         $arr_data['content'] = $sdf['content'];
     }
     $arr_data['messager'] = '';
     if ($sdf['add_time']) {
         $arr_data['created'] = date('Y-m-d H:i:s', $sdf['add_time']);
     }
     if ($sdf['comment']) {
         $arr_data['memo'] = $sdf['comment'] ? $sdf['comment'] : '';
     }
     if ($sdf['status']) {
         $arr_data['status'] = $sdf['status'];
     }
     if ($sdf['member_id']) {
         $arr_data['buyer_id'] = $sdf['member_id'];
     }
     if ($sdf['product_data']) {
         $arr_product_data = unserialize($sdf['product_data']);
     }
     if (isset($arr_product_data) && $arr_product_data) {
         foreach ($arr_product_data as $key => &$items) {
             $arr_product_data[$key]['sku_bn'] = $items['bn'];
             unset($items['bn']);
             $arr_product_data[$key]['sku_name'] = $items['name'];
             unset($items['name']);
             $arr_product_data[$key]['number'] = $items['num'];
             unset($items['num']);
         }
         $arr_data['aftersale_items'] = json_encode($arr_product_data);
     } else {
         $arr_data['aftersale_items'] = "";
     }
     $arr_callback = array('class' => 'b2c_api_callback_app', 'method' => 'callback', 'params' => array('method' => !$method ? 'store.trade.aftersale.add' : $method, 'tid' => $arr_data['tid']));
     if (!$method) {
         //$rst = $this->b2c_app->matrix()->call('store.trade.remarket.add', $arr_data);
         parent::request('store.trade.aftersale.add', $arr_data, $arr_callback, 'Aftersales add', 1);
     } else {
         //$rst = $this->b2c_app->matrix()->call($method, $arr_data);
         parent::request($method, $arr_data, $arr_callback, 'Aftersales update', 1);
     }
 }
Exemplo n.º 8
0
 /**
  * ¶©µ¥´´½¨
  * @param array sdf
  * @return boolean success or failure
  */
 protected function request($sdf, $params = array(), $callback = array(), $title = '', $time_out = 1, $rpc_id = null)
 {
     $obj_math = kernel::single('ectools_math');
     /**
      * Ö§¸¶×´Ì¬Êý×é
      */
     $arr_pay_status = array('0' => 'PAY_NO', '1' => 'PAY_FINISH', '2' => 'PAY_TO_MEDIUM', '3' => 'PAY_PART', '4' => 'REFUND_PART', '5' => 'REFUND_ALL');
     $arr_data['tid'] = $sdf['order_id'];
     $arr_data['title'] = 'Order Create';
     $arr_data['created'] = date('Y-m-d H:i:s', $sdf['createtime']);
     $arr_data['modified'] = date('Y-m-d H:i:s', $sdf['last_modified']);
     $arr_data['status'] = $sdf['status'] == 'active' ? 'TRADE_ACTIVE' : 'TRADE_CLOSED';
     $arr_data['pay_status'] = $sdf['pay_status'] == '0' || !$sdf['pay_status'] ? 'PAY_NO' : $arr_pay_status[$sdf['pay_status']];
     $arr_data['ship_status'] = $sdf['ship_status'] == '0' || !$sdf['ship_status'] ? 'SHIP_NO' : 'SHIP_FINISH';
     $arr_data['has_invoice'] = $sdf['is_tax'] == 'true' || $sdf['is_tax'] === true ? true : false;
     $arr_data['invoice_title'] = $sdf['tax_title'] ? $sdf['tax_title'] : '';
     $arr_data['invoice_fee'] = $sdf['cost_tax'];
     //发票内容
     $arr_data['tax_type'] = $sdf['tax_type'];
     $arr_data['tax_content'] = $sdf['tax_content'] ? $sdf['tax_content'] : '';
     $arr_data['total_goods_fee'] = $obj_math->number_plus(array($sdf['cost_item'], $sdf['pmt_goods']));
     $arr_data['total_trade_fee'] = $sdf['total_amount'];
     $arr_data['discount_fee'] = $sdf['discount'];
     $arr_data['goods_discount_fee'] = $sdf['pmt_goods'];
     $arr_data['orders_discount_fee'] = $sdf['pmt_order'];
     $arr_promotion_details = array();
     if ($sdf['order_pmt']) {
         foreach ($sdf['order_pmt'] as $arr_order_pmt) {
             $arr_promotion_details[] = array('promotion_name' => $arr_order_pmt['pmt_describe'], 'promotion_fee' => $arr_order_pmt['pmt_amount']);
         }
     }
     if ($sdf['addon']) {
         if ($sdf['addon']['order_chgpointmoney'] > 0) {
             $arr_data['goods_discount_fee'] = $obj_math->number_plus(array($arr_data['goods_discount_fee'], $sdf['addon']['order_chgpointmoney']));
             $arr_promotion_details[] = array('promotion_name' => app::get('b2c')->_('¶©µ¥»ý·ÖÕÛ¿ÛÓÅ»Ý'), 'promotion_fee' => $sdf['addon']['order_chgpointmoney']);
         }
     }
     if ($arr_promotion_details) {
         $arr_data['promotion_details'] = json_encode($arr_promotion_details);
     }
     $arr_data['payed_fee'] = $sdf['payed'];
     $arr_data['currency'] = $sdf['currency'];
     $arr_data['currency_rate'] = $sdf['cur_rate'];
     $arr_data['total_currency_fee'] = $sdf['cur_amount'];
     $arr_data['buyer_obtain_point_fee'] = $sdf['score_g'];
     $arr_data['point_fee'] = $sdf['score_u'];
     $arr_data['total_weight'] = $sdf['weight'];
     $arr_data['receiver_time'] = $sdf['consignee']['r_time'] ? $sdf['consignee']['r_time'] : '';
     $arr_data['shipping_tid'] = $sdf['shipping']['shipping_id'];
     $arr_data['shipping_type'] = $sdf['shipping']['shipping_name'];
     $arr_data['shipping_fee'] = $sdf['shipping']['cost_shipping'];
     $arr_data['is_protect'] = $sdf['shipping']['is_protect'];
     $arr_data['protect_fee'] = $sdf['shipping']['cost_protect'];
     $opayment = app::get('ectools')->model('payment_cfgs');
     $arr_payment = $opayment->getPaymentInfo($sdf['payinfo']['pay_app_id']);
     $arr_data['payment_tid'] = $arr_payment['app_rpc_id'];
     $arr_data['payment_type'] = $arr_payment['app_display_name'];
     //$arr_data['is_cod'] = $sdf['payinfo']['pay_app_id'] == '-1' ? 'true' : 'false';
     $arr_data['is_cod'] = $arr_payment['is_cod'];
     //支付方式支持是否“货到付款”
     $arr_data['receiver_name'] = $sdf['consignee']['name'];
     $arr_data['receiver_email'] = $sdf['consignee']['email'] ? $sdf['consignee']['email'] : '';
     $arr_data['receiver_mobile'] = $sdf['consignee']['mobile'];
     $arr_states = explode(':', $sdf['consignee']['area']);
     $str_states = $arr_states[1];
     $arr_states = explode('/', $str_states);
     $arr_data['receiver_state'] = trim($arr_states[0]);
     $arr_data['receiver_city'] = trim($arr_states[1]);
     $arr_data['receiver_district'] = trim($arr_states[2]) . (isset($arr_states[3]) ? '/' . trim($arr_states[3]) : "") . (isset($arr_states[4]) ? '/' . trim($arr_states[4]) : "");
     $arr_data['receiver_community'] = isset($arr_states[3]) ? trim($arr_states[3]) : "";
     $arr_data['receiver_address'] = $sdf['consignee']['addr'];
     $arr_data['receiver_zip'] = $sdf['consignee']['zip'] ? $sdf['consignee']['zip'] : '';
     $arr_data['receiver_phone'] = $sdf['consignee']['telephone'] ? $sdf['consignee']['telephone'] : '';
     $arr_data['pay_cost'] = $sdf['payinfo']['cost_payment'];
     $arr_data['buyer_memo'] = $sdf['memo'] ? $sdf['memo'] : '';
     $arr_data['orders_number'] = 1;
     $arr_data['is_auto_complete'] = $sdf['is_auto_complete'];
     $arr_data['branch_id'] = isset($sdf['branch_id']) ? intval($sdf['branch_id']) : 0;
     $arr_data['branch_name_user'] = isset($sdf['branch_name_user']) ? trim($sdf['branch_name_user']) : "";
     // 取到用户信息
     if ($sdf['member_id']) {
         $col_arr = array('members' => 'name,zip,addr,area,tel', 'account' => 'login_account');
         $aMember = kernel::single('b2c_user_object')->get_members_data($col_arr, $sdf['member_id']);
         $arr_data['buyer_uname'] = $aMember['account']['local'];
         $arr_data['buyer_name'] = $aMember['members']['name'] ? $aMember['members']['name'] : '';
         if ($aMember['members']['area'] && strpos($aMember['members']['area'], ':') !== false) {
             $arr_area = explode(':', $aMember['members']['area']);
             $arr_district = explode('/', $arr_area[1]);
             $arr_data['buyer_state'] = $arr_district[0];
             $arr_data['buyer_city'] = $arr_district[1];
             $arr_data['buyer_district'] = $arr_district[2];
         }
         $arr_data['buyer_address'] = $aMember['members']['addr'];
         $arr_data['buyer_mobile'] = $aMember['account']['mobile'] ? $aMember['account']['mobile'] : '';
         $arr_data['buyer_phone'] = $aMember['members']['tel'] ? $aMember['members']['tel'] : '';
         $arr_data['buyer_email'] = $aMember['account']['email'];
         $arr_data['buyer_zip'] = $aMember['members']['zip'];
     } else {
         $arr_data['buyer_uname'] = '';
         $arr_data['buyer_name'] = '';
         $arr_data['buyer_state'] = '';
         $arr_data['buyer_city'] = '';
         $arr_data['buyer_district'] = '';
         $arr_data['buyer_address'] = '';
         $arr_data['buyer_mobile'] = '';
         $arr_data['buyer_phone'] = '';
         $arr_data['buyer_email'] = '';
         $arr_data['buyer_zip'] = '';
     }
     $index = 0;
     foreach ($sdf['order_objects'] as $odr_obj) {
         $arr_data['orders']['order'][$index] = array('oid' => $odr_obj['obj_id'], 'orders_bn' => $odr_obj['bn'], 'type' => $odr_obj['obj_type'] == 'goods' ? 'goods' : $odr_obj['obj_type'], 'type_alias' => $odr_obj['obj_alias'], 'iid' => $odr_obj['obj_id'], 'title' => $odr_obj['name'], 'items_num' => intval($odr_obj['quantity']), 'order_status' => 'SHIP_NO', 'price' => $odr_obj['price'], 'total_order_fee' => $obj_math->number_multiple(array($odr_obj['price'], $odr_obj['quantity'])), 'discount_fee' => 0, 'consign_time' => '', 'order_items' => array('item' => array()), 'weight' => $odr_obj['weight']);
         foreach ($odr_obj['order_items'] as $odr_item) {
             $arr_addon = array();
             $str_property = "";
             if ($odr_item['addon']) {
                 $arr_addon = unserialize($odr_item['addon']);
                 if ($arr_addon['product_attr']) {
                     foreach ($arr_addon['product_attr'] as $arr_product_attr) {
                         $str_property .= $arr_product_attr['label'] . ":" . $arr_product_attr['value'] . ";";
                     }
                 }
                 if ($str_property && strpos($str_property, ";") !== false) {
                     $str_property = substr($str_property, 0, strrpos($str_property, ";"));
                 }
             }
             $arr_data['orders']['order'][$index]['order_items']['item'][] = array('sku_id' => $odr_item['products']['product_id'], 'iid' => $odr_item['goods_id'], 'bn' => $odr_item['bn'], 'name' => $odr_item['name'], 'sku_properties' => $str_property, 'weight' => $odr_item['weight'], 'score' => $odr_item['score'], 'price' => $odr_item['price'], 'num' => $odr_item['quantity'], 'sendnum' => $odr_item['sendnum'], 'total_item_fee' => $odr_item['amount'], 'sale_price' => $odr_item['g_price'], 'item_type' => $odr_item['item_type'], 'item_status' => 'normal');
         }
         $index++;
     }
     if ($arr_data['orders']) {
         $arr_data['orders'] = json_encode($arr_data['orders']);
     }
     $arr_callback = array('class' => 'b2c_api_callback_app', 'method' => 'callback', 'params' => array('method' => 'store.trade.add', 'tid' => $sdf['order_id']));
     // »ØË·ºÍÇëÇó
     parent::request('store.trade.add', $arr_data, $arr_callback, 'Order Create', 1);
     return true;
 }
Exemplo n.º 9
0
 /**
  * 订单取消事件埋点
  * @param array sdf
  * @return boolean success or failure
  */
 protected function request($sdf, $params = array(), $callbck = array(), $title = '', $time_out = 1, $rpc_id = null)
 {
     // 回朔待续...
     $arr_data['tid'] = $sdf;
     $arr_data['status'] = 'TRADE_CLOSED';
     $arr_callback = array('class' => 'b2c_api_callback_app', 'method' => 'callback', 'params' => array('method' => 'store.trade.status.update', 'tid' => $sdf));
     //$rst = $this->app->matrix()->call('store.trade.status.update', $arr_data);
     parent::request('store.trade.status.update', $arr_data, $arr_callback, 'Order Cancel', 1);
     return true;
 }
Exemplo n.º 10
0
 /**
  * 订单创建
  * @param array sdf
  * @return boolean success or failure
  */
 protected function request(&$sdf)
 {
     $arr_data['tid'] = $sdf['order_id'];
     $arr_data['title'] = 'Order Create';
     $arr_data['created'] = date('Y-m-d H:i:s', $sdf['createtime']);
     $arr_data['modified'] = date('Y-m-d H:i:s', $sdf['last_modified']);
     $arr_data['status'] = $sdf['status'] == 'active' ? 'TRADE_ACTIVE' : 'TRADE_CLOSED';
     $arr_data['pay_status'] = $sdf['pay_status'] == '0' || !$sdf['pay_status'] ? 'PAY_NO' : 'PAY_FINISH';
     $arr_data['ship_status'] = $sdf['ship_status'] == '0' || !$sdf['ship_status'] ? 'SHIP_NO' : 'SHIP_FINISH';
     $arr_data['has_invoice'] = $sdf['is_tax'] == 'true' || $sdf['is_tax'] === true ? true : false;
     $arr_data['invoice_title'] = $sdf['tax_title'];
     $arr_data['invoice_fee'] = $sdf['cost_tax'];
     $arr_data['total_goods_fee'] = $sdf['cost_item'];
     $arr_data['total_trade_fee'] = $sdf['total_amount'];
     $arr_data['discount_fee'] = $sdf['discount'];
     $arr_data['payed_fee'] = $sdf['payed'];
     $arr_data['currency'] = $sdf['currency'];
     $arr_data['currency_rate'] = $sdf['cur_rate'];
     $arr_data['total_currency_fee'] = $sdf['cur_amount'];
     $arr_data['buyer_obtain_point_fee'] = $sdf['score_g'];
     $arr_data['point_fee'] = $sdf['score_u'];
     $arr_data['total_weight'] = $sdf['weight'];
     $arr_data['receiver_time'] = $sdf['consignee']['r_time'] ? $sdf['consignee']['r_time'] : '';
     $arr_data['shipping_tid'] = $sdf['shipping']['shipping_id'];
     $arr_data['shiptype_name'] = $sdf['shipping']['shipping_name'];
     $arr_data['shipping_fee'] = $sdf['shipping']['cost_shipping'];
     $arr_data['is_protect'] = $sdf['shipping']['is_protect'];
     $arr_data['protect_fee'] = $sdf['shipping']['cost_protect'];
     $opayment = app::get('ectools')->model('payment_cfgs');
     $arr_payment = $opayment->getPaymentInfo($sdf['payinfo']['pay_app_id']);
     $arr_data['paytype_name'] = $arr_payment['app_display_name'];
     $arr_data['is_cod'] = $sdf['payinfo']['pay_app_id'] == '货到付款' ? 'true' : 'false';
     $arr_data['receiver_name'] = $sdf['consignee']['name'];
     $arr_data['receiver_email'] = $sdf['consignee']['email'] ? $sdf['consignee']['email'] : '';
     $arr_data['receiver_mobile'] = $sdf['consignee']['mobile'];
     $arr_states = explode(':', $sdf['consignee']['area']);
     $str_states = $arr_states[1];
     $arr_states = explode('/', $str_states);
     $arr_data['receiver_state'] = trim($arr_states[0]);
     $arr_data['receiver_city'] = trim($arr_states[1]);
     $arr_data['receiver_district'] = trim($arr_states[2]);
     $arr_data['receiver_address'] = $sdf['consignee']['addr'];
     $arr_data['receiver_zip'] = $sdf['consignee']['zip'] ? $sdf['consignee']['zip'] : '';
     $arr_data['receiver_phone'] = $sdf['consignee']['telephone'] ? $sdf['consignee']['telephone'] : '';
     $arr_data['commission_fee'] = $sdf['payinfo']['cost_payment'];
     $arr_data['trade_memo'] = '';
     $arr_data['orders_number'] = 1;
     $index = 0;
     foreach ($sdf['order_objects'] as $odr_obj) {
         $arr_data['orders']['order'][$index] = array('oid' => intval($sdf['order_id']), 'type' => $odr_obj['obj_type'] == 'goods' ? 'goods' : 'gift', 'type_alias' => $odr_obj['obj_alias'], 'iid' => $odr_obj['goods_id'], 'title' => $odr_obj['name'], 'items_num' => intval($odr_obj['quantity']), 'order_status' => 'SHIP_NO', 'total_order_fee' => $this->objMath->number_multiple(array($odr_obj['price'], $odr_obj['quantity'])), 'discount_fee' => 0, 'consign_time' => '', 'order_items' => array('item' => array()), 'weight' => $odr_obj['weight']);
         foreach ($odr_obj['order_items'] as $odr_item) {
             $arr_data['orders']['order'][$index]['order_items']['item'][] = array('sku_id' => $odr_item['products']['product_id'], 'iid' => $odr_item['goods_id'], 'bn' => $odr_item['bn'], 'name' => $odr_item['name'], 'weight' => $odr_item['weight'], 'score' => $odr_item['score'], 'price' => $odr_item['price'], 'num' => $odr_item['quantity'], 'sendnum' => $odr_item['sendnum'], 'total_item_fee' => 0, 'item_type' => $odr_item['item_type']);
         }
         $index++;
     }
     if ($arr_data['orders']) {
         $arr_data['orders'] = json_encode($arr_data['orders']);
     }
     $arr_callback = array('class' => 'b2c_api_callback_app', 'method' => 'callback', 'params' => array('method' => 'store.trade.add', 'tid' => $sdf['order_id']));
     // 回朔和请求
     parent::request('store.trade.add', $arr_data, $arr_callback, 'Order Create', 1);
     return true;
 }
Exemplo n.º 11
0
 /**
  * 退款单发送矩阵请求
  * @param array 数组值
  * @return null
  */
 public function send_request(&$sdf)
 {
     $obj_members = $this->app->model('members');
     $login_name = kernel::single('b2c_user_object')->get_member_name(null, $sdf['member_id']);
     $arr_data = array();
     $arr_data['tid'] = $sdf['order_id'];
     $arr_data['refund_id'] = $sdf['refund_id'];
     $arr_data['buyer_bank'] = $sdf['bank'];
     $arr_data['buyer_account'] = $sdf['account'];
     $arr_data['buyer_name'] = $login_name ? $login_name : $sdf['op_name'];
     $arr_data['refund_fee'] = $sdf['money'];
     $arr_data['currency'] = $sdf['currency'];
     $arr_data['currency_fee'] = $sdf['cur_money'];
     $arr_data['pay_type'] = $sdf['pay_type'];
     $arr_data['payment_type'] = $sdf['pay_name'];
     $arr_data['payment_tid'] = $sdf['pay_app_id'];
     $arr_data['seller_account'] = $sdf['pay_account'];
     $arr_data['t_begin'] = date('Y-m-d H:i:s', $sdf['t_begin']);
     $arr_data['t_sent'] = date('Y-m-d H:i:s', $sdf['t_payed']);
     $arr_data['t_received'] = date('Y-m-d H:i:s', $sdf['t_confirm']);
     $arr_data['status'] = $sdf['status'] == 'succ' ? 'SUCC' : 'PROGRESS';
     $arr_data['memo'] = ($sdf['memo'] ? $sdf['memo'] : "") . "#" . $sdf['refund_bn'] . "#";
     $arr_data['outer_no'] = $sdf['trade_no'];
     $arr_callback = array('class' => 'b2c_api_callback_app', 'method' => 'callback', 'params' => array('method' => 'store.trade.refund.add', 'tid' => $arr_data['tid']));
     parent::request('store.trade.refund.add', $arr_data, $arr_callback, 'Order Refund', 1);
 }