feat: spu
This commit is contained in:
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
use Hyperf\Database\Model\Builder;
|
||||
use Hyperf\DbConnection\Model\Model;
|
||||
|
||||
/**
|
||||
@@ -24,8 +25,22 @@ class Cycle extends Model
|
||||
*/
|
||||
protected array $fillable = [];
|
||||
|
||||
protected array $guarded = [];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*/
|
||||
protected array $casts = ['id' => 'integer', 'is_use' => 'integer'];
|
||||
|
||||
const string CREATED_AT = 'create_time';
|
||||
const null UPDATED_AT = null;
|
||||
|
||||
/**
|
||||
* @param string $date
|
||||
* @return Builder|\Hyperf\Database\Model\Model|null
|
||||
*/
|
||||
public function getInfoByDate(string $date): \Hyperf\Database\Model\Model|Builder|null
|
||||
{
|
||||
return $this->where('dates',$date)->first();
|
||||
}
|
||||
}
|
||||
|
||||
44
app/Model/Sku.php
Normal file
44
app/Model/Sku.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
use Hyperf\DbConnection\Model\Model;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property int $spu_id
|
||||
* @property string $title
|
||||
* @property string $image_ids
|
||||
* @property string $price
|
||||
* @property string $param
|
||||
* @property string $extra
|
||||
* @property int $total_stock
|
||||
* @property int $surplus_stock
|
||||
* @property int $sales_num
|
||||
* @property int $order_num
|
||||
* @property int $cancel_num
|
||||
* @property int $ahead_refund_num
|
||||
* @property int $behind_refund_num
|
||||
* @property int $saleable
|
||||
* @property string $create_time
|
||||
* @property string $update_time
|
||||
*/
|
||||
class Sku extends Model
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'sku';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = [];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*/
|
||||
protected array $casts = ['id' => 'integer', 'spu_id' => 'integer', 'total_stock' => 'integer', 'surplus_stock' => 'integer', 'sales_num' => 'integer', 'order_num' => 'integer', 'cancel_num' => 'integer', 'ahead_refund_num' => 'integer', 'behind_refund_num' => 'integer', 'saleable' => 'integer'];
|
||||
}
|
||||
63
app/Model/Spu.php
Normal file
63
app/Model/Spu.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
use Hyperf\Database\Model\Builder;
|
||||
use Hyperf\DbConnection\Model\Model;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property int $cycle_id
|
||||
* @property int $city_id
|
||||
* @property int $kitchen_id
|
||||
* @property int $chef_id
|
||||
* @property string $title
|
||||
* @property string $sub_title
|
||||
* @property int $category_id
|
||||
* @property int $saleable
|
||||
* @property string $create_time
|
||||
* @property string $update_time
|
||||
*/
|
||||
class Spu extends Model
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'spu';
|
||||
|
||||
/**
|
||||
* 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', 'cycle_id' => 'integer', 'city_id' => 'integer', 'kitchen_id' => 'integer','chef_id' => 'integer', 'category_id' => 'integer', 'saleable' => 'integer'];
|
||||
|
||||
const string CREATED_AT = 'create_time';
|
||||
const string UPDATED_AT = 'update_time';
|
||||
|
||||
/**
|
||||
* @param int $cityId
|
||||
* @param int $cycleId
|
||||
* @return Builder|\Hyperf\Database\Model\Model|null
|
||||
*/
|
||||
public function getInfoByCityIdAndCycleId(int $cityId, int $cycleId): \Hyperf\Database\Model\Model|Builder|null
|
||||
{
|
||||
return $this->where('city_id', $cityId)->where('cycle_id', $cycleId)->first();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @return Builder|\Hyperf\Database\Model\Model|null
|
||||
*/
|
||||
public function getInfoById(int $id): \Hyperf\Database\Model\Model|Builder|null
|
||||
{
|
||||
return $this->where('id', $id)->first();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user