新版订单消耗系统

OrderEditRecordsDetail.php 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: shensong
  5. * Date: 2021/2/4
  6. * Time: 15:00
  7. */
  8. namespace App\Models;
  9. use Illuminate\Database\Eloquent\Model;
  10. class OrderEditRecordsDetail extends Model
  11. {
  12. #订单批量记录与订单关系表
  13. protected $table = 'order_edit_records_detail';
  14. public $timestamps = false;
  15. public static function addData($data, $editId)
  16. {
  17. $insert = [];
  18. foreach($data as $val) {
  19. $item = [];
  20. $item['edit_id'] = $editId;
  21. $item['order_id'] = $val['order_id'];
  22. $item['final_amount'] = $val['final_amount'];
  23. $item['original_final_amount'] = $val['original_final_amount'];
  24. $item['original_actual_consumption_after'] = $val['original_actual_consumption_after'];
  25. $item['actual_consumption_after'] = $val['actual_consumption_after'];
  26. $item['original_top_fee_after'] = $val['original_top_fee_after'];
  27. $item['top_fee_after'] = $val['top_fee_after'];
  28. $item['original_link_fee_after'] = $val['original_link_fee_after'];
  29. $item['link_fee_after'] = $val['link_fee_after'];
  30. $item['original_flow_boost_back_point_after'] = $val['original_flow_boost_back_point_after'];
  31. $item['flow_boost_back_point_after'] = $val['flow_boost_back_point_after'];
  32. $item['enable'] = 1;
  33. $insert[] = $item;
  34. }
  35. return self::insert($insert);
  36. }
  37. public static function getAllOrder($editId)
  38. {
  39. $list = self::where('edit_id', $editId)->where('enable', 1)->get();
  40. $list = json_decode(json_encode($list), 1);
  41. return $list;
  42. }
  43. }