post['name'])&&$this->post['name']!=""? trim($this->post['name']):""; if($name==""){ return error_show(1004,"参数name不能为空"); } $platform = isset($this->post['platform'])&&$this->post['platform']!=""? trim($this->post['platform']):""; if($platform==""){ return error_show(1004,"参数platform不能为空"); } $khNo = isset($this->post['khNo'])&&$this->post['khNo']!=""?trim($this->post['khNo']):""; $companyNo = isset($this->post['companyNo'])&&$this->post['companyNo']!=""?trim($this->post['companyNo']):""; if($khNo==""){ return error_show(1004,"参数khNo不能为空"); } if($companyNo==""){ return error_show(1004,"参数companyNo不能为空"); } $platform_temp = Db::name('platform') ->field('id,is_select_pay_rate,status') ->where(['is_del' => 0, 'id' => $platform]) ->findOrEmpty(); if (empty($platform_temp)) return json_show(1004, '该平台不存在'); if ($platform_temp['status'] != 1) return json_show(1004, '该平台已被启用'); if ($platform_temp['is_select_pay_rate'] == 1) { $temp = Db::name('platform_pay_rate') ->field('id') ->where(['is_del' => 0, 'platform_id' => $platform, 'companyNo' => $companyNo]) ->findOrEmpty(); if (!empty($temp)) return json_show(1004, '平台设置支付渠道业务公司,不能包含销售方公司'); } $use_desc = isset($this->post['use_desc'])&&$this->post['use_desc']!=""?trim($this->post['use_desc']):""; $budget_total = isset($this->post['budget_total'])&&$this->post['budget_total']!=""?floatval($this->post['budget_total']):""; $arrtime = isset($this->post['arrtime'])&&$this->post['arrtime']!=""?$this->post['arrtime']:""; $endtime = isset($this->post['endtime'])&&$this->post['endtime']!=""?$this->post['endtime']:""; if($use_desc==""){ return error_show(1004,"参数use_desc不能为空"); } if($budget_total==""){ return error_show(1004,"参数budget_total不能为空"); } if($arrtime==""){ return error_show(1004,"参数arrtime不能为空"); } if($endtime==""){ return error_show(1004,"参数endtime不能为空"); } $low_rate = isset($this->post['low_rate'])&&$this->post['low_rate']!=""?floatval($this->post['low_rate']):"0"; // if($low_rate==""){ // return error_show(1004,"参数low_rate不能为空"); // } $ladder = isset($this->post['ladder'])&&!empty($this->post['ladder'])? $this->post['ladder']:""; if($ladder==""){ return error_show(1004,"参数ladder不能为空"); } // $token = isset($this->post['token'])&& $this->post['token']!='' ? trim($this->post['token']):""; // if($token==''){ // return error_show(105,"参数token不能为空"); // } // $user =GetUserInfo($token); // if(empty($user)||$user['code']!=0){ // return error_show(1002,"用户数据不存在"); // } $createrid= $this->uid;//isset($user["data"]['id']) ? $user["data"]['id'] : ""; $creater= $this->uname;//isset($user["data"]['nickname']) ? $user["data"]['nickname'] : ""; Db::startTrans(); try { $projectNo = makeNo("PR"); $data=[ "projectNo"=>$projectNo, "platform_id"=>$platform, "khNo"=>$khNo, "companyNo"=>$companyNo, "project_name"=>$name, "budget_total"=>$budget_total, "use_desc"=>$use_desc, "low_rate"=>$low_rate, "creater"=>$creater, "createrid"=>$createrid, "arrtime"=>$arrtime, "endtime"=>$endtime, "status"=>1, "is_del"=>0, "addtime"=>date("Y-m-d H:i:s"), "updatetime"=>date("Y-m-d H:i:s") ]; $pro=Db::name("project")->insertGetId($data); if($pro>0){ if(!empty($ladder)){ $la=[]; foreach ($ladder as $value){ $pgNo = makeNo("PI"); $temp=[]; $temp['pgNo']=$pgNo; $temp['projectNo']=$projectNo; $temp['good_type']=$value['good_type']; $temp['good_name']=$value['good_name']; $temp['good_img']=$value['good_img']; $temp['cat_id']=isset($value['cat_id'])?$value['cat_id']:0; $temp['budget_price']=$value['budget_price']; $temp['num']=$value['num']; $temp['creater']=$creater; $temp['createrid']=$createrid; $temp['status']=1; $temp['is_del']=0; $temp['addtime']=date("Y-m-d H:i:s"); $temp['updatetime']=date("Y-m-d H:i:s"); $in = Db::name("project_info")->insert($temp,true); if($in>0){ ActionLog::logAdd(['id'=>$createrid,'nickname'=>$creater], [ "order_code" => $pgNo,//编码,这里是project的编码 "status" => 1,//这里的status是之前的值 "action_remark" => '',//备注 "action_type" => "create"//新建create,编辑edit,更改状态status ], "PRI", 1, $temp); }else{ Db::rollback(); return error_show(1004,"项目新建失败"); } } //修改状态,添加待办 ActionLog::logAdd(['id'=>$createrid,'nickname'=>$creater], [ "order_code" => $projectNo,//项目编码 "status" =>0,//这里的status是之前的值 "action_remark" => '',//备注 "action_type" => "create"//新建create,编辑edit更改状态status ], "PRT", 1, $this->post); $process = ["order_code" => $projectNo, "order_id" => Db::name("project")->getLastInsID(), "order_status" =>1, "order_type" => 'PRT',"before_status"=>1];//order_status==7修改毛利率 ProcessOrder::AddProcess(['id'=>$createrid,'nickname'=>$creater], $process); //修改状态,添加待办,只记录动作 ActionLog::logAdd(['id'=>$createrid,'nickname'=>$creater], [ "order_code" => $projectNo,//编码,这里是project的编码 "status" => 1,//这里的status是之前的值 "action_remark" => '',//备注 "action_type" => "create"//新建create,编辑edit,更改状态status ], "PRO", 1, $this->post); $process = ["order_code" => $projectNo, "order_id" => $pro, "order_status" =>1, "order_type" =>"PRO","before_status"=>1,'holder_id'=>$data['createrid']]; ProcessOrder::AddProcess(['id'=>$createrid,'nickname'=>$creater], $process); //台账记录 Db::name('standing_book') ->insert([ 'standBookNo' => makeNo("IO"), 'projectNo' => $projectNo, 'companyNo' => $companyNo, 'customer_code' => $khNo, 'addtime' => date('Y-m-d H:i:s'), 'updatetime' => date('Y-m-d H:i:s') ]); Db::commit(); return app_show(0,"项目新建成功",['projectNo'=>$projectNo]); } } Db::rollback(); return error_show(1004,"项目新建失败"); }catch (\Exception $e){ Db::rollback(); return error_show(1004,$e->getMessage()); } } public function addfeed(){ $pgNo =isset($this->post['pgNo']) && $this->post['pgNo']!=""? trim($this->post['pgNo']):""; if($pgNo==""){ return error_show(1004,"参数pgNo不能为空"); } $projectinfo = Db::name("project_info")->where(["pgNo"=>$pgNo,"is_del"=>0])->find(); if($projectinfo==false){ return error_show(1004,"未找到项目阶梯信息"); } $project = Db::name("project")->where(["projectNo"=>$projectinfo['projectNo'],"is_del"=>0])->find(); if($project==false){ return error_show(1004,"未找到项目阶梯信息"); } $spuCode =isset($this->post['spuCode'])&&!empty($this->post['spuCode']) ?$this->post['spuCode']:""; if($spuCode==""){ return error_show(1004,"参数spuCode不能为空"); } $source =isset($this->post['source'])&&$this->post['source']!=="" ?intval($this->post['source']):"1"; if($source==""){ return error_show(1004,"参数source不能为空"); } $good=[]; if($source==1){ $good=Db::name("good_platform")->alias("a")->leftJoin("good b","a.spuCode=b.spuCode")->where (["a.skuCode"=>$spuCode,"a.is_del"=>0])->select()->toArray(); if(empty($good)){ return error_show(1004,"未找到商品信息"); } }else{ $good=Db::name("consult_bids")->where(["spuCode"=>$spuCode,"is_del"=>0])->select()->toArray(); if(empty($good)){ return error_show(1004,"未找到商品信息"); } } // $token = isset($this->post['token'])&& $this->post['token']!='' ? trim($this->post['token']):""; // if($token==''){ // return error_show(105,"参数token不能为空"); // } // $user =GetUserInfo($token); // if(empty($user)||$user['code']!=0){ // return error_show($user['code'],"用户数据不存在"); // } $createrid= $this->uid;//isset($user["data"]['id']) ? $user["data"]['id'] : ""; $creater= $this->uname;//isset($user["data"]['nickname']) ? $user["data"]['nickname'] : ""; Db::startTrans(); try{ $data=[]; foreach ($good as $value){ $temp=[]; $temp['spuCode']=$value['spuCode']; $temp['skuCode']=isset($value['skuCode'])?$value['skuCode']:""; $temp['pgNo']=$projectinfo['pgNo']; $temp['projectNo']=$projectinfo['projectNo']; $temp['good_name']=$value['good_name']; $temp['good_type']=$projectinfo['good_type']; $temp['data_source']=$source; $temp['cat_id']=$value['cat_id']; $temp['budget_price']=$projectinfo['budget_price']; if($source==1){ $ladd = Db::name("good_ladder")->where([["skuCode","=",$value['skuCode']],["min_num","<=", $projectinfo["num"]],["status","=",1],["is_del","=",0]])->order("min_num desc")->find(); $nake =Db::name("good_nake")->where(["spuCode"=>$value['spuCode'],"is_del"=>0])->where([["min_num","<=",$projectinfo['num']]]) ->order("min_num desc")->find(); $origin_price=isset($nake['nake_total'])?$nake['nake_total']:"0" ; $sale_price = $ladd['sale_price']; if($value['is_gold_price']==1 && $value['is_stock']!=1){ $gold = Db::name("gold_price1") ->field('id,price') ->where(["type" => $value['noble_metal'], "is_del" => 0, "status" => 1]) ->order("addtime desc") ->find(); //$saleprice(最终售价) = (打样费/购买数量 + 开模费/购买数量 + 商品重量* 最新金价 + 工艺费* 商品重量+包装费+加标费+证书费+产品裸价+物流费)/(1-成本售价/100); $sale_price = ($value['demo_fee'] / $projectinfo["num"] + $value['open_fee'] / $projectinfo["num"] + $value['noble_weight'] * $gold["price"] + $ladd['cost_fee'] * $value['noble_weight'] + $nake['package_fee'] + $nake['mark_fee'] + $nake['cert_fee'] + $nake['nake_fee'] + $nake['delivery_fee']); } }else{ $sale_price =$value['sale_price']; $origin_price =$value['sale_price']; } $temp['sale_price']=$sale_price; $temp['origin_price']=$origin_price; $temp['num']=$projectinfo['num']; $temp['status']=0; $temp['is_del']=0; $temp['creater']=$creater; $temp['createrid']=$createrid; $temp['addtime']=date("Y-m-d H:i:s"); $temp['updatetime']=date("Y-m-d H:i:s"); $data[]=$temp; } $nu = Db::name("project_feedback")->insertAll($data); if($nu>0){ $old_projectinfo_status = $projectinfo['status']; $projectinfo['status']=2; $projectinfo['updatetime']=date("Y-m-d H:i:s"); $up = Db::name("project_info")->save($projectinfo); if($up){ //修改状态,添加待办,只记录动作 ActionLog::logAdd(['id' => $this->uid, 'nickname' => $this->uname], [ "order_code" => $pgNo,//编码,这里是project的编码 "status" => $old_projectinfo_status,//这里的status是之前的值 "action_remark" => '',//备注 "action_type" => "status"//新建create,编辑edit,更改状态status ], "PRI", 2, $projectinfo); $count = Db::name("project_info")->where(["projectNo"=>$projectinfo['projectNo'],"status"=>1]) ->count(); if($count==0){ $proc =Db::name("project")->where(["projectNo"=>$projectinfo['projectNo'],"status"=>1])->save (["status"=>2,"updatetime"=>date("Y-m-d H:i:s")]); if($proc){ //修改状态,添加待办 ActionLog::logAdd(['id' => $this->uid, 'nickname' => $this->uname], [ "order_code"=>$projectinfo['projectNo'],//项目编码 "status"=>1,//这里的status是之前的值 "action_remark"=>'',//备注 "action_type"=>"status"//新建create,编辑edit,更改状态status ],"PRO",2,["status"=>2,"updatetime"=>date("Y-m-d H:i:s")]); ProcessOrder::AddProcess(['id' => $this->uid, 'nickname' => $this->uname],[ "order_type"=>'PRO', "order_code"=>$projectinfo['projectNo'], "order_id"=>$project['id'],//这里更新是根据编码更新的,没有主键id "order_status"=>2, "before_status"=>1, 'holder_id'=>$project['createrid'] ]); Db::commit(); return app_show(0,"添加成功"); } } } 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 list() { $param = $this->request->only([ 'page' => 1, 'size' => 10, 'khNo' => '', 'project_name' => '', 'status' => '', 'start' => '', 'end' => '', 'low' => '', 'up' => '', 'companyNo' => '', 'relaComNo' => '', 'platform_id' => '', 'company_name' => '', ], 'post', 'trim'); // $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 = [["p.is_del", "=", 0]]; // $khNo = isset($this->post['khNo']) &&$this->post['khNo']!==""? trim($this->post['khNo']):""; if ($param['khNo'] !== "") $where[] = ["p.khNo", "=", $param['khNo']]; // $project_name = isset($this->post['project_name']) &&$this->post['project_name']!==""? trim($this->post['project_name']):""; if ($param['project_name'] !== "") $where[] = ["p.project_name", "like", '%' . $param['project_name'] . '%']; // $status = isset($this->post['status']) &&$this->post['status']!==""? intval($this->post['status']):""; if ($param['status'] !== "") $where[] = ["p.status", "=", $param['status']]; // $start = isset($this->post['start'])&&$this->post['start']!=="" ? $this->post['start']:""; if ($param['start'] !== '') $where[] = ["p.addtime", ">=", $param['start']]; // $end = isset($this->post['end'])&&$this->post['end']!=="" ? $this->post['end']:""; if ($param['end'] !== '') $where[] = ["p.addtime", "<=", $param['end']]; // $low = isset($this->post['low'])&&$this->post['low']!=="" ? floatval($this->post['low']):""; if ($param['low'] !== '') $where[] = ["p.budget_total", ">=", $param['low']]; // $up = isset($this->post['up'])&&$this->post['up']!=="" ? floatval($this->post['up']):""; if ($param['up'] !== '') $where[] = ["p.budget_total", "<=", $param['up']]; // $companyNo = isset($this->post['companyNo'])&&$this->post['companyNo']!=="" ? trim($this->post['companyNo']):""; if ($param['companyNo'] !== '') $where[] = ["p.companyNo", "like", '%' . $param['companyNo'] . '%']; // $relaComNo = isset($this->post['relaComNo']) && $this->post['relaComNo'] !== "" ? trim($this->post['relaComNo']) : ""; if ($param['relaComNo'] != '') $where[] = ["p.companyNo", "=", $param['relaComNo']]; // $platform_id = isset($this->post['platform_id'])&&$this->post['platform_id']!=="" ? intval($this->post['platform_id']):""; if ($param['platform_id'] !== '') $where[] = ["p.platform_id", "=", $param['platform_id']]; // $company_name = isset($this->post['company_name'])&&$this->post['company_name']!=="" ? trim($this->post['company_name']):""; if ($param['company_name'] !== '') $where[] = ["p.createrid", 'in', get_company_item_user_by_name($param['company_name'])]; // $role=$this->checkRole(); // if(!empty($role['write'])){ // $where[]=["p.createrid","in",$role['write']]; // } // $role = $this->checkDataShare(); // if (!empty($role[DataGroupModel::$type_全部])) $where[] = ['p.createrid', 'in', $role[DataGroupModel::$type_全部]]; $role = $this->checkDataShare(); $hand = resign_hand_user($this->uid, 0); if (!empty($role[DataGroupModel::$type_全部])) { $arr = array_unique(array_merge($hand, $role[DataGroupModel::$type_全部])); $where[] = ['p.createrid', 'in', $arr]; } // if(!empty($role['platform'])){ // $where[]=["p.platform_id","in",$role['platform']]; // } $count = Db::name('project') ->alias('p') ->where($where) ->count(); $list = Db::name('project') ->alias('p') ->field('p.*,b.platform_name,b.platform_code') ->leftJoin('platform b', 'b.id=p.platform_id') ->where($where) ->page($param['page'], $param['size']) ->order("p.addtime desc") ->select() ->toArray(); //所有创建人及所属部门 $all_createrid = array_column($list, 'createrid'); $item = get_company_name_by_uid($all_createrid); //所有公司编码 $all_code = array_merge(array_column($list, 'khNo'), array_column($list, 'companyNo')); $headquarters = get_headquarters_code_and_name($all_code); $data = []; foreach ($list as $value) { // $info = Db::name("platform")->where(['id'=>$value['platform_id']])->find(); // $value['platform_name']=isset($info['platform_name'])?$info['platform_name']:""; // $value['platform_code']=isset($info['platform_code'])?$info['platform_code']:""; // $khinfo = Db::name("customer_info")->where(["companyNo"=>$value['khNo']])->find(); $value['khName'] = $headquarters[$value['khNo']] ?? '';//isset($khinfo['companyName'])?$khinfo['companyName']:""; // $company = Db::name("business")->where(["companyNo"=>$value['companyNo']])->find(); $value['company'] = $headquarters[$value['companyNo']] ?? '';//isset($company['company'])?$company['company']:""; $value['company_name'] = $item[$value['createrid']]??''; //是否具有编辑权限 $value['is_allow_update'] = 0; if (in_array($this->roleid, [1, 33]) || in_array($value['createrid'], $role[DataGroupModel::$type_可编辑])) $value['is_allow_update'] = 1; $data[] = $value; } return app_show(0, "获取成功", ['list' => $data, 'count' => $count]); } 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 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['khNo'], $info['companyNo']]]); // $khinfo = Db::name("customer_info")->where(["companyNo"=>$info['khNo']])->find(); $info['khName'] = $tmp['data'][$info['khNo']] ?? '';//isset($khinfo['companyName'])?$khinfo['companyName']:""; // $company = Db::name("business")->where(["companyNo"=>$info['companyNo']])->find(); $info['company'] = $tmp['data'][$info['companyNo']] ?? '';//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'],[]):[]; }); // $zx = Db::name("consult_info")->where(["pgNo"=>$value["pgNo"],"is_del"=>0,"bargain_status"=>0]) // ->column("infoNo"); // if(!empty($zx)){ // $zxback = Db::name("consult_bids")->where(["infoNo"=>$zx,"is_del"=>0])->select()->toArray(); // array_walk($zxback,function (&$v){ // $v["cat_info"]=isset($v['cat_id'])? made($v['cat_id'],[]):[]; // }); // }else{ // $zxback=[]; // } $value['feedback']=$feedback; // $value['zxback']=$zxback; $info['ladder'][]=$value; } } return app_show(0,"获取成功",$info); } public function plan_create(){ $projectNo = isset($this->post['projectNo'])&&$this->post['projectNo']!==""?trim($this->post['projectNo']):""; if($projectNo==""){ return error_show(1004,"参数projectNo不能为空"); } $info =Db::name("project")->where(["projectNo"=>$projectNo,"is_del"=>0])->find(); if($info==false){ return error_show(1004,"未找到项目信息"); } if($info['low_rate']<=0){ return error_show(1004,"项目毛利未设置"); } if($info['status']!=3 && $info['status']!=4){ return error_show(1004,"项目状态有误"); } $feedback =isset($this->post['feedback'])&&!empty($this->post['feedback'])?$this->post['feedback']:""; if($feedback==""){ return error_show(1004,"参数feedback不能为空"); } $feedid =array_column($feedback,"feedid"); $feedinfo = Db::name("project_feedback")->where(['id'=>$feedid,"projectNo"=>$projectNo,"is_del"=>0]) ->select()->toArray(); if(empty($feedinfo)){ return error_show(1004,"反馈数据未找到"); } // $token = isset($this->post['token'])&& $this->post['token']!='' ? trim($this->post['token']):""; // if($token==''){ // return error_show(105,"参数token不能为空"); // } // $user =GetUserInfo($token); // if(empty($user)||$user['code']!=0){ // return error_show(1002,"用户数据不存在"); // } $createrid= $this->uid;//isset($user["data"]['id']) ? $user["data"]['id'] : ""; $creater= $this->uname;//isset($user["data"]['nickname']) ? $user["data"]['nickname'] : ""; Db::startTrans(); try { $planNo=makeNo("PL"); $total=0; $num_t=0; $origia=0; $dl=[]; foreach ($feedinfo as $value){ $key =array_search($value['id'],$feedid); $price = $feedback[$key]; // if($price['sale_price']<$value['origin_price']){ // Db::rollback(); // return error_show(1004,"反馈商品价格不能小于初始金额"); // } if($price['good_num']<$value['num']){ Db::rollback(); return error_show(1004,"商品数量不能小于初始数量"); } if($value['data_source']==2){ $bids =Db::name("consult_info")->where(["pgNo"=>$value['pgNo'],"is_del"=>0])->find(); if($bids==false){ Db::rollback(); return error_show(1004,"未找到反馈商品咨询单"); } $old_bids_status = $bids["status"]; $bids["status"]=3; $bids["updatetime"]=date("Y-m-d H:i:s"); $bd=Db::name("consult_info")->save($bids); if($bd==false){ Db::rollback(); return error_show(1004,"反馈商品咨询单更新失败"); }else{ //修改状态,添加待办 ActionLog::logAdd(['id' => $this->uid, 'nickname' => $this->uname], [ "order_code" => $bids['infoNo'],//咨询单详情编号 "status" => $old_bids_status,//这里的status是之前的值 "action_remark" => '',//备注 "action_type" => "status"//新建create,编辑edit,更改状态status ], "ZXD", 3, $bids); } } // $value['sale_price'] = $price['sale_price']; // $value['updatetime'] = date("Y-m-d H:i:s"); // $cre=Db::name("project_feedback")->save($value); // if($cre==false){ // Db::rollback(); // return error_show(1004,"反馈商品价格修改失败"); // } $temp=[]; $temp['planNo']=$planNo; $temp['feedback_id']=$value['id']; $temp['sale_price']=$price["sale_price"]; $temp['sale_num']=$price["good_num"]; $temp['status']=1; $temp['is_del']=0; $temp['addtime']=date("Y-m-d H:i:s"); $temp['updatetime']=date("Y-m-d H:i:s"); $total+=$price['good_num']*$price["sale_price"]; $origia+=$price['good_num']*$value["origin_price"]; $num_t+=$price['good_num']; $dl[]=$temp; } $rate = round(($total-$origia)/$total,4)*100; if($rate<$info['low_rate']){ Db::rollback(); return error_show(1004,"方案毛利不能低于最低项目毛利率"); } $inn=Db::name("project_plan_rela")->insertAll($dl); if($inn>0){ $data=[ "planNo"=>$planNo, "projectNo"=>$projectNo, "createrid"=>$createrid, "creater"=>$creater, "sale_total"=>round($total,2), "total_num"=>$num_t, "origin_total"=>round($origia,2), "sale_rate"=>$rate, "status"=>0, "is_del"=>0, "addtime"=>date("Y-m-d H:i:s"), "updatetime"=>date("Y-m-d H:i:s") ]; $up =Db::name("project_plan")->insert($data); if($up){ $old_project_status = $info['status']; $info['status']=4; $info['updatetime']=date("Y-m-d H:i:s"); $cr =Db::name("project")->save($info); if($cr){ //修改状态,添加待办 ActionLog::logAdd(['id' => $this->uid, 'nickname' => $this->uname], [ "order_code" => $projectNo,//项目编码 "status" => $old_project_status,//这里的status是之前的值 "action_remark" => '',//备注 "action_type" => "status"//新建create,编辑edit,更改状态status ], "PRO", 4, $info); ProcessOrder::AddProcess(['id' => $this->uid, 'nickname' => $this->uname], [ "order_type" => 'PRO', "order_code" => $projectNo, "order_id" => $info['id'], "order_status" => 4, "before_status"=>$old_project_status, 'holder_id'=>$info['createrid'] ]); Db::commit(); return app_show(0,"方案制作成功",["planNo"=>$planNo]); } } } Db::rollback(); return error_show(1004,"方案制作失败"); }catch (\Exception $e){ Db::rollback(); return error_show(1004,$e->getMessage()); } } public function planinfo(){ $planNo = isset($this->post['planNo'])&& $this->post['planNo']!==""?trim($this->post["planNo"]):""; if($planNo==""){ return error_show(1004,"参数planNo不能为空"); } $plan = Db::name("project_plan")->where(["planNo"=>$planNo,"is_del"=>0])->find(); if($plan==false){ return error_show(1004,"未找到项目方案信息"); } $plan['feedback']=[]; $feedback =Db::name("project_plan_rela")->where(["planNo"=>$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 $value){ $key =array_search($value['id'],$feedid); $price = $feedback[$key]['sale_price']; $value["cat_info"]=isset($value['cat_id'])&&$value['cat_id']!=""? made($value['cat_id'],[]):[]; $value["sale_price"]=$price; $value["origin_num"]=$value['num']; $value["num"]=$feedback[$key]['sale_num']; $plan['feedback'][]=$value; } } } return app_show(0,"获取成功",$plan); } 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["origin_sale_price"]=$val['sale_price']; $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_thumb_img'])&&$good['good_thumb_img']!=""?trim($good['good_thumb_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){ $poject=Db::name("project")->where(["projectNo"=>$value['projectNo']])->find(); if($poject==false){ Db::rollback(); return error_show(1004,"项目单未找到"); } $old_projectinfo_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' => $this->uid, 'nickname' => $this->uname], [ "order_code" => $value['pgNo'],//编码 "status" => $old_projectinfo_status,//这里的status是之前的值 "action_remark" => '',//备注 "action_type" => "status"//新建create,编辑edit,更改状态status ], "PRI", 3, $value); $count = Db::name("project_info")->where(["projectNo"=>$value['projectNo'],"status"=>2]) ->count(); if($count==0){ $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,"反馈数据选择失败"); }else{ //修改状态,添加待办 ActionLog::logAdd(['id' => $this->uid, 'nickname' => $this->uname], [ "order_code" =>$value['projectNo'],//项目编码 "status" => $poject['status'],//这里的status是之前的值 "action_remark" => '',//备注 "action_type" => "status"//新建create,编辑edit,更改状态status ], "PRO", 3, ["status"=>3,"updatetime"=>date("Y-m-d H:i:s")]); ProcessOrder::AddProcess(['id' => $this->uid, 'nickname' => $this->uname], [ "order_type" => 'PRO', "order_code" =>$value['projectNo'], "order_id" => $poject['id'], "order_status" => 3, "before_status"=>$poject['status'], 'holder_id'=>$poject['createrid'] ]); } } }else{ Db::rollback(); return error_show(1004,"反馈数据选择失败"); } } 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' => $this->uid, 'nickname' => $this->uname], [ "order_code" => $value['planNo'],//编码 "status" => $value['status'],//这里的status是之前的值 "action_remark" => '',//备注 "action_type" => "edit"//新建create,编辑edit,更改状态status ], "PRO", 1, $value); } $project = array_column($selec, "projectNo"); if (empty($project)) { Db::rollback(); return error_show(1004, "方案选择失败"); } $pro = Db::name("project")->where(["projectNo" => $project, "status" => 4])->save(["status" => 5, "updatetime" => date("Y-m-d H:i:s")]); if ($pro) { foreach ($project as $value){ $poject=Db::name("project")->where(["projectNo"=>$value])->find(); if($poject==false){ Db::rollback(); return error_show(1004,"项目单未找到"); } //修改状态,添加待办 ActionLog::logAdd(['id' => $this->uid, 'nickname' => $this->uname], [ "order_code" =>$value,//项目编码 "status" => 4,//这里的status是之前的值 "action_remark" => '',//备注 "action_type" => "status"//新建create,编辑edit,更改状态status ], "PRO", 5, ["status"=>5,"updatetime"=>date("Y-m-d H:i:s")]); ProcessOrder::AddProcess(['id' => $this->uid, 'nickname' => $this->uname], [ "order_type" => 'PRO', "order_code" =>$value, "order_id" => $poject['id'], "order_status" => 5, "before_status"=>4, 'holder_id'=>$poject['createrid'] ]); } Db::commit(); return app_show(0, "方案数据修改成功"); } } Db::rollback(); return error_show(1004,"方案选择失败"); }catch (\Exception $e){ Db::rollback(); return error_show(1004,$e->getMessage()); } } public function changeRate(){ $projectNo = isset($this->post['projectNo'])&&$this->post['projectNo']!==""?trim($this->post['projectNo']):""; if($projectNo==""){ return error_show(1004,"参数projectNo不能为空"); } $info =Db::name("project")->where(["projectNo"=>$projectNo,"is_del"=>0])->find(); if($info==false){ return error_show(1004,"未找到项目信息"); } $rate = isset($this->post['rate'])&&$this->post['rate']!=="" ?floatval($this->post['rate']):""; if($rate===""){ return error_show(1004,"参数rate不能为空"); } $info['low_rate']=$rate; $info['updatetime']=date("Y-m-d H:i:s"); $up =Db::name("project")->save($info); if($up){ return app_show(0,"利润率修改成功"); }else{ return error_show(1004,"利润率修改失败"); } } //废弃???@wf by 22.09.01(在路由文件中没有找到这个方法) public function order(){ $id = isset($this->post['id'])&& $this->post['id']!=="" ? intval($this->post['id']):""; if($id==""){ return error_show(1004,"参数id不能为空"); } $backinfo = Db::name("project_feedback")->where(["id"=>$id,"is_del"=>0])->find(); if($backinfo==false){ return error_show(1004,"未找到数据"); } $prject = Db::name("project")->where(["projectNo"=>$backinfo['projectNo'],"is_del"=>0])->find(); if($prject==false) { return error_show(1004, "未找到项目数据"); } $send_type =isset($this->post['send_type'])&&$this->post['send_type']!=""? intval($this->post['send_type']):""; if($send_type==""){ return error_show(1004,"参数send_type不能为空"); } if($send_type==1){ $va = isset($this->post['order_addr']) && $this->post['order_addr'] !== "" ? $this->post['order_addr'] : ""; if ($va == "") { return error_show(1002, "参数order_addr不能为空"); } } $plat = Db::name("platform")->where(["id"=>$prject['platform_id']])->find(); // $token = isset($this->post['token'])&& $this->post['token']!=="" ? trim($this->post['token']):""; // if($token==""){ // return error_show(1004,"参数token不能为空"); // } // $apply_id = GetUserInfo($token); // if (empty($apply_id) || $apply_id['code'] != 0) { // return error_show(1002, "申请人数据不存在"); // } $rm = $this->uid;//isset($apply_id["data"]['id']) ? $apply_id["data"]['id'] : ""; $ri = $this->uname;//isset($apply_id["data"]['nickname']) ? $apply_id["data"]['nickname'] : ""; $orderCode = makeNo("QR"); Db::startTrans(); try{ $data = [ "orderCode" => $orderCode, "good_code" => $backinfo['spuCode'], "customer_code" => $prject['khNo'], "good_name" => $backinfo['good_name'], "good_num" => $backinfo['num'], "order_type" =>3, "order_source" =>3,//3项目 "item_code"=>isset($plat['platform_code'])? $plat['platform_code']:"", "good_type"=>1, "apply_id" => $rm, "apply_name" => $ri, "origin_price" =>$backinfo['nake_price'], "sale_price" => $backinfo['sale_price'], "post_fee" => 0, "status" => 0, "supplierNo" =>$prject['companyNo'], "send_num" => 0, "zxNo"=>$backinfo['pgNo'], "wsend_num" => $backinfo['num'], "send_type" => $send_type, "send_status" => 1, "is_del" => 0, "addtime" => date("Y-m-d H:i:s"), "updatetime" => date("Y-m-d H:i:s"), 'total_price' => $backinfo['sale_price'] * $backinfo['num'], ]; $datainfo = Db::name('sale')->insert($data, true); if($datainfo>0){ if($send_type==1){ foreach ($va as $value) { $temp = []; $addrs = []; if ($value['addr_code'] !== '' && is_array($value['addr_code'])) { $addrs['provice_code'] = $value['addr_code'][0]; $addrs['city_code'] = $value['addr_code'][1]; $addrs['area_code'] = $value['addr_code'][2]; $addr = json_encode($addrs); } else { $addr = isset($value['addr_code']) ? $value['addr_code'] : ''; } $temp['orderCode'] = $orderCode; $temp['contactor'] = $value['contactor']; $temp['mobile'] = $value['mobile']; $temp['addr'] = $value['addr']; $temp['addr_code'] = $addr; $temp['customer_code'] = $prject['khNo']; $temp['receipt_quantity'] = $value['receipt_quantity']; $temp['post_fee'] = 0; $temp['is_del'] = 0; $temp['addtime'] = date("Y-m-d H:i:s"); $temp['updatetime'] = date("Y-m-d H:i:s"); $temp['arrive_time'] = date("Y-m-d H:i:s"); $vat[] = $temp; } $vmp = Db::name('order_addr')->insertAll($vat); if ($vmp==false) { Db::rollback(); return error_show(1004, "销售订单创建失败"); } } Db::name('standing_book') ->where('projectNo', $backinfo['projectNo']) ->update([ 'sale_id' => $datainfo, 'orderCode' => $orderCode, 'customer_code' => $prject['khNo'], 'spuCode' => $backinfo['spuCode'], 'order_type' => $data['order_type'], 'order_source' => $data['order_source'], 'supplierNo' => $prject['companyNo'], 'updatetime' => date("Y-m-d H:i:s") ]); Db::commit(); return error_show(0, "销售订单创建成功"); } Db::rollback(); return error_show(1004, "销售订单创建失败"); }catch (\Exception $w){ Db::rollback(); return error_show(1004, $w->getMessage()); } } public function feeddel(){ $feedid = isset($this->post['id'])&&!empty($this->post['id']) ? $this->post['id'] :[]; if(empty($feedid)){ return error_show(1004,"参数feedid不能为空"); } $selec = Db::name("project_feedback")->where(["id"=>$feedid,'is_del'=>0])->select(); if(empty($selec)){ return error_show(1004,"反馈数据信息未找到"); } $up = Db::name("project_feedback")->where(["id"=>$feedid,'is_del'=>0])->save(["is_del"=>1,"updatetime"=>date("Y-m-d H:i:s")]); if($up){ return app_show(0,"反馈数据删除成功"); }else{ return error_show(1004,"反馈数据删除失败"); } } }