作者 李涵

合并分支 'li' 到 'master'

订单模块



查看合并请求 !8
r111rer656
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: yhbr
* Date: 2018/9/29
* Time: 13:42
*/
namespace app\order\model;
use think\Model;
use think\Db;
class OrderModel extends Model
{
//订单列表的全部、待支付、代发货、待收货、已完成订单
public function getAllOrders()
{
$all = Db::name('zj_order')
->field('id,order_num,step')
->where(['uid' => session('user.id')])
->order('create_time DESC')
->select()
->toArray();
$unpaid = [];
$undelivered = [];
$unreceived = [];
$completed = [];
$a = 0;
$b = 0;
$c = 0;
$d = 0;
foreach ($all as $key => $item) {
$item['detail'] = Db::name('zj_order_goods')->alias('o')
->field('o.*,g.name,g.intro,g.price,g.thumb')
->join('zj_goods g', 'g.id=o.gid')
->where(['oid' => $item['id']])->select()->toArray();
foreach ($item['detail'] as $k => $v) {
$item['detail'][$k]['thumb'] = cmf_get_image_url($v['thumb']);
}
$all[$key] = $item;
if ($item['step'] == 1) {
$unpaid[$a] = $item;
$a++;
} elseif ($item['step'] == 2) {
$undelivered[$b] = $item;
$b++;
} elseif ($item['step'] == 3) {
$unreceived[$c] = $item;
$c++;
} elseif ($item['step'] == 5) {
$completed[$d] = $item;
$d++;
} else {
continue;
}
}
$data = [
'all' => $all,
'unpaid' => $unpaid,
'undelivered' => $undelivered,
'unreceived' => $unreceived,
'completed' => $completed
];
return $data;
}
}
\ No newline at end of file
... ...
<?php
/**
* Created by PhpStorm.
* User: yhbr
* Date: 2018/9/29
* Time: 10:46
*/
namespace app\sms\controller;
use cmf\controller\HomeBaseController;
use think\Db;
class SmsController extends HomeBaseController
{
public function sendSms()
{
require_once EXTEND_PATH . '/zt_sms/sms.php';
$mobile = request()->param('mobile');
$code = rand(000000, 999999);
$content = '【天生红】您的验证码为' . $code . ',有效期5分钟,请及时使用。';
$sms = new \SendMsg($mobile, $content);
$sms->sendSMS();
$time = time();
$code = [
'mobile' => $mobile,
'code' => $code,
'create_time' => $time,
'expire_time' => $time + 300
];
if (Db::name('zj_code')->where(['mobile' => $mobile])->count()) {
Db::name('zj_code')->where(['mobile' => $mobile])->update($code);
} else {
Db::name('zj_code')->insert($code);
}
}
public function checkCode()
{
$mobile = request()->param('mobile');
$code = request()->param('code');
$data = Db::name('zj_code')->field('mobile,code,expire_time')->where(['mobile' => $mobile])->find();
if (time() > $data['expire_time']) {
$this->success('验证码已过期,请重新发送', '', false);
} else {
if ($code == $data['code'] && $code != null && $data['code'] != null && $mobile == $data['mobile']) {
Db::name('zj_code')->where(['mobile' => $mobile])->update(['code' => '']);
$this->success('身份信息核实成功', url(''), true);
} else {
$this->success('验证码有误', '', false);
}
}
}
public function bindNewMobile()
{
$mobile = request()->param('mobile');
$code = request()->param('code');
$data = Db::name('zj_code')->field('mobile,code,expire_time')->where(['mobile' => $mobile])->find();
if (time() > $data['expire_time']) {
$this->success('验证码已过期,请重新发送', '', false);
} else {
if ($code == $data['code'] && $code != null && $data['code'] != null && $mobile == $data['mobile']) {
Db::name('zj_code')->where(['mobile' => $mobile])->update(['code' => '']);
Db::name('user')->update(['id' => session('user.id'), 'mobile' => $mobile]);
$this->success('绑定成功', url(''), true);
} else {
$this->success('验证码有误', '', false);
}
}
}
}
\ No newline at end of file
... ...
... ... @@ -9,12 +9,14 @@
namespace app\user\controller;
use cmf\controller\HomeBaseController;
use think\Db;
use app\order\model\OrderModel;
class CenterController extends HomeBaseController
{
function _initialize()
{
echo session('user.id', 8);
if (empty(session('user.id'))) {
$this->error('登录失败');
}
... ... @@ -58,16 +60,12 @@ class CenterController extends HomeBaseController
public function editPhone()
{
$request = request();
if ($request->isAjax()) {
if (Db::name('user')->update(['id' => session('user.id'), 'mobile' => $request->param('mobile')])) {
$this->success('编辑成功', url('user/Center/userInfo'));
}
} else {
return $this->fetch('edit_phone', [
'mobile' => Db::name('user')->where(['id' => session('user.id')])->value('mobile')
]);
}
return $this->fetch('edit_phone');
}
public function editPhone2()
{
return $this->fetch('edit_phone2');
}
public function aboutUs()
... ... @@ -183,4 +181,19 @@ class CenterController extends HomeBaseController
]);
}
public function upload()
{
upload();
}
public function orderList()
{
$order = new OrderModel;
$data = $order->getAllOrders();
print_R($data);exit();
return $this->fetch('order_list', [
'data' => $data
]);
}
}
\ No newline at end of file
... ...
... ... @@ -119,8 +119,46 @@
</body>
<script src="__INDEX__/js/jquery.min.js"></script>
<script>
$(".sendcode").click(function () {
var mobile = $(".enterphone").val();
$.ajax({
url:"{:url('sms/Sms/sendSms')}",
data:{
mobile:mobile
},
type:"POST",
dataType:"JSON",
})
})
$(".nextstep").click(function(){
window.location.href='editnewphone.html'
var mobile = $(".enterphone").val();
var code = $(".entercode").val();
if(mobile == '') {
alert('请输入手机号');
}else {
if(code == '') {
alert('请输入验证码');
}else {
$.ajax({
url:"{:url('sms/Sms/checkCode')}",
data:{
mobile:mobile,
code:code
},
type:"POST",
dataType:"JSON",
success: function (data) {
if(data.data === true) {
window.location.href="{:url('user/Center/editPhone2')}"
}else {
alert(data.msg);
}
}
})
}
}
})
</script>
</html>
... ...
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<link rel="stylesheet" href="https://at.alicdn.com/t/font_834805_0ml90wdq5hzm.css">
<link rel="stylesheet" href="__INDEX__/css/base.css">
<link rel="stylesheet" href="__INDEX__/css/swiper.min.css">
<script type="text/javascript" src="__INDEX__/js/base.js"></script>
<title>编辑手机号</title>
<style>
body,html{
width:100%;
height:100%;
background: RGBA(245, 246, 250, 1);
}
.phone{
width:6.96rem;
margin: 0 auto;
height:1rem;
background: #fff;
border-radius: 0.5rem;
font-size: 0.28rem;
color: RGBA(151, 160, 168, 1);
/*padding: 0.37rem 0.52rem;*/
margin-top: 0.32rem;
}
.enterphone{
width:6.96rem;
margin: 0 auto;
height:1rem;
background: #fff;
border-radius: 0.5rem;
font-size: 0.28rem;
color: RGBA(151, 160, 168, 1);
padding: 0.37rem 0.52rem;
border:none;
outline:none;
}
.code{
font-size: 0;
display:flex;
justify-content: space-between;
align-content: center;
width:6.96rem;
margin: 0 auto;
height:1rem;
background: #fff;
border-radius: 0.5rem;
color: RGBA(151, 160, 168, 1);
margin-top: 0.32rem;
}
.code_num{
height:1rem;
line-height: 1rem;
font-size: 0.28rem;
margin-left: 0.52rem;
}
.entercode{
height:1rem;
line-height: 1rem;
font-size: 0.28rem;
outline:none;
border:none;
border-radius: 0.5rem;
color: RGBA(151, 160, 168, 1);
}
.sendcode{
width:2.44rem;
font-size: 0.28rem;
height:0.72rem;
background: RGBA(254, 10, 1, 1);
color:#fff;
border-radius: 0.36rem;
line-height: 0.72rem;
text-align: center;
margin-top: 0.15rem;
margin-right: 0.37rem;
}
.nextstep{
width:6.86rem;
height:0.88rem;
text-align: center;
line-height: 0.88rem;
background:RGBA(254, 10, 1, 1);
font-size: 0.32rem;
color:#fff;
border-radius: 0.44rem;
position:fixed;
bottom:0.55rem;
left:0;
right:0;
margin: 0 auto;
box-shadow:0px 15px 30px 0px rgba(254,10,1,0.24);
}
</style>
</head>
<body>
<div class="container">
<div class="phone">
<input type="text" class="enterphone" placeholder="输入新的手机号">
</div>
</div>
<div class="code">
<p class="code_num">
<input type="text" class="entercode" placeholder="验证码">
</p>
<p class="sendcode">发送验证码</p>
</div>
<p class="nextstep">
确定
</p>
</body>
<script src="__INDEX__/js/jquery.min.js"></script>
<script>
$(".sendcode").click(function () {
var mobile = $(".enterphone").val();
$.ajax({
url:"{:url('sms/Sms/sendSms')}",
data:{
mobile:mobile
},
type:"POST",
dataType:"JSON",
})
})
$(".nextstep").click(function(){
var mobile = $(".enterphone").val();
$.ajax({
url:"{:url('sms/Sms/checkCode')}",
data:{
mobile:mobile,
code:$(".entercode").val()
},
type:"POST",
dataType:"JSON",
success: function (data) {
if(data.data === true) {
window.location.href="{:url('user/Center/userInfo')}"
}else {
alert(data.msg);
}
}
})
})
</script>
</html>
\ No newline at end of file
... ...
... ... @@ -131,7 +131,7 @@
})
//全部订单
$(".myorder").click(function(){
window.location.href='myorder.html'
window.location.href="{:url('user/Center/orderList')}"
})
$(".home").click(function(){
window.location.href="{:url('index/Index/index')}";
... ...
... ... @@ -36,7 +36,7 @@
<p class="iconfont icon-xiangji" id="imghead" onclick="$('#previewImg').click();"></p>
</div>
<!--<img src="__INDEX__/img/delet.png" alt="" style="position:absolute;bottom:92px;left:46px" class="deleteimg"/>-->
<input type="file" onchange="previewImage(this)" style="display: none;" id="previewImg">
<form id="form"><input type="file" name="file" onchange="previewImage(this)" style="display: none;" id="previewImg"></form>
</div>
</div>
<div class="head">
... ... @@ -127,6 +127,25 @@
img.src = evt.target.result;
}
reader.readAsDataURL(file.files[0]);
var formData=new FormData($("#form")[0]);
$.ajax({
type:"post",
url:"{:url('user/Center/upload')}",
data:formData,
dataType:'json',
async:false,
cache:false,
contentType:false,
processData:false,
success:function(data){
console.log(data);
},
error:function(res){
}
});
} else //兼容IE
{
var sFilter = 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src="';
... ...
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<link rel="stylesheet" href="https://at.alicdn.com/t/font_834805_0ml90wdq5hzm.css">
<link rel="stylesheet" href="__INDEX__/css/base.css">
<link rel="stylesheet" href="__INDEX__/css/myorder.css">
<link rel="stylesheet" href="__INDEX__/css/swiper.min.css">
<script type="text/javascript" src="__INDEX__/js/base.js"></script>
<title>全部订单</title>
</head>
<body>
<div class="deletewrap" style="display:none">
<div class="deletepop">
<p class="suredelete">取消订单</p>
<p class="certainornot">确定取消该订单吗?</p>
<div class="certain">
<p class="cancel">取消</p>
<p class="sure">确认</p>
</div>
</div>
</div>
<div class="container">
<div class="head">
<ul class="order_list">
<li class="active" ordertype="0">
<em></em>
全部
</li>
<li ordertype="1">
<em></em>
待支付
</li>
<li ordertype="2">
<em></em>
待发货
</li>
<li ordertype="3">
<em></em>
待收货
</li>
<li ordertype="4">
<em></em>
已完成
</li>
</ul>
</div>
<!--全部订单-->
<div class="orderlist allorder">
<!--代付款-->
<div class="item_order_list">
<div class="order_head">
<div class="order_num">
<p class="order_list_num">订单号:</p>
<p class="item_num">201807122659</p>
</div>
<p class="order_type">待付款</p>
</div>
<div class="order_content">
<div class="order_content_item">
<p class="content_item_img">
<img src="__INDEX__/img/apic01.png" alt="">
</p>
<div class="content_text">
<p class="good_name">百草味 肉干肉脯百草味 肉干肉脯 白芝麻猪肉脯</p>
<div class="good_test">
<p class="item_tast">奶油味夏威夷果</p>
<p class="tast_num">x1</p>
</div>
<p class="item_price">
<span class="item_money">30</span>
</p>
</div>
</div>
<div class="order_content_item">
<p class="content_item_img">
<img src="__INDEX__/img/apic01.png" alt="">
</p>
<div class="content_text">
<p class="good_name">百草味 肉干肉脯百草味 肉干肉脯 白芝麻猪肉脯</p>
<div class="good_test">
<p class="item_tast">奶油味夏威夷果</p>
<p class="tast_num">x1</p>
</div>
<p class="item_price">
<span class="item_money">30</span>
</p>
</div>
</div>
</div>
<div class="unpay">
<p class="pay">付款</p>
<p class="cancelorder cancellist">取消订单</p>
</div>
</div>
<!--待发货-->
<div class="item_order_list">
<div class="order_head">
<div class="order_num">
<p class="order_list_num">订单号:</p>
<p class="item_num">201807122659</p>
</div>
<p class="order_type">待发货</p>
</div>
<div class="order_content">
<div class="order_content_item">
<p class="content_item_img">
<img src="__INDEX__/img/apic01.png" alt="">
</p>
<div class="content_text">
<p class="good_name">百草味 肉干肉脯百草味 肉干肉脯 白芝麻猪肉脯</p>
<div class="good_test">
<p class="item_tast">奶油味夏威夷果</p>
<p class="tast_num">x1</p>
</div>
<p class="item_price">
<span class="item_money">30</span>
</p>
</div>
</div>
<div class="order_content_item">
<p class="content_item_img">
<img src="__INDEX__/img/apic01.png" alt="">
</p>
<div class="content_text">
<p class="good_name">百草味 肉干肉脯百草味 肉干肉脯 白芝麻猪肉脯</p>
<div class="good_test">
<p class="item_tast">奶油味夏威夷果</p>
<p class="tast_num">x1</p>
</div>
<p class="item_price">
<span class="item_money">30</span>
</p>
</div>
</div>
</div>
</div>
<!--待收货-->
<div class="item_order_list">
<div class="order_head">
<div class="order_num">
<p class="order_list_num">订单号:</p>
<p class="item_num">201807122659</p>
</div>
<p class="order_type">待收货</p>
</div>
<div class="order_content">
<div class="order_content_item">
<p class="content_item_img">
<img src="__INDEX__/img/apic01.png" alt="">
</p>
<div class="content_text">
<p class="good_name">百草味 肉干肉脯百草味 肉干肉脯 白芝麻猪肉脯</p>
<div class="good_test">
<p class="item_tast">奶油味夏威夷果</p>
<p class="tast_num">x1</p>
</div>
<p class="item_price">
<span class="item_money">30</span>
</p>
</div>
</div>
<div class="order_content_item">
<p class="content_item_img">
<img src="__INDEX__/img/apic01.png" alt="">
</p>
<div class="content_text">
<p class="good_name">百草味 肉干肉脯百草味 肉干肉脯 白芝麻猪肉脯</p>
<div class="good_test">
<p class="item_tast">奶油味夏威夷果</p>
<p class="tast_num">x1</p>
</div>
<p class="item_price">
<span class="item_money">30</span>
</p>
</div>
</div>
</div>
<div class="unpay">
<p class="pay">确认收货</p>
</div>
</div>
<!--已完成-->
<div class="item_order_list drawback">
<div class="order_head">
<div class="order_num">
<p class="order_list_num">订单号:</p>
<p class="item_num">201807122659</p>
</div>
<p class="order_type">已完成</p>
</div>
<div class="order_content">
<div class="order_content_item">
<p class="content_item_img">
<img src="__INDEX__/img/apic01.png" alt="">
</p>
<div class="content_text">
<p class="good_name">百草味 肉干肉脯百草味 肉干肉脯 白芝麻猪肉脯</p>
<div class="good_test">
<p class="item_tast">奶油味夏威夷果</p>
<p class="tast_num">x1</p>
</div>
<p class="item_price">
<span class="item_money">30</span>
</p>
</div>
</div>
<div class="order_content_item">
<p class="content_item_img">
<img src="__INDEX__/img/apic01.png" alt="">
</p>
<div class="content_text">
<p class="good_name">百草味 肉干肉脯百草味 肉干肉脯 白芝麻猪肉脯</p>
<div class="good_test">
<p class="item_tast">奶油味夏威夷果</p>
<p class="tast_num">x1</p>
</div>
<p class="item_price">
<span class="item_money">30</span>
</p>
</div>
</div>
</div>
<div class="unpay">
<p class="pay eval">评价</p>
<p class="cancelorder refund">申请退款</p>
</div>
</div>
<!--待退货-->
<div class="item_order_list">
<div class="order_head">
<div class="order_num">
<p class="order_list_num">订单号:</p>
<p class="item_num">201807122659</p>
</div>
<p class="order_type">待发货</p>
</div>
<div class="order_content">
<div class="order_content_item">
<p class="content_item_img">
<img src="__INDEX__/img/apic01.png" alt="">
</p>
<div class="content_text">
<p class="good_name">百草味 肉干肉脯百草味 肉干肉脯 白芝麻猪肉脯</p>
<div class="good_test">
<p class="item_tast">奶油味夏威夷果</p>
<p class="tast_num">x1</p>
</div>
<p class="item_price">
<span class="item_money">30</span>
</p>
</div>
</div>
<div class="order_content_item">
<p class="content_item_img">
<img src="__INDEX__/img/apic01.png" alt="">
</p>
<div class="content_text">
<p class="good_name">百草味 肉干肉脯百草味 肉干肉脯 白芝麻猪肉脯</p>
<div class="good_test">
<p class="item_tast">奶油味夏威夷果</p>
<p class="tast_num">x1</p>
</div>
<p class="item_price">
<span class="item_money">30</span>
</p>
</div>
</div>
</div>
</div>
</div>
<!--待支付-->
<div class="orderlist waitpay" style="display:none">
<div class="item_order_list">
<div class="order_head">
<div class="order_num">
<p class="order_list_num">订单号:</p>
<p class="item_num">201807122659</p>
</div>
<p class="order_type">待付款</p>
</div>
<div class="order_content">
<div class="order_content_item">
<p class="content_item_img">
<img src="__INDEX__/img/apic01.png" alt="">
</p>
<div class="content_text">
<p class="good_name">百草味 肉干肉脯百草味 肉干肉脯 白芝麻猪肉脯</p>
<div class="good_test">
<p class="item_tast">奶油味夏威夷果</p>
<p class="tast_num">x1</p>
</div>
<p class="item_price">
<span class="item_money">30</span>
</p>
</div>
</div>
<div class="order_content_item">
<p class="content_item_img">
<img src="__INDEX__/img/apic01.png" alt="">
</p>
<div class="content_text">
<p class="good_name">百草味 肉干肉脯百草味 肉干肉脯 白芝麻猪肉脯</p>
<div class="good_test">
<p class="item_tast">奶油味夏威夷果</p>
<p class="tast_num">x1</p>
</div>
<p class="item_price">
<span class="item_money">30</span>
</p>
</div>
</div>
</div>
<div class="unpay">
<p class="pay">付款</p>
<p class="cancelorder cancellist">取消订单</p>
</div>
</div>
</div>
<!--待发货-->
<div class="orderlist waitsend" style="display:none">
<div class="item_order_list">
<div class="order_head">
<div class="order_num">
<p class="order_list_num">订单号:</p>
<p class="item_num">201807122659</p>
</div>
<p class="order_type">待发货</p>
</div>
<div class="order_content">
<div class="order_content_item">
<p class="content_item_img">
<img src="__INDEX__/img/apic01.png" alt="">
</p>
<div class="content_text">
<p class="good_name">百草味 肉干肉脯百草味 肉干肉脯 白芝麻猪肉脯</p>
<div class="good_test">
<p class="item_tast">奶油味夏威夷果</p>
<p class="tast_num">x1</p>
</div>
<p class="item_price">
<span class="item_money">30</span>
</p>
</div>
</div>
<div class="order_content_item">
<p class="content_item_img">
<img src="__INDEX__/img/apic01.png" alt="">
</p>
<div class="content_text">
<p class="good_name">百草味 肉干肉脯百草味 肉干肉脯 白芝麻猪肉脯</p>
<div class="good_test">
<p class="item_tast">奶油味夏威夷果</p>
<p class="tast_num">x1</p>
</div>
<p class="item_price">
<span class="item_money">30</span>
</p>
</div>
</div>
</div>
</div>
</div>
<!--待收货-->
<div class="orderlist waittake" style="display:none">
<div class="item_order_list">
<div class="order_head">
<div class="order_num">
<p class="order_list_num">订单号:</p>
<p class="item_num">201807122659</p>
</div>
<p class="order_type">待收货</p>
</div>
<div class="order_content">
<div class="order_content_item">
<p class="content_item_img">
<img src="__INDEX__/img/apic01.png" alt="">
</p>
<div class="content_text">
<p class="good_name">百草味 肉干肉脯百草味 肉干肉脯 白芝麻猪肉脯</p>
<div class="good_test">
<p class="item_tast">奶油味夏威夷果</p>
<p class="tast_num">x1</p>
</div>
<p class="item_price">
<span class="item_money">30</span>
</p>
</div>
</div>
<div class="order_content_item">
<p class="content_item_img">
<img src="__INDEX__/img/apic01.png" alt="">
</p>
<div class="content_text">
<p class="good_name">百草味 肉干肉脯百草味 肉干肉脯 白芝麻猪肉脯</p>
<div class="good_test">
<p class="item_tast">奶油味夏威夷果</p>
<p class="tast_num">x1</p>
</div>
<p class="item_price">
<span class="item_money">30</span>
</p>
</div>
</div>
</div>
<div class="unpay">
<p class="pay">确认收货</p>
</div>
</div>
</div>
<!--已完成-->
<div class="orderlist finish drawback" style="display:none">
<div class="item_order_list">
<div class="order_head">
<div class="order_num">
<p class="order_list_num">订单号:</p>
<p class="item_num">201807122659</p>
</div>
<p class="order_type">已完成</p>
</div>
<div class="order_content">
<div class="order_content_item">
<p class="content_item_img">
<img src="__INDEX__/img/apic01.png" alt="">
</p>
<div class="content_text">
<p class="good_name">百草味 肉干肉脯百草味 肉干肉脯 白芝麻猪肉脯</p>
<div class="good_test">
<p class="item_tast">奶油味夏威夷果</p>
<p class="tast_num">x1</p>
</div>
<p class="item_price">
<span class="item_money">30</span>
</p>
</div>
</div>
<div class="order_content_item">
<p class="content_item_img">
<img src="__INDEX__/img/apic01.png" alt="">
</p>
<div class="content_text">
<p class="good_name">百草味 肉干肉脯百草味 肉干肉脯 白芝麻猪肉脯</p>
<div class="good_test">
<p class="item_tast">奶油味夏威夷果</p>
<p class="tast_num">x1</p>
</div>
<p class="item_price">
<span class="item_money">30</span>
</p>
</div>
</div>
</div>
<div class="unpay">
<p class="pay eval">评价</p>
<p class="cancelorder refund">申请退款</p>
</div>
</div>
</div>
</div>
</body>
<script type="text/javascript" src="__INDEX__/js/jquery.min.js"></script>
<script>
$(".order_list li").click(function(){
$(this).addClass("active");
$(this).siblings("li").removeClass("active");
if($(this).attr("ordertype")==0){
$(".allorder").css("display","block");
$(".allorder").siblings(".orderlist").css("display","none")
}else if($(this).attr("ordertype")==1){
$(".waitpay").css("display","block");
$(".waitpay").siblings(".orderlist").css("display","none")
}else if($(this).attr("ordertype")==2){
$(".waitsend").css("display","block");
$(".waitsend").siblings(".orderlist").css("display","none")
}else if($(this).attr("ordertype")==3){
$(".waittake").css("display","block");
$(".waittake").siblings(".orderlist").css("display","none")
}else if($(this).attr("ordertype")==4){
$(".finish").css("display","block");
$(".finish").siblings(".orderlist").css("display","none")
}
})
//取消订单弹出层
$(".cancellist").click(function(){
$(".deletewrap").show();
})
//确认取消订单
$(".sure").click(function(){
$(".deletewrap").hide();
})
$(".cancel").click(function(){
$(".deletewrap").hide();
})
//申请退款
$(".refund").click(function(){
window.event.stopPropagation()
window.location.href='application.html'
})
//评价
$(".eval").click(function(){
window.event.stopPropagation()
window.location.href='evalute.html'
})
//退款申请详情页
$(".drawback").click(function(){
window.location.href='applicationdetail.html'
})
</script>
</html>
... ...
... ... @@ -1848,4 +1848,38 @@ function printer($config, $content)
require_once EXTEND_PATH . 'yly/printer.php';
$api = new \Yprint($partner, $machine_code, $content, $apiKey, $msign);
$api->action_print();
}
function upload()
{
$request = request();
if ($request->isAjax()) {
$file = request()->file('file');
$info = $file->move(ROOT_PATH . 'public' . DS . 'upload/portal/headimg');
if ($info) {
// 成功上传后 获取上传信息
// 输出 jpg
//echo $info->getExtension();
// 输出 20160820/42a79759f284b767dfcb2a0197904287.jpg
$save = cmf_get_image_url('portal/headimg/' . $info->getSaveName());
// 输出 42a79759f284b767dfcb2a0197904287.jpg
//echo $info->getFilename();
//更新头像
//原始头像
$origin = Db::name('user')->where(['id'=>session('user.id')])->value('avatar');
if (Db::name('user')->update(['id' => session('user.id'), 'avatar' => $save])) {
unlink($origin);
echo json_encode(['msg' => 'ok', 'data' => $save]);
exit();
} else {
unlink($save);
}
} else {
// 上传失败获取错误信息
echo $file->getError();
exit();
}
}
}
\ No newline at end of file
... ...
<?php
class SendMsg {
protected $mobile;
protected $content;
function __construct($mobile, $content) {
$this->mobile=$mobile;
$this->content=$content;
}
/**
* 百荣科技短信接口
*/
public function sendSMS(){
date_default_timezone_set('PRC');//设置时区
$url = "http://www.ztsms.cn/sendNSms.do";//提交地址
$username = "zhaochanggongren";//用户名
$password = "Cxz307312";//原密码
$data = array(
'content' => $this->content."",//短信内容
'mobile' => $this->mobile,//手机号码
'productid' => '676767',//产品id
'xh' => ''//小号
);
$isTranscoding = false;
$timeout = 30;
$data['content'] = $isTranscoding === true ? mb_convert_encoding($data['content'], "UTF-8") : $data['content'];
$data['username']=$username;
$data['tkey'] = date('YmdHis');
$data['password'] = md5(md5($password) . $data['tkey']);
$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, $_SERVER['HTTP_USER_AGENT']); // 模拟用户使用的浏览器
curl_setopt($curl, CURLOPT_POST, true); // 发送一个常规的Post请求
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data)); // Post提交的数据包
curl_setopt($curl, CURLOPT_TIMEOUT, $timeout); // 设置超时限制防止死循环
curl_setopt($curl, CURLOPT_HEADER, false); // 显示返回的Header区域内容
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); // 获取的信息以文件流的形式返回
$result = curl_exec($curl); // 执行操作
if (curl_errno($curl)){
echo 'Error POST'.curl_error($curl);
}
return $result;
}
}
\ No newline at end of file
... ...