ChannelBookSell.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: hp
  5. * Date: 2017/11/21
  6. * Time: 8:59
  7. */
  8. namespace App\Modules\Channel\Models;
  9. use DB;
  10. use Illuminate\Database\Eloquent\Model;
  11. class ChannelBookSell extends Model
  12. {
  13. protected $table = 'channel_book_sell_stats';
  14. protected $fillable = ['id', 'plaform', 'zsy_bid', 'book_name', 'plaform_code', 'amount', 'sub_num', 'date', 'month',
  15. 'is_checked', 'is_pushed', 'bill_type', 'created_at', 'updated_at'];
  16. static function addInfo($data){
  17. return self::create($data);
  18. }
  19. /**
  20. * 根据id查找
  21. * @param $id
  22. * @return mixed
  23. */
  24. static function getById($id)
  25. {
  26. return self::where('id', $id)->first();
  27. }
  28. /**
  29. * 根据名称查找
  30. * @param $name
  31. * @return mixed
  32. */
  33. static function getByName($book_name)
  34. {
  35. return self::where('book_name', $book_name)->get();
  36. }
  37. /**
  38. * 根据code查找
  39. * @param $code
  40. * @return mixed
  41. */
  42. static function getByCode($code)
  43. {
  44. return self::where('code', $code)->get();
  45. }
  46. /**
  47. * 获取列表
  48. * @return mixed
  49. */
  50. static function getList()
  51. {
  52. return self::paginate();
  53. }
  54. static function updateStatus($id,$params=[])
  55. {
  56. if ($params){
  57. return self::where('id',$id)->update($params);
  58. }
  59. }
  60. }