<?php namespace app\admin\controller; use app\common\controller\Backend; use think\Db; /** * 图片订单管理 * * @icon fa fa-circle-o */ class Order extends Backend { /** * Order模型对象 * @var \app\admin\model\Order */ protected $model = null; public function _initialize() { parent::_initialize(); $this->model = new \app\admin\model\Order; } /** * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 */ public function fapiao(){ $id = $this->request->param('ids'); $order_id = ','.$id.','; $data = Db::name('invoice') ->whereLike('order_id',"%$order_id%") ->find(); $this->assign('data',$data); return $this->view->fetch(); } public function shou(){ $id = $this->request->param('ids'); $time = Db::name('order') ->where('id',$id) ->field('pic_id,video_id,createtime,num') ->find(); $createtime = date('Y-m-d H:i:s',$time['createtime']); $shou = Db::name('shou') ->whereLike('order_id',"%$id%") ->find(); if(empty($shou)){ $this->error('用户暂未下载授权书'); } if(!empty($time['pic_id'])){ $pic_id = explode(',',$time['pic_id']); $v['pic_num'] = Db::name('pic') ->whereIn('id',$pic_id) ->column('number'); //拼接所有素材的唯一编号 $str = ''; $pic_str = implode(',',$v['pic_num']); $str .= $pic_str.','; $this->test_pdf($shou['name'],$shou['use'],$shou['tel'],$str,$time['num'],$createtime); } if(!empty($time['video_id'])){ $video_id = unserialize($time['video_id']); $v_id = array_column($video_id,'id'); $v['video_num'] = Db::name('video') ->whereIn('id',$v_id) ->column('number'); //拼接所有素材的唯一编号 $str = ''; $video_str = implode(',',$v['video_num']); $str .= $video_str.','; $this->test_pdf($shou['name'],$shou['use'],$shou['tel'],$str,$time['num'],$createtime); } } public function test_pdf($name='',$use='',$tel='',$number='',$order_num='',$time='') { // create new PDF document $pdf = new \TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); // set document information $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor('Nicola Asuni'); $pdf->SetTitle('TCPDF Example 002'); $pdf->SetSubject('TCPDF Tutorial'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide'); // remove default header/footer $pdf->setPrintHeader(false); $pdf->setPrintFooter(false); // set default monospaced font $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); // set margins $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); // set auto page breaks $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); // set image scale factor $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); // set some language-dependent strings (optional) // if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { // require_once(dirname(__FILE__).'/lang/eng.php'); // $pdf->setLanguageArray($l); // } // --------------------------------------------------------- // set font $pdf->SetFont('msyh', '', 20); // add a page $pdf->AddPage(); $test_title = ' <div> <div style="font-size: 28px;color: #333;text-align: center;margin-bottom: 30px" > 素材使用授权书 </div> <div style="font-size: 16px;color: #333;margin-bottom: 20px"> 亲爱的用户,您好 </div> <div style="font-size: 16px;color: #333"> 非常感谢您使用仁甲看见SHOP的相关素材, 本小程序内销售的素材均为仁甲看见拍摄的正版优质作品,为方便您能正当合法的使用本素材,避免日后因版权纠纷引起的不必要麻烦,请务必填写本授权书;我们会为您自动生成一个pdf文件发送给您; </div> <div style="line-height: 0.5"> <div style="font-size: 18px;color: #333;font-weight:bold"> 使用方<span style="color:orange">【'.$name.'】</span> </div> <div style="font-size: 18px;color: #333;font-weight:bold"> 使用用途<span style="color:orange">【'.$use.'】</span> </div> <div style="font-size: 18px;color: #333;font-weight:bold"> 联系方式<span style="color:orange">【'.$tel.'】</span> </div> <div style="font-size: 18px;color: #333;font-weight:bold"> 素材编号为<span style="color:orange">【'.$number.'】</span> </div> <div style="font-size: 18px;color: #333;font-weight:bold"> 订单编号为<span style="color:orange">【'.$order_num.'】</span> </div> <div style="font-size: 18px;color: #333;font-weight:bold"> 素材购买时间为<span style="color:orange">【'.$time.'】</span> </div> <div style="font-size: 18px;color: #333;font-weight:bold"> 本小程序所有的图片及视频素材拥有者为山东仁甲看见影像服务有限公司 </div> </div> <div style=""> <div style="font-size: 16px;color: gray;margin-bottom: 20px;text-align: center">关于版权和使用权</div> <div style="font-size: 16px;color: #333;font-weight: bold"> <span>您购买的素材</span><span style="color:red">仅限贵单位使用于本协议中的指定用途</span>,仅拥有<span style="color:red">使用权</span>,不包含<span style="color:red">版权</span> <span style="color:red">及著作权等</span> ;如若在其他项目中继续使用,须联系客服更新授权书(无限次免费),以避免日后出现的侵权事件造成的不必要麻烦。 </div> </div> <div style="margin-bottom:20px"> <div style="font-size: 16px;color: gray;margin-bottom: 20px;text-align: center">关于物权</div> <div style="font-size: 16px;color: #333;"> 此微信小程序中图片/视频涉及的拍摄目标主要针对城市景观,如果客户在使用过程中出现<span style="color:red">涉及物权纠纷的案例</span>,本公司及小程序概不负责。如果您介意此事,请慎重下单 。</div> </div> <div style="margin-bottom:20px"> <div style="font-size: 16px;color: gray;margin-bottom: 20px;text-align: center">关于素材质量</div> <div style="font-size: 16px;color: #333;font-weight: bold"> 素材拍摄使用的设备种类很多,本小程序内素材稳定性 分辨率 调色 光比等都会略有差别,建议您在下单购买之前认真查看小样,素材属于虚拟版权物品,<span style="color:red">一经售出概不接</span> <span style="color:red">受任何理由的退换货</span>。如果您介意此事,请慎重下单</div> </div> <div style="font-size: 16px;color: #333;margin-bottom: 20px"> 视频素材的分辨率在每个素材下方都有详细描述,2K 4K 8K有些部分素材尺寸并 <span style="color:red">非为国际常用标准的尺寸</span> ,比如部分8k素材实际分辨率为6K,建议您在下单购买之前仔细查看照片和视频下方关于分辨率的说明描述,以避免因为分辨率问题带来的困扰和麻烦。</div> <div style="font-size: 16px;color: #333;margin-bottom: 20px"> 我们摆上货架的商品都是仁甲看见仔细筛选和挑选的优质素材,部分航拍延时素材可能存在 <span style="color:red">轻微抖动</span> 的问题,建议您在购买之前仔细查看预览视频及水印小样,以避免因为素材抖动问题带来的困扰和麻烦。 <span style="font-weight:bold">如果您介意此事,请慎重下单。</span> </div> <div style="font-size: 16px;color: #333;margin-bottom: 20px"> 如果您在使用素材的过程中遇到<span style="color:red;font-weight:bold">其他问题</span>或是有更好的建议请联系客服,我们会在 第一时间与您沟通确保素材的正常使用</div> <div style="margin-bottom:20px"> <div style="font-size: 16px;color: gray;margin-bottom: 20px;text-align: center">关于义务</div> <div style="font-size: 16px;color: #333;margin-bottom: 20px"> 您应当严格遵守用户使用规范的相关规定,不得使用仁甲看见SHOP小程序的所有素材用于违法行为或其它非法目的</div> <div style="font-size: 16px;color: #333;margin-bottom: 20px"> 您不得利用此微信小程序素材丑化、诽谤、恶意抹黑山东仁甲看见影像服务有限公司的形象,或用于危害社会,侵蚀道德风尚,宣传不法邪教组织等内容。</div> <div style="font-size: 16px;color: #333;margin-bottom: 20px"> 其他干扰仁甲看见SHOP小程序正常运营和侵犯其他用户或第三方合法权益的行为。</div> </div> <div style="margin-bottom:20px"> <div style="font-size: 16px;color: gray;margin-bottom: 20px;text-align: center">关于免责</div> <div style="font-size: 16px;color: #333;margin-bottom: 20px"> 您应当理解并同意,仁甲看见SHOP小程序所展示的服务是以现有技术和素材原状提供的,所展示及销售的版权素材皆为最原始状态,由于您对本网站服务未尽了解或理解错误造成的损失不承担法律责任。</div> <div style="font-size: 16px;color: #333;margin-bottom: 20px"> 您应当理解并同意,如果您无法判断所需内容是否需要额外的第三方授权,您有义务咨询专业人士的法律意见或与本公司相关部门进行确认,因您未尽到上述责任产生的任何第三方主张的索赔、要求或损失,您应当独立承担责任;本公司因此遭受损失的,您应当一并赔偿</div> <div style="font-size: 16px;color: #333;margin-bottom: 20px"> 您应当理解并同意,仁甲看见SHOP小程序不担保所提供的服务完全符合您的需要,对于可能遇到的网络信息带来的风险,不对其内容的准确性、真实性、正当性、合法性负责,包括但不限于:</div> <div style="font-size: 16px;color: #333;margin-bottom: 20px"> 1. 使用本服务过程中受到,遭人误导或理解错误导致或可能导致的任何心理、生理上的伤害以及其他经济损失;</div> <div style="font-size: 16px;color: #333;margin-bottom: 20px"> 2. 使用过程中造成的个人隐私泄露或其他信息安全风险;</div> <div style="font-size: 16px;color: #333;margin-bottom: 20px"> 您应当理解并同意,除法律不能豁免的责任外,本网站对您或通过您使用本网站或其内容的第三方,均不承担个人风险行为产生的责任,包括木马病毒、未能传送讯息、数据损坏、传输错误,或因使用互联网服务供应商,或因链接到第三方网站和第三方网站内容,而导致的任何损害,包括但不限于利润的损失、机会的损失或必然的损害赔偿。</div> <div style="font-size: 16px;color: #333;margin-bottom: 30px"> 您应当理解并同意,仁甲看见SHOP小程序不能随时预见和防范法律法规、技术以及其他风险,包括但不限于不可抗力、第三方瑕疵、黑客攻击、系统不稳定等可能导致服务中断、数据丢失以及其他的损失与风险。</div> <div style="font-size: 16px;color: #333;margin-bottom: 20px"> 本公司依据协议约定取得处理违法违规行为的权利,但不构成义务或承诺,有权利但没有义务及时发现违法行为或进行处理。</div> </div> <div style="margin-bottom:20px"> <div style="font-size: 16px;color: gray;margin-bottom: 20px;text-align: center">关于产权保护</div> <div style="font-size: 16px;color: #333;margin-bottom: 20px"> 仁甲看见SHOP小程序的一切商标权、专利权、图片、视频等知识产权均受中华人民共和国法律法规和相应的国际条约保护,山东仁甲看见影像服务有限公司享有上述知识产权。</div> <div style="font-size: 16px;color: #333;margin-bottom: 20px"> 未经山东仁甲看见影像服务有限公司或相关权利人书面同意,您不得为任何商业或非商业目的自行或许可任何第三方实施、利用、转让上述知识产权,也不得以任何形式进行或创造相关衍生作品</div> </div> <div style="margin-bottom:20px"> <div style="font-size: 16px;color: gray;margin-bottom: 20px;text-align: center">补充说明</div> <div style="font-size: 16px;color: #333;margin-bottom: 20px"> 本协议自发布之日起生效,直至本网站决定终止此协议或协议更新后终止。</div> <div style="font-size: 16px;color: #333;margin-bottom: 20px"> 本协议签订地为中华人民共和国山东省青岛市李沧区。</div> <div style="font-size: 16px;color: #333;margin-bottom: 20px"> 本协议的成立、生效、履行、解释及纠纷解决,适用中华人民共和国大陆地区法律(不包括冲突法)。</div> <div style="font-size: 16px;color: #333;margin-bottom: 20px"> 若您和本网站发生任何纠纷或争议,首先应友好协商解决;协商不成的,您同意将纠纷或争议提交本协议签订地有管辖权的人民法院管辖</div> <div style="font-size: 16px;color: #333;margin-bottom: 20px"> 本协议所有条款的标题仅为阅读方便,本身并无实际涵义,不能作为本协议涵义解释的依据。</div> <div style="font-size: 16px;color: #333;margin-bottom: 20px"> 本协议条款无论因何种原因部分无效或不可执行,其余条款仍有效,对双方具有约束力。</div> </div> <div style="color:red;font-size:16px;margin-bottom:20px;text-align: center;font-weight: bold">山东仁甲看见影像服务有限公司对于本协议所有条款拥有最终解释权</div> <div style="color:red;font-size:16px;margin-bottom:20px;text-align: center;font-weight: bold">祝您使用愉快!!!</div> </div>'; // output the HTML content $pdf->MultiCell('', '', $test_title, $border=0, $align='J', $fill=0, $ln=1, $x='20', $y='20', $reseth=true, $stretch=0, $ishtml=true, $autopadding=true, $maxh=0); // --------------------------------------------------------- // --------------------------------------------------------- //Close and output PDF document $pdf->Output('example_002.pdf', 'D'); // var_dump($pdf);exit; exit; } /** * 查看 */ public function index() { //当前是否为关联查询 $this->relationSearch = true; //设置过滤方法 $this->request->filter(['strip_tags']); if ($this->request->isAjax()) { //如果发送的来源是Selectpage,则转发到Selectpage if ($this->request->request('keyField')) { return $this->selectpage(); } list($where, $sort, $order, $offset, $limit) = $this->buildparams(); $total = $this->model ->with(['user']) ->where($where) ->order($sort, $order) ->count(); $list = $this->model ->with(['user']) ->where($where) ->order($sort, $order) ->limit($offset, $limit) ->select(); $list = collection($list)->toArray(); $type = new \app\admin\model\Pic(); $video = new \app\admin\model\Video(); foreach ($list as &$v){ $type_ids = $type->whereIn('id',$v['pic_id'])->column('title'); if(!empty($v['video_id'])){ $a = []; $v['video_id'] = unserialize($v['video_id']); foreach ($v['video_id'] as &$v1){ //获取视频标题 $v1['id'] = $video->where('id',$v1['id'])->column('title'); //判断视频属性 if($v1['attr'] == 1){ $v1['attr'] = '2k'; }elseif ($v1['attr'] == 2){ $v1['attr'] = '4k'; }else{ $v1['attr'] = '8k'; } array_push($a,$v1['id']); } $v['video_id'] = $a; } $v['pic_id'] = trim(implode(',',$type_ids),','); } $result = array("total" => $total, "rows" => $list); return json($result); } return $this->view->fetch(); } /** * 导出发票信息 */ public function qrcode_zip() { $list = Db::name('invoice') ->select(); foreach ($list as &$val){ $val['user_id'] = Db::name('user')->where('id',$val['user_id'])->value('nickname'); if(!empty($val['order_id'])){ $order_id = explode(',',trim($val['order_id'],',')); $order_id = Db::name('order')->whereIn('id',$order_id)->column('num'); $val['order_id'] = implode(',',$order_id); } $val['createtime'] = date('Y-m-d H:i:s',$val['createtime']); } ob_end_clean();//清除缓冲区,避免乱码 header('Content-type:application/vnd.ms-excel'); header('Content-Disposition:attachment;filename='. '发票信息' .'.xls');//文件名自己取 $THead = array('id' ,'用户昵称' ,'订单号' ,'公司名称' ,'公司电话','公司地址','纳税人识别号','银行名称','银行账号','收件人名字','收件人电话','收件人地址','创建时间');//这里是要输出的列头 $TBody = $list; echo '<table>';//以表格的形式输出 也可以字符串拼接 //输出head echo '<tr>'; foreach ( $THead as $h ) { echo '<th>' . $h . '</th>';//直接输出即可, } echo '</tr>'; //输出body foreach ( $TBody as $row ) { echo '<tr>'; foreach ($row as $v) { echo '<td>' . $v . '</td>'; } echo '</tr>'; } echo '</table>';//OK exit(); } }