function callback($data)
 {
     //     	$request_data = get_post(NULL);
     $request_data = $data['request_data'];
     $return_data = json_decode($data['return_data']);
     $return_data = object_array($return_data);
     if ($return_data['rsp'] == 'succ') {
         //回调接口
         $callback_data = array();
         $callback_data['res'] = '';
         $callback_data['msg_id'] = $data['msg_id'];
         $callback_data['err_msg'] = '';
         $callback_data['data'] = json_encode($return_data['data']);
         $callback_data['sign'] = '';
         $callback_data['rsp'] = 'succ';
     } else {
         $callback_data = array();
         $callback_data['res'] = $return_data['res'];
         $callback_data['msg_id'] = $data['msg_id'];
         $callback_data['err_msg'] = '';
         $callback_data['data'] = json_encode($return_data['data']);
         $callback_data['sign'] = '';
         $callback_data['rsp'] = 'fail';
     }
     return array('callback_data' => $callback_data, 'callback_url' => $request_data['callback_url']);
 }
 function callback($data)
 {
     //	$request_data = get_post(NULL);
     $request_data = $data['request_data'];
     $return_data = json_decode($data['return_data']);
     $return_data = object_array($return_data);
     $CI =& get_instance();
     $CI->load->model('stream_model');
     $order_rs = $CI->stream_model->findByAttributes("order_bn = '" . $request_data['tid'] . "' and from_method='store.trade.reship.add'", 'stream_id desc');
     $reship_id = '';
     if ($order_rs) {
         $request_rs = mb_unserialize($order_rs['request_data']);
         $reship_id = $request_rs['reship_id'];
     }
     if ($return_data['rsp'] == 'succ') {
         //回调接口
         $callback_data = array();
         $callback_data['res'] = '';
         $callback_data['msg_id'] = $data['msg_id'];
         $callback_data['err_msg'] = '';
         $callback_data['data'] = json_encode(array('tid' => $request_data['tid'], 'reship_id' => $reship_id));
         $callback_data['sign'] = '';
         $callback_data['rsp'] = 'succ';
     } else {
         $callback_data = array();
         $callback_data['res'] = $return_data['res'];
         $callback_data['msg_id'] = $data['msg_id'];
         $callback_data['err_msg'] = '';
         $callback_data['data'] = json_encode(array('tid' => $request_data['tid'], 'reship_id' => $reship_id));
         $callback_data['sign'] = '';
         $callback_data['rsp'] = 'fail';
     }
     return array('callback_data' => $callback_data, 'callback_url' => $request_data['callback_url']);
 }
 function result($params)
 {
     $return_data = json_decode($params['return_data']);
     $return_data = object_array($return_data);
     $response_data = $params['response_data'];
     if ($return_data['rsp'] != 'succ') {
         return json_encode(array('res' => $return_data['res'], 'msg_id' => $params['msg_id'], 'rsp' => 'fail', 'err_msg' => '', 'data' => ''));
     } else {
         return json_encode(array('res' => $return_data['res'], 'msg_id' => $params['msg_id'], 'rsp' => 'running', 'err_msg' => '', 'data' => ''));
     }
 }
 function result($post_data)
 {
     $return_data = json_decode($post_data['return_data']);
     $return_data = object_array($return_data);
     if ($return_data['rsp'] == 'succ') {
         $re = array('res' => '', 'msg_id' => $post_data['msg_id'], 'err_msg' => '', 'data' => $return_data['data'], 'rsp' => 'succ', 'res_ltype' => $return_data['data']['total_results']);
         return json_encode($re);
     } else {
         return '{"res": "", "msg_id": "' . $post_data['msg_id'] . '", "rsp": "fail", "err_msg": "", "data": ""}';
     }
 }
Beispiel #5
0
/**
 * json数据 转换 数组
 */
function object_array($array)
{
    if (is_object($array)) {
        $array = (array) $array;
    }
    if (is_array($array)) {
        foreach ($array as $key => $value) {
            $array[$key] = object_array($value);
        }
    }
    return $array;
}
Beispiel #6
0
 public function push()
 {
     $ret = $this->_avpush->send();
     $ret = object_array($ret);
     if ($ret['objectId']) {
         $ret['errcode'] = 0;
         $ret['msg_id'] = $ret['objectId'];
         $ret['errmsg'] = '发送成功';
     } else {
         $ret['errcode'] = 1;
         $ret['errmsg'] = '发送失败';
     }
     return $ret;
 }
 function callback($data)
 {
     // 	$request_data = get_post(NULL);
     $request_data = $data['request_data'];
     $return_data = json_decode($data['return_data']);
     $return_data = object_array($return_data);
     sort($return_data['data']);
     //回调接口
     $callback_data = array();
     $callback_data['res'] = '';
     $callback_data['err_msg'] = '';
     $callback_data['data'] = json_encode($this->build_data($return_data['data']));
     $callback_data['sign'] = '';
     $callback_data['rsp'] = 'succ';
     $callback_data['msg_id'] = $data['msg_id'];
     return array('callback_data' => $callback_data, 'callback_url' => $request_data['callback_url']);
 }
Beispiel #8
0
 public function create_fqrforreg()
 {
     $dotype = '777800';
     $uid = $dotype;
     $param = array('expire_seconds' => 2592000, 'action_name' => 'QR_SCENE', 'action_info' => array('scene' => array('scene_id' => $uid)));
     $param = json_encode($param);
     $wxmsg = new WxUserInfo();
     $access_token = $wxmsg->accessToken();
     $rs = post('https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=' . $access_token, $param);
     $rs = json_decode($rs);
     //处理object
     $rs = object_array($rs);
     header('location:https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=' . $rs['ticket']);
 }
 function result($data)
 {
     $return_data = json_decode($data['return_data']);
     $return_data = object_array($return_data);
     $data_rs = array();
     $promotion_details = object_array(json_decode($return_data['data']['promotion_details']));
     $data_rs['trade']['discount_fee'] = $return_data['data']['discount_fee'];
     $data_rs['trade']['promotion_details'] = $promotion_details;
     $data_rs['trade']['buyer_name'] = $return_data['data']['buyer_name'];
     $data_rs['trade']['is_cod'] = $return_data['data']['is_cod'];
     $data_rs['trade']['receiver_email'] = $return_data['data']['receiver_email'];
     $data_rs['trade']['point_fee'] = $return_data['data']['point_fee'];
     $data_rs['trade']['currency_rate'] = $return_data['data']['currency_rate'];
     $data_rs['trade']['currency'] = $return_data['data']['currency'];
     $data_rs['trade']['total_weight'] = $return_data['data']['total_weight'];
     $data_rs['trade']['total_currency_fee'] = $return_data['data']['total_currency_fee'];
     $data_rs['trade']['shipping_type'] = $return_data['data']['shipping_type'];
     $data_rs['trade']['receiver_address'] = $return_data['data']['receiver_address'];
     $data_rs['trade']['payment_tid'] = $return_data['data']['receiver_zip'];
     $orders = object_array(json_decode($return_data['data']['orders']));
     foreach ($orders['order'] as $key => $value) {
         $item = $orders['order'][$key]['order_items']['item'];
         unset($orders['order'][$key]['order_items']);
         $orders['order'][$key]['order_items']['orderitem'] = $item;
     }
     $data_rs['trade']['orders'] = $orders;
     $data_rs['trade']['trade_memo'] = $return_data['data']['trade_memo'];
     $data_rs['trade']['lastmodify'] = $return_data['data']['lastmodify'];
     $data_rs['trade']['branch_id'] = $return_data['data']['branch_id'];
     $data_rs['trade']['has_invoice'] = $return_data['data']['has_invoice'];
     $data_rs['trade']['receiver_district'] = $return_data['data']['receiver_district'];
     $data_rs['trade']['receiver_city'] = $return_data['data']['receiver_city'];
     $data_rs['trade']['title'] = $return_data['data']['title'];
     $data_rs['trade']['orders_discount_fee'] = $return_data['data']['orders_discount_fee'];
     $data_rs['trade']['tax_type'] = $return_data['data']['tax_type'];
     $data_rs['trade']['buyer_memo'] = $return_data['data']['buyer_memo'];
     $data_rs['trade']['invoice_title'] = $return_data['data']['invoice_title'];
     $data_rs['trade']['receiver_state'] = $return_data['data']['receiver_state'];
     $data_rs['trade']['branch_name_user'] = $return_data['data']['branch_name_user'];
     $data_rs['trade']['local_id'] = $return_data['data']['local_id'];
     $data_rs['trade']['tax_content'] = $return_data['data']['tax_content'];
     $data_rs['trade']['receiver_time'] = $return_data['data']['receiver_time'];
     $data_rs['trade']['protect_fee'] = $return_data['data']['protect_fee'];
     $data_rs['trade']['receiver_phone'] = $return_data['data']['receiver_phone'];
     $data_rs['trade']['pay_status'] = $return_data['data']['pay_status'];
     $data_rs['trade']['shop_bn'] = $return_data['data']['shop_bn'];
     $data_rs['trade']['status'] = $return_data['data']['status'];
     $data_rs['trade']['total_trade_fee'] = $return_data['data']['total_trade_fee'];
     $data_rs['trade']['buyer_address'] = $return_data['data']['buyer_address'];
     $data_rs['trade']['pay_cost'] = $return_data['data']['pay_cost'];
     $data_rs['trade']['buyer_uname'] = $return_data['data']['buyer_uname'];
     $data_rs['trade']['buyer_email'] = $return_data['data']['buyer_email'];
     $data_rs['trade']['tid'] = $return_data['data']['tid'];
     $data_rs['trade']['receiver_community'] = $return_data['data']['receiver_community'];
     $data_rs['trade']['buyer_zip'] = $return_data['data']['buyer_zip'];
     $payment_lists = object_array(json_decode($return_data['data']['payment_lists']));
     $data_rs['trade']['payment_lists'] = $payment_lists;
     $data_rs['trade']['receiver_mobile'] = $return_data['data']['receiver_mobile'];
     $data_rs['trade']['buyer_mobile'] = $return_data['data']['buyer_mobile'];
     $data_rs['trade']['goods_discount_fee'] = $return_data['data']['goods_discount_fee'];
     $data_rs['trade']['orders_number'] = $return_data['data']['orders_number'];
     $data_rs['trade']['shipping_tid'] = $return_data['data']['shipping_tid'];
     $data_rs['trade']['total_goods_fee'] = $return_data['data']['total_goods_fee'];
     $data_rs['trade']['created'] = $return_data['data']['created'];
     $data_rs['trade']['is_auto_complete'] = $return_data['data']['is_auto_complete'];
     $data_rs['trade']['payed_fee'] = $return_data['data']['payed_fee'];
     $data_rs['trade']['invoice_fee'] = $return_data['data']['invoice_fee'];
     $data_rs['trade']['modified'] = $return_data['data']['modified'];
     $data_rs['trade']['is_protect'] = $return_data['data']['is_protect'];
     $data_rs['trade']['ship_status'] = $return_data['data']['ship_status'];
     $data_rs['trade']['buyer_obtain_point_fee'] = $return_data['data']['buyer_obtain_point_fee'];
     $data_rs['trade']['payment_type'] = $return_data['data']['payment_type'];
     $data_rs['trade']['buyer_phone'] = $return_data['data']['buyer_phone'];
     $data_rs['trade']['receiver_name'] = $return_data['data']['receiver_name'];
     $data_rs['trade']['shipping_fee'] = $return_data['data']['shipping_fee'];
     $data_rs['trade']['receiver_zip'] = $return_data['data']['receiver_zip'];
     $data_rs['trade']['buyer_id'] = $return_data['data']['buyer_id'];
     $result_data = array();
     $result_data['res'] = '';
     $result_data['msg_id'] = $data['msg_id'];
     $result_data['err_msg'] = '';
     $result_data['data'] = json_encode($data_rs);
     $result_data['rsp'] = 'succ';
     //	error_log(json_encode($result_data),3,'e.log');
     return json_encode($result_data);
     //	$txt = print_r($result_data,1);
     //	return '{"res":"","msg_id":"5534B399C0A81729C278EEB1F8539164","err_msg":"","data":"{\"trade\": {\"discount_fee\": \"0.00\", \"promotion_details\": [{\"promotion_fee\": \"0.00\", \"promotion_name\": \"\u6ce8\u518c\u4f1a\u5458\u53ca\u94f6\u5361\u4f1a\u5458\u6d88\u8d391\u5143\u79ef\u5206+1\"}], \"buyer_name\": \"\", \"is_cod\": null, \"receiver_email\": \"\", \"point_fee\": \"0.00\", \"currency_rate\": \"1.0000\", \"currency\": \"CNY\", \"total_weight\": \"800.00\", \"total_currency_fee\": \"101.24\", \"shipping_type\": \"\u987a\u4e30\", \"receiver_address\": \"\u5e7f\u4e1c\u5e7f\u5dde\u5e02\u4e1c\u5c71\u533a11\", \"payment_tid\": \"deposit\", \"orders\": {\"order\": [{\"consign_time\": \"\", \"weight\": \"800\", \"title\": \"\u65b0\u897f\u5170\u6d3b\u7eff\u9752\u53e3\u3010\u9884\u552e\u3011\", \"discount_fee\": 0, \"type\": \"goods\", \"price\": \"88.000\", \"oid\": \"25150\", \"order_status\": \"SHIP_NO\", \"order_items\": {\"orderitem\": [{\"sku_id\": \"1148\", \"name\": \"\u65b0\u897f\u5170\u6d3b\u7eff\u9752\u53e3\u3010\u9884\u552e\u3011\", \"weight\": \"800\", \"iid\": \"14\", \"discount_fee\": 0, \"bn\": \"11002401\", \"sku_properties\": \"\u89c4\u683c:800g\/\u76d2\", \"item_status\": \"normal\", \"item_type\": \"product\", \"num\": \"1\", \"sendnum\": \"0\", \"sale_price\": \"86.240\", \"score\": \"86\", \"price\": \"86.240\", \"total_item_fee\": 86.239999999999995}]}, \"iid\": \"25150\", \"type_alias\": \"\u5546\u54c1\u533a\u5757\", \"total_order_fee\": 86.239999999999995, \"items_num\": 1, \"orders_bn\": \"11002401\"}]}, \"trade_memo\": null, \"lastmodify\": \"2015-04-20 15:57:06\", \"branch_id\": 0, \"has_invoice\": false, \"receiver_district\": \"\u4e1c\u5c71\u533a\", \"receiver_city\": \"\u5e7f\u5dde\u5e02\", \"title\": \"Order Create\", \"orders_discount_fee\": \"0.00\", \"tax_type\": \"false\", \"buyer_memo\": \"\", \"invoice_title\": \"\", \"receiver_state\": \"\u5e7f\u4e1c\", \"branch_name_user\": \"\", \"local_id\": null, \"tax_content\": \"\", \"receiver_time\": \"\u4efb\u610f\u65e5\u671f,\u4efb\u610f\u65f6\u95f4\u6bb5\", \"protect_fee\": \"0.00\", \"receiver_phone\": \"\", \"pay_status\": \"PAY_NO\", \"shop_bn\": \"xbd_store_\", \"status\": \"TRADE_ACTIVE\", \"total_trade_fee\": \"101.24\", \"buyer_address\": \"\", \"pay_cost\": \"0.00\", \"buyer_uname\": \"freedom\", \"buyer_email\": \"171868746@qq.com\", \"tid\": \"150420155724776\", \"receiver_community\": \"\", \"buyer_zip\": null, \"payment_lists\": {\"payment_list\": []}, \"receiver_mobile\": \"13690182120\", \"buyer_mobile\": \"\", \"goods_discount_fee\": \"0.00\", \"orders_number\": 1, \"shipping_tid\": \"1\", \"total_goods_fee\": \"86.24\", \"created\": \"2015-04-20 15:57:06\", \"is_auto_complete\": \"false\", \"payed_fee\": \"0.00\", \"invoice_fee\": \"0.00\", \"modified\": \"2015-04-20 15:57:06\", \"is_protect\": \"false\", \"ship_status\": \"SHIP_NO\", \"buyer_obtain_point_fee\": \"86.00\", \"payment_type\": \"\u9884\u5b58\u6b3e\", \"buyer_phone\": \"\", \"receiver_name\": \"13690182120\", \"shipping_fee\": \"15.00\", \"receiver_zip\": \"\", \"buyer_id\": 343}}","rsp":"succ"}';
 }
Beispiel #10
0
 function result($params)
 {
     //return json_encode(array('res'=>'', 'msg_id'=>$post_data['msg_id'], 'rsp'=>'running', 'err_msg'=>'', 'data'=>''));
     //return '{"res": "", "msg_id": "'.$post_data['msg_id'].'", "rsp": "running", "err_msg": "", "data": ""}';
     $return_data = json_decode($params['return_data']);
     $return_data = object_array($return_data);
     if ($return_data['rsp'] != 'succ') {
         return json_encode(array('res' => $return_data['res'], 'msg_id' => $params['msg_id'], 'rsp' => 'fail', 'err_msg' => '', 'data' => ''));
     } else {
         return json_encode(array('res' => $return_data['res'], 'msg_id' => $params['msg_id'], 'rsp' => 'running', 'err_msg' => '', 'data' => ''));
     }
 }
 /**
  * CURL Post
  */
 private function postCurl($url, $option, $header = 0, $type = 'POST')
 {
     $curl = curl_init();
     // 启动一个CURL会话
     curl_setopt($curl, CURLOPT_URL, $url);
     // 要访问的地址
     curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
     // 对认证证书来源的检查
     curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
     // 从证书中检查SSL加密算法是否存在
     curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)');
     // 模拟用户使用的浏览器
     if (!empty($option)) {
         $options = json_encode($option);
         curl_setopt($curl, CURLOPT_POSTFIELDS, $options);
         // Post提交的数据包
     }
     curl_setopt($curl, CURLOPT_TIMEOUT, 30);
     // 设置超时限制防止死循环
     curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
     // 设置HTTP头
     curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
     // 获取的信息以文件流的形式返回
     curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $type);
     $result = curl_exec($curl);
     // 执行操作
     $res = object_array(json_decode($result));
     $res['status'] = curl_getinfo($curl, CURLINFO_HTTP_CODE);
     pre($res);
     return $res;
     curl_close($curl);
     // 关闭CURL会话
 }
Beispiel #12
0
 public function create_qr($openid = '', $type, $dotype = '1001')
 {
     //找到此用户的uid
     $uid = M('member')->where(array('OpenID' => $openid))->limit(1)->getField('uid');
     $uid = $dotype . $type . $uid;
     //https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=TOKEN
     //{"expire_seconds": 604800, "action_name": "QR_SCENE", "action_info": {"scene": {"scene_id": 123}}}
     $param = array('expire_seconds' => 2592000, 'action_name' => 'QR_SCENE', 'action_info' => array('scene' => array('scene_id' => $uid)));
     $param = json_encode($param);
     $wxmsg = new WxUserInfo();
     $access_token = $wxmsg->accessToken();
     $rs = post('https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=' . $access_token, $param);
     $rs = json_decode($rs);
     //处理object
     $rs = object_array($rs);
     return 'https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=' . $rs['ticket'];
 }
Beispiel #13
0
 public function create_qr111($openid = 'oyKgswI_fyh9dM5rdw6SAEy0dEUg', $type = 1)
 {
     //找到此用户的uid
     $uid = M('member')->where(array('openid' => $openid))->limit(1)->getField('uid');
     $uid = $type . $uid;
     //https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=TOKEN
     //{"expire_seconds": 604800, "action_name": "QR_SCENE", "action_info": {"scene": {"scene_id": 123}}}
     $param = array('expire_seconds' => 2592000, 'action_name' => 'QR_SCENE', 'action_info' => array('scene' => array('scene_id' => $uid)));
     $param = json_encode($param);
     // S('access_token',null);die;
     // echo S('access_token');die;
     $rs = post('https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=' . S('access_token'), $param);
     $rs = json_decode($rs);
     //处理object
     $rs = object_array($rs);
     echo 'https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=' . $rs['ticket'];
     // print_r($rs);
 }
Beispiel #14
0
 /**
  * 根据订单号抓取订单列表
  * @param datetime $starttime
  * @param datetime $endtime
  * @return array
  * @author lzx
  */
 public function spiderOrderLists($starttime, $endtime)
 {
     $OrderObject = F('amazon.package.GetOrders');
     F('xmlhandle');
     $OrderObject->setRequestConfig($this->authorize);
     $simplelists = array();
     //使用启用缓存方便调试:0:不使用; 1:正常使用缓存; 2:更新缓存中的数据
     if (!empty($GLOBALS['memc_obj']) && C('ENABLE_AMAZON_GET_ORDER_CACHE') != 0) {
         $cache_mode = C('ENABLE_AMAZON_GET_ORDER_CACHE');
         $simplelists = $GLOBALS['memc_obj']->get('ENABLE_AMAZON_GET_ORDER_CACHE');
         if (empty($simplelists) || $cache_mode == 2) {
             $simplelists = $OrderObject->getOrderLists($starttime, $endtime);
             //amazon订单数据存入缓存
             $GLOBALS['memc_obj']->set('ENABLE_AMAZON_GET_ORDER_CACHE', $simplelists, 10800);
         }
     } else {
         $simplelists = $OrderObject->getOrderLists($starttime, $endtime);
     }
     $StatusMenu = M('StatusMenu');
     $ORDER_INIT = $StatusMenu->getOrderStatusByStatusCode('ORDER_INIT', 'id');
     foreach ($simplelists as $xml_simplelist) {
         $simplelist = object_array($xml_simplelist);
         $orders = $simplelist['' . "" . '*' . "" . '_fields']['Orders']['FieldValue'];
         foreach ($orders as $order) {
             $orderInfo = $order['' . "" . '*' . "" . '_fields'];
             //订单表数据
             $order = array('recordNumber' => $orderInfo['AmazonOrderId']['FieldValue'], 'platformId' => 11, 'site' => $this->authorize['site'], 'paymentMethod' => $orderInfo['PaymentMethod']['FieldValue'], 'currency' => $orderInfo['OrderTotal']['FieldValue']['' . "" . '*' . "" . '_fields']['CurrencyCode']['FieldValue'], 'accountId' => M('Account')->getAccountIdByName($this->authorize['account']), 'ordersTime' => strtotime($orderInfo['PurchaseDate']['FieldValue']), 'paymentTime' => strtotime($orderInfo['LastUpdateDate']['FieldValue']), 'onlineTotal' => $orderInfo['OrderTotal']['FieldValue']['' . "" . '*' . "" . '_fields']['Amount']['FieldValue'], 'actualTotal' => $orderInfo['OrderTotal']['FieldValue']['' . "" . '*' . "" . '_fields']['Amount']['FieldValue'], 'transportId' => 0, 'actualShipping' => 0, 'marketTime' => 0, 'ShippedTime' => 0, 'ORtransport' => $orderInfo['ShipServiceLevel']['FieldValue'], 'orderStatus' => $ORDER_INIT, 'orderType' => $ORDER_INIT, 'orderAttribute' => 1, 'pmId' => 0, 'channelId' => 0, 'calcWeight' => 0, 'calcShipping' => 0, 'orderAddTime' => time(), 'isSendEmail' => 0, 'isNote' => 0, 'isCopy' => 0, 'isSplit' => 0, 'combinePackage' => 0, 'combineOrder' => 0, 'completeTime' => 0, 'storeId' => 1, 'is_offline' => 0, 'is_delete' => 0, 'isExpressDelivery' => 0);
             //订单扩展表
             $orderExtension = array('declaredPrice' => 0.0, 'orderStatus' => $orderInfo['OrderStatus']['FieldValue'], 'fulfillmentChannel' => $orderInfo['FulfillmentChannel']['FieldValue'], 'salesChannel' => $orderInfo['SalesChannel']['FieldValue'], 'shipServiceLevel' => $orderInfo['ShipServiceLevel']['FieldValue'], 'marketplaceId' => $orderInfo['MarketplaceId']['FieldValue'], 'shipmentServiceLevelCategory' => $orderInfo['ShipmentServiceLevelCategory']['FieldValue']);
             $ShippingAddress = $orderInfo['ShippingAddress']['FieldValue']['' . "" . '*' . "" . '_fields'];
             $street2 = htmlentities($ShippingAddress['AddressLine1']['FieldValue']);
             $street3 = htmlentities($ShippingAddress['AddressLine2']['FieldValue']);
             if (!empty($ShippingAddress['County']['FieldValue'])) {
                 //郡,县
                 $street2 = htmlentities($ShippingAddress['County']['FieldValue'] . ' ' . $street2, ENT_QUOTES);
                 $street3 = htmlentities($ShippingAddress['County']['FieldValue'] . ' ' . $street3, ENT_QUOTES);
             }
             $countrySn = $ShippingAddress['CountryCode']['FieldValue'] == 'GB' ? 'UK' : $ShippingAddress['CountryCode']['FieldValue'];
             $countryNameInfo = M('Order')->getCountrieInfoBySn($countrySn);
             $countryName = $countryNameInfo['regions_en'];
             //用户表
             $orderUserInfo = array('username' => htmlentities($ShippingAddress['Name']['FieldValue'], ENT_QUOTES), 'platformUsername' => htmlentities($orderInfo['BuyerName']['FieldValue'], ENT_QUOTES), 'email' => $orderInfo['BuyerEmail']['FieldValue'], 'countryName' => $countryName, 'countrySn' => $countrySn, 'county' => '', 'currency' => $orderInfo['OrderTotal']['FieldValue']['' . "" . '*' . "" . '_fields']['CurrencyCode']['FieldValue'], 'state' => htmlentities($ShippingAddress['StateOrRegion']['FieldValue'], ENT_QUOTES), 'city' => htmlentities($ShippingAddress['City']['FieldValue'], ENT_QUOTES), 'address1' => htmlentities($ShippingAddress['AddressLine1']['FieldValue']), 'address2' => $street2, 'address3' => $street3, 'phone' => $ShippingAddress['Phone']['FieldValue'], 'zipCode' => htmlentities($ShippingAddress['PostalCode']['FieldValue'], ENT_QUOTES));
             //订单详细表
             //使用启用缓存方便调试:0:不使用; 1:正常使用缓存; 2:更新缓存中的数据
             if (!empty($GLOBALS['memc_obj']) && C('ENABLE_AMAZON_GET_ORDER_CACHE') != 0) {
                 $cache_mode = C('ENABLE_AMAZON_GET_ORDER_CACHE');
                 $orderDetailObjList = $GLOBALS['memc_obj']->get('ENABLE_AMAZON_GET_ORDER_DETAIL_CACHE');
                 if (empty($orderDetailObjList) || $cache_mode == 2) {
                     $orderDetailObjList = $OrderObject->getOrderDetailLists($orderInfo['AmazonOrderId']['FieldValue']);
                     //amazon订单数据存入缓存
                     $GLOBALS['memc_obj']->set('ENABLE_AMAZON_GET_ORDER_DETAIL_CACHE', $orderDetailObjList, 10800);
                 }
             } else {
                 $orderDetailObjList = $OrderObject->getOrderDetailLists($orderInfo['AmazonOrderId']['FieldValue']);
             }
             $orderDetailLists = object_array($orderDetailObjList);
             $orderDetail = array();
             foreach ($orderDetailLists as $orderDetailList) {
                 $orderDetails = $orderDetailList['' . "" . '*' . "" . '_fields']['OrderItems']['FieldValue'];
                 foreach ($orderDetails as $orderItems) {
                     $orderItem = $orderItems['' . "" . '*' . "" . '_fields'];
                     $itemPrices = $orderItem['ItemPrice']['FieldValue']['' . "" . '*' . "" . '_fields'];
                     $orderDetail[] = array('orderDetail' => array('recordNumber' => $orderItem['OrderItemId']['FieldValue'], 'itemPrice' => round($itemPrices['Amount']['FieldValue'] / $orderItem['QuantityOrdered']['FieldValue'], 2), 'sku' => str_pad(preg_replace('/^(0|\\*)*/', '', $orderItem['SellerSKU']['FieldValue']), 3, '0', STR_PAD_LEFT), 'amount' => $orderItem['QuantityOrdered']['FieldValue'], 'shippingFee' => 0, 'createdTime' => time(), 'storeId' => 1, 'is_delete' => 0, 'itemId' => $orderItem['ASIN']['FieldValue']), 'orderDetailExtension' => array('itemTitle' => htmlentities($orderItem['Title']['FieldValue'], ENT_QUOTES), 'itemURL' => '', 'shippingTax' => $orderItem['ShippingTax']['FieldValue']['' . "" . '*' . "" . '_fields']['Amount']['FieldValue'], 'shippingDiscount' => $orderItem['ShippingDiscount']['FieldValue']['' . "" . '*' . "" . '_fields']['Amount']['FieldValue'], 'shippingPrice' => $orderItem['ShippingPrice']['FieldValue']['' . "" . '*' . "" . '_fields']['Amount']['FieldValue'], 'conditionNote' => empty($orderItem['ConditionNote']['FieldValue']) ? 'not found' : $orderItem['ConditionNote']['FieldValue'], 'conditionSubtypeId' => $orderItem['ConditionSubtypeId']['FieldValue'], 'conditionId' => $orderItem['ConditionId']['FieldValue']));
                 }
             }
             //组装数据
             $inserOrder[] = array('order' => $order, 'orderExtension' => $orderExtension, 'orderUserInfo' => $orderUserInfo, 'orderDetail' => $orderDetail);
             //拦截逻辑,计算重量运费
             /**待实现**/
         }
         return $inserOrder;
     }
 }
 function addtaobao()
 {
     include_once "Vendor/taobao/TopSdk.php";
     $url = strtolower(get_post_value('url'));
     $url = 'http://item.taobao.com/item.htm?id=43980628011';
     echo $url . '<br/>';
     $it_id = getQuerystr($url, 'id');
     //获取id值
     $c = new TopClient();
     //在taobao/TopClient.php 文件中 xml 改成 json
     $c->appkey = "23096388";
     $c->secretKey = "2cf7057bf7d3901d068ce5a200f89f0d";
     $req = new ItemGetRequest();
     $req->setFields("num_iid,title,price,pic_url,change_prop,location,list_time,delist_time,num,desc,property_alias,props,props_name,detail_url,item_weight,item_size,change_prop,item_imgs,prop_imgs,nick");
     $req->setNumIid($it_id);
     $resp = $c->execute($req, "");
     $array = object_array($resp);
     $delist_time = $array['item']['delist_time'];
     $descs = $array['item']['desc'];
     $list_time = $array['item']['list_time'];
     $city = $array['item']['location']['city'];
     $state = $array['item']['location']['state'];
     $num = $array['item']['num'];
     $num_iid = $array['item']['num_iid'];
     $pic_url = $array['item']['pic_url'];
     $price = $array['item']['price'];
     $property_alias = $array['item']['property_alias'];
     $props = $array['item']['props'];
     $props_name = $array['item']['props_name'];
     $title = $array['item']['title'];
     $nick = $array['item']['nick'];
     $type0 = '';
     //颜色
     $type1 = '';
     //尺寸
     $type2 = '';
     //上市时间
     $typeArr = explode(';', $props_name);
     foreach ($typeArr as $arrays) {
         $array = explode(':', $arrays);
         if ($array[0] == '1627207') {
             $type0 .= $array[3] . "|";
         }
         if ($array[0] == '20509') {
             $type1 .= $array[3] . "|";
         }
         if ($array[0] == '8560225') {
             $type2 .= $array[3] . "|";
         }
     }
     $pattern = "/<[img|IMG].*?src=[\\'|\"](.*?(?:[\\.gif|\\.jpg]))[\\'|\"].*?[\\/]?>/";
     preg_match_all($pattern, $descs, $match);
     $imgsrc = '';
     //照片描述
     foreach ($match[1] as $v) {
         $imgsrc .= $v . "|";
     }
     if (substr($url, 0, 7) != 'http://') {
         $url = 'http://' . $url;
     }
     $product_url = null;
     if (substr($url, 0, 22) == 'http://item.taobao.com') {
         $taobao = new Taobao($url);
         $product_url = $taobao->getProductUrl();
         $data = $taobao->getData();
         $this->assign('product_url', $product_url);
         $this->assign('data', $data);
         $this->assign('title', $title);
         $this->assign('type0', $type0);
         $this->assign('type1', $type1);
         $this->assign('type2', $type2);
         $this->assign('type3', $type2);
         $this->assign('list_time', $list_time);
         $this->assign('delist_time', $delist_time);
         $this->assign('location', $city . '|' . $state);
         $this->assign('price', $price);
         $this->assign('nick', $nick);
         $this->assign('pic_url', $pic_url);
         $this->assign('imgsrc', $imgsrc);
     } else {
     }
     $upload = new Upload();
     $this->assign('upload', $upload->show());
 }
Beispiel #16
0
 public function create_fqr()
 {
     $param = array('expire_seconds' => 2592000, 'action_name' => 'QR_LIMIT_STR_SCENE', 'action_info' => array('scene' => array('scene_str' => 'kj1')));
     $param = json_encode($param);
     // S('access_token',null);die;
     // echo S('access_token');die;
     $rs = post('https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=' . S('access_token'), $param);
     $rs = json_decode($rs);
     //处理object
     $rs = object_array($rs);
     header('location:https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=' . $rs['ticket']);
     // print_r($rs);
 }
Beispiel #17
0
 public function JsonToArray($data)
 {
     $data = json_decode($data);
     if (is_object($data)) {
         $data = (array) $data;
     }
     if (is_array($data)) {
         foreach ($data as $key => $value) {
             $data[$key] = object_array($value);
         }
     }
     return $data;
 }
Beispiel #18
0
 public function show()
 {
     //如果应用在推送平台添加,需要传入应用id,然后根据应用id查询应用的密钥
     $app_push_id = intval($this->input['app_id']);
     if ($app_push_id) {
         $sql = 'SELECT * FROM ' . DB_PREFIX . "app_info WHERE id = " . $app_push_id;
         $appinfo = $this->db->query_first($sql);
     }
     if (!$appinfo['access_id'] || !$appinfo['access_key']) {
         $this->errorOutput('缺少应用配置');
     }
     $content = trim($this->input['content']);
     if (!$content) {
         $this->errorOutput('缺少通知内容');
     }
     //platform_type:1信鸽,2极光,3AVOS
     $platform_type = $appinfo['platform_type'];
     //极光可以不写标题,不写标题,默认显示应用包名称
     $title = trim($this->input['title']);
     if (!$title && ($platform_type = 1)) {
         $this->errorOutput('请输入通知标题');
     }
     //通知离线时间
     $expire_time = intval($this->input['expire_time']);
     //发送时间
     $send_time = $this->input['send_time'];
     //扩展字段
     if ($this->input['extras']) {
         $extras = $this->input['extras'];
     }
     $ios = $ios_dev = '';
     if ($this->input['ios'] == 1) {
         $ios_dev = 1;
     } else {
         if ($this->input['ios'] == 2) {
             $ios = 1;
         }
     }
     $android_sys = $this->input['android'];
     $winphone = $this->input['winphone'];
     if (!$ios && !$ios_dev && !$android_sys && !$winphone) {
         $this->errorOutput('请选择客户端设备系统');
     }
     if ($platform_type == 1) {
         $accessId = $appinfo['access_id'];
         $secretKey = $appinfo['access_key'];
         //$accessId = 2100033914;
         //$secretKey = '755776a7f60242ed472848ddf6b08197';
         if (!$accessId || !$secretKey) {
             $this->errorOutput('请传入应用信息');
         }
         include_once CUR_CONF_PATH . 'lib/XingeApp.php';
         $push = new XingeApp($accessId, $secretKey);
         $mess = new Message();
         $mess->setTitle($title);
         $mess->setContent($content);
         //0是通知,1是消息
         $mess_type = intval($this->input['mess_type']);
         if ($mess_type) {
             $mess->setType(Message::TYPE_MESSAGE);
         } else {
             $mess->setType(Message::TYPE_NOTIFICATION);
             $style = new Style(0);
             #含义:样式编号0,响铃,震动,可从通知栏清除,不影响先前通知
             $style = new Style(0, 1, 1, 1, 0);
             $mess->setStyle($style);
             #接收消息时间范围
             $acceptTime1 = new TimeInterval(0, 0, 23, 59);
             $mess->addAcceptTime($acceptTime1);
             $action = new ClickAction();
             $action_type = intval($this->input['action_type']);
             //点击通知操作
             $action_url = $this->input['action_url'];
             //打开的url地址
             if (!$action_type) {
                 #打开activity或app本身
                 $action->setActionType(ClickAction::TYPE_ACTIVITY);
             } else {
                 if ($action_type == 1 && $action_url) {
                     //打开链接
                     $action->setActionType(ClickAction::TYPE_URL);
                     $action->setUrl($action_url);
                     #打开url需要用户确认
                     $action_comfirm = intval($this->input['action_comfirm']);
                     $action->setComfirmOnUrl($action_comfirm);
                 } else {
                     if ($action_type == 2) {
                         $intent = $this->input['intent'];
                         $action->setActionType(ClickAction::TYPE_INTENT);
                         $action->setIntent($intent);
                     }
                 }
             }
             $mess->setAction($action);
             #自定义内容
             if ($extras) {
                 $mess->setCustom($extras);
             }
         }
         //设备标识
         $device_token = trim($this->input['device_token']);
         //推送帐号
         //$account = trim($this->input['account']);
         //向ios推送时启用,1生产,2开发
         $environment = intval($this->input['environment']);
         //设备类型
         $device_type = intval($this->input['device_type']);
         $device_sys = '';
         switch ($device_type) {
             case 0:
                 $device_sys = XingeApp::DEVICE_ALL;
                 break;
             case 1:
                 $device_sys = XingeApp::DEVICE_BROWSER;
                 break;
             case 2:
                 $device_sys = XingeApp::DEVICE_PC;
                 break;
             case 3:
                 $device_sys = XingeApp::DEVICE_ANDROID;
                 break;
             case 4:
                 $device_sys = XingeApp::DEVICE_IOS;
                 break;
             case 5:
                 $device_sys = XingeApp::DEVICE_WINPHONE;
                 break;
             default:
                 $device_sys = XingeApp::DEVICE_ALL;
         }
         if ($device_token) {
             $ret = $push->PushSingleDevice($device_token, $mess, $environment);
         } else {
             $ret = $push->PushAllDevices($device_sys, $mess, $environment);
         }
     } else {
         if ($platform_type == 2) {
             if (!$appinfo['access_id'] || !$appinfo['access_key']) {
                 $this->errorOutput('缺少应用配置');
             }
             include_once CUR_CONF_PATH . 'lib/jpush/JPushClient.php';
             include_once CUR_CONF_PATH . 'lib/jpush/model/Audience.php';
             include_once CUR_CONF_PATH . 'lib/jpush/model/Message.php';
             include_once CUR_CONF_PATH . 'lib/jpush/model/notification/Notification.php';
             include_once CUR_CONF_PATH . 'lib/jpush/model/notification/IOSNotification.php';
             include_once CUR_CONF_PATH . 'lib/jpush/model/notification/AndroidNotification.php';
             include_once CUR_CONF_PATH . 'lib/jpush/model/notification/WinphoneNotification.php';
             include_once CUR_CONF_PATH . 'lib/jpush/model/Options.php';
             include_once CUR_CONF_PATH . 'lib/jpush/model/Platform.php';
             include_once CUR_CONF_PATH . 'lib/jpush/model/PushPayload.php';
             $client = new JPushClient($app_key, $master_secret);
             $platform = new Platform();
             $audience = new Audience();
             $message = new Message();
             $options = new Options();
             $notification = new Notification();
             $ios = new IOSNotification();
             $android = new AndroidNotification();
             $winphone = new WinphoneNotification();
             //set platform params
             $platform->ios = true;
             $platform->winphone = true;
             //set options params设置选项
             $options->sendno = 10;
             $options->apns_production = true;
             $options->time_to_live = 60;
             //set notification params
             $ios->alert = $content;
             $ios->sound = "default";
             $ios->badge = 1;
             //$ios->extras = $extras;
             $ios->content_available = null;
             $android->alert = $content;
             $android->title = $title;
             $android->builder_id = 1;
             //$android->extras = $extras;
             $winphone->alert = $content;
             $winphone->title = $title;
             $winphone->_open_page = "/friends.xaml";
             //$winphone->extras = $extras;
             $notification->alert = $content;
             $notification->android = $android;
             $notification->ios = $ios;
             $notification->winphone = $winphone;
             //发送广播通知
             $payload = new PushPayload();
             $payload->notification = $notification;
             //设置接受设备系统
             //$payload->platform = $platform;
             $payload->options = $options;
             $ret = $client->sendPush($payload);
         } elseif ($platform_type == 3) {
             if (!$appinfo['access_id'] || !$appinfo['access_key'] || !$appinfo['secret_key']) {
                 $this->errorOutput('缺少应用配置');
             }
             if (!$appinfo['channel']) {
                 $this->errorOutput('订阅频道不存在');
             }
             include_once CUR_CONF_PATH . 'lib/avos/AV.php';
             include_once CUR_CONF_PATH . 'lib/avos/AVObject.php';
             include_once CUR_CONF_PATH . 'lib/avos/AVQuery.php';
             include_once CUR_CONF_PATH . 'lib/avos/AVUser.php';
             include_once CUR_CONF_PATH . 'lib/avos/AVFile.php';
             include_once CUR_CONF_PATH . 'lib/avos/AVPush.php';
             include_once CUR_CONF_PATH . 'lib/avos/AVGeoPoint.php';
             include_once CUR_CONF_PATH . 'lib/avos/AVACL.php';
             include_once CUR_CONF_PATH . 'lib/avos/AVCloud.php';
             $obj = new AVPush();
             $app_info['access_id'] = $appinfo['access_id'];
             $app_info['access_key'] = $appinfo['access_key'];
             $app_info['secret_key'] = $appinfo['secret_key'];
             $app_info['avos_url'] = 'https://cn.avoscloud.com/1/';
             //应用信息
             $obj->app_info = $app_info;
             //设置标题,不设置默认显示应用名称
             $obj->title = $title;
             //通知内容
             $obj->alert = $content;
             //$this->input['link_module'] = 'news';
             //$this->input['content_id'] = 1;
             if ($this->input['link_module']) {
                 $obj->module_id = $this->input['link_module'];
             }
             if ($this->input['content_id']) {
                 $obj->id = $this->input['content_id'];
             }
             //$push->channels = array('123456');
             if ($appinfo['channel']) {
                 $obj->channels = explode(',', $appinfo['channel']);
             }
             if ($android_sys) {
                 $obj->action = 'com.avos.UPDATE_STATUS';
             }
             //声音
             $sound = $this->input['sound'];
             if ($sound) {
                 $obj->sound = $sound;
             }
             //指定设备
             $platform_id = trim($this->input['platform_id']);
             if ($platform_id) {
                 $obj->where = array('installationId' => $platform_id);
             }
             //发送时间
             if ($send_time) {
                 $send_time = date('c', strtotime($send_time));
                 $send_time = explode('+', $send_time);
                 $send_time = $send_time[0] . '.000Z';
                 //file_put_contents('4.txt', $send_time);
                 $obj->push_time = $send_time;
             }
             //设置离线时间
             if ($expire_time) {
                 if ($send_time) {
                     $obj->expiration_time_interval = $expire_time;
                 } else {
                     $expire_time += TIMENOW;
                     $expire_time = date("c", $expire_time);
                     $expire_time = explode('+', $expire_time);
                     $expire_time = $expire_time[0] . '.000Z';
                     $obj->expiration_time = $expire_time;
                     //$obj->expiration_time = '2014-07-22T17:24:13.145Z';
                 }
             }
             //通知推送
             $return = $obj->send();
             $return = object_array($return);
             if ($return['objectId']) {
                 $ret['errcode'] = 0;
                 $ret['msg_id'] = $return['objectId'];
                 $ret['errmsg'] = '发送成功';
             } else {
                 $ret['errcode'] = 1;
                 $ret['errmsg'] = '发送失败';
             }
             //file_put_contents('1.txt', var_export($return,1));
             //hg_pre($return);
         }
     }
     if (!$send_time) {
         $send_time = TIMENOW;
     } else {
         $send_time = strtotime($send_time);
     }
     $data = array('app_id' => $app_id, 'title' => $title, 'content' => $content, 'msg_id' => $ret['msg_id'], 'errcode' => $ret['errcode'], 'errmsg' => $ret['errmsg'], 'ios' => $ios, 'ios_dev' => $ios_dev, 'android' => $android_sys, 'winphone' => $winphone, 'create_time' => TIMENOW, 'update_time' => TIMENOW, 'user_id' => $this->user['user_id'], 'user_name' => $this->user['user_name'], 'appid' => $this->user['appid'], 'appname' => $this->user['display_name'], 'ip' => hg_getip(), 'platform_type' => $platform_type, 'send_time' => $send_time, 'expire_time' => $expire_time);
     $sql = 'INSERT INTO ' . DB_PREFIX . 'notice SET ';
     foreach ($data as $k => $v) {
         $sql .= "{$k} = '" . $v . "',";
     }
     $this->db->query(rtrim($sql, ','));
     $data['id'] = $this->db->insert_id();
     $this->addItem($data);
     $this->output();
 }
Beispiel #19
0
 public function create_fqr($type = '')
 {
     //找到此用户的uid
     $uid = '00';
     //				$type='91'
     $dotype = '7777';
     $uid = $dotype . $type . $uid;
     //https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=TOKEN
     //{"expire_seconds": 604800, "action_name": "QR_SCENE", "action_info": {"scene": {"scene_id": 123}}}
     $param = array('expire_seconds' => 2592000, 'action_name' => 'QR_SCENE', 'action_info' => array('scene' => array('scene_id' => $uid)));
     $param = json_encode($param);
     $wxmsg = new WxUserInfo();
     $access_token = $wxmsg->accessToken();
     $rs = post('https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=' . $access_token, $param);
     $rs = json_decode($rs);
     //处理object
     $rs = object_array($rs);
     header('location:https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=' . $rs['ticket']);
 }
Beispiel #20
0
 public function update_bk_data()
 {
     //找出我们的赛事
     $ids = M('jc_project')->where(array('sell_status' => 'Selling', 'type' => 2))->getfield('id', true);
     foreach ($ids as $key => $value) {
         $url = "http://i.sporttery.cn/open_v1_0/bk_match_list/get_bk_result_odds/?username=11000000&password=test_passwd&format=jsonp&callback=initData&m_id=" . $value . "&_=";
         $rs = get($url);
         $rs = preg_replace("#\\\\u([0-9a-f]{4})#ie", "iconv('UCS-2BE', 'UTF-8', pack('H4', '\\1'))", $rs);
         $rs = str_replace('initData(', "", $rs);
         $rs = substr_replace($rs, '', -1, 1);
         $rs = json_decode($rs);
         $rs = object_array($rs);
         $win = $rs['data']['mnl']['h'];
         $lost = $rs['data']['mnl']['a'];
         $rang_win = $rs['data']['hdc']['h'];
         $rang_lost = $rs['data']['hdc']['a'];
         $rs['data']['had'] = serialize($rs['data']['mnl']);
         $rs['data']['hhad'] = serialize($rs['data']['hdc']);
         $rs['data']['crs'] = serialize($rs['data']['hilo']);
         $rs['data']['ttg'] = serialize($rs['data']['wnm']);
         if (!M('jc_all_data')->where(array('id' => $rs['data']['id']))->find()) {
             M('jc_all_data')->add($rs['data']);
         } else {
             M('jc_all_data')->where(array('id' => $rs['data']['id']))->save($rs['data']);
         }
         //处理结果数据
         $goal = explode(':', $rs['data']['final']);
         if ($rs['data']['match_status'] == "Final") {
             //比赛结束,更新数据
             $array = array('sell_status' => 'Final', 'status' => 3, 'l_goal' => $goal[0], 'a_goal' => $goal[1], 'll_goal' => $goal[0] + $rs['data']['goalline'], 'aa_goal' => $goal[1], 'had_result' => $rs['data']['mnl_result'], 'hhad_result' => $rs['data']['hdc_result'], 'win' => $win, 'ping' => $ping, 'lost' => $lost, 'rang_win' => $rang_win, 'rang_ping' => $rang_ping, 'rang_lost' => $rang_lost);
             M('jc_project')->where(array('id' => $rs['data']['id'], 'sell_status' => 'Selling'))->setField($array);
         }
     }
     $this->redirect('selling');
 }
Beispiel #21
0
 /**
  * 自定义数据调用(新版本)
  */
 public function data2()
 {
     // 安全认证码
     $auth = $this->input->get('auth');
     if ($auth != md5(SYS_KEY)) {
         // 安全认证码不正确
         $data = array('error' => '安全认证码不正确');
     } else {
         // 解析数据
         $data = $this->template->list_tag($this->input->get('param'));
     }
     $title = $this->input->get('title');
     $description = $this->input->get('description');
     // 接收参数
     $format = $this->input->get('format');
     $data = arrayToObject($data);
     $data = object_array($data->return);
     foreach ($data as $k => $d) {
         $s[] = $d;
         if ($title) {
             $s[$k][title] = mb_substr($data[$k][title], 0, $title);
         }
         if ($description) {
             $s[$k][description] = mb_substr($data[$k][description], 0, $description);
         }
         $s[$k][newthumb] = dr_file_info($data[$k][thumb]);
         $s[$k][newthumb] = $s[$k][newthumb][attachment];
     }
     // 页面输出
     if ($format == 'xml') {
         header('Content-Type: text/xml');
         echo dr_array2xml($data, FALSE);
     } elseif ($format == 'jsonp') {
         echo $this->input->get('callback') . '(' . json_encode($s) . ')';
     } else {
         echo json_encode($data);
     }
 }
Beispiel #22
0
 public function recordList()
 {
     if (!empty($_GET['d'])) {
         //print_r(json_decode(json_encode($_GET['d'])));
         $data = object_array(json_decode($_GET['d']));
         //
         $this->assign('recordlist', $data);
         //print_r($data);
         $this->assign('recordnum', count($data));
         $this->display();
     }
 }
Beispiel #23
0
 private function push_notice($type)
 {
     $id = intval($this->input['id']);
     if ($type == 'update' && !$id) {
         $this->errorOutput('id不存在');
     }
     $app_id = intval($this->input['app_push_id']);
     if (!$app_id) {
         $this->errorOutput('请选择应用');
     }
     /**************权限控制开始**************/
     //节点权限
     if ($app_id && $this->user['group_type'] > MAX_ADMIN_TYPE) {
         $nodes['nodes'][$app_id] = $app_id;
     }
     $nodes['_action'] = 'notice_manage';
     $this->verify_content_prms($nodes);
     /**************权限控制结束**************/
     $content = trim($this->input['content']);
     if (!$content) {
         $this->errorOutput('请输入通知内容');
     }
     $ios = $ios_dev = '';
     if ($this->input['ios'] == 1) {
         $ios_dev = 1;
     } else {
         if ($this->input['ios'] == 2) {
             $ios = 1;
         }
     }
     $android_sys = $this->input['android'];
     $winphone = $this->input['winphone'];
     if (!$ios && !$ios_dev && !$android_sys && !$winphone) {
         $this->errorOutput('请选择客户端设备系统');
     }
     //根据应用id查询注册应用信息
     $sql = 'SELECT * FROM ' . DB_PREFIX . "app_info WHERE id = " . $app_id;
     $appinfo = array();
     $appinfo = $this->db->query_first($sql);
     if (empty($appinfo)) {
         $this->errorOutput('注册应用信息不存在');
     }
     //扩展字段
     if ($this->input['extras']) {
         $extras = $this->input['extras'];
     }
     //通知离线时间
     $expire_time = intval($this->input['expire_time']);
     //发送时间
     $send_time = $this->input['send_time'];
     //platform_type:1信鸽,2极光,3AVOS
     $platform_type = $appinfo['platform_type'];
     //极光可以不写标题,不写标题,默认显示应用包名称
     $title = trim($this->input['title']);
     if (!$title && $platform_type == 1) {
         $this->errorOutput('请输入通知标题');
     }
     if ($platform_type == 1) {
         $accessId = $appinfo['access_id'];
         $secretKey = $appinfo['secret_key'];
         //$accessId = 2100033914;
         //$secretKey = '755776a7f60242ed472848ddf6b08197';
         if (!$accessId || !$secretKey) {
             $this->errorOutput('请传入应用信息');
         }
         include_once CUR_CONF_PATH . 'lib/XingeApp.php';
         $push = new XingeApp($accessId, $secretKey);
         $mess = new Message();
         $mess->setTitle($title);
         $mess->setContent($content);
         //0是通知,1是消息
         $mess_type = intval($this->input['mess_type']);
         if ($mess_type) {
             $mess->setType(Message::TYPE_MESSAGE);
         } else {
             $mess->setType(Message::TYPE_NOTIFICATION);
             $style = new Style(0);
             #含义:样式编号0,响铃,震动,可从通知栏清除,不影响先前通知
             $style = new Style(0, 1, 1, 1, 0);
             $mess->setStyle($style);
             #接收消息时间范围
             $acceptTime1 = new TimeInterval(0, 0, 23, 59);
             $mess->addAcceptTime($acceptTime1);
             //发送时间
             if ($send_time) {
                 $send_time .= ':00';
                 $mess->setSendTime($send_time);
             }
             //离线时间
             if ($expire_time) {
                 $mess->setExpireTime($expireTime);
             }
             $action = new ClickAction();
             $action_type = intval($this->input['action_type']);
             //点击通知操作
             $action_url = $this->input['action_url'];
             //打开的url地址
             $intent = $this->input['intent'];
             if (!$action_type) {
                 #打开activity或app本身
                 $action->setActionType(ClickAction::TYPE_ACTIVITY);
             } else {
                 if ($action_type == 1 && $action_url) {
                     //打开链接
                     $action->setActionType(ClickAction::TYPE_URL);
                     $action->setUrl($action_url);
                     #打开url需要用户确认
                     $action_comfirm = intval($this->input['action_comfirm']);
                     $action->setComfirmOnUrl($action_comfirm);
                 } else {
                     if ($action_type == 2 && $intent) {
                         $action->setActionType(ClickAction::TYPE_INTENT);
                         $action->setIntent($intent);
                     }
                 }
             }
             $mess->setAction($action);
             #自定义内容
             if ($extras) {
                 $mess->setCustom($extras);
             }
         }
         //设备标识
         $device_token = trim($this->input['device_token']);
         //推送帐号
         //$account = trim($this->input['account']);
         $environment = 0;
         //设备类型
         $device_sys = '';
         if (($ios || $ios_dev) && $android_sys && $winphone) {
             $device_sys = XingeApp::DEVICE_ALL;
             //向ios推送时启用,1生产,2开发
             $environment = $ios_dev ? 2 : 1;
         } else {
             if ($ios || $ios_dev) {
                 $device_sys = XingeApp::DEVICE_IOS;
                 //向ios推送时启用,1生产,2开发
                 $environment = $ios_dev ? 2 : 1;
             } else {
                 if ($android_sys) {
                     $device_sys = XingeApp::DEVICE_ANDROID;
                 } else {
                     if ($winphone) {
                         $device_sys = XingeApp::DEVICE_WINPHONE;
                     }
                 }
             }
         }
         $ret = $push->PushAllDevices($device_sys, $mess, $environment);
         if (!$ret['ret_code']) {
             $ret['errcode'] = 0;
             $ret['msg_id'] = $ret['result']['push_id'];
             $ret['errmsg'] = '发送成功';
         } else {
             $ret['errcode'] = $ret['ret_code'];
             $errmsg = $this->XingeErrorMsg($ret['ret_code']);
             $ret['errmsg'] = $errmsg['errmsg'];
         }
     } else {
         if ($platform_type == 2) {
             include_once CUR_CONF_PATH . 'lib/jpush/JPushClient.php';
             include_once CUR_CONF_PATH . 'lib/jpush/model/Audience.php';
             include_once CUR_CONF_PATH . 'lib/jpush/model/Message.php';
             include_once CUR_CONF_PATH . 'lib/jpush/model/notification/Notification.php';
             include_once CUR_CONF_PATH . 'lib/jpush/model/Options.php';
             include_once CUR_CONF_PATH . 'lib/jpush/model/Platform.php';
             include_once CUR_CONF_PATH . 'lib/jpush/model/PushPayload.php';
             $app_key = $appinfo['access_key'];
             $master_secret = $appinfo['secret_key'];
             //$master_secret = 'b10501ff90b68130097458bc';
             //$app_key='2193f24f5975b39235afdc9a';
             $client = new JPushClient($app_key, $master_secret);
             $platform = new Platform();
             $audience = new Audience();
             $message = new Message();
             $options = new Options();
             $notification = new Notification();
             $extras = array();
             $link_module = trim($this->input['link_module']);
             if ($link_module) {
                 $extras = array($link_module => '');
                 if ($this->input['module_id']) {
                     $extras[$link_module] = $this->input['module_id'];
                 }
             }
             //set platform params
             if ($ios || $ios_dev) {
                 include_once CUR_CONF_PATH . 'lib/jpush/model/notification/IOSNotification.php';
                 $ios_obj = new IOSNotification();
                 $platform->ios = true;
                 //set notification params
                 $ios_obj->alert = $content;
                 $ios_obj->sound = "default";
                 $ios_obj->badge = 1;
                 //$ios->extras = $extras;
                 //静默推送
                 $ios_obj->content_available = null;
                 $notification->ios = $ios_obj;
                 $options->apns_production = $ios_dev ? false : true;
             }
             if ($android_sys) {
                 include_once CUR_CONF_PATH . 'lib/jpush/model/notification/AndroidNotification.php';
                 $android = new AndroidNotification();
                 $platform->android = true;
                 $android->alert = $content;
                 $android->title = $title;
                 $android->builder_id = 1;
                 //$android->extras = $extras;
                 $notification->android = $android;
             }
             if ($winphone) {
                 include_once CUR_CONF_PATH . 'lib/jpush/model/notification/WinphoneNotification.php';
                 $winphone_obj = new WinphoneNotification();
                 $platform->winphone = true;
                 $winphone_obj->alert = $content;
                 $winphone_obj->title = $title;
                 $winphone_obj->_open_page = "/friends.xaml";
                 //$winphone->extras = $extras;
                 $notification->winphone = $winphone_obj;
             }
             //set options params设置选项
             //$options->sendno = 10;
             $options->time_to_live = $expire_time;
             $notification->alert = $content;
             //发送广播通知
             $payload = new PushPayload();
             $payload->notification = $notification;
             //设置接受设备系统
             //$payload->platform = $platform;
             $payload->options = $options;
             $ret = $client->sendPush($payload);
             $ret = json_decode($ret, 1);
             if ($ret['error']) {
                 $ret['errcode'] = $ret['reeor']['code'];
                 $errmsg = $this->JPushErrorMsg($ret['errcode']);
                 $ret['errmsg'] = $errmsg['errmsg'];
             } else {
                 $ret['errcode'] = 0;
                 $ret['msg_id'] = $ret['msg_id'];
                 $ret['errmsg'] = '发送成功';
             }
         } else {
             if ($platform_type == 3) {
                 if (!$appinfo['access_id'] || !$appinfo['access_key'] || !$appinfo['secret_key']) {
                     $this->errorOutput('缺少应用配置');
                 }
                 if (!$appinfo['channel']) {
                     $this->errorOutput('订阅频道不存在');
                 }
                 include_once CUR_CONF_PATH . 'lib/avos/AV.php';
                 include_once CUR_CONF_PATH . 'lib/avos/AVObject.php';
                 include_once CUR_CONF_PATH . 'lib/avos/AVQuery.php';
                 include_once CUR_CONF_PATH . 'lib/avos/AVUser.php';
                 include_once CUR_CONF_PATH . 'lib/avos/AVFile.php';
                 include_once CUR_CONF_PATH . 'lib/avos/AVPush.php';
                 include_once CUR_CONF_PATH . 'lib/avos/AVGeoPoint.php';
                 include_once CUR_CONF_PATH . 'lib/avos/AVACL.php';
                 include_once CUR_CONF_PATH . 'lib/avos/AVCloud.php';
                 $obj = new AVPush();
                 $app_info['access_id'] = $appinfo['access_id'];
                 $app_info['access_key'] = $appinfo['access_key'];
                 $app_info['secret_key'] = $appinfo['secret_key'];
                 $app_info['action'] = $appinfo['action'];
                 $app_info['avos_url'] = 'https://cn.avoscloud.com/1/';
                 //应用信息
                 $obj->app_info = $app_info;
                 ##############################################
                 if ($ios || $ios_dev) {
                     $ios_info = array('alert' => $content);
                     //声音
                     $sound = $this->input['sound'];
                     if ($sound) {
                         $ios_info['sound'] = $sound;
                     } else {
                         $ios_info['sound'] = 'UILocalNotificationDefaultSoundName';
                     }
                     if ($this->input['badge']) {
                         $ios_info['badge'] = $this->input['badge'];
                     } else {
                         $ios_info['badge'] = 'Increment';
                     }
                     if ($this->input['link_module']) {
                         $ios_info['module_id'] = $this->input['link_module'];
                     }
                     if ($this->input['content_id']) {
                         $ios_info['id'] = $this->input['content_id'];
                     }
                     if ($ios_dev) {
                         $obj->prod = 'dev';
                     }
                     $obj->ios = $ios_info;
                 }
                 if ($android_sys) {
                     $and_info = array();
                     if ($this->settings['push_type']) {
                         $and_info['push_content'] = $content;
                         $and_info['push_title'] = $title;
                     } else {
                         $and_info['alert'] = $content;
                         $and_info['title'] = $title;
                     }
                     if ($this->input['link_module']) {
                         $and_info['module_id'] = $this->input['link_module'];
                     }
                     if ($this->input['content_id']) {
                         $and_info['id'] = $this->input['content_id'];
                     }
                     if ($app_info['action']) {
                         $and_info['action'] = $app_info['action'];
                     } else {
                         $and_info['action'] = 'com.avos.UPDATE_STATUS';
                     }
                     if ($appinfo['packagename']) {
                         $and_info['packagename'] = $appinfo['packagename'];
                     }
                     if ($this->settings['push_app_id']) {
                         $and_info['push_app_id'] = $this->settings['push_app_id'];
                     }
                     $obj->android = $and_info;
                 }
                 if ($appinfo['channel']) {
                     $obj->channels = explode(',', $appinfo['channel']);
                 }
                 //指定设备
                 $intall_id = trim($this->input['intall_id']);
                 if ($platform_id) {
                     $obj->where = array('installationId' => $intall_id);
                 }
                 ##############################################
                 if ($send_time) {
                     $send_time = date('c', strtotime($send_time));
                     $send_time = explode('+', $send_time);
                     $send_time = $send_time[0] . '.000Z';
                     //file_put_contents('4.txt', $send_time);
                     $obj->push_time = $send_time;
                 }
                 //设置离线时间
                 if ($expire_time) {
                     if ($send_time) {
                         $obj->expiration_time_interval = $expire_time;
                     } else {
                         $expire_time += TIMENOW;
                         $expire_time = date("c", $expire_time);
                         $expire_time = explode('+', $expire_time);
                         $expire_time = $expire_time[0] . '.000Z';
                         $obj->expiration_time = $expire_time;
                         //$obj->expiration_time = '2014-07-22T17:24:13.145Z';
                     }
                 }
                 //通知推送
                 $return = $obj->send();
                 $return = object_array($return);
                 if ($return['objectId']) {
                     $ret['errcode'] = 0;
                     $ret['msg_id'] = $return['objectId'];
                     $ret['errmsg'] = '发送成功';
                 } else {
                     $ret['errcode'] = 1;
                     $ret['errmsg'] = '发送失败';
                 }
                 //hg_pre($return);
             }
         }
     }
     if (!$send_time) {
         $send_time = TIMENOW;
     } else {
         $send_time = strtotime($this->input['send_time']);
     }
     $data = array('app_id' => $app_id, 'title' => $title, 'content' => $content, 'msg_id' => $ret['msg_id'], 'errcode' => $ret['errcode'], 'errmsg' => $ret['errmsg'], 'ios' => $ios, 'ios_dev' => $ios_dev, 'android' => $android_sys, 'winphone' => $winphone, 'create_time' => TIMENOW, 'update_time' => TIMENOW, 'org_id' => $this->user['org_id'], 'user_id' => $this->user['user_id'], 'user_name' => $this->user['user_name'], 'appid' => $this->user['appid'], 'appname' => $this->user['display_name'], 'ip' => hg_getip(), 'platform_type' => $platform_type, 'send_time' => $send_time, 'expire_time' => $expire_time, 'intall_id' => $intall_id);
     //file_put_contents('3.txt', var_export($ret,1));
     if ($type == 'create') {
         $sql = 'INSERT INTO ' . DB_PREFIX . 'notice SET ';
         foreach ($data as $k => $v) {
             $sql .= "{$k} = '" . $v . "',";
         }
         $this->db->query(rtrim($sql, ','));
         $data['id'] = $this->db->insert_id();
     } else {
         if ($type == 'update') {
             $sql = 'UPDATE ' . DB_PREFIX . 'notice SET ';
             foreach ($data as $k => $v) {
                 $sql .= "{$k} = '" . $v . "',";
             }
             $sql = rtrim($sql, ',');
             $sql .= ' WHERE id=' . $id;
             $this->db->query($sql);
             $data['id'] = $id;
         }
     }
     $this->addItem($data);
     $this->output();
 }
Beispiel #24
0
 public function create_qr111($openid = 'oyKgswI_fyh9dM5rdw6SAEy0dEUg', $type = 1)
 {
     //找到此用户的uid
     $uid = M('member')->where(array('OpenID' => $openid))->limit(1)->getField('uid');
     $uid = $type . $uid;
     $param = array('expire_seconds' => 2592000, 'action_name' => 'QR_SCENE', 'action_info' => array('scene' => array('scene_id' => $uid)));
     $param = json_encode($param);
     $wxmsg = new WxUserInfo();
     $access_token = $wxmsg->accessToken();
     $rs = post('https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=' . $access_token, $param);
     $rs = json_decode($rs);
     //处理object
     $rs = object_array($rs);
     echo 'https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=' . $rs['ticket'];
     // print_r($rs);
 }
Beispiel #25
0
function zzb($xxurl)
{
    $url = "http://zzb.bz/panel/api/create/";
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, TRUE);
    $param_key = "NJR07";
    // your api key
    $param_url = $xxurl;
    // your huge url
    $param_password = "";
    $param_description = "";
    $array = array('key' => $param_key, 'url' => $param_url, 'password' => $param_password, 'description' => $param_description);
    curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($array));
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
    $response = curl_exec($ch);
    curl_close($ch);
    $data = object_array(json_decode($response));
    return $data['Result'];
}
 function result($data)
 {
     $return_data = json_decode($data['return_data']);
     $return_data = object_array($return_data);
     return '{"res": "' . $return_data['res'] . '", "msg_id": "' . $data['msg_id'] . '", "rsp": "running", "err_msg": "", "data": ""}';
 }
Beispiel #27
0
 public function livescores()
 {
     $url = "http://i.sporttery.cn/api/match_live/get_match_list?callback=?&_=1469065725758";
     $content = get($url);
     $content = str_replace('var match_list = ', "", $content);
     $content = substr($content, 0, strlen($content) - 1);
     $content = json_decode($content);
     $content = object_array($content);
     foreach ($content as $key => $value) {
         if ($value['status'] == "Playing") {
             //进行中
             $playing[] = $value;
         }
         if ($value['status'] == "Fixture") {
             //未开赛
             $fixture[] = $value;
         }
         if ($value['status'] == "Played") {
             //已结束
             $played[] = $value;
         }
     }
     // print_r($content);die;
     $this->match = $content;
     $this->playing = $playing;
     $this->played = $played;
     $this->fixture = $fixture;
     layout(false);
     $this->display();
 }
Beispiel #28
0
 function insertuseranswer($userid)
 {
     //ajax返回一个串
     if (isset($_GET["backjson"])) {
         $answerArr = object_array(json_decode($_GET["backjson"]));
         for ($j = 0; $j < count($answerArr["data"]); $j++) {
             $answerArr["data"][$j]["userid"] = $userid;
         }
         $answerid = "";
         foreach ($answerArr["data"] as $key => $value) {
             $answerid = $answerid . DB::insert($this->_answer, $value) . ",";
         }
     }
     return "";
 }
Beispiel #29
0
$signture_string = "";
$signture = "";
$uuid = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $signture_string = $_POST["data"];
    $signture = $_POST["sign"];
    $uuid = $_POST["uuid"];
}
/* test
$uuid = 1;
$signture = "LPriNRh6hMvW5n7+wCHr+0/JEWnwrYCTMOKGu351I5LLRm6T912czaICLP5jInMo++X6q8s1iteynfur2eFxPyF/RUsEcnZyYSxB1hOYwMhiKw46c5KWvPKeLJCVnnnfgjW/1kV9aZ/1T3ytg3TM6+DOYMa651lkV5gONjE5cAnvyMwfhSqx7w/O2bFZOEi85gQWg1fJoGywrHpJe1l9KlOapmU+KHe7X1gvExKdUrggwstO0TotGrLbgVJtZErM85fJzj41yTYIuWC/C0MSX6lVSEJ9C08sz0j4j3rgPVuECYXUoqAhgPgangb5xMM8N3XediJ7QHMU+K27SCrVUg==";
$signture_string = '{"orderId":"ord2erId","packageName":"com.MI.Angelfly","productId":"angel_dia01","purchaseTime":1419303818706,"purchaseState": 0,"purchaseToken": "pmgjpkgbinkjalobejbkmfoc.AO-J1OzfTqZM1WOAeRpoNTsgx6ZeCYlT-9RoPkGiVW7mgXONssZOO3sfjy8lWVDPElt48q6Ok2XSvp3dGWnKNENmE10tpM_zpIZs20ssKJ-XQn78emYvvv4"}';
*/
include "CheckGooglePlay.php";
$signture_json = json_decode($signture_string);
$signture_data = object_array($signture_json);
$orderId = $signture_data["orderId"];
# 检查订单是否重复
if (checkOrderId($orderId)) {
    echo "Repeat";
} else {
    if (!checkGooglePlay($signture_string, $signture) and 0) {
        echo "error";
    } else {
        //充值的价格
        $productId = $signture_data["productId"];
        $price = $config_array["google_billing"][$productId];
        //给予钻石
        $result = $db->fn_addValue("tb_user", $uuid, "jewel", $price);
        if ($result != 0) {
            //订单写入数据库
Beispiel #30
0
/**
 * 类中方法参数判断
 */
function param_verify($obj, $func, $data)
{
    static $reflection;
    static $error = array();
    $return_data = array();
    if (empty($error)) {
        $error = (include CONF_PATH . 'error.php');
        $error = $error['ERROR'];
    }
    if (empty($reflection)) {
        $reflection = new ReflectionMethod($obj, $func);
    }
    $param = $reflection->getParameters();
    $param = object_array($param);
    //提取出当前函数的参数
    $params = array();
    foreach ($param as $k => $v) {
        $params[$v['name']] = $v['name'];
    }
    //判断传进来的参数是否在param 中
    foreach ($data as $k => $v) {
        if (!in_array($k, $params)) {
            E($error[5], 5);
        }
    }
    //调整传进来的顺序
    foreach ($params as $k => $v) {
        $return_data[$k] = $data[$k];
    }
    return $return_data;
}