|
- <?php
- /**
- * Created by PhpStorm.
- * User: nizongfeng
- * Date: 2021/10/27
- * Time: 19:19
- */
-
- namespace app\admin\service;
-
-
- use app\admin\command\Util;
- use app\admin\model\PurchasePrice;
- use think\Exception;
-
- class PurchasePriceDao
- {
-
- /**
- * 添加采购单每日价格
- * @param $param
- * @param int $order_id
- * @param string $prod_type
- * @param int $order_detail_id
- * @param int $purchase_id
- * @return array
- */
- public function addList($param,int $order_id,string $prod_type,int $order_detail_id,int $purchase_id){
- try {
- foreach ($param as $value) {
- $data = [
- "order_id" => $order_id,
- "prod_type" => $prod_type,
- "order_detail_id" => $order_detail_id,
- "purchase_id" => $purchase_id,
- "run_date" => $value['run_date'],
- "count" => $value['count'],
- "price" => $value['price'],
- "cost" => $value['cost']
- ];
- $model = new PurchasePrice();
- $model->insertGetId($data);
- }
- return Util::returnArrSu();
- }catch (Exception $e){
- return Util::returnArrEr("添加采购单每日价格失败".$e->getMessage());
- }
- }
- }
|