thinkPHP 거래내역 조회 기능
이 글은 주로 thinkPHP 거래 내역 조회 기능을 소개하고, thinkPHP 데이터베이스 조회 기능을 분석하고, 출력 관련 연산 스킬을 예시 형태로 보여줍니다. 도움이 필요한 친구들이 참고할 수 있습니다.
이 글은 thinkPHP 거래 내역 조회 기능을 예시로 분석합니다. 예. 참고할 수 있도록 모든 사람과 공유하세요. 세부정보는 다음과 같습니다.
거래 세부정보
는 일반적으로 거래 날짜, 거래 금액, 거래 상태(선택 사항 여부)
총 거래 금액 등을 포함하여 월 단위입니다.
데이터가 많으면 페이지를 매기는 것이 가장 좋습니다.
특정 가맹점을 확인하시는 것이 가장 좋습니다.
1. SQL을 시뮬레이션하여 쿼리 기능을 구현합니다
SELECT a.id as user_id,a.username,b.name as store_name,c.id as order_id,c.price,c.paytime,c.sendtime,c.receivetime FROM sh_user a LEFT JOIN sh_store b on a.id = b.user_id LEFT JOIN sh_order c ON b.id = c.store_id WHERE a.opener_id = 1 and a.`status` = 1 and c.status = 1 ORDER BY c.id desc; SELECT count(b.id) as count ,sum(c.price) as total_price FROM sh_user a LEFT JOIN sh_store b on a.id = b.user_id LEFT JOIN sh_order c ON b.id = c.store_id WHERE a.opener_id = 1 and a.`status` = 1 and c.status = 1;
SQL 쿼리는 기본적으로 완료되었으며, 나머지는 php와 thinkphp를 사용하여 쿼리 기능을 구현하고 몇 가지 로직과 조건을 추가하는 것입니다.
// 商户交易 public function trade(){ if($type = $this->_request('type','trim')){ $s_year = $this->_request('s_year','trim'); $s_month = $this->_request('s_month','trim'); $s_user_id = $this->_request('s_user_id','trim,intval'); $this->assign('s_user_id',$s_user_id); if($type == 'last'){ // 获取上一月 if($s_month==1){ $useYear = $s_year-1; $useMonth = 12; }else{ $useYear = $s_year; $useMonth = $s_month-1; } } if($type == 'next'){ // 获取下一月 if($s_month==12){ $useYear = $s_year+1; $useMonth = 1; }else{ $useYear = $s_year; $useMonth = $s_month+1; } } if ($type == 'selectuser'){ $useYear = $s_year; $useMonth = $s_month; } }else{ // 获取当前年 月 $useYear = date('Y'); $useMonth = date('m'); } $this->assign('s_year',$useYear); $this->assign('s_month',$useMonth); $b_time = strtotime($useYear.'-'.$useMonth.'-'.'1'); $e_time = strtotime($useYear.'-'.$useMonth.'-'.date('t',strtotime($b_time)).' 23:59:59'); if(isset($s_user_id) && $s_user_id > 0){ $where['a.id'] = $s_user_id; } $where['a.opener_id'] = $this->opener_id; $where['a.status'] = 1; // 合法的用户 $where['c.status'] = 1; // 合法的订单 $where['c.paytime'] = array(array('gt',$b_time),array('lt',$e_time),'and'); $count_and_totalprice = M()->table('sh_user a') ->join('sh_store b on a.id = b.user_id') ->join('sh_order c on b.id = c.store_id') ->where($where) ->field('count(b.id) as count ,sum(c.price) as totalprice') ->find(); $count = $count_and_totalprice['count']; $totalprice = $count_and_totalprice['totalprice'] ? $count_and_totalprice['totalprice'] : 0; $Page = new Page($count, 10); $list = M()->table('sh_user a') ->join('sh_store b on a.id = b.user_id') ->join('sh_order c on b.id = c.store_id') ->where($where) ->order('c.id desc') ->limit($Page->firstRow.','.$Page->listRows) ->field('a.id as user_id,a.username,b.name as store_name,c.id as order_id,c.price,c.paytime,c.sendtime,c.receivetime') ->select(); foreach ($list as $k => $v) { if($v['sendtime'] == 0 && $v['receivetime'] == 0){ $list[$k]['progress'] = '1'; // 已付款,待发货 } if($v['sendtime'] > 0 && $v['receivetime'] == 0){ $list[$k]['progress'] = '2'; // 已发货,待签收 } if($v['sendtime'] > 0 && $v['receivetime'] > 0){ $list[$k]['progress'] = '3'; // 交易完成 } } // 获取拓展员用户 $user_list = M('User') ->where(array('opener_id'=>$this->opener_id)) ->field('id,username') ->select(); $this->assign('user_list',$user_list); $this->assign('totalprice',$totalprice); $this->assign('page',$Page->show()); $this->assign('list', $list); $this->display(); }
html part
<include file="Public:head" title="交易详情" /> <style> .top { background-color: #eee; height: 50px; line-height: 50px; font-size: 18px; border-bottom: #ddd 1px solid; margin-bottom: -1px; } .list-group{ border: 1px solid #DDDDDD; } .list-group .list-group-item { text-align: left; line-height: 25px; border: none; background-color: #F9F9F9; font-size: 14px; } #select-date { padding: 0px 10px; } #select-date .date-txt { font-size: 18px; } #total { width: 140px; height: 140px; background-color: #EC6C00; margin: auto; } #total .money-txt { color: white; padding-top: 10px; } #datalist { margin-top: 30px; } #relief .form-control{ margin-top: 10px; margin-bottom: 10px; /*background-color: #FFCE42;*/ } .page{ margin-right: 10px; margin-bottom: 20px; } .table th { color: #C4C4C4; } .table tbody tr td+td+td { color: #D3964F; } </style> <script type="text/javascript"> function lastMonth(){ todo('last'); } function nextMonth(){ todo('next'); } function selectUser(){ todo('selectuser'); } function todo(type){ var s_year = $('#s_year').val(); var s_month = $('#s_month').val(); var s_user_id = $('#s_user_id').val(); window.location.href="{sh::U('User/trade')}&s_year="+s_year+"&s_month="+s_month+"&s_user_id="+s_user_id+"&type="+type; } </script> <body> <p data-example-id="list-group-btns" class="bs-example"> <p id="select-date"> <ul class="pager"> <li class="previous"><a onclick="lastMonth();"><span aria-hidden="true">←</span> </a></li> <span class="date-txt"><strong>{sh:$s_year}.{sh:$s_month}</strong> <present name="paymentData"><span class="glyphicon glyphicon-ok-sign" aria-hidden="true"></span></present> </span> <input type="text" id="s_year" value="{sh:$s_year}" hidden="hidden"> <input type="text" id="s_month" value="{sh:$s_month}" hidden="hidden"> <li class="next"><a onclick="nextMonth();"><span aria-hidden="true">→</span></a></li> </ul> </p> <p id="relief"> <select id="s_user_id" onchange="selectUser();" class="form-control btn-success"> <option value="">全部商户</option> <volist name="user_list" id="vo"> <option value="{sh:$vo.id}" <eq name="vo.id" value="$s_user_id">selected="selected"</eq>>{sh:$vo.username}</option> </volist> </select> </p> <p id="total" class="img-circle"> <p class="text-center money-txt"> <h3>总交易金额</h3> <h2>¥{sh:$totalprice}</h2> </p> </p> <p id="datalist"> <table class="table table-striped"> <thead> <tr> <th>商户</th> <th>日期</th> <th>交易金额</th> <!-- <th>状态</th> --> </tr> </thead> <tbody> <empty name="list"><tr><td class="text-center" colspan="4">暂无数据</td></tr></empty> <volist name="list" id="vo"> <tr> <td>{sh:$vo.username}</td> <td>{sh:$vo.paytime|date="Y-m-d H:i",###}</td> <td>{sh:$vo.price}</td> <!-- <td> <if condition="$vo.progress eq 1"><span class="text-primary">待发货</span> <elseif condition="$vo.progress eq 2"/><span class="text-danger">待签收</span> <elseif condition="$vo.progress eq 3"/><span class="text-success"><strong>已完成</strong></span> </if> </td> --> </tr> </volist> </tbody> </table> <p class="page text-right"> {sh:$page} </p> </p> </body> </html>
효과, 다른 사람의 디자인을 보고 자세히 알아보세요. 가장 중요한 것은 인터페이스 디스플레이입니다. 모든 데이터는 여러 디스플레이를 기반으로 하므로 먼저 어떤 데이터인지 확인하세요. 필요해서 얻으세요.
관련 추천:
위 내용은 thinkPHP 거래내역 조회 기능의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

AI Hentai Generator
AI Hentai를 무료로 생성하십시오.

인기 기사

뜨거운 도구

메모장++7.3.1
사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전
중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기
강력한 PHP 통합 개발 환경

드림위버 CS6
시각적 웹 개발 도구

SublimeText3 Mac 버전
신 수준의 코드 편집 소프트웨어(SublimeText3)

뜨거운 주제











ThinkPHP 프로젝트를 실행하려면 다음이 필요합니다: Composer를 설치하고, 프로젝트 디렉터리를 입력하고 php bin/console을 실행하고, 시작 페이지를 보려면 http://localhost:8000을 방문하세요.

12306 티켓 예매 앱의 최신 버전을 다운로드하세요. 모두가 매우 만족하는 여행 티켓 구매 소프트웨어입니다. 소프트웨어에서 제공되는 다양한 티켓 소스가 있어 매우 편리합니다. - 실명인증으로 온라인 구매가 가능합니다. 모든 사용자가 쉽게 여행티켓과 항공권을 구매하고 다양한 할인 혜택을 누릴 수 있습니다. 또한 사전에 예약하고 티켓을 얻을 수도 있습니다. 호텔을 예약하거나 차량으로 픽업 및 하차할 수도 있습니다. 한 번의 클릭으로 원하는 곳으로 이동하고 티켓을 구매할 수 있어 여행이 더욱 간편해지고 편리해집니다. 모든 사람의 여행 경험이 더욱 편안해졌습니다. 이제 편집자가 온라인으로 자세히 설명합니다. 12306명의 사용자에게 과거 티켓 구매 기록을 볼 수 있는 방법을 제공합니다. 1. 철도 12306을 열고 오른쪽 하단의 My를 클릭한 후 My Order를 클릭합니다. 2. 주문 페이지에서 Paid를 클릭합니다. 3. 유료페이지에서

ThinkPHP에는 다양한 PHP 버전용으로 설계된 여러 버전이 있습니다. 메이저 버전에는 3.2, 5.0, 5.1, 6.0이 포함되며, 마이너 버전은 버그를 수정하고 새로운 기능을 제공하는 데 사용됩니다. 최신 안정 버전은 ThinkPHP 6.0.16입니다. 버전을 선택할 때 PHP 버전, 기능 요구 사항 및 커뮤니티 지원을 고려하십시오. 최상의 성능과 지원을 위해서는 최신 안정 버전을 사용하는 것이 좋습니다.

Xuexin.com에서 내 학업 자격을 어떻게 확인하나요? Xuexin.com에서 학업 자격을 확인할 수 있습니다. 많은 사용자가 Xuexin.com에서 학업 자격을 확인하는 방법을 모릅니다. 다음으로 편집자는 Xuexin.com에서 학업 자격을 확인하는 방법에 대한 그래픽 튜토리얼을 제공합니다. 유저들이 와서 구경해 보세요! Xuexin.com 사용 튜토리얼: Xuexin.com에서 학업 자격을 확인하는 방법 1. Xuexin.com 입구: https://www.chsi.com.cn/ 2. 웹사이트 쿼리: 1단계: Xuexin.com 주소를 클릭합니다. 위의 홈페이지에 들어가려면 [교육 쿼리]를 클릭합니다. 2단계: 최신 웹페이지에서 아래 그림의 화살표와 같이 [쿼리]를 클릭합니다. 3단계: 새 페이지에서 [학점 파일에 로그인]을 클릭합니다. 4단계: 로그인 페이지에서 정보를 입력하고 [로그인]을 클릭합니다.

ThinkPHP Framework를 로컬에서 실행하는 단계: ThinkPHP Framework를 로컬 디렉터리에 다운로드하고 압축을 풉니다. ThinkPHP 루트 디렉터리를 가리키는 가상 호스트(선택 사항)를 만듭니다. 데이터베이스 연결 매개변수를 구성합니다. 웹 서버를 시작합니다. ThinkPHP 애플리케이션을 초기화합니다. ThinkPHP 애플리케이션 URL에 접속하여 실행하세요.

Laravel과 ThinkPHP 프레임워크의 성능 비교: ThinkPHP는 일반적으로 최적화 및 캐싱에 중점을 두고 Laravel보다 성능이 좋습니다. Laravel은 잘 작동하지만 복잡한 애플리케이션의 경우 ThinkPHP가 더 적합할 수 있습니다.

ThinkPHP 설치 단계: PHP, Composer 및 MySQL 환경을 준비합니다. Composer를 사용하여 프로젝트를 만듭니다. ThinkPHP 프레임워크와 종속성을 설치합니다. 데이터베이스 연결을 구성합니다. 애플리케이션 코드를 생성합니다. 애플리케이션을 실행하고 http://localhost:8000을 방문하세요.

MySQL과 PL/SQL은 각각 관계형 데이터베이스와 절차적 언어의 특성을 나타내는 서로 다른 두 가지 데이터베이스 관리 시스템입니다. 이 기사에서는 구체적인 코드 예제를 통해 MySQL과 PL/SQL 간의 유사점과 차이점을 비교합니다. MySQL은 SQL(구조적 쿼리 언어)을 사용하여 데이터베이스를 관리하고 운영하는 인기 있는 관계형 데이터베이스 관리 시스템입니다. PL/SQL은 Oracle 데이터베이스 고유의 절차적 언어로 저장 프로시저, 트리거, 함수 등의 데이터베이스 개체를 작성하는 데 사용됩니다. 같은
