新版订单消耗系统

MjMcnImport.php 905B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. class MjMcnImport extends Model
  5. {
  6. protected $table = 'mj_mcn_import';
  7. public $timestamps = false;
  8. protected static $unguarded = true;
  9. public static function delByMcnId($id)
  10. {
  11. $info = OrderMcn::select('task_id', 'month')
  12. ->where('id', $id)
  13. ->first();
  14. if(empty($info)){
  15. return false;
  16. }
  17. return self::where('task_id', $info->task_id)->where('month', $info->month)->update(['enable'=>0]);
  18. }
  19. public static function delByCaId($id)
  20. {
  21. $info = OrderMcn::select('task_id', 'original_month')
  22. ->where('id', $id)
  23. ->first();
  24. if(empty($info)){
  25. return false;
  26. }
  27. return self::where('task_id', $info->task_id)->where('month', $info->original_month)->update(['enable'=>0]);
  28. }
  29. }