75 lines
2.1 KiB
PHP
75 lines
2.1 KiB
PHP
<?php
|
||
|
||
declare(strict_types=1);
|
||
|
||
namespace App\Model;
|
||
|
||
|
||
|
||
use Hyperf\Snowflake\Concern\Snowflake;
|
||
|
||
/**
|
||
* @property int $account_detail_id 主键id
|
||
* @property int $doctor_id 医生id
|
||
* @property int $year 年(2023)
|
||
* @property int $month 月(12)
|
||
* @property int $day 日(01)
|
||
* @property int $account_month_id 月份账户id
|
||
* @property string $total_amount_day 订单总金额-日
|
||
* @property \Carbon\Carbon $created_at 创建时间
|
||
* @property \Carbon\Carbon $updated_at 修改时间
|
||
*/
|
||
class DoctorAccountDay extends Model
|
||
{
|
||
use Snowflake;
|
||
|
||
/**
|
||
* The table associated with the model.
|
||
*/
|
||
protected ?string $table = 'doctor_account_day';
|
||
|
||
/**
|
||
* The attributes that are mass assignable.
|
||
*/
|
||
protected array $fillable = ['account_detail_id', 'doctor_id', 'year', 'month', 'day', 'account_month_id', 'total_amount_day', 'created_at', 'updated_at'];
|
||
|
||
/**
|
||
* The attributes that should be cast to native types.
|
||
*/
|
||
protected array $casts = ['account_detail_id' => 'integer', 'doctor_id' => 'integer', 'year' => 'integer', 'month' => 'integer', 'day' => 'integer', 'account_month_id' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
|
||
|
||
protected string $primaryKey = "account_detail_id";
|
||
|
||
/**
|
||
* 获取信息-单条
|
||
* @param array $params
|
||
* @param array $fields
|
||
* @return object|null
|
||
*/
|
||
public static function getOne(array $params, array $fields = ['*']): object|null
|
||
{
|
||
return self::where($params)->first($fields);
|
||
}
|
||
|
||
/**
|
||
* 获取信息-多条
|
||
* @param array $params
|
||
* @param array $fields
|
||
* @return object|null
|
||
*/
|
||
public static function getList(array $params, array $fields = ['*']): object|null
|
||
{
|
||
return self::where($params)->get($fields);
|
||
}
|
||
|
||
/**
|
||
* 获取total_amount_day字段总和
|
||
* @param array $params
|
||
* @return int|mixed|string
|
||
*/
|
||
public static function getDoctorSumTotalAmount(array $params): mixed
|
||
{
|
||
return self::where($params)->sum("total_amount_day");
|
||
}
|
||
}
|