|
@@ -2,25 +2,15 @@
|
|
|
|
|
|
namespace app\admin\controller;
|
|
|
|
|
|
-use app\BaseController;
|
|
|
use think\App;
|
|
|
use think\facade\Db;
|
|
|
|
|
|
-class Consult extends BaseController
|
|
|
+class Consult extends Base
|
|
|
{
|
|
|
- public $post = "";
|
|
|
+
|
|
|
public function __construct(App $app)
|
|
|
{
|
|
|
parent::__construct($app);
|
|
|
- $this->post=$this->request->post();
|
|
|
-// $token = isset($this->post['token']) ? trim($this->post['token']) : "";
|
|
|
-// if($token==""){
|
|
|
-// return error_show(101,'token不能为空');
|
|
|
-// }
|
|
|
-// $effetc = VerifyTokens($token);
|
|
|
-// if(!empty($effetc) && $effetc['code']!=0) {
|
|
|
-// return error_show($effetc['code'], $effetc['message']);
|
|
|
-// }
|
|
|
}
|
|
|
// public function list(){
|
|
|
// $page = isset($this->post['page']) && $this->post['page'] !== "" ? intval($this->post['page']) :"1";
|
|
@@ -233,7 +223,7 @@ class Consult extends BaseController
|
|
|
$zx = Db::name("consult_order")->insert($data);
|
|
|
if($zx){
|
|
|
foreach ($ladder as $value){
|
|
|
- $infoNo=isset($value['pgNo'])&&$value['pgNo']!==""?trim($value['pgNo']):makeNo("INF");
|
|
|
+ $infoNo=makeNo("INF");
|
|
|
$info=[
|
|
|
"infoNo"=>$infoNo,
|
|
|
"zxNo"=>$zxNo,
|
|
@@ -259,6 +249,7 @@ class Consult extends BaseController
|
|
|
"total_weight"=>isset($value['total_weight'])?$value['total_weight']:"0",
|
|
|
"budget_price"=>$value['budget_price'],
|
|
|
"num"=>$value['num'],
|
|
|
+ "pgNo"=>isset($value['pgNo'])&&$value['pgNo']!==""?trim($value['pgNo']):"",
|
|
|
"use_desc"=>$value['use_desc'],
|
|
|
"remark"=>$value['remark'],
|
|
|
"status"=>1,
|
|
@@ -492,6 +483,184 @@ class Consult extends BaseController
|
|
|
}
|
|
|
return app_show(0,"获取成功",$zxinfo);
|
|
|
}
|
|
|
+
|
|
|
+ public function zxedit(){
|
|
|
+ $infoNo= isset($this->post['infoNo'])&&$this->post['infoNo']!=""?trim($this->post['infoNo']):"";
|
|
|
+ if($infoNo==""){
|
|
|
+ return error_show(1004,"参数infoNo不能为空");
|
|
|
+ }
|
|
|
+ $zxinfo = Db::name("consult_info")->where(["infoNo"=>$infoNo,"is_del"=>0])->find();
|
|
|
+ if($zxinfo==false){
|
|
|
+ return error_show(1004,"未找到信息数据");
|
|
|
+ }
|
|
|
+
|
|
|
+ $good_name= isset($this->post['good_name'])&&$this->post['good_name']!=""?trim($this->post['good_name']):"";
|
|
|
+ if($good_name==""){
|
|
|
+ return error_show(1003,"参数good_name不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ $good_img= isset($this->post['good_img'])&&$this->post['good_img']!=""?trim($this->post['good_img']):"";
|
|
|
+ if($good_img==""){
|
|
|
+ return error_show(1003,"参数good_img不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ $cat_id= isset($this->post['cat_id'])&&$this->post['cat_id']!=""?intval($this->post['cat_id']):"";
|
|
|
+ if($cat_id==""){
|
|
|
+ return error_show(1003,"参数cat_id不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ $unit= isset($this->post['unit'])&&$this->post['unit']!=""?trim($this->post['unit']):"";
|
|
|
+ if($unit==""){
|
|
|
+ return error_show(1003,"参数unit不能为空");
|
|
|
+ }
|
|
|
+ $brand_id= isset($this->post['brand_id'])&&$this->post['brand_id']!==""?intval($this->post['brand_id']):"0";
|
|
|
+
|
|
|
+ $arrival_time= isset($this->post['arrival_time'])&&$this->post['arrival_time']!=""?$this->post['arrival_time']:"";
|
|
|
+ if($arrival_time==""){
|
|
|
+ return error_show(1003,"参数arrival_time不能为空");
|
|
|
+ }
|
|
|
+ $model= isset($this->post['model'])&&$this->post['model']!=""?trim($this->post['model']):"";
|
|
|
+ if($model==""){
|
|
|
+ return error_show(1003,"参数model不能为空");
|
|
|
+ }
|
|
|
+ $color= isset($this->post['color'])&&$this->post['color']!=""?trim($this->post['color']):"";
|
|
|
+ if($color==""){
|
|
|
+ return error_show(1003,"参数color不能为空");
|
|
|
+ }
|
|
|
+ $material= isset($this->post['material'])&&$this->post['material']!=""?trim($this->post['material']):"";
|
|
|
+ if($material==""){
|
|
|
+ return error_show(1003,"参数material不能为空");
|
|
|
+ }
|
|
|
+ $cost_desc= isset($this->post['cost_desc'])&&$this->post['cost_desc']!=""?trim($this->post['cost_desc']):"";
|
|
|
+ if($cost_desc==""){
|
|
|
+ return error_show(1003,"参数cost_desc不能为空");
|
|
|
+ }
|
|
|
+ $is_addrs= isset($this->post['is_addrs'])&&$this->post['is_addrs']!==""?intval($this->post['is_addrs']):"";
|
|
|
+ if($is_addrs===""){
|
|
|
+ return error_show(1003,"参数is_addrs不能为空");
|
|
|
+ }
|
|
|
+ $is_custom= isset($this->post['is_custom'])&&$this->post['is_custom']!==""?trim($this->post['is_custom']):"";
|
|
|
+ if($is_custom===""){
|
|
|
+ return error_show(1003,"参数is_custom不能为空");
|
|
|
+ }
|
|
|
+ $metal_id= isset($this->post['metal_id'])&&$this->post['metal_id']!==""?intval($this->post['metal_id']):"";
|
|
|
+ if($metal_id===""){
|
|
|
+ return error_show(1003,"参数metal_id不能为空");
|
|
|
+ }
|
|
|
+ $config = isset($this->post['config'])&& $this->post['config']!=""?trim($this->post['config']):"";
|
|
|
+ $other_config = isset($this->post['other_config'])&& $this->post['other_config']!=""?trim($this->post['other_config']):"";
|
|
|
+ $specs_weight = isset($this->post['specs_weight'])&& $this->post['specs_weight']!==""?floatval($this->post['specs_weight']):"";
|
|
|
+ $gold_price = isset($this->post['gold_price'])&& $this->post['gold_price']!==""?floatval($this->post['gold_price']):"";
|
|
|
+ $is_gold_price = isset($this->post['is_gold_price'])&& $this->post['is_gold_price']!==""?intval($this->post['is_gold_price']):"0";
|
|
|
+ $budget_price = isset($this->post['budget_price'])&& $this->post['budget_price']!==""?floatval($this->post['budget_price']):"";
|
|
|
+ $total_weight = isset($this->post['total_weight'])&& $this->post['total_weight']!==""?floatval($this->post['total_weight']):"";
|
|
|
+ $num = isset($this->post['num'])&& $this->post['num']!==""?intval($this->post['num']):"";
|
|
|
+ if($num===""){
|
|
|
+ return error_show(1003,"参数num不能为空");
|
|
|
+ }
|
|
|
+ if($budget_price===""){
|
|
|
+ return error_show(1003,"参数budget_price不能为空");
|
|
|
+ }
|
|
|
+ $use_desc = isset($this->post['use_desc'])&& $this->post['use_desc']!="" ? trim($this->post['use_desc']):"";
|
|
|
+ if($use_desc==""){
|
|
|
+ return error_show(1003,"参数use_desc不能为空");
|
|
|
+ }
|
|
|
+ $remark = isset($this->post['remark'])&& $this->post['remark']!="" ? trim($this->post['remark']):"";
|
|
|
+ if($remark==""){
|
|
|
+ return error_show(1003,"参数remark不能为空");
|
|
|
+ }
|
|
|
+ if($metal_id!=0){
|
|
|
+ if($config==""){
|
|
|
+ return error_show(1003,"参数config不能为空");
|
|
|
+ }
|
|
|
+ if($other_config==""){
|
|
|
+ return error_show(1003,"参数other_config不能为空");
|
|
|
+ }
|
|
|
+ if($specs_weight===""){
|
|
|
+ return error_show(1003,"参数specs_weight不能为空");
|
|
|
+ }
|
|
|
+ if($gold_price===""){
|
|
|
+ return error_show(1003,"参数gold_price不能为空");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $token = isset($this->post['token'])&& $this->post['token']!='' ? trim($this->post['token']):"";
|
|
|
+ if($token==''){
|
|
|
+ return error_show(102,"参数token不能为空");
|
|
|
+ }
|
|
|
+ $user =GetUserInfo($token);
|
|
|
+ if(empty($user)||$user['code']!=0){
|
|
|
+ return error_show(105,"用户数据不存在");
|
|
|
+ }
|
|
|
+ $createrid= isset($user["data"]['id']) ? $user["data"]['id'] : "";
|
|
|
+ $creater= isset($user["data"]['nickname']) ? $user["data"]['nickname'] : "";
|
|
|
+ $bidlist = Db::name("consult_bids")->where(["infoNo"=>$zxinfo['infoNo'],"is_del"=>0])->select();
|
|
|
+ try{
|
|
|
+ $innew =makeNo("INF");
|
|
|
+ $info=[
|
|
|
+ "infoNo"=>$innew,
|
|
|
+ "zxNo"=>$zxinfo['zxNo'],
|
|
|
+ "spuCode"=>"",
|
|
|
+ "good_name"=>$good_name,
|
|
|
+ "good_img"=>$good_img,
|
|
|
+ "cat_id"=>$cat_id,
|
|
|
+ "unit"=>$unit,
|
|
|
+ "brand_id"=>$brand_id,
|
|
|
+ "arrival_time"=>$arrival_time,
|
|
|
+ "model"=>$model,
|
|
|
+ "color"=>$color,
|
|
|
+ "material"=>$material,
|
|
|
+ "cost_desc"=>$cost_desc,
|
|
|
+ "is_addrs"=>$is_addrs,
|
|
|
+ "is_custom"=>$is_custom,
|
|
|
+ "metal_id"=>$metal_id,
|
|
|
+ "config"=>$config,
|
|
|
+ "other_config"=>$other_config,
|
|
|
+ "specs_weight"=>$specs_weight===""?0:$specs_weight,
|
|
|
+ "gold_price"=>$gold_price===""? 0 : $gold_price,
|
|
|
+ "is_gold_price"=>$is_gold_price===""?0:$is_gold_price,
|
|
|
+ "total_weight"=>$total_weight===""? $num*$specs_weight :$total_weight,
|
|
|
+ "budget_price"=>$budget_price,
|
|
|
+ "num"=>$num,
|
|
|
+ "use_desc"=>$use_desc,
|
|
|
+ "remark"=>$remark,
|
|
|
+ "status"=>1,
|
|
|
+ "is_del"=>0,
|
|
|
+ "addtime"=>date("Y-m-d H:i:s"),
|
|
|
+ "updatetime"=>date("Y-m-d H:i:s")
|
|
|
+ ];
|
|
|
+ $up = Db::name("consult_info")->insert($info);
|
|
|
+ if($up){
|
|
|
+ if (!empty($bidlist)){
|
|
|
+ foreach ($bidlist as $value){
|
|
|
+ unset($value['id']);
|
|
|
+ $value['infoNo']=$innew;
|
|
|
+ $value['sale_price'] =$value['total_price'];
|
|
|
+ $value['status'] =0;
|
|
|
+ $value['updatetime'] =date("Y-m-d H:i:s");
|
|
|
+ $in = Db::name("consult_bids")->insert($value);
|
|
|
+ if($in==false){
|
|
|
+ Db::rollback();
|
|
|
+ return error_show(1004,"反馈商品新建失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $zxinfo["bargain_status"] =1;
|
|
|
+ $zxinfo["bargain_code"] =$innew;
|
|
|
+ $zxinfo["updatetime"] =date("Y-m-d H:i:s");
|
|
|
+ $bar=Db::name("consult_info")->save($zxinfo);
|
|
|
+ if($bar==false){
|
|
|
+ Db::rollback();
|
|
|
+ return error_show(1004,"反馈商品更新失败");
|
|
|
+ }
|
|
|
+ Db::commit();
|
|
|
+ return app_show(0,"咨询新建成功",["infoNo"=>$innew]);
|
|
|
+ }
|
|
|
+ }catch (\Exception $e){
|
|
|
+ Db::rollback();
|
|
|
+ return error_show(1004,$e->getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
//** 发布竞标任务 */
|
|
|
public function bargain(){
|
|
|
$infoNo= isset($this->post['infoNo'])&&$this->post['infoNo']!=""?trim($this->post['infoNo']):"";
|
|
@@ -968,6 +1137,16 @@ class Consult extends BaseController
|
|
|
if ($bidNo !== "") {
|
|
|
$where[] = ['bidNo','=',$bidNo];
|
|
|
}
|
|
|
+ $pgNo = isset($this->post['pgNo']) && $this->post['pgNo'] !== "" ? trim($this->post['pgNo']) : "";
|
|
|
+ if ($pgNo !== "") {
|
|
|
+ $bidinfo = Db::name("consult_info")->where([["pgNo","=",$pgNo],["is_del","=",0]])->column("infoNo");
|
|
|
+ $where[] = ['infoNo','in',$bidinfo];
|
|
|
+ }
|
|
|
+ $bargain_status = isset($this->post['bargain_status']) && $this->post['bargain_status'] !== "" ? intval($this->post['bargain_status']) : "";
|
|
|
+ if ($bargain_status !== "") {
|
|
|
+ $bidinfo = Db::name("consult_info")->where([["bargain_status","=",$bargain_status],["is_del","=",0]])->column("infoNo");
|
|
|
+ $where[] = ['infoNo','in',$bidinfo];
|
|
|
+ }
|
|
|
$projectNo = isset($this->post['projectNo']) && $this->post['projectNo'] !== "" ? trim($this->post['projectNo']) : "";
|
|
|
if ($projectNo !== "") {
|
|
|
$zxlist = Db::name("consult_order")->where(["projectNo"=>$projectNo,"is_del"=>0,"is_project"=>1])->column
|
|
@@ -1015,6 +1194,7 @@ class Consult extends BaseController
|
|
|
$price = GoodPrice($god, $budget/100);
|
|
|
}
|
|
|
$value['sale_price'] =round($price,2);
|
|
|
+ $value['bargain_status']=$bidinfo['bargain_status'];
|
|
|
$data[]=$value;
|
|
|
}
|
|
|
return app_show(0,"获取成功",['count'=>$count,'list'=>$data]);
|
|
@@ -1042,11 +1222,11 @@ class Consult extends BaseController
|
|
|
}
|
|
|
$token = isset($this->post['token'])&& $this->post['token']!='' ? trim($this->post['token']):"";
|
|
|
if($token==''){
|
|
|
- return error_show(1002,"参数token不能为空");
|
|
|
+ return error_show(102,"参数token不能为空");
|
|
|
}
|
|
|
$user =GetUserInfo($token);
|
|
|
if(empty($user)||$user['code']!=0){
|
|
|
- return error_show(1005,"用户数据不存在");
|
|
|
+ return error_show(105,"用户数据不存在");
|
|
|
}
|
|
|
$createrid= isset($user["data"]['id']) ? $user["data"]['id'] : "";
|
|
|
$creater= isset($user["data"]['nickname']) ? $user["data"]['nickname'] : "";
|
|
@@ -1089,6 +1269,7 @@ class Consult extends BaseController
|
|
|
$price = GoodPrice($god, $budget/100);
|
|
|
}
|
|
|
$value['sale_price'] =round($price,2);
|
|
|
+ $value['bargain_status']=$bidinfo['bargain_status'];
|
|
|
$data[]=$value;
|
|
|
}
|
|
|
return app_show(0,"获取成功",$data);
|