Ruan Blog - 阮家森的博客 Ruan Blog - 阮家森的博客

[BUG修复]多商户后台无法上传首图视频,多商户上传视频与总后台不区分问题

in 人人商城read (244) 站长Ruan 文章转载请注明来源!

一共两个BUG问题修复
1.多商户后台无法上传小程序首图视频,缺少上传按钮的问题
2.修复上传后,多商户可以查看到总后台和其他商户上传的视频

问题1修复:
文件:./ewei_shopv2/plugin/merch/template/web_v3/manage/goods/tab/basic.html

//视频原上传方法如下
{php echo tpl_form_field_video2('video', $item['video'], array('disabled'=>!cv('goods.edit'), 'network'=>true, 'placeholder'=>'请选择视频'))}
//将disabled这一个参数删除即可显示,权限判断问题,修改后如下
{php echo tpl_form_field_video2('video', $item['video'], array('network'=>true, 'placeholder'=>'请选择视频'))}

问题2修复:
说明:微擎目录。该修复方法比较笨。。。如有哪位大神有更好的修理方法请留言指导下,谢谢!
文件1:./web/source/utility/file.ctrl.php

//找到 $do=='video'那段 直接覆盖以下代码
if ($do == 'video' || $do == 'voice') {
    $server = $islocal ? MATERIAL_LOCAL : MATERIAL_WEXIN;
    $page_index = max(1, $_GPC['page']);
    $page_size = 10;
    $material_news_list = material_list($do, $server, array('page_index' => $page_index, 'page_size' => $page_size));
    $material_list = $material_news_list['material_list'];
    $pager = $material_news_list['page'];

    $merchinfo = $_GPC['__merch_' . $uniacid . '_session'] ? json_decode(base64_decode($_GPC['__merch_' . $uniacid . '_session']),true) : '';

    foreach ($material_list as $key=>&$item) {
        if ($merchinfo && strpos($item['attachment'],'merch/'.$merchinfo['id'].'/') === false){
            unset($material_list[$key]);
        }elseif(!$merchinfo && strpos($item['attachment'],'merch/') !== false) {
            unset($material_list[$key]);
        }else{
            $item['url'] = tomedia($item['attachment']);
            unset($item['uid']);
        }
    }
    $result = array('items' => $material_list, 'pager' => $pager);
    if ($merchinfo){
        $result['merch'] = $merchinfo;
    }
    iajax(0, $result);
}

文件2:./web/resource/js/app/common.min.js

//大概是在#18815行左右,获取已上传视频列表的方法 o(),r()这里
    function o() {
        a.getResources("video", e.currentPage, 1 == e.index).then(function(a) {
            e.videos = a.items, e.pager = t.trustAsHtml(a.pager), e.merch = a.merch ,e.dest_dir = a.merch ? 'merch/'+a.merch.id+'/' : '';
        })
    }

    function r() {
        var dest_dir = e.dest_dir;
        a.getResources("video", e.currentPage, 1 == e.index).then(function(a) {
           dest_dir = a.merch ? 'merch/'+a.merch.id+'/' : '';
           e.uploadurl = (0 === e.index) ? "./index.php?c=utility&a=file&do=wechat_upload&upload_type=video&mode=perm&uniacid=" + e.uniacid : "./index.php?c=utility&a=file&do=upload&upload_type=video&global=" + e.global + "&dest_dir=" + dest_dir + "&uniacid=" + e.uniacid
        })
        e.uploadurl = (0 === e.index) ? "./index.php?c=utility&a=file&do=wechat_upload&upload_type=video&mode=perm&uniacid=" + e.uniacid : "./index.php?c=utility&a=file&do=upload&upload_type=video&global=" + e.global + "&dest_dir=" + dest_dir + "&uniacid=" + e.uniacid
    }

//还有18800左右 function s(e, n, i, s)方法
function s(e, n, i, s) {
        var r = a.defer(),
            l = r.promise,
            c = "./index.php?c=utility&a=file&do=" + e + "&page=" + n + "&local=" + (i ? "local" : "wx") + o(s);
        return t.get(c).then(function(e) {
            if (200 == e.status) {
                var t = e.data.message;
                if ("0" == t.errno) {
                    var a = t.message.items;
                    r.resolve({
                        pager: t.message.pager,
                        merch: t.message.merch,//增加获取多商户数据
                        items: a
                    })
                }
            }
            r.resolve([])
        }, function(e) {
            r.reject(e)
        }), l
    }
文章二维码

扫描二维码,在手机上阅读!

人人商城
最后由Ruan修改于2019-02-23 18:11

此处评论已关闭

PREVIOUS NEXT
雷姆
拉姆