|
@@ -3,7 +3,7 @@
|
|
|
|
|
|
namespace app\admin\controller;
|
|
|
|
|
|
-use think\facade\Db;
|
|
|
+use think\exception\ErrorException;use think\facade\Db;
|
|
|
use think\App;class CatPlat extends Base{
|
|
|
public function __construct(App $app) {parent::__construct($app);}
|
|
|
|
|
@@ -140,7 +140,7 @@ use think\App;class CatPlat extends Base{
|
|
|
return error_show(1004,"参数 fund_code 不能为空");
|
|
|
}
|
|
|
$data=[
|
|
|
- "cat_id"=>$catid,
|
|
|
+ "cat_id"=>$cat_id,
|
|
|
"platform_id"=>$plat_id,
|
|
|
"rate"=>$rate,
|
|
|
"order_rate"=>$order_rate,
|
|
@@ -148,8 +148,6 @@ use think\App;class CatPlat extends Base{
|
|
|
"sale_rate"=>$sale_rate,
|
|
|
"low_rate"=>$low_rate,
|
|
|
"fund_code"=>$fund_code,
|
|
|
- "apply_id"=>$this->uid,
|
|
|
- "apply_name"=>$this->uname,
|
|
|
"updatetime"=>date("Y-m-d H:i:s")
|
|
|
];
|
|
|
$int = Db::name("cat_plat")->where($cat)->update($data);
|
|
@@ -288,6 +286,55 @@ use think\App;class CatPlat extends Base{
|
|
|
$saleprice = $nakelist['nake_total'] / (1 - $budget);
|
|
|
}
|
|
|
return app_show(0, "获取成功", ["sale_price" => round($saleprice, 2), 'new_cost_fee' => round($sale_cost_fee, 2)]);
|
|
|
+ }
|
|
|
|
|
|
+ public function catlist(){
|
|
|
+ $where =[["is_del","=",0]];
|
|
|
+ $cat_name=isset($this->post['cat_name']) && $this->post['cat_name'] !==""? trim($this->post['cat_name']) :"";
|
|
|
+ if($cat_name!==""){
|
|
|
+ $where[]=['cat_name',"like","%$cat_name%"];
|
|
|
+ }
|
|
|
+ $pid=isset($this->post['pid']) && $this->post['pid'] !==""? intval($this->post['pid']) :"";
|
|
|
+ $plat_id=isset($this->post['platform_id']) && $this->post['platform_id'] !==""? intval($this->post['platform_id']) :"";
|
|
|
+ if($pid!==""){
|
|
|
+ $where[]=["pid","=",$pid];
|
|
|
+ $pcat = Db::name('cat')->where(['id'=>$pid,"is_del"=>0])->find();
|
|
|
+ if($pcat==false){
|
|
|
+ return error_show(1004,"未找到分类数据");
|
|
|
+ }else{
|
|
|
+ if($pcat['level']==2){
|
|
|
+ if($plat_id==""){
|
|
|
+ return error_show(1004,"参数 plat_id 不能为空");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if($plat_id!=""){
|
|
|
+ $platform = Db::name("platform")->where(["id"=>$plat_id,"is_del"=>0])->find();
|
|
|
+ }
|
|
|
+ $status=isset($this->post['status']) && $this->post['status'] !==""? intval($this->post['status']) :"";
|
|
|
+ if($status!==""){
|
|
|
+ $where[]=['status',"=",$status];
|
|
|
+ }
|
|
|
+ $list = Db::name('cat')->where($where)->select();
|
|
|
+ $data=[];
|
|
|
+ foreach ($list as $key=>$value){
|
|
|
+ if($value['level']==3){
|
|
|
+ $catplat= Db::name("cat_plat")->where(["cat_id"=>$value['id'],"platform_id"=>$plat_id,"is_del"=>0])
|
|
|
+ ->find();
|
|
|
+ if($catplat==false){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ $value['rate']= $catplat['rate'];
|
|
|
+ $value['order_rate']= $catplat['order_rate'];
|
|
|
+ $value['low_rate']= $catplat['low_rate'];
|
|
|
+ $value['money_rate']= $catplat['money_rate'];
|
|
|
+ $value['sale_rate']= $catplat['sale_rate'];
|
|
|
+ }
|
|
|
+ $value['platform_name'] = isset($platform['platform_name']) ? $platform['platform_name']:"";
|
|
|
+ $value['platform_id'] = $plat_id;
|
|
|
+ $data[]=$value;
|
|
|
+ }
|
|
|
+ return app_show(0, "获取成功",$list);
|
|
|
}
|
|
|
}
|