123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193 |
- <?php
- declare (strict_types = 1);
- namespace app\Admin\controller;
- use app\BaseController;
- use think\facade\Db;
- use think\Request;
- class Tz extends BaseController
- {
- /**
- * 显示资源列表
- *
- * @return \think\Response
- */
- public function list()
- {
- $post =$this->request->post();
- $token = isset($post['token']) ? trim($post['token']) : "";
- // if($token==""){
- // return error_show(1001,'token不能为空');
- // }
- // $effetc = VerifyTokens($token);
- // if(!empty($effetc) && $effetc['code']!=0){
- // return error_show($effetc['code'],$effetc['message']);
- // }
- $page = isset($post['page'])&&$post['page']!='' ? intval($post['page']): 1;
- $size = isset($post['size'])&&$post['size']!='' ? intval($post['size']):10;
- $condition=[];
- $qrdno = isset($post['qrdno'])&&$post['qrdno']!="" ? trim($post['qrdno']):"";
- if($qrdno!=""){
- $condition[]=['qrdNo',"=",$qrdno];
- }
- $cgdno = isset($post['cgdno'])&&$post['cgdno']!="" ? trim($post['cgdno']):"";
- if($cgdno!=""){
- $condition[]=['cgdNo',"=",$cgdno];
- }
- $type = isset($post['type'])&&$post['type']!="" ? trim($post['type']):"";
- if($type!=""){
- $condition[]=['cgdtype',"like","%{$type}%"];
- }
- $supllier = isset($post['supllier'])&&$post['supllier']!="" ? trim($post['supllier']):"";
- if($supllier!=""){
- $condition[]=['supllier_name',"like","%{$supllier}%"];
- }
- $count =Db::name("tz")->where($condition)->count();
- $total = ceil($count/$size)>1 ? ceil($count/$size) : 1;
- $page = $page>=$total?intval($total):$page;
- $list = Db::name("tz")->where($condition)->page($page,$size)->select();
- return app_show(0,"获取成功",['list'=>$list,'count'=>$count]);
- }
- /**
- * 显示创建资源表单页.
- *
- * @return \think\Response
- */
- public function create()
- {
- $arr =[1528938.18,2548230.3,1019292.12];
- $total = round(5096460.60000000,2);
- echo $total == array_sum($arr);
- die();
- $post =$this->request->post();
- $token = isset($post['token']) ? trim($post['token']) : "";
- // if($token==""){
- // return error_show(1001,'token不能为空');
- // }
- // $effetc = VerifyTokens($token);
- // if(!empty($effetc) && $effetc['code']!=0){
- // return error_show($effetc['code'],$effetc['message']);
- // }
- $qrdNo = isset($post['id'])&&$post["id"] !='' ? intval($post['id']) :"";
- if($qrdNo==''){
- return error_show(1006,"参数id 不能为空");
- }
- $list = Db::name("tz")->where("id","=",$qrdNo)->find();
- if(empty($list)){
- return error_show(1006,"未找到数据");
- }
- $list['qrdpay'] = $this->read($list['productNo']);
- $list['cgdpay'] = $this->save($list['cgdNo']);
- $list['fh'] = $this->edit($list['productNo']);
- $list['th'] = $this->update($list['productNo']);
- return app_show(0,"获取成功",$list);
- }
- /**
- * 保存新建的资源
- *
- * @param \think\Request $request
- * @return \think\Response
- */
- public function save($cgdcode)
- {
- if($cgdcode==""){
- return [];
- }
- $list = Db::name('pay')->alias('a')->leftJoin('cfp_pay_info b','a.payNo = b.payNo')->where([['a.status',">=",
- 0],['b.status',"=",1],['sequenceNo',"=",$cgdcode]])->field('payNo,total_fee,ainv_fee')->select();
- foreach ($list as $key=>$value){
- $invtime = Db::name('pay_stages')->where([['is_del',"=",0],['status',"=",7],['payNo',"=",
- $value['payNo']]])->order('invtime desc')
- ->find();
- $paytime = Db::name('pay_stages')->where([['is_del',"=",0],['paystatus',"=",4],['payNo',"=",
- $value['payNo']]])
- ->order('paytime desc')
- ->find();
- $list[$key]['invtime']=isset($invtime['invtime'])&& $invtime!="" ?$invtime['invtime'] : '';
- $list[$key]['paytime']=isset($paytime['paytime'])&& $paytime!="" ?$paytime['paytime'] : '';
- }
- return empty($list)?[] : $list;
- }
- /**
- * 显示指定的资源
- *
- * @param int $id
- * @return \think\Response
- */
- public function read($qrdno)
- {
- $order = Db::name("order_info")->alias('a')->leftJoin("cfp_order_pool b","a.orderNo = b.orderNo
- AND b.is_del = 0 ")->leftJoin("cfp_assoc_list ak","ak.codeNo = a.orderNo OR ak.viceNo = a.orderNo ")->where
- ("ak.rela_form IN ( 1, 2, 3 ) AND ak.STATUS = 3 AND ak.is_del = 0 and a.goodNo = '{$qrdno}' AND a.STATUS = 1")
- ->field('ak.*')
- ->find();
- $list =['pay'=>[],'inv'=>[]];
- if(empty($order)){
- return $list;
- }
- foreach ($order as $key=>$value){
- $temp=[];
- if($value['rela_form'] == 2 || $value['rela_form'] == 3){
- $temp['paytime']=$value['addtime'];
- $temp['payfee']=$value['cancel_total'];
- $temp['payNo']=$value['rela_form']==2?$value['viceNo']:$value['codeNo'];
- $list['pay'][]=$temp;
- }
- if($value['rela_form'] ==1 ){
- $temp['invtime']=$value['addtime'];
- $temp['invfee']=$value['cancel_total'];
- $temp['invNo']=$value['viceNo'];
- $list['inv'][]=$temp;
- }
- }
- return $list;
- }
- /**
- * 显示编辑资源表单页.
- *
- * @param int $id
- * @return \think\Response
- */
- public function edit($qrdNo)
- {
- $fh = Db::table("fh_source")->where([['qrdNo',"=",$qrdNo],['sendstatus',"=",1]])->field("fhNo,send,bala,send_date,post_company,post_code")->select();
- return empty($fh)?[]:$fh;
- }
- /**
- * 保存更新的资源
- *
- * @param \think\Request $request
- * @param int $id
- * @return \think\Response
- */
- public function update($qrdNo)
- {
- $th = Db::name("th_source")->where([['th_qrdcpNo',"=",$qrdNo],['th_status',"=",1]])->field("thNo,createtime,th_qrd_fee,th_cgd_fee,th_num")->select();
- return empty($th)?[]:$th;
- }
- /**
- * 删除指定资源
- *
- * @param int $id
- * @return \think\Response
- */
- public function delete($id)
- {
- //
- }
- }
|