作者 王晓刚
1 个管道 的构建 通过 耗费 19 秒

bug

... ... @@ -23,6 +23,14 @@ class GoodsdetailsController extends WeChatBaseController{
$uid = cmf_get_current_user_id();
//判断跳转过来的链接
if(!empty($goods_id['status']) && !empty($goods_id['id'])){
//判断上级权限是否存在
$my_user = Db::name('my_user') -> where('id',$goods_id['id']) -> find();
if(empty($my_user)){
$this->error('查无此人','','','');
}
if($my_user['status'] != $goods_id['status']){
$this->error('该二维码已失效','','','');
}
$share_user = Db::name('my_user') -> where('uid',$uid) -> find();
//判断用户是否存在
if(!empty($share_user)){
... ...
... ... @@ -80,6 +80,14 @@ class IndexController extends WeChatBaseController
$data_id = $this -> request -> param();
//判断跳转链接是否存在数据
if(!empty($data_id['status_id'])){
//判断上级权限是否存在
$my_user = Db::name('my_user') -> where('id',$data_id['my_user_id']) -> find();
if(empty($my_user)){
$this->error('查无此人','','','');
}
if($my_user['status'] != $data_id['status_id']){
$this->error('该二维码已失效','','','');
}
//判断用户是不是老师
if($data_my_user['status'] == 3){
//是老师则判断老师绑定状态
... ... @@ -137,6 +145,14 @@ class IndexController extends WeChatBaseController
$data_id = $this -> request -> param();
//判断跳转链接是否存在数据 如果不存在添加一条自由人用户
if(!empty($data_id)){
//判断上级权限是否存在
$my_user = Db::name('my_user') -> where('id',$data_id['my_user_id']) -> find();
if(empty($my_user)){
$this->error('查无此人','','','');
}
if($my_user['status'] != $data_id['status_id']){
$this->error('该二维码已失效','','','');
}
//判断数据是老师还是业务员
if($data_id['status_id'] == 2){
//业务员分享 添加老师
... ...
... ... @@ -189,6 +189,23 @@ class OrderSalesmanController extends WeChatBaseController
if(empty($indent)){
$this->error('查询为空');
}
if($indent['is_courier'] == 1){
$school = Db::name('school')->where(['region'=>$indent['region'],'uid'=>$indent['salesman_uid']])->select();
$arr1 = [];
foreach($school as $key => $s){
$arr1[$key]['value'] = $s['id'];
$arr1[$key]['text'] = $s['school'];
}
$school_id = Db::name('school')->where(['region'=>$indent['region'],'uid'=>$indent['salesman_uid']])->value('id');
$grade = Db::name('grade_class')->where(['school_id'=>$school_id])->select()->toArray();
foreach($grade as $key => $g){
$class = explode('-',$g['class']);
$grade[$key]['start'] = $class[0];
$grade[$key]['end'] = $class[1];
}
$this->assign('school',json_encode($arr1));
$this->assign('grade',$grade);
}
$indentGoodsModel = new IndentGoodsModel();
$indent_goods = $indentGoodsModel->selectData(['indent_id'=>$indent['id']]);
if(!empty($indent['indent_address'])){
... ... @@ -225,4 +242,36 @@ class OrderSalesmanController extends WeChatBaseController
$this->success('更新成功');
}
}
public function updatePost(){
$param = $this->request->param();
$indent_id = $this->request->param('indent_id',0,'intval');
if(empty($indent_id)){
$this->error('缺少必要参数123');
}
$indentModel = new IndentModel();
$data = $indentModel->findData(['id'=>$indent_id]);
if($data['is_courier'] == 1){
if(empty($param['name']) || empty($param['region']) || empty($param['school']) || empty($param['grade_class']) || empty($param['phone'])){
$this->error('缺少必要参数');
}
$grade_class = explode('-',$param['grade_class']);
$arr['name'] = $param['name'];
$arr['phone'] = $param['phone'];
$arr['region'] = $param['region'];
$arr['school'] = $param['school'];
$arr['grade'] = $grade_class[0];
$arr['class'] = $grade_class[1];
$result = $indentModel ->updateData(['id'=>$indent_id],$arr);
}else if($data['is_courier'] == 2){
if(empty($param['name']) || empty($param['phone']) || empty($param['region']) || empty($param['region_detail'])){
$this->error('缺少必要参数123');
}
$arr['name'] = $param['name'];
$arr['phone'] = $param['phone'];
$arr['region'] = $param['region'];
$arr['region_detail'] = $param['region_detail'];
$result = $indentModel ->updateData(['id'=>$indent_id],$arr);
}
$this->success('SUCCESS');
}
}
\ No newline at end of file
... ...
... ... @@ -171,6 +171,8 @@ class OrderpageController extends WeChatBaseController{
$indet_data_update['indent_address'] = $address['id'];
$indet_data_update['name'] = $address['name'];
$indet_data_update['phone'] = $address['phone'];
$indet_data_update['region'] = $address['region'];
$indet_data_update['region_detail'] = $address['detailed'];
Db::name('indent') -> update($indet_data_update);
}
$this -> assign('address',$address);
... ... @@ -288,7 +290,10 @@ class OrderpageController extends WeChatBaseController{
* 获取学校
*/
public function get_school(){
$user_id = cmf_get_current_user_id();
$user_id = $this->request->param('user_id');
if(empty($user_id)){
$user_id = cmf_get_current_user_id();
}
$my_user = Db::name('my_user')->where('uid',$user_id)->find();
if($my_user['status'] == 3){
$my_user2 = Db::name('my_user')->where('id',$my_user['pid'])->find();
... ...
... ... @@ -138,8 +138,10 @@ class ShareController extends WeChatBaseController
if(empty($param['phone'])){
$this->error('手机号不能为空');
}
$data['name'] = $param['name'];
$data['phone'] = $param['phone'];
$user_id = cmf_get_current_user_id();
$result = Db::name('my_user')->where('uid',$user_id)->update($param);
$result = Db::name('my_user')->where('uid',$user_id)->update($data);
if(empty($result)){
$this->error('保存失败');
}else{
... ...
... ... @@ -194,7 +194,7 @@
</style>
</head>
<body style="cursor:pointer;">
<body style="cursor:pointer;background: #fff">
<!--学校弹窗-->
... ... @@ -398,6 +398,9 @@
<div class="log_three_select_one log_three_select_btn clear ">
重置
</div>
<!--<div class="log_three_select_one log_three_select_btn html2canvas">-->
<!--生成图片-->
<!--</div>-->
<input type="hidden" id="school" value=""/>
<input type="hidden" id="grade" value=""/>
<input type="hidden" id="is_courier" value="1"/>
... ... @@ -416,7 +419,7 @@
<!-- 列表内容 -->
<div>
<!--未发货-->
<div class="log_three_list_contant" style="display: block;">
<div class="log_three_list_contant" style="display: block;background: rgba(359, 295, 265, 1)">
<foreach name="$data" item="vo">
<if condition="$vo.state eq 2">
<php>$arr1[] = $vo;</php>
... ... @@ -1406,6 +1409,51 @@
window.event ? (window.event.cancelBubble = true) : e.stopPropagation();
}
</script>
<script src="https://cdn.bootcss.com/html2canvas/0.5.0-beta4/html2canvas.js"></script>
<script>
$(".html2canvas").click(function () {
// html2canvas($(".log_three_list_contant")).then(function (canvas) {
// var imgUri = canvas.toDataURL("image/png").replace("image/png", "image/octet-stream"); // 获取生成的图片的url
// window.location.href = imgUri; // 下载图片
// });
alert(132);
html2canvas($('.log_three_list_contant'), {
onrendered: function (canvas) {
var data = canvas.toDataURL("image/jpg","image/octet-stream");//生成的格式
//data就是生成的base64码啦
console.log(data);
downloadFile('ceshi.png',data);
}
});
});
function downloadFile(fileName, content) {
let aLink = document.createElement('a');
let blob = this.base64ToBlob(content); //new Blob([content]);
let evt = document.createEvent("HTMLEvents");
evt.initEvent("click", true, true);//initEvent 不加后两个参数在FF下会报错 事件类型,是否冒泡,是否阻止浏览器的默认行为
aLink.download = fileName;
aLink.href = URL.createObjectURL(blob);
// aLink.dispatchEvent(evt);
aLink.click()
}
//base64转blob
function base64ToBlob(code) {
let parts = code.split(';base64,');
let contentType = parts[0].split(':')[1];
let raw = window.atob(parts[1]);
let rawLength = raw.length;
let uInt8Array = new Uint8Array(rawLength);
for (let i = 0; i < rawLength; ++i) {
uInt8Array[i] = raw.charCodeAt(i);
}
return new Blob([uInt8Array], {type: contentType});
}
</script>
</body>
</html>
\ No newline at end of file
... ...
... ... @@ -130,7 +130,10 @@
姓名
</div>
<div class="log_four_input_one_center">
<div id="city_text">{$data.indent_address.name}</div>
<!--<div id="city_text">-->
<!--{$data.indent_address.name}-->
<!--</div>-->
<input type="text" class="name" value="{$data.name}" />
</div>
<div class="log_four_input_one_right">
<img src="__TMPL__/public/assets/images/29.png" alt=""/>
... ... @@ -141,18 +144,19 @@
电话
</div>
<div class="log_four_input_one_center">
<div id="city_text">{$data.indent_address.phone}</div>
<!--<div id="city_text">{$data.indent_address.phone}</div>-->
<input type="text" class="phone" value="{$data.phone}" />
</div>
<div class="log_four_input_one_right">
<img src="__TMPL__/public/assets/images/29.png" alt=""/>
</div>
</div>
<div class="log_four_input_one">
<div class="log_four_input_one city_word1">
<div class="log_four_input_one_left">
地址
</div>
<div class="log_four_input_one_center">
<div id="city_text">{$data.indent_address.region}</div>
<div id="city_text1" class="region">{$data.region}</div>
</div>
<div class="log_four_input_one_right">
<img src="__TMPL__/public/assets/images/29.png" alt=""/>
... ... @@ -163,42 +167,46 @@
详细地址
</div>
<div class="log_four_input_one_center">
<div id="city_text">{$data.indent_address.detailed}</div>
<!--<div id="city_text">{$data.indent_address.detailed}</div>-->
<input type="text" class="region_detail" value="{$data.region_detail}" />
</div>
<div class="log_four_input_one_right">
<img src="__TMPL__/public/assets/images/29.png" alt=""/>
</div>
</div>
<else/>
<div class="log_four_input_one">
<div class="log_four_input_one city_word">
<div class="log_four_input_one_left">
地区
</div>
<div class="log_four_input_one_center">
<div id="city_text">{$data.region}</div>
<div id="city_text" class="region" style="color: black;">
{$data.region}
</div>
</div>
<div class="log_four_input_one_right">
<img src="__TMPL__/public/assets/images/29.png" alt=""/>
</div>
</div>
<div class="log_four_input_one">
<div class="log_four_input_one log_three_select_school2">
<div class="log_four_input_one_left">
学校
</div>
<div class="log_four_input_one_center">
<div id="city_text">{$data.school}</div>
<div class="log_four_input_one_center school">
{$data.school}
</div>
<div class="log_four_input_one_right">
<img src="__TMPL__/public/assets/images/29.png" alt=""/>
</div>
</div>
<div class="log_four_input_one">
<div class="log_four_input_one log_three_select_class2">
<div class="log_four_input_one_left">
班级
</div>
<div class="log_four_input_one_center">
<div id="city_text">{$data.grade}-{$data.class}</div>
<div class="grade_class_text">{$data.grade}-{$data.class}</div>
</div>
<input type="hidden" class="grade_class" value="{$data.grade}-{$data.class}"/>
<div class="log_four_input_one_right">
<img src="__TMPL__/public/assets/images/29.png" alt=""/>
</div>
... ... @@ -208,7 +216,7 @@
姓名
</div>
<div class="log_four_input_one_center">
<div id="city_text">{$data.name}</div>
<input style="width: 200px;text-align: left" class="name" type="text" value="{$data.name}"/>
</div>
<div class="log_four_input_one_right">
<img src="__TMPL__/public/assets/images/29.png" alt=""/>
... ... @@ -219,7 +227,7 @@
手机号
</div>
<div class="log_four_input_one_center">
<div id="city_text">{$data.phone}</div>
<input style="width: 200px;text-align: left" class="phone" type="text" value="{$data.phone}"/>
</div>
</div>
</if>
... ... @@ -269,7 +277,10 @@
<!-- 底部按钮 -->
<div class="log_seven_btn log_seven_btn9" style="margin-top: 0.36rem;">
<if condition="$data.state eq 2">
<div class="log_seven_btn_contant send" data-is_courier="{$data.is_courier}" data-indent-id="{$data.id}">
<div class="log_seven_btn_contant update" style="margin: 15px;" data-indent-id="{$data.id}">
确认修改
</div>
<div class="log_seven_btn_contant send" style="margin: 15px;" data-is_courier="{$data.is_courier}" data-indent-id="{$data.id}">
立即发货
</div>
<elseif condition="$data.state eq 5"/>
... ... @@ -286,6 +297,12 @@
<script src="__TMPL__/public/assets/js/mui.picker.min.js"></script>
<script src="__TMPL__/public/assets/js/city.data-3.js"></script>
<script>
</script>
<script>
<notempty name='$school'>
var myschool = {$school};
school_s(myschool);
</notempty>
var excompanypicker = new mui.PopPicker();
excompanypicker.setData([{
value: 'SF',
... ... @@ -336,6 +353,104 @@
$('.excompany_word').css('color', '#333333');
});
})
var schoolpicker = new mui.PopPicker();
var classpicker = new mui.PopPicker();
function school_s(myschool){
(function($, doc) {
console.log(myschool);
$.init();
$.ready(function() {
schoolpicker.setData(myschool);
});
})(mui, document);
}
function grade_s(mygrade){
(function($, doc) {
$.init();
$.ready(function() {
classpicker.setData(mygrade);
});
})(mui, document);
}
var city_picker = new mui.PopPicker({
layer: 3
});
city_picker.setData(cityData3);
$(".city_word").on("tap", function() {
setTimeout(function() {
city_picker.show(function(items) {
$("#city_text").text((items[0] || {}).text + "," + (items[1] || {}).text + "," + (items[2] || {}).text); //该ID为接收城市ID字段
$('#city_text').css('color', '#333333');
$("#city_text").html((items[0] || {}).text + " " + (items[1] || {}).text + " " + (items[2] || {}).text);
var area = items[0].text+" "+items[1].text+" "+items[2].text;
$('.region').val(area);
$.get("{:url('orderpage/get_school')}",{'area':area,'user_id':{$data.uid}},function(res){
$('.xuexiao_name').text('请选择学校');
$('.xuexiao_name').removeAttr("style");
$('.banji_name').text('请选择班级');
$('.banji_name').removeAttr("style");
if(res){
myschool = JSON.parse(res);
console.log(myschool);
school_s(myschool);
}else{
school_s('');
grade_s('');
}
});
});
}, 200);
});
$(".city_word1").on("tap", function() {
setTimeout(function() {
city_picker.show(function(items) {
$("#city_text1").text((items[0] || {}).text + "," + (items[1] || {}).text + "," + (items[2] || {}).text); //该ID为接收城市ID字段
$('#city_text1').css('color', '#333333');
$("#city_text1").html((items[0] || {}).text + " " + (items[1] || {}).text + " " + (items[2] || {}).text);
var area = items[0].text+" "+items[1].text+" "+items[2].text;
});
}, 200);
});
var school_name
$(".log_three_select_school2").click(function() {
schoolpicker.show(function(e) {
console.log(e, '3333')
console.log(e[0].value);
console.log(e[0].text);
$('.school').text(e[0].text);
school_name = e[0].value
$(".xuexiao_name").text(e[0].text);
$('.xuexiao_name').css('color', '#333333');
$.post("{:url('Personalcenter/get_grade_class')}", {id: school_name}, function (data) {
if (data) {
data = JSON.parse(data);
$('.banji_name').text('请选择班级').css("color","#CCCCCC");
grade_s(data);
}
});
});
})
$(".log_three_select_class2").click(function() {
if(school_name != undefined) {
classpicker.show(function(e) {
console.log(e)
console.log(e[0].value);
console.log(e[0].text);
$('.grade_class_text').text(e[0].text)
$('.grade_class').val(e[0].text)
$(".banji_name").text(e[0].text);
$('.banji_name').css('color', '#333333');
});
} else {
alert("请先选择学校")
}
})
</script>
<script>
function zZFun(e) {
... ... @@ -457,6 +572,31 @@
function zZFun(e) {
window.event ? (window.event.cancelBubble = true) : e.stopPropagation();
}
$('.update').click(function(){
var indent_id = $(this).attr('data-indent-id');
var name = $('.name').val();
var phone = $('.phone').val();
var region = $('.region').text();
var region_detail = $('.region_detail').val();
var school = $('.school').text();
var grade_class = $('.grade_class_text').text();
console.log(school);
console.log(grade_class)
$.ajax({
url:"{:url('updatePost')}",
type:"GET",
data:{'indent_id':indent_id,'name':name,'phone':phone,'region':region,'region_detail':region_detail,'school':school,'grade_class':grade_class},
success:function(res){
if(res.code == 1){
alert('修改成功')
}
},
error:function(res){
alert('与服务器断开链接')
}
})
})
</script>
</body>
... ...
... ... @@ -16,6 +16,7 @@
background-position: bottom;
background-size: 100% 0.06rem;
background-color: white;
margin-top: 55px;
}
</style>
</head>
... ...
... ... @@ -1037,6 +1037,7 @@ body {
align-items: center;
padding: 0 0.32rem;
box-sizing: border-box;
margin-top: 88px;
}
.or_addressYesTxt2 {
... ... @@ -2005,6 +2006,7 @@ body {
.logistics_box {
margin: 0 0.32rem;
cursor: pointer;
margin-top: 55px;
}
.log_detailImg {
... ...
... ... @@ -1173,7 +1173,7 @@ cursor: pointer;
.log_four_input_one_center input {
outline: none;
text-align: right;
/*text-align: right;*/
cursor: pointer;
height: 0.4rem;
font-size: 0.28rem;
... ... @@ -1182,6 +1182,7 @@ cursor: pointer;
border: none;
margin: 0;
padding: 0;
text-align: left;
}
.log_four_top,
... ...
/**
* covert canvas to image
* and save the image file
*/
var Canvas2Image = function () {
// check if support sth.
var $support = function () {
var canvas = document.createElement('canvas'),
ctx = canvas.getContext('2d');
return {
canvas: !!ctx,
imageData: !!ctx.getImageData,
dataURL: !!canvas.toDataURL,
btoa: !!window.btoa
};
}();
var downloadMime = 'image/octet-stream';
function scaleCanvas (canvas, width, height) {
var w = canvas.width,
h = canvas.height;
if (width == undefined) {
width = w;
}
if (height == undefined) {
height = h;
}
var retCanvas = document.createElement('canvas');
var retCtx = retCanvas.getContext('2d');
retCanvas.width = width;
retCanvas.height = height;
retCtx.drawImage(canvas, 0, 0, w, h, 0, 0, width, height);
return retCanvas;
}
function getDataURL (canvas, type, width, height) {
canvas = scaleCanvas(canvas, width, height);
return canvas.toDataURL(type);
}
function saveFile (strData,filename) {
var save_link = document.createElement('a');
save_link.href = strData;
save_link.download = filename;
var event = new MouseEvent('click',{"bubbles":false, "cancelable":false});
save_link.dispatchEvent(event);
}
function genImage(strData) {
var img = document.createElement('img');
img.src = strData;
return img;
}
function fixType (type) {
type = type.toLowerCase().replace(/jpg/i, 'jpeg');
var r = type.match(/png|jpeg|bmp|gif/)[0];
return 'image/' + r;
}
function encodeData (data) {
if (!window.btoa) { throw 'btoa undefined' }
var str = '';
if (typeof data == 'string') {
str = data;
} else {
for (var i = 0; i < data.length; i ++) {
str += String.fromCharCode(data[i]);
}
}
return btoa(str);
}
function getImageData (canvas) {
var w = canvas.width,
h = canvas.height;
return canvas.getContext('2d').getImageData(0, 0, w, h);
}
function makeURI (strData, type) {
return 'data:' + type + ';base64,' + strData;
}
/**
* create bitmap image
* 按照规则生成图片响应头和响应体
*/
var genBitmapImage = function (oData) {
//
// BITMAPFILEHEADER: http://msdn.microsoft.com/en-us/library/windows/desktop/dd183374(v=vs.85).aspx
// BITMAPINFOHEADER: http://msdn.microsoft.com/en-us/library/dd183376.aspx
//
var biWidth = oData.width;
var biHeight = oData.height;
var biSizeImage = biWidth * biHeight * 3;
var bfSize = biSizeImage + 54; // total header size = 54 bytes
//
// typedef struct tagBITMAPFILEHEADER {
// WORD bfType;
// DWORD bfSize;
// WORD bfReserved1;
// WORD bfReserved2;
// DWORD bfOffBits;
// } BITMAPFILEHEADER;
//
var BITMAPFILEHEADER = [
// WORD bfType -- The file type signature; must be "BM"
0x42, 0x4D,
// DWORD bfSize -- The size, in bytes, of the bitmap file
bfSize & 0xff, bfSize >> 8 & 0xff, bfSize >> 16 & 0xff, bfSize >> 24 & 0xff,
// WORD bfReserved1 -- Reserved; must be zero
0, 0,
// WORD bfReserved2 -- Reserved; must be zero
0, 0,
// DWORD bfOffBits -- The offset, in bytes, from the beginning of the BITMAPFILEHEADER structure to the bitmap bits.
54, 0, 0, 0
];
//
// typedef struct tagBITMAPINFOHEADER {
// DWORD biSize;
// LONG biWidth;
// LONG biHeight;
// WORD biPlanes;
// WORD biBitCount;
// DWORD biCompression;
// DWORD biSizeImage;
// LONG biXPelsPerMeter;
// LONG biYPelsPerMeter;
// DWORD biClrUsed;
// DWORD biClrImportant;
// } BITMAPINFOHEADER, *PBITMAPINFOHEADER;
//
var BITMAPINFOHEADER = [
// DWORD biSize -- The number of bytes required by the structure
40, 0, 0, 0,
// LONG biWidth -- The width of the bitmap, in pixels
biWidth & 0xff, biWidth >> 8 & 0xff, biWidth >> 16 & 0xff, biWidth >> 24 & 0xff,
// LONG biHeight -- The height of the bitmap, in pixels
biHeight & 0xff, biHeight >> 8 & 0xff, biHeight >> 16 & 0xff, biHeight >> 24 & 0xff,
// WORD biPlanes -- The number of planes for the target device. This value must be set to 1
1, 0,
// WORD biBitCount -- The number of bits-per-pixel, 24 bits-per-pixel -- the bitmap
// has a maximum of 2^24 colors (16777216, Truecolor)
24, 0,
// DWORD biCompression -- The type of compression, BI_RGB (code 0) -- uncompressed
0, 0, 0, 0,
// DWORD biSizeImage -- The size, in bytes, of the image. This may be set to zero for BI_RGB bitmaps
biSizeImage & 0xff, biSizeImage >> 8 & 0xff, biSizeImage >> 16 & 0xff, biSizeImage >> 24 & 0xff,
// LONG biXPelsPerMeter, unused
0,0,0,0,
// LONG biYPelsPerMeter, unused
0,0,0,0,
// DWORD biClrUsed, the number of color indexes of palette, unused
0,0,0,0,
// DWORD biClrImportant, unused
0,0,0,0
];
var iPadding = (4 - ((biWidth * 3) % 4)) % 4;
var aImgData = oData.data;
var strPixelData = '';
var biWidth4 = biWidth<<2;
var y = biHeight;
var fromCharCode = String.fromCharCode;
do {
var iOffsetY = biWidth4*(y-1);
var strPixelRow = '';
for (var x = 0; x < biWidth; x++) {
var iOffsetX = x<<2;
strPixelRow += fromCharCode(aImgData[iOffsetY+iOffsetX+2]) +
fromCharCode(aImgData[iOffsetY+iOffsetX+1]) +
fromCharCode(aImgData[iOffsetY+iOffsetX]);
}
for (var c = 0; c < iPadding; c++) {
strPixelRow += String.fromCharCode(0);
}
strPixelData += strPixelRow;
} while (--y);
var strEncoded = encodeData(BITMAPFILEHEADER.concat(BITMAPINFOHEADER)) + encodeData(strPixelData);
return strEncoded;
};
/**
* [saveAsImage]
* @param {[obj]} canvas [canvasElement]
* @param {[Number]} width [optional] png width
* @param {[Number]} height [optional] png height
* @param {[String]} type [image type]
* @param {[String]} filename [image filename]
* @return {[type]} [description]
*/
var saveAsImage = function (canvas, width, height, type,filename) {
if ($support.canvas && $support.dataURL) {
if (typeof canvas == "string") { canvas = document.getElementById(canvas); }
if (type == undefined) { type = 'png'; }
filename = filename == undefined||filename.length === 0 ?Date.now()+'.'+type: filename+'.'+type
type = fixType(type);
if (/bmp/.test(type)) {
var data = getImageData(scaleCanvas(canvas, width, height));
var strData = genBitmapImage(data);
saveFile(makeURI(strData, downloadMimedownloadMime),filename);
} else {
var strData = getDataURL(canvas, type, width, height);
saveFile(strData.replace(type, downloadMime),filename);
}
}
};
var convertToImage = function (canvas, width, height, type) {
if ($support.canvas && $support.dataURL) {
if (typeof canvas == "string") { canvas = document.getElementById(canvas); }
if (type == undefined) { type = 'png'; }
type = fixType(type);
if (/bmp/.test(type)) {
var data = getImageData(scaleCanvas(canvas, width, height));
var strData = genBitmapImage(data);
return genImage(makeURI(strData, 'image/bmp'));
} else {
var strData = getDataURL(canvas, type, width, height);
return genImage(strData);
}
}
};
return {
saveAsImage: saveAsImage,
saveAsPNG: function (canvas, width, height, fileName) {
return saveAsImage(canvas, width, height, 'png',fileName);
},
saveAsJPEG: function (canvas, width, height, fileName) {
return saveAsImage(canvas, width, height, 'jpeg',fileName);
},
saveAsGIF: function (canvas, width, height, fileName) {
return saveAsImage(canvas, width, height, 'gif',fileName);
},
saveAsBMP: function (canvas, width, height, fileName) {
return saveAsImage(canvas, width, height, 'bmp',fileName);
},
convertToImage: convertToImage,
convertToPNG: function (canvas, width, height) {
return convertToImage(canvas, width, height, 'png');
},
convertToJPEG: function (canvas, width, height) {
return convertToImage(canvas, width, height, 'jpeg');
},
convertToGIF: function (canvas, width, height) {
return convertToImage(canvas, width, height, 'gif');
},
convertToBMP: function (canvas, width, height) {
return convertToImage(canvas, width, height, 'bmp');
}
};
}();
\ No newline at end of file
... ...
... ... @@ -204,7 +204,7 @@ class WeChatBaseController extends BaseController
*/
public function checkWeChatUserLogin()
{
// $user = Db::name('user')->where('id',6)->find();
// $user = Db::name('user')->where('id',436)->find();
// cmf_update_current_user($user);
// session('user',null);
$userId = cmf_get_current_user_id();
... ...