TechnicalIncomelog.php 857 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace app\model;
  3. use think\Model;
  4. class TechnicalIncomelog extends Model
  5. {
  6. protected $connection = 'mysql';
  7. protected $pk = 'id';
  8. protected $name = 'technical_incomelog';
  9. public function member()
  10. {
  11. return $this->hasOne(Member::class, 'id', 'buyer_id');
  12. }
  13. public function technical()
  14. {
  15. return $this->hasOne(Technical::class, 'uuid', 'uuid');
  16. }
  17. public function order()
  18. {
  19. return $this->hasOne(Order::class, 'id', 'order_id');
  20. }
  21. public function orderGoods()
  22. {
  23. return $this->hasMany(OrderGoods::class, 'order_id');
  24. }
  25. public static function getorderIncome($order_id)
  26. {
  27. $res = self::where('order_id', $order_id)->find();
  28. if (!empty($res)) {
  29. return $res->income;
  30. }else{
  31. return 0;
  32. }
  33. }
  34. }