示例#1
0
 public function getInfoById($id)
 {
     $map['id'] = $id;
     $res = $this->where($map)->find();
     $res['icon_url'] = add_root_path('/' . $res['icon_url']);
     return $res;
 }
 public function __construct()
 {
     parent::__construct();
     $this->url = U('load');
     //获取loadAction的路径,用于分页加载
     $this->rootPath = add_root_path('');
     $this->pageSize = 10;
     //单页记录数
     $this->goodsDetailUrl = U('Goods/GoodsDetail/index');
 }
 public function getAttchmentPath()
 {
     $map['id'] = $this->id;
     $res = $this->where($map)->select();
     if (substr($res[0]['savepath'], 0, 1) == '.') {
         $savepath = substr($res[0]['savepath'], 1, strlen($res[0]['savepath']) - 1);
     }
     $path = add_root_path(C('UPLOAD_ROOT_PATH') . $savepath . $res[0]['savename']);
     return $path;
 }
 function saveWeixinFile($fileInfo)
 {
     $filecontent = $fileInfo["body"];
     $header = $fileInfo["header"];
     $documentRoot = I('server.DOCUMENT_ROOT');
     $savePath = "./Customer/" . $this->openid . "/";
     $saveName = uniqid();
     //更新数据库,取出做为filename
     $data['openid'] = $this->openid;
     $data['upload_time'] = time();
     $data['type'] = $header['content_type'];
     //未正确接收到图片信息,返回FALSE
     if ($data['type'] == "text/plain") {
         return false;
     }
     $data['ext'] = substr($header['content_type'], strrpos($header['content_type'], '/') + 1);
     $data['savepath'] = $savePath;
     $data['savename'] = $saveName . '.' . $data['ext'];
     $data['md5'] = md5($filecontent);
     $data['sha1'] = sha1($filecontent);
     $this->data($data)->add();
     $id = $this->getLastInsID();
     //上传文件
     $savePath = $documentRoot . add_root_path("/Uploads" . substr($savePath, 1));
     if (!is_dir($savePath)) {
         mkdir($savePath);
         // 如果不存在则创建
     }
     $fileName = $savePath . $data['savename'];
     $local_file = fopen($fileName, 'w');
     if (false !== $local_file) {
         if (false !== fwrite($local_file, $filecontent)) {
             fclose($local_file);
         }
     }
     $attId = $id;
     return $attId;
 }
	</head>
        <body>
    <div id="login-page" class="container">
        <h5><?php 
echo $error;
?>
</h5>
        <form id="login-form" class="well" method="post" action="<?php 
echo $url;
?>
">
        <input type="text" class="span2" name="name" placeholder="Name" /><br />
        <input type="password" class="span2" name="password" placeholder="Password" /><br />
        <label class="checkbox"> <input type="checkbox" />记住密码</label>
        <button type="submit" class="btn btn-primary">登陆</button>
    </form>	
    </div>
		<script src="<?php 
echo add_root_path('/theme/Akira/js/jquery.min.js');
?>
"></script>
		<script src="<?php 
echo add_root_path('/theme/Akira/js/bootstrap.min.js');
?>
"></script>
		<script src="<?php 
echo add_root_path('/theme/Akira/js/site.js');
?>
"></script>
	</body>
</html>
 private function _fetchInfo($value)
 {
     //不存在设定的关键字,即直接返回原值
     if (!isset($value[$this->key])) {
         return FALSE;
     } else {
         $map['id'] = $value[$this->key];
         $res = $this->where($map)->find();
         if (!$res) {
             $map['id'] = $this->defaultImageId;
             $res = $this->where($map)->find();
         }
         //url字符串拼接
         if (substr($res['savepath'], 0, 1) == '.') {
             $savePath = substr($res['savepath'], 1, strlen($res['savepath']) - 1);
         }
         $res['url'] = add_root_path(C('UPLOAD_ROOT_PATH') . $savePath . $res['savename']);
         return $res;
     }
 }
if (isset($message)) {
    ?>
<div class="img"><img src="<?php 
    echo add_root_path("/theme/wemall/images/success.png");
    ?>
"/></div>
<div class="success"><?php 
    echo $message;
    ?>
</div>
<div class="clr"></div>
<?php 
} else {
    ?>
<div class="img"><img src="<?php 
    echo add_root_path("/theme/wemall/images/fail.png");
    ?>
" /></div>
<div class="error"><?php 
    echo $error;
    ?>
</div>
<div class="clr"></div>
<?php 
}
?>
<p class="detail"></p>
<div>
<p class="jump">
页面自动 <a id="href" href="<?php 
echo $jumpUrl;
示例#8
0
/**
* 	作用:使用证书,以post方式提交xml到对应的接口url
*/
function post_xml_ssl_curl($xml, $url, $second = 30)
{
    $ch = curl_init();
    //超时时间
    curl_setopt($ch, CURLOPT_TIMEOUT, $second);
    //这里设置代理,如果有的话
    //curl_setopt($ch,CURLOPT_PROXY, '8.8.8.8');
    //curl_setopt($ch,CURLOPT_PROXYPORT, 8080);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
    //设置header
    curl_setopt($ch, CURLOPT_HEADER, FALSE);
    //要求结果为字符串且输出到屏幕上
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    //设置证书
    //使用证书:cert 与 key 分别属于两个.pem文件
    //默认格式为PEM,可以注释
    curl_setopt($ch, CURLOPT_SSLCERTTYPE, 'PEM');
    curl_setopt($ch, CURLOPT_SSLCERT, add_root_path(C('WXPAY_SSLCERT_PATH')));
    //默认格式为PEM,可以注释
    curl_setopt($ch, CURLOPT_SSLKEYTYPE, 'PEM');
    curl_setopt($ch, CURLOPT_SSLKEY, add_root_path(C('WXPAY_SSLKEY_PATH')));
    //post提交方式
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
    $data = curl_exec($ch);
    //返回结果
    if ($data) {
        curl_close($ch);
        return $data;
    } else {
        $error = curl_errno($ch);
        echo "curl出错,错误码:{$error}" . "<br>";
        echo "<a href='http://curl.haxx.se/libcurl/c/libcurl-errors.html'>错误原因查询</a></br>";
        curl_close($ch);
        return false;
    }
}
 public function indexAction()
 {
     //        // 判断当前URL是否传入了code和state值
     $checkBrower = C('WECHAT_BROWER');
     if ($checkBrower == true) {
         $code = I('get.code', 'defaultCode');
         $state = I('get.state', '');
         //无授权code,则跳转获取
         if ($code == 'defaultCode' || $state == '' || $code == session('code')) {
             goto_auth();
             return;
         }
         //通过微信返回的CODE值,获取用户信息
         $userInfo = get_user_info($code);
         $userToken = $userInfo['access_token'];
         $this->openid = $userInfo['openid'];
         session('openid', $this->openid);
         session('openidTime', time());
         //            //判断用户权限,未注册跳转到提示页面
         //            $customerInfo = get_customer_info($this->openid);
         //            $customerType = $customerInfo['subscribe_state'];
         //            if($customerType == 0)
         //            {
         ////                转到注册界面
         ////                $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
         ////                $url = "$protocol$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
         ////                $url = U('Register/Index/index');
         //                //转至提示如果成为分销商的界面
         //                $id = 1;
         //                $reply = new ReplyModel();
         //                $reply->setId($id);
         //                $replyInfo = $reply->getInfoById();
         //                redirect($replyInfo['url']);
         //            }
         session('code', $code);
         //获取调用收货地址配置信息
         //获取调用微信JSSDK签名信息
         $jssdk = new JSSDKController();
         $jssdk->setCode($code);
         $jssdk->setState($state);
         $jssdk->setUserToken($userToken);
         //        echo 'pay中当前code值' . $code . "<br />";
         //        echo 'pay中当前state值' . $state . "<br />";
         //        echo 'pay中当前userToken值' . $userToken . '<br />';
         $addressPackage = $jssdk->getAddressPackage();
         $signPackage = $jssdk->getSignPackage();
     }
     $openid = get_openid();
     $this->assign('openid', $openid);
     $title = '确认订单';
     $this->assign('title', $title);
     //获取get信息,去除html过滤.数据类型为JSON格式的字符串
     $ids = I('get.ids', '');
     //字符串转为数组
     $this->assign('ids', $ids);
     $ids = explode("-", $ids);
     $shoppingCart = new ShoppingCartModel();
     $counts = $shoppingCart->getCounts($ids, $openid);
     $this->assign('counts', implode('-', $counts));
     //取用户收货地址信息
     $address = new CustomerAddressModel();
     $address->setOpenid($openid);
     $customerAddress = $address->getLastUseAdderss();
     $this->assign('address', $customerAddress);
     //设置GET收货地址管理的URL
     $customerAddress['chooseAddressUrl'] = U('Address/chooseAddress');
     $this->assign('address', $customerAddress);
     //取收货地址信息HTML
     $this->assign('indexAddress', $this->fetch('indexAddress'));
     /* 进行数据处理,添加商品详情,按不同来源、物流方式进行分组,并将分组后数组的信息返回 */
     $data = $this->dataAccess($ids, $counts);
     $product = $data[0];
     $totalInfo = $data[1];
     //传用户id,优惠券表里取对应的优惠券
     $couponM = D('Coupon');
     $coupon = $couponM->getCoupon($openid);
     $freightM = D('System/Config');
     $freight = $freightM->freightCount();
     //取运费的五个字段
     $this->assign('freight', $freight);
     //给出收货地址URL信息
     $data['addUrl'] = U('OrderForm/Address/add?openid=' . $openid);
     $data['editUrl'] = U('OrderForm/Address/edit?openid=' . $openid);
     $data['saveAddressUrl'] = U('OrderForm/Address/save');
     $data['uploadImageUrl'] = U('OrderForm/Address/uploadImage');
     $data['updateAddressUrl'] = U('OrderForm/Address/updateAddress');
     $data['deleteUrl'] = U('OrderForm/Address/delete');
     $this->assign('data', $data);
     //给出可以定制的header信息
     $this->assign('header', $this->fetch('indexHeader'));
     $this->assign('coupon', $coupon);
     $this->assign('total', $totalInfo);
     //地址下面的条纹图片路径
     $guoduUrl = add_root_path('/theme/wemall/images/guodu.png');
     $this->assign('guoduUrl', $guoduUrl);
     $this->assign('css', $this->fetch('indexCss'));
     $this->assign('signPackage', $signPackage);
     $this->assign('addressPackage', $addressPackage);
     $updateUrl = U('Index/payNow');
     $this->assign('url', $updateUrl);
     $wxJs = $this->fetch('wxJs');
     $this->assign('wxJs', $wxJs);
     $js = $this->fetch('js');
     $this->assign('js', $js);
     $this->assign('product', $product);
     //送入首页URL
     $indexUrl = U('Home/Index/index');
     $this->assign('indexUrl', $indexUrl);
     //定制底部菜单
     $this->assign('footer', $this->fetch('footer'));
     $this->assign('YZBody', $this->fetch('index'));
     $this->display(YZ_TEMPLATE);
 }
<?php

if (!defined('THINK_PATH')) {
    exit;
}
?>
<div class="viewport">
    <div class="tips">
        <img src="<?php 
echo add_root_path('/theme/wemall/images/spacer.gif');
?>
" />
        <div class="text">正在跳转微信支付...</div>   
    </div>
</div>
<?php 
echo $css;
    ?>
" onclick="wxPay($(this))">
        <div class="payline col-xs-9">
            <img src="<?php 
    echo add_root_path('/theme/wemall/images/weixin.png');
    ?>
" alt="微信支付" />微信支付
        </div>
        <div class="col-xs-3 text-center">        
            <span class="glyphicon glyphicon-chevron-right"></span>
        </div>
</div>
<div class="row otherpay"  onclick="otherPay()">
    <div class="col-xs-9">
        <div class="payline"><img class="img1" src="<?php 
    echo add_root_path('/theme/wemall/images/yinhang.png');
    ?>
" alt="其它支付" />银行卡/支付宝支付</div> 
    </div>

    <div class="col-xs-3 text-center">    
       <span class="glyphicon glyphicon-chevron-right"></span>
    </div>
    <div class="col-xs-11 tips col-xs-offset-1">
        <p><?php 
    echo $tips;
    ?>
</p>
    </div>
</div> 
       <?php 
if ($status == error) {
    ?>
    <div class="img"><img width="80px" src=" <?php 
    echo add_root_path("/theme/wemall/images/fail_f.png");
    ?>
"/></div>
    <div class="error"><?php 
    echo $tips;
    ?>
</div>
    <div class="clr"></div>
<?php 
} else {
    ?>
    <div class="img"><img width="80px" src="<?php 
    echo add_root_path("/theme/wemall/images/success_f.png");
    ?>
"/></div>
    <div class="success"><?php 
    echo $tips;
    ?>
</div>
    <div class="clr"></div>
<?php 
}
?>
<p class="detail"></p>
<div class="p"><p class="jump">
系统将在<b id="wait"><?php 
echo $waitSecond;
?>