|
@@ -150,11 +150,11 @@ class Good extends BaseController
|
|
|
$actm=new ActGood();
|
|
|
if($this->request->isCx==1){
|
|
|
$field="a.id,a.actCode,a.yz_good_code,a.apply_id,a.apply_name,a.stock_num,a.used_num,a.balance_num,a.status,
|
|
|
- a.addtime,a.updatetime,c.plat_code,b.act_name,b.company_name,b.contactor,b.mobile,b.startTime,b.endTime,
|
|
|
+ a.addtime,a.updatetime,c.plat_code,b.act_name,b.company_name,b.contactor,b.mobile,b.startTime,b.endTime,c.spuCode,
|
|
|
c.final_price,c.desc,d.good_name,d.good_unit,c.yz_cat_id,d.cat_id,a.roundId,d.brand_id,a.origin_price,a.good_url";
|
|
|
}else{
|
|
|
$field="a.id,a.actCode,a.yz_good_code,a.stock_num,a.used_num,a.balance_num,a.status,a.addtime,a.updatetime,
|
|
|
- b.act_name,b.company_name,b.contactor,b.mobile,b.startTime,b.endTime,c.final_price,c.desc,d.good_name,
|
|
|
+ b.act_name,b.company_name,b.contactor,b.mobile,b.startTime,b.endTime,c.final_price,c.desc,d.good_name,c.spuCode,
|
|
|
d.good_unit,d.cat_id,d.brand_id,a.roundId,a.origin_price,a.good_url";
|
|
|
}
|
|
|
$count =$actm->alias("a")
|
|
@@ -179,6 +179,7 @@ class Good extends BaseController
|
|
|
foreach ($list as &$item){
|
|
|
$item['unit'] =$unit[$item['good_unit']] ?? "";
|
|
|
$item['brand_name'] = $all_brand[$item['brand_id']]?? "";
|
|
|
+ $item['stock_total'] = Db::name("good_stock")->where(['spuCode' => $item['spuCode'], "is_del" => 0])->sum("usable_stock");
|
|
|
if($this->request->isCx==1){
|
|
|
$item['cat_info'] = made($item['cat_id'], []);
|
|
|
}else{
|
|
@@ -256,11 +257,11 @@ class Good extends BaseController
|
|
|
if($param['id']=='') return json_show(1004,"参数 id 不能为空");
|
|
|
if($this->request->isCx==1){
|
|
|
$field="a.id,a.actCode,a.yz_good_code,a.apply_id,a.apply_name,a.stock_num,a.used_num,a.balance_num,a.status,
|
|
|
- a.addtime,a.updatetime,c.plat_code,b.act_name,b.company_name,b.contactor,b.mobile,b.startTime,b.endTime,
|
|
|
+ a.addtime,a.updatetime,c.plat_code,b.act_name,b.company_name,b.contactor,b.mobile,b.startTime,b.endTime,d.spuCode,
|
|
|
c.final_price,c.desc,d.good_name,d.good_unit,c.yz_cat_id,d.cat_id,d.brand_id,a.roundId,a.origin_price,a.good_url";
|
|
|
}else{
|
|
|
$field="a.id,a.actCode,a.yz_good_code,a.stock_num,a.used_num,a.balance_num,a.status,a.addtime,a.updatetime,
|
|
|
- b.act_name,b.company_name,b.contactor,b.mobile,b.startTime,b.endTime,c.final_price,c.desc,d.good_name,
|
|
|
+ b.act_name,b.company_name,b.contactor,b.mobile,b.startTime,b.endTime,c.final_price,c.desc,d.good_name,d.spuCode,
|
|
|
d.good_unit,d.cat_id,d.brand_id,a.roundId,a.origin_price,a.good_url";
|
|
|
}
|
|
|
$actm=new ActGood();
|
|
@@ -284,6 +285,7 @@ class Good extends BaseController
|
|
|
unset($info['good_unit']);
|
|
|
unset($info['brand_id']);
|
|
|
}
|
|
|
+ $info['stock_total'] = Db::name("good_stock")->where(['spuCode' => $info['spuCode'], "is_del" => 0])->sum("usable_stock");
|
|
|
return json_show(0,"获取成功",$info->toArray());
|
|
|
}
|
|
|
|
|
@@ -448,11 +450,9 @@ class Good extends BaseController
|
|
|
//获取跟有赞对接的平台所属的商品上线信息
|
|
|
public function listByYz()
|
|
|
{
|
|
|
-
|
|
|
$this->noble=\think\facade\Config::get("noble");
|
|
|
$order=\think\facade\Config::get("order");
|
|
|
$this->acton=$order['order_type'];
|
|
|
-
|
|
|
$param = $this->request->only([
|
|
|
'page' => 1,
|
|
|
'size' => 15,
|
|
@@ -527,6 +527,7 @@ class Good extends BaseController
|
|
|
$value['good_url'] =$yzadd[$value['skuCode']]? $yzadd[$value['skuCode']]['detail_url']??"":"";
|
|
|
|
|
|
$spec = Db::name("good_spec")->where(["spuCode" => $value['spuCode'], "is_del" => 0])->select()->toArray();
|
|
|
+ $value['stock_total'] = Db::name("good_stock")->where(['spuCode' => $value['spuCode'], "is_del" => 0])->sum("usable_stock");
|
|
|
$speclist = [];
|
|
|
if (!empty($spec)) {
|
|
|
foreach ($spec as $val) {
|
|
@@ -541,16 +542,14 @@ class Good extends BaseController
|
|
|
}
|
|
|
}
|
|
|
$value['good_img']=str_replace($this->origin_img_host,$this->ssl_img_host,$value['good_img']);
|
|
|
- $value['good_info_img']=str_replace($this->origin_img_host,$this->ssl_img_host,$value['good_img']);
|
|
|
- $value['good_thumb_img']=str_replace($this->origin_img_host,$this->ssl_img_host,$value['good_img']);
|
|
|
+ $value['good_info_img']=str_replace($this->origin_img_host,$this->ssl_img_host,$value['good_info_img']);
|
|
|
+ $value['good_thumb_img']=str_replace($this->origin_img_host,$this->ssl_img_host,$value['good_thumb_img']);
|
|
|
if($this->request->isCx==1){
|
|
|
$value['cat_info'] = made($value['cat_id'], []);
|
|
|
-// $platform = Db::name("platform")->field('id,platform_name')->where(["id" => $value['platform_code']])->find();
|
|
|
+
|
|
|
$value['platform_name'] = $all_platform[$value['platform_code']]??"";
|
|
|
-// $value['platform_code_en'] = isset($platform['platform_code_en']) ? $platform['platform_code_en'] : "";
|
|
|
-// $supplier = Db::name("supplier")->field('id,name')->where(["code" => $value['supplierNo']])->find();
|
|
|
+
|
|
|
$value['supplier_name'] = $all_supplier[$value['supplierNo']]??"";
|
|
|
- $value['company'] = isset($company['company']) ? $company['company'] : "";
|
|
|
$value['stock_total'] = Db::name("good_stock")->where(['spuCode' => $value['spuCode'], "is_del" => 0])->sum("usable_stock");
|
|
|
$value['exclusive'] = makeExcluse($value['is_exclusive']);
|
|
|
$value['noble_name'] = isset($value['noble_metal']) && $value['noble_metal'] != 0 ? $this->noble[$value['noble_metal']] : "";
|
|
@@ -602,7 +601,10 @@ class Good extends BaseController
|
|
|
$info['unit'] = isset($unit['unit']) ? $unit['unit'] : "";
|
|
|
$info['exam_status'] = $info['exam_status']==6?1:0;
|
|
|
$info['origin_price'] =$yzgood->where(["item_no"=>$info['skuCode'],"is_del"=>0])->value("origin",'');
|
|
|
+ $info['good_url'] =$yzgood->where(["item_no"=>$info['skuCode'],"is_del"=>0])->value("detail_url",'');
|
|
|
+
|
|
|
$spec = Db::name("good_spec")->where(["spuCode" => $info['spuCode'], "is_del" => 0])->select()->toArray();
|
|
|
+ $info['stock_total'] = Db::name("good_stock")->where(['spuCode' => $info['spuCode'], "is_del" => 0])->sum("usable_stock");
|
|
|
$speclist = [];
|
|
|
if (!empty($spec)) {
|
|
|
foreach ($spec as $val) {
|
|
@@ -617,8 +619,8 @@ class Good extends BaseController
|
|
|
}
|
|
|
}
|
|
|
$info['good_img']=str_replace($this->origin_img_host,$this->ssl_img_host,$info['good_img']);
|
|
|
- $info['good_info_img']=str_replace($this->origin_img_host,$this->ssl_img_host,$info['good_img']);
|
|
|
- $info['good_thumb_img']=str_replace($this->origin_img_host,$this->ssl_img_host,$info['good_img']);
|
|
|
+ $info['good_info_img']=str_replace($this->origin_img_host,$this->ssl_img_host,$info['good_info_img']);
|
|
|
+ $info['good_thumb_img']=str_replace($this->origin_img_host,$this->ssl_img_host,$info['good_thumb_img']);
|
|
|
if($this->request->isCx==1){
|
|
|
$info['cat_info'] = made($info['cat_id'], []);
|
|
|
$platform = Db::name("platform")->field('id,platform_name')->where(["id" => $info['platform_code']])->find();
|