feat: 引入商品模型并更新报价控制器查询逻辑

This commit is contained in:
mkm 2024-05-25 14:14:00 +08:00
parent cbc52952ae
commit 43c749f480

View File

@ -6,6 +6,8 @@ use app\api\controller\BaseApiController;
use app\api\lists\operation\OpurchaseGoodsOfferList;
use app\api\logic\operation\OpurchaseGoodsOfferLogic;
use app\api\validate\OpurchaseGoodsOfferValidate;
use app\common\model\goods\Goods;
use app\common\model\goods\Goodsclass;
use think\facade\Db;
class OpurchaseGoodsOfferController extends BaseApiController
@ -29,8 +31,18 @@ class OpurchaseGoodsOfferController extends BaseApiController
$page_no = $this->request->get('page_no', 1);
$page_size = $this->request->get('page_size', 15);
$data = Db::name('opurchase_goods_offer_date')->where('supplier_id', $supplier['id'])->page($page_no, $page_size)->select()->each(function ($item) {
$data = Db::name('opurchase_goods_offer_date')->where('supplier_id', $supplier['id'])->page($page_no, $page_size)->select()
->each(function ($item) {
$item['name']=date('Y-m-d', $item['create_time']).' 报价清单';
$item['class_arr']=[];
$goods_id=Db::name('opurchase_goods_offer')->whereDay('create_time',$item['name'])->where('supplier_id', $item['supplier_id'])->limit(3)->column('goods_id');
if($goods_id){
$class=Goods::where('id','in',$goods_id)->column('class');
if($class){
$name=Goodsclass::where('id','in',$class)->column('name');
$item['class_arr']=$name;
}
}
return $item;
})->toArray();
$count = Db::name('opurchase_goods_offer_date')->where('supplier_id', $supplier['id'])->count();