Files
hyperf_service/app/Model/Order.php
2025-03-06 16:25:25 +08:00

78 lines
2.2 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Database\Concerns\BuildsQueries;
use Hyperf\Database\Model\Builder;
use Hyperf\Database\Model\Collection;
use Hyperf\DbConnection\Model\Model;
/**
* @property int $id
* @property string $order_sno
* @property int $user_id
* @property int $cycle_id
* @property int $site_id
* @property int $city_id
* @property int $coupon_id
* @property int $copies
* @property int $type
* @property string $total_price
* @property string $actual_price
* @property string $discount_price
* @property int $status
* @property int $is_refund_all
* @property string $cancel_time
* @property string $set_out_time
* @property string $delivery_time
* @property string $take_food_time
* @property string $finish_time
* @property string $pay_time
* @property string $order_json
* @property string $create_time
* @property string $update_time
*/
class Order extends Model
{
/**
* The table associated with the model.
*/
protected ?string $table = 'order';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = [];
protected array $guarded = [];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['id' => 'integer', 'user_id' => 'integer', 'cycle_id' => 'integer', 'site_id' => 'integer', 'city_id' => 'integer', 'coupon_id' => 'integer', 'meal_copies' => 'integer', 'optional_copies' => 'integer', 'status' => 'integer', 'is_refund_all' => 'integer'];
const string CREATED_AT = 'create_time';
const string UPDATED_AT = 'update_time';
/**
* @param int $id
* @return Order|Order[]|Collection|\Hyperf\Database\Model\Model|null
*/
public function getInfoById(int $id): array|Order|Collection|\Hyperf\Database\Model\Model|null
{
return $this->find($id);
}
/**
* @param string $orderSno
* @return \Hyperf\Database\Model\Model|Builder|BuildsQueries|null
*/
public function getInfoByOrderSno(string $orderSno): \Hyperf\Database\Model\Model|Builder|BuildsQueries|null
{
return $this->where('order_sno',$orderSno)->first();
}
}