UserBikeOperate.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Support\Facades\DB;
  4. use Illuminate\Support\Facades\Log;
  5. class UserBikeOperate extends Model
  6. {
  7. protected $guarded = [];
  8. const STATUS_OK = 1;
  9. const STATUS_PAUSE = 0;
  10. public static $statusMaps = [
  11. self::STATUS_OK => '正常',
  12. self::STATUS_PAUSE => '暂停'
  13. ];
  14. const TYPE_NULL = 0;
  15. const TYPE_BILL_BIKE = 1;
  16. const TYPE_OPEN_BIKE = 2;
  17. const TYPE_CLONE_BIKE = 3;
  18. public static $typeMaps = [
  19. self::TYPE_NULL => '未知',
  20. self::TYPE_BILL_BIKE => '寻车',
  21. self::TYPE_OPEN_BIKE => '开锁',
  22. self::TYPE_CLONE_BIKE => '关锁'
  23. ];
  24. public static function log($type, $bike_no, $user_id, $lat, $lng)
  25. {
  26. $data = [
  27. 'name' => self::$typeMaps[$type],
  28. 'type' => $type,
  29. 'bike_no' => $bike_no,
  30. 'user_id' => $user_id,
  31. 'latitude' => $lat,
  32. 'longitude' => $lng,
  33. 'merchant_id' => merchant_id()
  34. ];
  35. self::create($data);
  36. }
  37. }