|
@@ -2,6 +2,8 @@
|
|
|
|
|
|
namespace app\admin\controller;
|
|
namespace app\admin\controller;
|
|
|
|
|
|
|
|
+use app\admin\model\ActionLog;
|
|
|
|
+use app\admin\model\ProcessOrder;
|
|
use think\App;
|
|
use think\App;
|
|
use think\facade\Db;
|
|
use think\facade\Db;
|
|
use think\facade\Validate;
|
|
use think\facade\Validate;
|
|
@@ -131,14 +133,7 @@ class Consult extends Base
|
|
if($endtime===""){
|
|
if($endtime===""){
|
|
return error_show(1002,"参数endtime不能为空");
|
|
return error_show(1002,"参数endtime不能为空");
|
|
}
|
|
}
|
|
-// $saleid = isset($this->post['saleid']) && $this->post['saleid'] !=="" ? intval($this->post['saleid']) : "";
|
|
|
|
-// if($saleid===""){
|
|
|
|
-// return error_show(1002,"参数saleid不能为空");
|
|
|
|
-// }
|
|
|
|
-// $depart = isset($this->post['depart']) && $this->post['depart'] !=="" ? intval($this->post['depart']) : "";
|
|
|
|
-// if($depart===""){
|
|
|
|
-// return error_show(1002,"参数depart不能为空");
|
|
|
|
-// }
|
|
|
|
|
|
+
|
|
$platform_code = isset($this->post['platform_code']) && $this->post['platform_code'] !=="" ? trim($this->post['platform_code']) :
|
|
$platform_code = isset($this->post['platform_code']) && $this->post['platform_code'] !=="" ? trim($this->post['platform_code']) :
|
|
"";
|
|
"";
|
|
if($platform_code===""){
|
|
if($platform_code===""){
|
|
@@ -160,226 +155,94 @@ class Consult extends Base
|
|
$creater= isset($user["data"]['nickname']) ? $user["data"]['nickname'] : "";
|
|
$creater= isset($user["data"]['nickname']) ? $user["data"]['nickname'] : "";
|
|
$depart= Db::name("depart_user")->where(["uid"=>$createrid,"status"=>1,"is_del"=>0])->find();
|
|
$depart= Db::name("depart_user")->where(["uid"=>$createrid,"status"=>1,"is_del"=>0])->find();
|
|
$zxNo=makeNo("ZX");
|
|
$zxNo=makeNo("ZX");
|
|
- $data=[
|
|
|
|
- "zxNo"=>$zxNo,
|
|
|
|
- "createrid"=>$createrid,
|
|
|
|
- "creater"=>$creater,
|
|
|
|
- "is_project"=>$is_project,
|
|
|
|
- "projectNo"=>isset($projectNo) ? $projectNo:"",
|
|
|
|
- "khNo"=>$khNo,
|
|
|
|
- "companyNo"=>$companyNo,
|
|
|
|
- "endtime"=>$endtime,
|
|
|
|
- "salesman"=>$creater,
|
|
|
|
- "platform_code"=>$platform_code,
|
|
|
|
- "saleid"=>$createrid,
|
|
|
|
- "depart"=>isset($depart['itemid'])?$depart['itemid']:0,
|
|
|
|
- "status"=>0,
|
|
|
|
- "is_del"=>0,
|
|
|
|
- "addtime"=>date("Y-m-d H:i:s"),
|
|
|
|
- "updatetime"=>date("Y-m-d H:i:s"),
|
|
|
|
- ];
|
|
|
|
- $zx = Db::name("consult_order")->insert($data);
|
|
|
|
- if($zx){
|
|
|
|
- foreach ($ladder as $value){
|
|
|
|
- $infoNo=makeNo("INF");
|
|
|
|
- $specinfo=[];
|
|
|
|
- if(isset($value['specinfo']) &&!empty($value['specinfo'])){
|
|
|
|
- foreach ($value["specinfo"] as $v){
|
|
|
|
- $spec =Db::name("specs")->where(["id"=>$v['specid']])->find();
|
|
|
|
- $spec_value =Db::name("spec_value")->where(["id"=>$v['spec_value_id']])->find();
|
|
|
|
- $v['spec_name']=isset($spec['spec_name'])? $spec['spec_name']:"";
|
|
|
|
- $v['spec_value_name']=isset($spec_value['spec_value'])?$spec_value['spec_value']:"" ;
|
|
|
|
- $specinfo[]=$v;
|
|
|
|
|
|
+ Db::startTrans();
|
|
|
|
+ try{
|
|
|
|
+ $data=[
|
|
|
|
+ "zxNo"=>$zxNo,
|
|
|
|
+ "createrid"=>$createrid,
|
|
|
|
+ "creater"=>$creater,
|
|
|
|
+ "is_project"=>$is_project,
|
|
|
|
+ "projectNo"=>isset($projectNo) ? $projectNo:"",
|
|
|
|
+ "khNo"=>$khNo,
|
|
|
|
+ "companyNo"=>$companyNo,
|
|
|
|
+ "endtime"=>$endtime,
|
|
|
|
+ "salesman"=>$creater,
|
|
|
|
+ "platform_code"=>$platform_code,
|
|
|
|
+ "saleid"=>$createrid,
|
|
|
|
+ "depart"=>isset($depart['itemid'])?$depart['itemid']:0,
|
|
|
|
+ "status"=>0,
|
|
|
|
+ "is_del"=>0,
|
|
|
|
+ "addtime"=>date("Y-m-d H:i:s"),
|
|
|
|
+ "updatetime"=>date("Y-m-d H:i:s"),
|
|
|
|
+ ];
|
|
|
|
+ $zx = Db::name("consult_order")->insert($data);
|
|
|
|
+ if($zx){
|
|
|
|
+ foreach ($ladder as $value){
|
|
|
|
+ $infoNo=makeNo("INF");
|
|
|
|
+ $specinfo=[];
|
|
|
|
+ if(isset($value['specinfo']) &&!empty($value['specinfo'])){
|
|
|
|
+ foreach ($value["specinfo"] as $v){
|
|
|
|
+ $spec =Db::name("specs")->where(["id"=>$v['specid']])->find();
|
|
|
|
+ $spec_value =Db::name("spec_value")->where(["id"=>$v['spec_value_id']])->find();
|
|
|
|
+ $v['spec_name']=isset($spec['spec_name'])? $spec['spec_name']:"";
|
|
|
|
+ $v['spec_value_name']=isset($spec_value['spec_value'])?$spec_value['spec_value']:"" ;
|
|
|
|
+ $specinfo[]=$v;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ $info=[
|
|
|
|
+ "infoNo"=>$infoNo,
|
|
|
|
+ "zxNo"=>$zxNo,
|
|
|
|
+ "spuCode"=>"",
|
|
|
|
+ "good_name"=>$value['good_name'],
|
|
|
|
+ "good_img"=>$value['good_img'],
|
|
|
|
+ "cat_id"=>$value['cat_id'],
|
|
|
|
+ "unit"=>$value['unit'],
|
|
|
|
+ "brand_id"=>$value['brand_id'],
|
|
|
|
+ "arrival_time"=>$value['arrival_time'],
|
|
|
|
+ "specinfo"=>empty($specinfo)?"" : json_encode($specinfo),
|
|
|
|
+ "cost_desc"=>$value['cost_desc'],
|
|
|
|
+ "is_addrs"=>$value['is_addrs'],
|
|
|
|
+ "is_custom"=>$value['is_custom'],
|
|
|
|
+ "metal_id"=>$value['metal_id'],
|
|
|
|
+ "config"=>isset($value['config'])?$value['config']:"",
|
|
|
|
+ "other_config"=>isset($value['other_config'])?$value['other_config']:"",
|
|
|
|
+ "specs_weight"=>isset($value['specs_weight'])?$value['specs_weight']:"0",
|
|
|
|
+ "gold_price"=>isset($value['gold_price'])?$value['gold_price']:"0",
|
|
|
|
+ "is_gold_price"=>isset($value['is_gold_price'])?$value['is_gold_price']:"0",
|
|
|
|
+ "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,
|
|
|
|
+ "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){
|
|
|
|
+ Db::rollback();
|
|
|
|
+ return error_show(1004,'添加失败');
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- $info=[
|
|
|
|
- "infoNo"=>$infoNo,
|
|
|
|
- "zxNo"=>$zxNo,
|
|
|
|
- "spuCode"=>"",
|
|
|
|
- "good_name"=>$value['good_name'],
|
|
|
|
- "good_img"=>$value['good_img'],
|
|
|
|
- "cat_id"=>$value['cat_id'],
|
|
|
|
- "unit"=>$value['unit'],
|
|
|
|
- "brand_id"=>$value['brand_id'],
|
|
|
|
- "arrival_time"=>$value['arrival_time'],
|
|
|
|
- "specinfo"=>empty($specinfo)?"" : json_encode($specinfo),
|
|
|
|
- "cost_desc"=>$value['cost_desc'],
|
|
|
|
- "is_addrs"=>$value['is_addrs'],
|
|
|
|
- "is_custom"=>$value['is_custom'],
|
|
|
|
- "metal_id"=>$value['metal_id'],
|
|
|
|
- "config"=>isset($value['config'])?$value['config']:"",
|
|
|
|
- "other_config"=>isset($value['other_config'])?$value['other_config']:"",
|
|
|
|
- "specs_weight"=>isset($value['specs_weight'])?$value['specs_weight']:"0",
|
|
|
|
- "gold_price"=>isset($value['gold_price'])?$value['gold_price']:"0",
|
|
|
|
- "is_gold_price"=>isset($value['is_gold_price'])?$value['is_gold_price']:"0",
|
|
|
|
- "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,
|
|
|
|
- "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){
|
|
|
|
- Db::rollback();
|
|
|
|
- return error_show(1004,'添加失败');
|
|
|
|
- }
|
|
|
|
|
|
+ $stn = ["order_code"=>$zxNo,"status"=>1,"action_remark"=>'',"action_type"=>"create"];
|
|
|
|
+ ActionLog::logAdd($this->post['token'],$stn,"ZXD",2,$info);
|
|
|
|
+ $process=["order_code"=>$zxNo,"order_id"=>Db::name("consult_order")->getLastInsID(),"order_status"=>1,"order_type"=>'ZXD'];
|
|
|
|
+ ProcessOrder::AddProcess($this->post['token'],$process);
|
|
|
|
+ Db::commit();
|
|
|
|
+ return app_show(0,"新建成功",["zxNo"=>$zxNo]);
|
|
|
|
+ }else{
|
|
|
|
+ Db::rollback();
|
|
|
|
+ return error_show(1004,"新建失败");
|
|
}
|
|
}
|
|
-
|
|
|
|
- return app_show(0,"新建成功",["zxNo"=>$zxNo]);
|
|
|
|
- }else{
|
|
|
|
- return error_show(1004,"新建失败");
|
|
|
|
|
|
+ }catch (\Exception $e){
|
|
|
|
+ Db::rollback();
|
|
|
|
+ return error_show(1003,$e->getMessage());
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
-// public function zxadd(){
|
|
|
|
-// $good_name = isset($this->post['good_name'])&&$this->post['good_name']!==""?trim($this->post['good_name']):"";
|
|
|
|
-// if($good_name===""){
|
|
|
|
-// return error_show(1004,"参数good_name不能为空");
|
|
|
|
-// }
|
|
|
|
-// $zxNo = isset($this->post['zxNo'])&&$this->post['zxNo']!==""?trim($this->post['zxNo']):"";
|
|
|
|
-// if($zxNo===""){
|
|
|
|
-// return error_show(1004,"参数zxNo不能为空");
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// $cat_id = isset($this->post['cat_id'])&&$this->post['cat_id']!==""?intval($this->post['cat_id']):"";
|
|
|
|
-// if($cat_id===""){
|
|
|
|
-// return error_show(1004,"参数cat_id不能为空");
|
|
|
|
-// }
|
|
|
|
-// $arrival_time = isset($this->post['arrival_time'])&&$this->post['arrival_time']!==""?$this->post['arrival_time']
|
|
|
|
-// :"";
|
|
|
|
-// if($arrival_time===""){
|
|
|
|
-// return error_show(1004,"参数arrival_time不能为空");
|
|
|
|
-// }
|
|
|
|
-// $good_img = isset($this->post['good_img'])&&$this->post['good_img']!==""?trim($this->post['good_img']):"";
|
|
|
|
-// if($good_img===""){
|
|
|
|
-// return error_show(1004,"参数good_img不能为空");
|
|
|
|
-// }
|
|
|
|
-// $is_custom = isset($this->post['is_custom'])&&$this->post['is_custom']!==""?intval($this->post['is_custom']):"";
|
|
|
|
-// if($is_custom===""){
|
|
|
|
-// return error_show(1004,"参数is_custom不能为空");
|
|
|
|
-// }
|
|
|
|
-// $unit = isset($this->post['unit'])&&$this->post['unit']!==""?trim($this->post['unit']):"";
|
|
|
|
-// if($unit===""){
|
|
|
|
-// return error_show(1004,"参数unit不能为空");
|
|
|
|
-// }
|
|
|
|
-// $brand_id = isset($this->post['brand_id'])&&$this->post['brand_id']!==""?intval($this->post['brand_id']):"";
|
|
|
|
-// if($brand_id===""){
|
|
|
|
-// return error_show(1004,"参数brand_id不能为空");
|
|
|
|
-// }
|
|
|
|
-// $material = isset($this->post['material'])&&$this->post['material']!==""?trim($this->post['material']):"";
|
|
|
|
-// if($material===""){
|
|
|
|
-// return error_show(1004,"参数material不能为空");
|
|
|
|
-// }
|
|
|
|
-// $color = isset($this->post['color'])&&$this->post['color']!==""?trim($this->post['color']):"";
|
|
|
|
-// if($color===""){
|
|
|
|
-// return error_show(1004,"参数color不能为空");
|
|
|
|
-// }
|
|
|
|
-// $cost_desc = isset($this->post['cost_desc'])&&$this->post['cost_desc']!==""?trim($this->post['cost_desc']):"";
|
|
|
|
-// if($cost_desc===""){
|
|
|
|
-// return error_show(1004,"参数cost_desc不能为空");
|
|
|
|
-// }
|
|
|
|
-// $model = isset($this->post['model'])&&$this->post['model']!==""?trim($this->post['model']):"";
|
|
|
|
-// if($model===""){
|
|
|
|
-// return error_show(1004,"参数model不能为空");
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// $is_addrs = isset($this->post['is_addrs'])&&$this->post['is_addrs']!==""?intval($this->post['is_addrs']):"";
|
|
|
|
-// if($is_addrs===""){
|
|
|
|
-// return error_show(1004,"参数is_addrs不能为空");
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// $metal_id = isset($this->post['metal_id'])&&$this->post['metal_id']!==""?trim($this->post['metal_id']):"";
|
|
|
|
-// if($metal_id===""){
|
|
|
|
-// return error_show(1004,"参数metal_id不能为空");
|
|
|
|
-// }
|
|
|
|
-// if($metal_id==0){
|
|
|
|
-// $config = isset($this->post['config'])&&!empty($this->post['config'])?$this->post['config']:"";
|
|
|
|
-// if($config===""){
|
|
|
|
-// return error_show(1004,"参数config不能为空");
|
|
|
|
-// }
|
|
|
|
-// $other_config = isset($this->post['other_config'])&&$this->post['other_config']!==""?trim($this->post['other_config'])
|
|
|
|
-// :"";
|
|
|
|
-// if($other_config===""){
|
|
|
|
-// return error_show(1004,"参数other_config不能为空");
|
|
|
|
-// }
|
|
|
|
-// $specs_weight = isset($this->post['specs_weight'])&&$this->post['specs_weight']!==""?floatval($this->post['specs_weight']):"";
|
|
|
|
-// if($specs_weight===""){
|
|
|
|
-// return error_show(1004,"参数specs_weight不能为空");
|
|
|
|
-// }
|
|
|
|
-// $gold_price = isset($this->post['gold_price'])&&$this->post['gold_price']!==""?floatval($this->post['gold_price']):"";
|
|
|
|
-// if($gold_price===""){
|
|
|
|
-// return error_show(1004,"参数gold_price不能为空");
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// }
|
|
|
|
-// $budget_price = isset($this->post['budget_price'])&&$this->post['budget_price']!==""?floatval($this->post['budget_price']):"";
|
|
|
|
-// if($budget_price===""){
|
|
|
|
-// return error_show(1004,"参数budget_price不能为空");
|
|
|
|
-// }
|
|
|
|
-// $num = isset($this->post['num'])&&$this->post['num']!==""?intval($this->post['num']):"";
|
|
|
|
-// if($num===""){
|
|
|
|
-// return error_show(1004,"参数num不能为空");
|
|
|
|
-// }
|
|
|
|
-// $use_desc = isset($this->post['use_desc'])&&$this->post['use_desc']!==""?trim($this->post['use_desc']):"";
|
|
|
|
-// if($use_desc===""){
|
|
|
|
-// return error_show(1004,"参数use_desc不能为空");
|
|
|
|
-// }
|
|
|
|
-// $remark = isset($this->post['remark'])&&$this->post['remark']!==""?trim($this->post['remark']):"";
|
|
|
|
-// if($remark===""){
|
|
|
|
-// return error_show(1004,"参数remark不能为空");
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// Db::startTrans();
|
|
|
|
-// try{
|
|
|
|
-// $infoNo=makeNo("INF");
|
|
|
|
-// $info=[
|
|
|
|
-// "infoNo"=>$infoNo,
|
|
|
|
-// "zxNo"=>$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"=>isset($config)?$config:"",
|
|
|
|
-// "other_config"=>isset($other_config)?$other_config:"",
|
|
|
|
-// "specs_weight"=>isset($specs_weight)?$specs_weight:0,
|
|
|
|
-// "gold_price"=>isset($gold_price)?$gold_price:0,
|
|
|
|
-// "budget_price"=>$budget_price,
|
|
|
|
-// "num"=>$num,
|
|
|
|
-// "use_desc"=>$use_desc,
|
|
|
|
-// "remark"=>$remark,
|
|
|
|
-// "status"=>0,
|
|
|
|
-// "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){
|
|
|
|
-// Db::commit();
|
|
|
|
-// return app_show(0,"添加成功",["infoNo"=>$infoNo]);
|
|
|
|
-// }else{
|
|
|
|
-// Db::rollback();
|
|
|
|
-// return error_show(1004,'添加失败');
|
|
|
|
-// }
|
|
|
|
-// }catch (\Exception $e){
|
|
|
|
-// Db::rollback();
|
|
|
|
-// return error_show(1004,$e->getMessage());
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
|
|
|
|
public function zxinfo(){
|
|
public function zxinfo(){
|
|
$infoNo= isset($this->post['infoNo'])&&$this->post['infoNo']!=""?trim($this->post['infoNo']):"";
|
|
$infoNo= isset($this->post['infoNo'])&&$this->post['infoNo']!=""?trim($this->post['infoNo']):"";
|
|
@@ -492,14 +355,6 @@ class Consult extends Base
|
|
if($specin==""){
|
|
if($specin==""){
|
|
return error_show(1003,"参数specinfo不能为空");
|
|
return error_show(1003,"参数specinfo不能为空");
|
|
}
|
|
}
|
|
-// $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']):"";
|
|
$cost_desc= isset($this->post['cost_desc'])&&$this->post['cost_desc']!=""?trim($this->post['cost_desc']):"";
|
|
if($cost_desc==""){
|
|
if($cost_desc==""){
|
|
return error_show(1003,"参数cost_desc不能为空");
|
|
return error_show(1003,"参数cost_desc不能为空");
|
|
@@ -662,6 +517,7 @@ class Consult extends Base
|
|
$zxinfo['updatetime']=date("Y-m-d H:i:s");
|
|
$zxinfo['updatetime']=date("Y-m-d H:i:s");
|
|
$up = Db::name("consult_info")->save($zxinfo);
|
|
$up = Db::name("consult_info")->save($zxinfo);
|
|
if($up){
|
|
if($up){
|
|
|
|
+
|
|
return app_show(0,"状态更新成功");
|
|
return app_show(0,"状态更新成功");
|
|
}else{
|
|
}else{
|
|
return error_show(1003,"状态更新失败");
|
|
return error_show(1003,"状态更新失败");
|