Commit 9a9c3604 authored by hangjun83's avatar hangjun83

百化接口

parent afe500ee
...@@ -45,7 +45,7 @@ class BhuaProductRepositoryEloquent extends BaseRepository implements BhuaProduc ...@@ -45,7 +45,7 @@ class BhuaProductRepositoryEloquent extends BaseRepository implements BhuaProduc
public function getProductsByWhere(array $where) public function getProductsByWhere(array $where)
{ {
$productsModel = $this; $productsModel = BhuaProducts::query();
foreach($where as $key => $w){ foreach($where as $key => $w){
if(!is_array($w)){ if(!is_array($w)){
$productsModel->where($key,$w); $productsModel->where($key,$w);
...@@ -92,7 +92,7 @@ class BhuaProductRepositoryEloquent extends BaseRepository implements BhuaProduc ...@@ -92,7 +92,7 @@ class BhuaProductRepositoryEloquent extends BaseRepository implements BhuaProduc
*/ */
public function getProductPackagesThroughGroupByPackUnit() public function getProductPackagesThroughGroupByPackUnit()
{ {
$packages = $this $packages = BhuaProducts::query()
->select('p_pack','p_pack_unit') ->select('p_pack','p_pack_unit')
->groupBy('p_pack','p_pack_unit') ->groupBy('p_pack','p_pack_unit')
->get(); ->get();
...@@ -109,7 +109,7 @@ class BhuaProductRepositoryEloquent extends BaseRepository implements BhuaProduc ...@@ -109,7 +109,7 @@ class BhuaProductRepositoryEloquent extends BaseRepository implements BhuaProduc
*/ */
public function getProductsList($where, $offset, $limit) public function getProductsList($where, $offset, $limit)
{ {
$productsModel = $this; $productsModel = BhuaProducts::query();
if(!empty($where)){ if(!empty($where)){
foreach($where as $key => $w){ foreach($where as $key => $w){
if(!is_array($w)){ if(!is_array($w)){
...@@ -128,7 +128,7 @@ class BhuaProductRepositoryEloquent extends BaseRepository implements BhuaProduc ...@@ -128,7 +128,7 @@ class BhuaProductRepositoryEloquent extends BaseRepository implements BhuaProduc
public function getProductsByCas($cas) public function getProductsByCas($cas)
{ {
$productsModel = $this; $productsModel = BhuaProducts::query();
$product = $productsModel->where('chemicals.c_cas',$cas)->get(); $product = $productsModel->where('chemicals.c_cas',$cas)->get();
if($product){ if($product){
return $product->toArray(); return $product->toArray();
......
...@@ -52,17 +52,6 @@ class BhuaOrdersService ...@@ -52,17 +52,6 @@ class BhuaOrdersService
if(isset($v['si_molbase_pog'])){ if(isset($v['si_molbase_pog'])){
$soItems[$k]['si_molbase_pog'] = $v['si_molbase_pog']; $soItems[$k]['si_molbase_pog'] = $v['si_molbase_pog'];
} }
//当前产品是否在促销设定里
$promotions = $productRepository->getProductPromotionByPid($productInfo['p_id']);
if($promotions){
foreach($promotions as $promotion){
if($promotion->pt_discount != 0){
$productInfo['p_discount'] = round($promotion->pt_discount * $productInfo['p_discount']);
}
}
}
$soItems[$k]['amount'] = round(bcmul($productInfo['p_discount'],$v['num'],3),2); $soItems[$k]['amount'] = round(bcmul($productInfo['p_discount'],$v['num'],3),2);
$soItems[$k]['weight'] = round(bcmul($productInfo['p_weight'],$v['num'],3),3); $soItems[$k]['weight'] = round(bcmul($productInfo['p_weight'],$v['num'],3),3);
//得到品牌 //得到品牌
...@@ -101,7 +90,7 @@ class BhuaOrdersService ...@@ -101,7 +90,7 @@ class BhuaOrdersService
$data['sorders']['so_no'] = ''; $data['sorders']['so_no'] = '';
$data['sorders']['so_ctime'] = time(); $data['sorders']['so_ctime'] = time();
//$data['sorders']['so_creater'] = $data['']; $data['sorders']['so_creater'] = $data['sorders']['creater'];
$orderId = $connection->table('sorders')->insertGetId($data['sorders']); $orderId = $connection->table('sorders')->insertGetId($data['sorders']);
......
...@@ -93,6 +93,8 @@ class BhuaOrdersService ...@@ -93,6 +93,8 @@ class BhuaOrdersService
$data['sorders']['so_ci_addr'] = $cusinvoice_arr['ci_addr']; $data['sorders']['so_ci_addr'] = $cusinvoice_arr['ci_addr'];
$data['sorders']['so_ci_phone'] = $cusinvoice_arr['ci_phone']; $data['sorders']['so_ci_phone'] = $cusinvoice_arr['ci_phone'];
$data['sorders']['creater'] = $customer['cus_id'];
if(!isset($requestParams['so_note'])){ if(!isset($requestParams['so_note'])){
$requestParams['so_note'] = ''; $requestParams['so_note'] = '';
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment