12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- namespace App\Models;
- use Illuminate\Database\Eloquent\Model;
- use Illuminate\Support\Facades\DB;
- use Illuminate\Support\Facades\Log;
- class UserBikeOperate extends Model
- {
- protected $guarded = [];
- const STATUS_OK = 1;
- const STATUS_PAUSE = 0;
- public static $statusMaps = [
- self::STATUS_OK => '正常',
- self::STATUS_PAUSE => '暂停'
- ];
- const TYPE_NULL = 0;
- const TYPE_BILL_BIKE = 1;
- const TYPE_OPEN_BIKE = 2;
- const TYPE_CLONE_BIKE = 3;
- public static $typeMaps = [
- self::TYPE_NULL => '未知',
- self::TYPE_BILL_BIKE => '寻车',
- self::TYPE_OPEN_BIKE => '开锁',
- self::TYPE_CLONE_BIKE => '关锁'
- ];
- public static function log($type, $bike_no, $user_id, $lat, $lng)
- {
- $data = [
- 'name' => self::$typeMaps[$type],
- 'type' => $type,
- 'bike_no' => $bike_no,
- 'user_id' => $user_id,
- 'latitude' => $lat,
- 'longitude' => $lng,
- ];
- self::create($data);
- }
- }
|