public function getBaseConf()
 {
     $Webap = M('web_ap');
     $webid = $Webap->where($_GET)->getField('webid');
     $web = M('website')->find($webid);
     cancleApi();
     exit(decodeUnicode(json_encode($web)));
 }
Beispiel #2
0
function output($data, $encode = 1)
{
    if ($encode) {
        var_dump(json_decode($data));
    } else {
        echo decodeUnicode($data);
    }
}
 public function getBaseConf()
 {
     $Webap = M('web_ap');
     $Website = M('website');
     $webid = $Webap->where($_GET)->getField('webid');
     $data = $Website->find($webid);
     cancleApi();
     exit(html_entity_decode(decodeUnicode(json_encode($data), false)));
 }
Beispiel #4
0
 /**
  * @return mixed
  */
 public function get()
 {
     $ACCESS_TOKEN = $this->getAccess();
     $menu_json = file_get_contents("https://api.weixin.qq.com/cgi-bin/menu/get?access_token=" . $ACCESS_TOKEN);
     $menu_array = json_decode($menu_json, true);
     $menu_json = decodeUnicode(json_encode($menu_array['menu']));
     //  $menu = json_decode(trim($menu_json), true);
     //   $data['option_value'] = decodeUnicode(json_encode($menu['menu']));
     //    $res = D('Options')->where(array('option_name' => 'Weixin_menu'))->data($data)->save();
     return $menu_json;
 }
Beispiel #5
0
require_once '../../admin/functions.php';
require_once 'php-export-data.class.php';
$req = get_param();
list($db_name, $table_name) = null_exit($req, 'db', 'table');
$columns = objects_read($db_name, $table_name, true);
$exporter = new ExportDataExcel('browser', $db_name . '-' . $table_name . '.xls');
$exporter->initialize();
//开始发送表格流数据到浏览器
$has_header = false;
foreach ($columns as $column) {
    if (!$has_header) {
        $exporter->addRow(array_keys($column));
        $has_header = true;
    }
    $datas = array();
    foreach ($column as $key => $val) {
        if (is_array($val)) {
            $unicode_str = json_encode($val);
            $datas[] = decodeUnicode($unicode_str);
        } else {
            $datas[] = $val;
        }
    }
    $exporter->addRow($datas);
}
$exporter->finalize();
//完成页脚,发送剩余数据到浏览器
function decodeUnicode($str)
{
    return preg_replace_callback('/\\\\u([0-9a-f]{4})/i', create_function('$matches', 'return mb_convert_encoding(pack("H*", $matches[1]), "UTF-8", "UCS-2BE");'), $str);
}
 public function update()
 {
     $Menu = new MenuEvent();
     $Weixin_menu_decode = json_decode(trim(get_opinion('Weixin_menu')), true);
     $menu = decodeUnicode(json_encode($Weixin_menu_decode));
     $res_info = $Menu->create($menu);
     json_decode($res_info, true);
     if ($res_info['errcode'] == 0) {
         $this->success('更新成功');
     } else {
         $this->error('更新失败' . $res_info['errmsg']);
     }
 }
Beispiel #7
0
     $promote_price = 0;
 }
 $data = array('product_sn' => $product_sn, 'name' => $name, 'shop_price' => $shop_price, 'price' => $price, 'lowest_price' => $lowest_price, 'reward' => 0, 'integral' => $integral, 'integral_given' => 0, 'img' => $img, 'desc' => $desc, 'detail' => $detail, 'business_account' => $_SESSION['business_account'], 'category_id' => $category, 'shop_category_id' => $shop_category, 'product_type_id' => $product_type, 'status' => $status, 'promote_price' => $promote_price, 'promote_begin' => $promote_begin, 'promote_end' => $promote_end, 'add_time' => time(), 'weight' => $weight, 'brand_id' => $brand, 'order_view' => $order_view, 'free_delivery' => $free_delivering, 'prev_status' => 0);
 $table = 'product';
 $db->begin();
 $transaction = true;
 if (!$db->autoInsert($table, array($data))) {
     $transaction = false;
 }
 $links = array(array('link' => 'product.php', 'alt' => '产品列表'), array('link' => 'product.php?act=add', 'alt' => '继续添加'));
 //新增产品库存
 if (is_array($attr)) {
     $log->record_array($attr);
     foreach ($attr as $k => $v) {
         $attributes = json_encode($v);
         $attributes = decodeUnicode($attributes);
         $attributes = $db->escape($attributes);
         $attributes = str_replace('\\/', '/', $attributes);
         $data = array('product_sn' => $product_sn, 'attributes' => $attributes, 'inventory' => $inventory[$k], 'inventory_logic' => $inventory[$k]);
         $table = 'inventory';
         if (!$db->autoInsert($table, array($data))) {
             $transaction = false;
         }
     }
 } else {
     $inventory = intval($single_inventory);
     $data = array('product_sn' => $product_sn, 'attributes' => '', 'inventory' => $inventory, 'inventory_logic' => $inventory);
     $table = 'inventory';
     if (!$db->autoInsert($table, array($data))) {
         $transaction = false;
     }
 public function menu()
 {
     $Menu = new \Weixin\Event\MenuEvent();
     //   $Menu->restore();
     //from remote
     $menu_array = json_decode($Menu->get(), true);
     //from db
     $Weixin_menu_decode = json_decode(trim(C('Weixin_menu')), true);
     $menu = decodeUnicode(json_encode($Weixin_menu_decode));
     dump($Menu->create($menu));
 }