|
@@ -1078,6 +1078,7 @@ class Goodup extends Base
|
|
|
$json = json_encode($timp,JSON_UNESCAPED_UNICODE);
|
|
|
$jsp = json_encode($data,JSON_UNESCAPED_UNICODE);
|
|
|
if($up){
|
|
|
+ $this->BasicToGood($supcode,$temp);
|
|
|
ChangeLog::logAdd(3,$data['spuCode'],$jsp,$json,['id' => $this->uid, 'nickname' => $this->uname]);
|
|
|
if($speclist!=="" && !empty($speclist)){
|
|
|
foreach ($speclist as $value){
|
|
@@ -1208,6 +1209,7 @@ class Goodup extends Base
|
|
|
$json = json_encode($temp,JSON_UNESCAPED_UNICODE);
|
|
|
$jsp = json_encode($datas,JSON_UNESCAPED_UNICODE);
|
|
|
if($up){
|
|
|
+ $this->BasicToGood($supcode,$data);
|
|
|
ChangeLog::logAdd(3,$datas['spuCode'],$jsp,$json,['id' => $this->uid, 'nickname' => $this->uname]);
|
|
|
//修改状态,添加待办
|
|
|
ActionLog::logAdd($this->post['token'], [
|
|
@@ -2562,6 +2564,7 @@ class Goodup extends Base
|
|
|
$json = json_encode($var,JSON_UNESCAPED_UNICODE);
|
|
|
$dat = json_encode($data,JSON_UNESCAPED_UNICODE);
|
|
|
if($up){
|
|
|
+ $this->BasicToGood($supcode,$temp);
|
|
|
ChangeLog::logAdd(3,$data['spuCode'],$dat,$json,['id' => $this->uid, 'nickname' => $this->uname]);
|
|
|
// //修改状态,添加待办
|
|
|
// ActionLog::logAdd($this->post['token'], [
|
|
@@ -2835,8 +2838,12 @@ class Goodup extends Base
|
|
|
if (!empty($all_good_basic)) return error_show(1004, '请从商品成本提交该商品上线');
|
|
|
|
|
|
foreach ($param['goodinfo'] as $value) {
|
|
|
- if($good_zixun_list[$value['spuCode']]['is_gold_price']==1&&$param['is_fixed']==1){
|
|
|
- return error_show(1004," {$good_zixun_list[$value['spuCode']]['good_name']}商品使用实时金价,不可使用一口价!");
|
|
|
+// if($good_zixun_list[$value['spuCode']]['is_gold_price']==1&&$param['is_fixed']==1){
|
|
|
+// return error_show(1004," {$good_zixun_list[$value['spuCode']]['good_name']}商品使用实时金价,不可使用一口价!");
|
|
|
+// }
|
|
|
+ $bd=[];
|
|
|
+ if($good_zixun_list[$value['spuCode']]['order_source']==2 ||$good_zixun_list[$value['spuCode']]['order_source']==3){
|
|
|
+ $bd = Db::name('consult_bids')->where(['spuCode'=> $value['spuCode']])->findOrEmpty();
|
|
|
}
|
|
|
//改变编码规则,将原来的skuCode后两位换成序列号
|
|
|
//str_pad字符串填充
|
|
@@ -2893,9 +2900,9 @@ class Goodup extends Base
|
|
|
'packing_weight' => '',
|
|
|
'good_bar' => '',
|
|
|
'supply_area' => $good_zixun_list[$value['spuCode']]['supply_area'],
|
|
|
- 'delivery_place' => '',
|
|
|
- 'origin_place' => '',
|
|
|
- 'delivery_day' => 0,
|
|
|
+ 'delivery_place' =>$bd['delivery_place']??"",
|
|
|
+ 'origin_place' =>$bd['origin_place']??'',
|
|
|
+ 'delivery_day' => $bd['delivery_day']??'',
|
|
|
'lead_time' => '',
|
|
|
'sample_day' => '',
|
|
|
'sample_fee' => '',
|
|
@@ -2961,9 +2968,9 @@ class Goodup extends Base
|
|
|
'packing_weight' => '',
|
|
|
'good_bar' => '',
|
|
|
'supply_area' => $good_zixun_list[$value['spuCode']]['supply_area'],
|
|
|
- 'delivery_place' => '',
|
|
|
- 'origin_place' => '',
|
|
|
- 'delivery_day' => '',
|
|
|
+ 'delivery_place' =>$bd['delivery_place']??'',
|
|
|
+ 'origin_place' =>$bd['origin_place']??'',
|
|
|
+ 'delivery_day' => $bd['delivery_day']??'',
|
|
|
'lead_time' => '',
|
|
|
'sample_day' => '',
|
|
|
'sample_fee' => '',
|
|
@@ -2999,7 +3006,7 @@ class Goodup extends Base
|
|
|
}
|
|
|
|
|
|
//good_spec
|
|
|
- if (!empty($good_zixun_list[$value['spuCode']]['specinfo'])) {
|
|
|
+ if ($good_zixun_list[$value['spuCode']]['specinfo']!=='') {
|
|
|
|
|
|
$spec_list = json_decode($good_zixun_list[$value['spuCode']]['specinfo'], true);
|
|
|
|
|
@@ -3008,8 +3015,8 @@ class Goodup extends Base
|
|
|
$temp = Db::name('good_spec')
|
|
|
->field('id')
|
|
|
->where(['spuCode' => $value['spuCode'], 'spec_id' => $specid, 'spec_value_id' => $spec['spec_value_id'], 'is_del' => 0])
|
|
|
- ->find();
|
|
|
- if (!empty($temp)) {
|
|
|
+ ->findOrEmpty();
|
|
|
+ if (empty($temp)) {
|
|
|
$good_spec_insert_data[] = [
|
|
|
'spuCode' => $value['spuCode'],
|
|
|
'spec_id' => $specid,
|
|
@@ -3494,9 +3501,14 @@ class Goodup extends Base
|
|
|
$temp=[];
|
|
|
$good_spec_insert_data=[];
|
|
|
$GoodBasic = new GoodBasic();
|
|
|
+
|
|
|
foreach ($good_zixun_list as $item){
|
|
|
$isT =$GoodBasic->where(["spuCode"=>$item['spuCode'],"is_del"=>0])->findOrEmpty();
|
|
|
if($isT->isEmpty()==false)return error_show(1004, "{$item['good_name']}商品已存在成本库中!");
|
|
|
+ $bd=[];
|
|
|
+ if($item['order_source']==2 || $item['order_source']==3){
|
|
|
+ $bd = Db::name("consult_bids")->where(["spuCode"=> $item['spuCode']])->findOrEmpty();
|
|
|
+ }
|
|
|
$temp[] = [
|
|
|
'spuCode' => $item['spuCode'],
|
|
|
'good_code' => $item['good_code'],
|
|
@@ -3525,9 +3537,9 @@ class Goodup extends Base
|
|
|
'packing_weight' => '',
|
|
|
'good_bar' => '',
|
|
|
'supply_area' => $item['supply_area'],
|
|
|
- 'delivery_place' => '',
|
|
|
- 'origin_place' => '',
|
|
|
- 'delivery_day' => '',
|
|
|
+ 'delivery_place' =>$bd['delivery_place']??"",
|
|
|
+ 'origin_place' =>$bd['origin_place']??'',
|
|
|
+ 'delivery_day' => $bd['delivery_day']??'',
|
|
|
'lead_time' => '',
|
|
|
'sample_day' => '',
|
|
|
'sample_fee' => '',
|
|
@@ -3561,7 +3573,7 @@ class Goodup extends Base
|
|
|
'other_config' => $item['other_config'],
|
|
|
];
|
|
|
|
|
|
- if (!empty($item['specinfo'])) {
|
|
|
+ if ($item['specinfo']!='') {
|
|
|
|
|
|
$spec_list = json_decode($item['specinfo'], true);
|
|
|
|
|
@@ -3571,8 +3583,8 @@ class Goodup extends Base
|
|
|
->field('id')
|
|
|
->where(['spuCode' => $item['spuCode'], 'spec_id' => $specid, 'spec_value_id' => $spec['spec_value_id'],
|
|
|
'is_del' => 0])
|
|
|
- ->find();
|
|
|
- if (!empty($specinfo)) {
|
|
|
+ ->findOrEmpty();
|
|
|
+ if (empty($specinfo)) {
|
|
|
$good_spec_insert_data[] = [
|
|
|
'spuCode' => $item['spuCode'],
|
|
|
'spec_id' => $specid,
|
|
@@ -3629,4 +3641,16 @@ class Goodup extends Base
|
|
|
return error_show(1005, $exception->getMessage());
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ protected function BasicToGood($spuCode,$data=[]){
|
|
|
+ $good =new \app\admin\model\Good();
|
|
|
+ $info = $good->where(["spuCode"=>$spuCode,"is_del"=>0])->findOrEmpty();
|
|
|
+ if($info->isEmpty()==false){
|
|
|
+ if(isset($data['usable_stock']))unset($data['usable_stock']);
|
|
|
+ if(isset($data['status']))unset($data['status']);
|
|
|
+ if(isset($data['charger']))unset($data['charger']);
|
|
|
+ if(isset($data['chargerid']))unset($data['chargerid']);
|
|
|
+ $good->where($info->toArray())->save($data);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|