123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- <?php
- namespace App\Models;
- use Illuminate\Database\Eloquent\Model;
- class OrderBikeOperate extends Model
- {
- //
- protected $table = "order_bike_operates";
- 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;
- const TYPE_PAUSE_OPEN_BIKE = 4;
- const TYPE_PAUSE_CLONE_BIKE = 5;
- const TYPE_ADMIN_SETTLRMENT = 6;
- const TYPE_ADMIN_ORDER_BACK = 7;
- const TYPE_ADMIN_ORDER_BACK_LOW_POWER = 10;
- const TYPE_ADMIN_ORDER_HUI_DIAN = 8;
- const TYPE_ADMIN_ORDER_OPEN_LOCK = 9;
- const TYPE_ADMIN_ORDER_REFUND = 11;
- public static $typeMaps = [
- self::TYPE_NULL => '未知',
- self::TYPE_BILL_BIKE => '寻车',
- self::TYPE_OPEN_BIKE => '开锁',
- self::TYPE_CLONE_BIKE => '关锁',
- self::TYPE_PAUSE_OPEN_BIKE => '开锁(临时停车)',
- self::TYPE_PAUSE_CLONE_BIKE => '关锁(临时停车)',
- self::TYPE_ADMIN_SETTLRMENT => '后台管理员结算订单',
- self::TYPE_ADMIN_ORDER_BACK => '后台管理员订单回溯',
- self::TYPE_ADMIN_ORDER_BACK_LOW_POWER => '后台管理员电量过低订单回溯',
- self::TYPE_ADMIN_ORDER_HUI_DIAN => '后台管理员恢复电能',
- self::TYPE_ADMIN_ORDER_OPEN_LOCK => '后台管理员开电车锁',
- self::TYPE_ADMIN_ORDER_REFUND => '后台管理员订单返还',
- ];
- const IS_ADMIN_NO = 'F';
- const IS_ADMIN_YES = 'T';
- public static $isAdminMaps = [
- self::IS_ADMIN_NO => '用户操作',
- self::IS_ADMIN_YES => '管理员操作'
- ];
- public function order(){
- return $this->belongsTo(Order::class,'order_id','id');
- }
- public function users(){
- return $this->belongsTo(User::class,'user_id','id');
- }
- public function adminUsers(){
- return $this->belongsTo(AdminUser::class,'user_id','id');
- }
- public static function logs($name,$type,$bike_id,$order_id,$user_id,$is_admin,$admin_id=0){
- $data = [
- 'name' => $name,
- 'type' => $type,
- 'bike_id' => $bike_id,
- 'order_id' => $order_id,
- 'user_id' => $user_id,
- 'is_admin' => $is_admin,
- 'admin_id' => $admin_id
- ];
- $res = self::create($data);
- return $res;
- }
- }
|