<?php

namespace app\admin\controller;

use app\admin\model\ActionLog;
use app\admin\model\ProcessOrder;
use app\BaseController;
use think\App;
use think\facade\Db;

//版本
class Version extends BaseController
{
    public function __construct(App $app)
    {
        parent::__construct($app);
        $this->post = $this->request->post();
    }

    public function list(){
        $page = isset($this->post['page'])&&$this->post['page']!="" ? intval($this->post['page']) : 1;
        $size = isset($this->post['size'])&&$this->post['size']!="" ? intval($this->post['size']) :10;
        $count= Db::name("version")->count();
        $total = ceil($count/$size);
        $page = $page>=$total? $total:$page;
        $list = Db::name("version")->page($page,$size)->order("addtime desc")->select();
        return app_show(0,"获取成功",["list"=>$list,"count"=>$count]);
    }

    public function create(){
        $title = isset($this->post['title'])&&$this->post['title']!="" ? $this->post['title']:"";
        if($title==""){
            return error_show(1004,"参数title 不能为空");
        }
        $content = isset($this->post['content'])&&$this->post['content']!="" ? $this->post['content']:"";
        if($content==""){
            return error_show(1004,"参数content 不能为空");
        }
        $version = isset($this->post['version'])&&$this->post['version']!="" ? $this->post['version']:"";
        if($version==""){
            return error_show(1004,"参数version 不能为空");
        }
        $data=[
            "title"=>$title,
            "content"=>$content,
            "version"=>$version,
            "addtime"=>date("Y-m-d H:i:s")
        ];

        $inert= Db::name("version")->insert($data);
        if($inert){

            return app_show(0,"版本信息新建成功");
        }else{
            return app_show(0,"版本信息新建失败");
        }
    }

    public function info(){
        $projectNo = isset($this->post['projectNo'])&&$this->post['projectNo']!==""?trim($this->post['projectNo']):"";
        if($projectNo==""){
            return error_show(1004,"参数projectNo不能为空");
        }

        $type = isset($this->post['type'])&&$this->post['type']!=="" ? intval($this->post['type']) :0;

        $info =Db::name("project")->where(["projectNo"=>$projectNo,"is_del"=>0])->find();
        if($info==false){
            return error_show(1004,"未找到项目信息");
        }
        $plat = Db::name("platform")->where(['id'=>$info['platform_id']])->find();
        $info['platform_name']=isset($plat['platform_name'])?$plat['platform_name']:"";
        $info['platform_code']=isset($plat['platform_code'])?$plat['platform_code']:"";

        $userCommon = \app\admin\common\User::getIns();
        $tmp = $userCommon->handle('getCodeAndName', ['code' => [$info['companyNo'], $info['khNo']]]);
        $info['khName'] = $tmp['data'][$info['khNo']] ?? '';
        $info['company'] = $tmp['data'][$info['companyNo']] ?? '';

//        $khinfo = Db::name("customer_info")->where(["companyNo"=>$info['khNo']])->find();
//        $info['khName'] = isset($khinfo['companyName'])?$khinfo['companyName']:"";
//        $company = Db::name("business")->where(["companyNo"=>$info['companyNo']])->find();
//        $info['company'] = isset($company['company'])?$company['company']:"";


        $ladder = Db::name("project_info")->where(['projectNo'=>$projectNo,"is_del"=>0])->select()->toArray();
        $info['ladder']=[];
        if(!empty($ladder)){
            foreach ($ladder as $value){
                $value["cat_info"]=isset($value['cat_id']) &&$value['cat_id']!=""? made($value['cat_id'],[]):[];
                $condition  = $type==0?['pgNo'=>$value['pgNo'],"is_del"=>0] : ['pgNo'=>$value['pgNo'],"is_del"=>0,"status"=>1];
                $feedback = Db::name("project_feedback")->where($condition)->select()->toArray();
                array_walk($feedback,function (&$v){
                    $v["cat_info"]=isset($v['cat_id'])&&$v['cat_id']!=""? made($v['cat_id'],[]):[];
                });

                $value['feedback']=$feedback;
                $info['ladder'][]=$value;
            }
        }
        return app_show(0,"获取成功",$info);
    }
    public function  feedlist(){
        $page =isset($this->post['page'])&&$this->post['page']!=="" ? intval($this->post['page']):1;
        $size =isset($this->post['size'])&&$this->post['size']!==""? intval($this->post['size']):10;
        $where=[["is_del","=",0]];
        $pgNo =isset($this->post['pgNo'])&&$this->post['pgNo']!==""?trim($this->post['pgNo']):"";
        if($pgNo!==""){
            $where[]=["pgNo","=",$pgNo];
        }
        $projectNo =isset($this->post['projectNo'])&&$this->post['projectNo']!==""?trim($this->post['projectNo']):"";
        if($projectNo!==""){
            $where[]=["projectNo","=",$projectNo];
        }
        $source =isset($this->post['source'])&&$this->post['source']!==""?intval($this->post['source']):"";
        if($source!==""){
            $where[]=["data_source","=",$source];
        }
        $cat_id =isset($this->post['cat_id'])&&$this->post['cat_id']!==""?intval($this->post['cat_id']):"";
        if($cat_id!==""){
            $where[]=["cat_id","=",$cat_id];
        }
        $status =isset($this->post['status'])&&$this->post['status']!==""?intval($this->post['status']):"";
        if($status!==""){
            $where[]=["status","=",$status];
        }
        $count = Db::name('project_feedback')->where($where)->count();
        $total = ceil($count / $size);
        $page = $page >= $total ? $total : $page;
        $list = Db::name('project_feedback')->where($where)->page($page,$size)->order("addtime desc")->select();
        $data=[];
        foreach ($list as $value){
            $value['can']=isset($value['cat_id'])&&$value['cat_id']!=""?made($value['cat_id']):"";

            if($value['data_source']==1){
                $good=Db::name("good_platform")->alias("a")->leftJoin("good b","a.spuCode=b.spuCode")->where
                (["a.skuCode"=>$value['skuCode'],"a.is_del"=>0])->find();
                $nake = Db::name("good_nake")->where([["spuCode","=",$value['spuCode']],["min_num","<=",
                    $value["num"]],["is_del","=",0]])->order("min_num desc")->find();
                $good['unit_id'] = isset($good['good_unit'])?$good['good_unit']:"";
                $good['cost_desc'] = isset($good['craft_desc'])?$good['craft_desc']:"";
                $good['pakge_fee'] = isset($nake['package_fee'])?$nake['package_fee']:"0";
                $good['mark_fee'] = isset($nake['mark_fee'])?$nake['mark_fee']:"0";
                $good['other_fee'] = isset($nake['other_fee'])?$nake['other_fee']:"0";
                $good['cert_fee'] = isset($nake['cert_fee'])?$nake['cert_fee']:"0";
                $good['delivery_fee'] = isset($nake['delivery_fee'])?$nake['delivery_fee']:"0";
                $good['nake_fee'] = isset($nake['nake_fee'])?$nake['nake_fee']:"0";
                $good['metal_id'] = isset($good['noble_metal'])?$good['noble_metal']:"0";
                $spec = Db::name("good_spec")->where(["spuCode"=>$good['spuCode'],"is_del"=>0])->select()->toArray();
                $good['specinfo']=[];
                if(!empty($spec)){
                    foreach ($spec as $vae){
                        $specs=Db::name("specs")->where(["id"=>$vae['spec_id']])->find();
                        $spec_value = Db::name("spec_value")->where(["id"=>$vae["spec_value_id"]])->find();
                        $temp = ["specid"=>$vae['spec_id'],"spec_name"=>$specs['spec_name'],"spec_value_id"=>$vae['spec_value_id'],"spec_value_name"=>$spec_value["spec_value"]];
                        $good['specinfo'][]=$temp;
                    }

                }
                $nake =Db::name("good_nake")->where(["spuCode"=>$good['spuCode'],"is_del"=>0])->where([["min_num","<=",$value['num']]])
                    ->order("min_num desc")->find();
                $good['origin_price']=$nake['nake_total'];
                $good['work_day']=$good['lead_time'];
                $good_img = $good['good_thumb_img'];

            }else{
                $good=Db::name("consult_bids")->where(["spuCode"=>$value['spuCode'],"is_del"=>0])->find();
                $good['specinfo'] = isset($good['specinfo'])&&$good['specinfo']!=""?json_decode($good['specinfo'],
                    true):"";
                $catinfo = Db::name("cat")->where(["id"=>$good['cat_id']])->find();
                $budget = isset($catinfo['order_rate']) ? $catinfo['order_rate']:100;
                $good_img = $good['good_img'];
            }
            $nobel =\think\facade\Config::get("noble");
            $value['good_name'] = isset($good['good_name'])?$good['good_name']:"";
            //  $value['good_img'] = isset($good['good_img'])?$good['good_img']:"";
            $value['brand_id'] = isset($good['brand_id'])?$good['brand_id']:"";
            $brand = Db::name("brand")->where(['id'=>$value["brand_id"]])->find();
            $value['brand_name'] =isset($brand['brand_name']) ? $brand['brand_name']:"";
            $value['specinfo'] = isset($good['specinfo'])&&$good['specinfo']!=""?$good['specinfo']:[];
            $value['unit_id'] = isset($good['unit_id'])?$good['unit_id']:"";
            $unit = Db::name("unit")->where(['id'=>$value["unit_id"]])->find();
            $value["unit_name"]=isset($unit['unit'])?$unit['unit']:"";
            $value['cost_desc'] = isset($good['cost_desc'])?$good['cost_desc']:"";
            $value['work_day'] = isset($good['work_day'])?$good['work_day']:"";
            $value['delivery_day'] = isset($good['delivery_day'])?$good['delivery_day']:"";
            $value['expire_day'] = isset($good['expire_day'])?$good['expire_day']:"0";
            $value['good_img'] = $good_img;
            $value['expire_day'] = isset($good['expire_day'])?$good['expire_day']:"";
            $value['origin_place'] = isset($good['origin_place'])?$good['origin_place']:"";
            $value['supplierNo'] = isset($good['supplierNo'])?$good['supplierNo']:"";
            $value['pay_way'] = isset($good['pay_way'])?$good['pay_way']:"";
            $value['tax'] = isset($good['tax'])?$good['tax']:"";
            $value['send_way'] = isset($good['send_way'])?$good['send_way']:"";
            $value['metal_id'] = isset($good['metal_id'])?$good['metal_id']:"";
            $value['metal_name'] = isset($nobel[$good['metal_id']])?$nobel[$good['metal_id']]:"";
            $value['is_gold_price'] = isset($good['is_gold_price'])?$good['is_gold_price']:"0";
            $value['config'] = isset($good['config'])?$good['config']:"";
            $value['other_config'] = isset($good['other_config'])?$good['other_config']:"";
            $value['weight'] = isset($good['weight'])?$good['weight']:"";
            $value['is_diff'] = isset($good['is_diff'])?$good['is_diff']:"0";
            $value['demo_fee'] = isset($good['demo_fee'])?$good['demo_fee']:"0";
            $value['deivery_fee'] = isset($good['deivery_fee'])?$good['deivery_fee']:"0";
            $value['open_fee'] = isset($good['open_fee'])?$good['open_fee']:"0";
            $value['pakge_fee'] = isset($good['pakge_fee'])?$good['pakge_fee']:"0";
            $value['nake_fee'] = isset($good['nake_fee'])?$good['nake_fee']:"0";
            $value['mark_fee'] = isset($good['mark_fee'])?$good['mark_fee']:"0";
            $value['cert_fee'] = isset($good['cert_fee'])?$good['cert_fee']:"0";
            $value['cost_fee'] = isset($good['cost_fee'])?$good['cost_fee']:"0";
            $value['rate'] = $value['sale_price'] == 0 ? 0 : round(($value['sale_price'] - $value['origin_price']) / $value['sale_price'] * 100, 2);
            $value['supply_area'] = isset($good['supply_area'])?$good['supply_area']:"";
            $data[]=$value;
        }
        return app_show(0,"获取成功",['list'=>$data,'count'=>$count]);
    }
    public function project_plan(){
        $projectNo = isset($this->post['projectNo'])&&$this->post['projectNo']!==""?trim($this->post['projectNo']):"";
        if($projectNo==""){
            return error_show(1004,"参数projectNo不能为空");
        }

        $type = isset($this->post['type'])&&$this->post['type']!=="" ? intval($this->post['type']) :0;

        $info =Db::name("project")->where(["projectNo"=>$projectNo,"is_del"=>0])->find();
        if($info==false){
            return error_show(1004,"未找到项目信息");
        }
        $plat = Db::name("platform")->where(['id'=>$info['platform_id']])->find();
        $info['platform_name']=isset($plat['platform_name'])?$plat['platform_name']:"";
        $info['platform_code']=isset($plat['platform_code'])?$plat['platform_code']:"";

        $userCommon = \app\admin\common\User::getIns();
        $names = $userCommon->handle('getCodeAndName', ['code' => $info['khNo']]);
//        $khinfo = Db::name("customer_info")->where(["companyNo"=>$info['khNo']])->find();
        $info['khName'] = $names['data'][$info['khNo']] ?? '';//isset($khinfo['companyName'])?$khinfo['companyName']:"";
        if($type==1){
            $where = ['projectNo'=>$projectNo,"is_del"=>0,"status"=>1];
        }else{
            $where = ['projectNo'=>$projectNo,"is_del"=>0];
        }
        $ladder = Db::name("project_plan")->where($where)->order("addtime desc")->select()->toArray();
        $info=[];
        if(!empty($ladder)){
            foreach ($ladder as $value){
                $value['feedback']=[];
                $feedback =Db::name("project_plan_rela")->where(["planNo"=>$value['planNo'],"is_del"=>0])->column("feedback_id,sale_price,sale_num");
                if(!empty($feedback)){
                    $feedid = array_column($feedback,"feedback_id");
                    $feedlist = Db::name("project_feedback")->where(["id"=>$feedid,"is_del"=>0])->select();
                    if(!empty($feedlist)){
                        foreach ($feedlist as $val){
                            $key =array_search($val['id'],$feedid);
                            $price = $feedback[$key]['sale_price'];
                            $val["cat_info"]=isset($val['cat_id'])&&$val['cat_id']!=""? made($val['cat_id'],[]):[];
                            $val["sale_price"]=$price;
                            $val["origin_num"]=$val['num'];
                            $val["num"]=$feedback[$key]['sale_num'];
                            if($val['data_source']!=1){
                                $good=Db::name("consult_bids")->where(["spuCode"=>$val['spuCode'],"is_del"=>0])->find();
                                $good['specinfo']=isset($good['specinfo'])&&$good['specinfo']!=""?json_decode($good['specinfo'],true):[];
                            }else{
                                $good=Db::name("good")->where(["spuCode"=>$val['spuCode'],"is_del"=>0])->find();
                                $spec = Db::name("good_spec")->where(["spuCode"=>$val['spuCode'],"is_del"=>0])->select()->toArray();
                                $good['specinfo']=[];
                                if(!empty($spec)){
                                    foreach ($spec as $vae){
                                        $specs=Db::name("specs")->where(["id"=>$vae['spec_id']])->find();
                                        $spec_value = Db::name("spec_value")->where(["id"=>$vae["spec_value_id"]])->find();
                                        $temp = ["specid"=>$vae['spec_id'],"spec_name"=>$specs['spec_name'],"spec_value_id"=>$vae['spec_value_id'],"spec_value_name"=>$spec_value["spec_value"]];
                                        $good['specinfo'][]=$temp;
                                    }
                                }
                            }
                            if(isset($good['brand_id'])){
                                $brand =Db::name("brand")->where(["id"=>$good['brand_id']])->find();
                            }
                            $val['good_img']=isset($good['good_img'])&&$good['good_img']!=""?trim($good['good_img']):"";
                            $val['brand_id']=isset($good['brand_id'])&&$good['brand_id']!=""?$good['brand_id']:"";
                            $val['brand_name']=isset($brand['brand_name'])&&$brand['brand_name']!=""?$brand['brand_name']:"";
                            $val['specinfo']=isset($good['specinfo'])&&$good['specinfo']!=""?$good['specinfo']:[];
                            $value['feedback'][]=$val;
                        }
                    }
                }
                $info[]=$value;
            }
        }
        return app_show(0,"获取成功",$info);
    }
    public function  feedCheck(){
        $feedid = isset($this->post['feedid'])&&!empty($this->post['feedid']) ? $this->post['feedid'] :[];
        if(empty($feedid)){
            return error_show(1004,"参数feedid不能为空");
        }
        $feedid=array_unique($feedid);
        $selec = Db::name("project_feedback")->where(["id"=>$feedid,'is_del'=>0,"status"=>0])->select()->toArray();
        if(empty($selec)){
            return error_show(1004,"反馈数据信息未找到");
        }
        $pgnos =array_column($selec,"pgNo");
        $infolist =   Db::name("project_info")->where(['pgNo'=>$pgnos])->select()->toArray();
        if(empty($infolist)){
            return error_show(1004,"项目商品数据未找到");
        }
        Db::startTrans();
        try{
            $up = Db::name("project_feedback")->where(["id"=>$feedid,'is_del'=>0,"status"=>0])->save(["status"=>1,"updatetime"=>date("Y-m-d H:i:s")]);
            if($up){

                foreach ($infolist as $value){
                    $old_value_status = $value['status'];
                    $value['status']=3;
                    $value['updatetime']=date("Y-m-d H:i:s");
                    $up = Db::name("project_info")->save($value);
                    if($up){
                        ActionLog::logAdd(['id'=>0,"nickname"=>'客户'], [
                            "order_code" => $value['pgNo'],//项目编码
                            "status" =>$old_value_status,//这里的status是之前的值
                            "action_remark" => '',//备注
                            "action_type" => "edit"//新建create,编辑edit更改状态status
                        ], "PRI", 3, ["status" =>3, "updatetime" => date("Y-m-d H:i:s")]);
                        $count = Db::name("project_info")->where(["projectNo"=>$value['projectNo'],"status"=>2])
                            ->count();
                        if($count==0){
                            $pr=Db::name("project")->where(["projectNo" => $value['projectNo']])->find();
                            if($pr==false){
                                Db::rollback();
                                return error_show(1004, "未找到项目信息");
                            }
                            $proc =Db::name("project")->where(["projectNo"=>$value['projectNo']])->save
                            (["status"=>3,"updatetime"=>date("Y-m-d H:i:s")]);
                            if(!$proc){
                                Db::rollback();
                                return error_show(1004,"反馈数据选择失败");
                            }
                            ActionLog::logAdd(['id'=>0,"nickname"=>'客户'], [
                                "order_code" => $value['projectNo'],//项目编码
                                "status" =>$pr['status'],//这里的status是之前的值
                                "action_remark" => '',//备注
                                "action_type" => "edit"//新建create,编辑edit更改状态status
                            ], "PRO", 3, ["status" => 3, "updatetime" => date("Y-m-d H:i:s")]);

                            $process = ["order_code" => $value['projectNo'], "order_id" => $pr['id'], "order_status" =>3, "order_type" => 'PRO',"before_status"=> $pr['status'],'holder_id'=>$pr['createrid']];
                            ProcessOrder::AddProcess(['id'=>0,"nickname"=>'客户'], $process);
                        }
                    }else{
                        Db::rollback();
                        return error_show(1004,"反馈数据选择失败");
                    }
                    $consult =Db::name('consult_order')->where(["projectNo"=>$value['projectNo']])->find();
                    if($consult!=false){
                        $up=Db::name("consult_info")->where(['zxNo'=>$consult['zxNo'],"is_del"=>0,"status"=>1])->select()
                            ->toArray();
                        if(!empty($up)){
                            $staar=Db::name("consult_info")->where(['zxNo'=>$consult['zxNo'],"is_del"=>0,"status"=>1])->save
                            (["status"=>2,"updatetime"=>date("Y-m-d H:i:s")]);
                            if($staar==false){
                                Db::rollback();
                                return error_show(1002, "项目咨询单招标结束失败");
                            }
                        }
                    }
                }

                Db::commit();
                return app_show(0,"反馈数据选择成功");
            }else{
                Db::rollback();
                return error_show(1004,"反馈数据选择失败");
            }
        }catch (\Exception $e){
            Db::rollback();
            return error_show(1004,$e->getMessage());
        }

    }
    public function  planCheck(){
        $planNos = isset($this->post['planNos'])&&!empty($this->post['planNos'])? $this->post['planNos'] :"";
        if($planNos==""){
            return error_show(1004,"参数planNos不能为空");
        }
        $status=isset($this->post['status'])&&$this->post['status']!=="" ? intval($this->post['status']):"";
        if($status==""){
            return error_show(1004,"参数status不能为空");
        }
        $selec = Db::name("project_plan")->where(["planNo"=>$planNos,'is_del'=>0,"status"=>0])->select()->toArray();
        if(empty($selec)){
            return error_show(1004,"项目方案数据信息未找到");
        }
        Db::startTrans();
        try{
            $up = Db::name("project_plan")->where(["planNo"=>$planNos,'is_del'=>0,"status"=>0])->save(["status"=>1,"updatetime"=>date("Y-m-d H:i:s")]);
            if($up) {
                foreach ($selec as $value){
                    ActionLog::logAdd(['id'=>0,"nickname"=>'客户'], [
                        "order_code" => $value['planNo'],//项目编码
                        "status" =>0,//这里的status是之前的值
                        "action_remark" => '',//备注
                        "action_type" => "edit"//新建create,编辑edit更改状态status
                    ], "PRP", 1, ["status" =>1, "updatetime" => date("Y-m-d H:i:s")]);
                }
                $project = array_column($selec, "projectNo");
                if (empty($project)) {
                    Db::rollback();
                    return error_show(1004, "方案选择失败");
                }
                $pr=Db::name("project")->where(["projectNo" => $project, "status" => 4])->find();
                if($pr==false){
                    Db::rollback();
                    return error_show(1004, "未找到项目信息");
                }
                $pro = Db::name("project")->where($pr)->save(["status" => 5, "updatetime" => date("Y-m-d H:i:s")]);
                if ($pro) {

                ActionLog::logAdd(['id'=>0,"nickname"=>'客户'], [
                    "order_code" => $pr['projectNo'],//项目编码
                    "status" =>4,//这里的status是之前的值
                    "action_remark" => '',//备注
                    "action_type" => "edit"//新建create,编辑edit更改状态status
                ], "PRO", 5, ["status" => 5, "updatetime" => date("Y-m-d H:i:s")]);

                $process = ["order_code" => $pr['projectNo'], "order_id" => $pr['id'], "order_status" =>5, "order_type" => 'PRO',"before_status"=> $pr['status'],'holder_id'=>$pr['createrid']];
                ProcessOrder::AddProcess(['id'=>0,"nickname"=>'客户'], $process);
                    Db::commit();
                    return app_show(0, "方案数据修改成功");
                }
            }
            Db::rollback();
            return error_show(1004,"方案选择失败");
        }catch (\Exception $e){
            Db::rollback();
            return error_show(1004,$e->getMessage()."|".$e->getLine());
        }

    }

    public function outOrder(){
       $param =$this->request->param();
        $outOrdr = isset($param['outCode'])&&$param['outCode']!=''? trim($param['outCode']) :"";
        if($outOrdr==""){
            return error_show(1004,"参数 outCode 不能为空");
        }
        $outinfo =Db::name("order_out")->where(["outCode"=>$outOrdr,"is_del"=>0])
        ->field("orderCode,outCode,apply_id,apply_name,addrid,post_name,post_code,sendtime,send_num,remark,addtime,updatetime")->find();
        if($outinfo==false){
         return error_show(1004,"未找到发货单信息");
        }
        $addrinfo =Db::name("order_addr")->where(["id"=>$outinfo['addrid']])->field("addr,addr_code,contactor,mobile,receipt_quantity")
        ->find();
        if($addrinfo==false){
            return error_show(1004,"未找到发货单地址信息");
        }
        $orderinfo =Db::name("sale")->where(["orderCode"=>$outinfo["orderCode"],"is_del"=>0])
        ->field("good_code,good_name,addtime,order_type")->find();
        if($orderinfo==false){
            return error_show(1004,"未找到订单信息");
        }

        $postdata=[];
        if($outinfo['post_code']!=''){
            $postCode = explode(",",$outinfo['post_code']);
            $postinfo =Db::name("express_data")->where(["post_code"=>$postCode[0]])->find();
            if($postinfo['status']>0){
                $postdata=json_decode($postinfo['post_data'],true);
            }
        }
         if($orderinfo['order_type']==3 || $orderinfo['order_type']==4){
            $good=Db::name("good_zixun")->where(["spuCode"=>$orderinfo['good_code'],"is_del"=>0])->find();
          }else{
            $good=Db::name("good")->where(["spuCode"=>$orderinfo['good_code'],"is_del"=>0])->find();
         }
         $info = GetInfoNoToken(["id"=>$outinfo['apply_id']]);
         $outinfo['apply_mobile'] ='';
         if($info['code']==0 && !empty($info['data'])) $outinfo['apply_mobile'] = $info['data']['mobile'] ?? '';
        $outinfo['addr'] = $addrinfo['addr'];
        $outinfo['contactor'] = $addrinfo['contactor'];
        $outinfo['mobile'] = $addrinfo['mobile'];
        $outinfo['receipt_num'] = $addrinfo['receipt_quantity'];
        $outinfo['good_name'] = $orderinfo['good_name'];
        $outinfo['good_code'] = $orderinfo['good_code'];
        $outinfo['order_time'] = $orderinfo['addtime'];
        $outinfo['post_data'] = $postdata;
        $outinfo['good_img'] = isset($good['good_img'])&&$good['good_img']!=""?trim($good['good_img']):"";
        return app_show(0,"获取成功",$outinfo);
    }
}