新增医生账户模型,修改省市区接口返回结构
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $account_id 账户id
|
||||
* @property int $doctor_id 医生id
|
||||
* @property string $total_amount 总金额(已完成订单的总金额)
|
||||
* @property string $balance_account 账户余额
|
||||
* @property string $withdrawal_amount 已提现金额
|
||||
* @property string $undrawn_amount 未提现金额
|
||||
* @property string $income_tax 所得税金额
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
*/
|
||||
class DoctorAccount extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'doctor_account';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['account_id', 'doctor_id', 'total_amount', 'balance_account', 'withdrawal_amount', 'undrawn_amount', 'income_tax', 'created_at', 'updated_at'];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*/
|
||||
protected array $casts = ['account_id' => 'integer', 'doctor_id' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
|
||||
|
||||
protected string $primaryKey = "account_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);
|
||||
}
|
||||
}
|
||||
@@ -77,7 +77,7 @@ class OrderInquiry extends Model
|
||||
* @param array $data 新增数据
|
||||
* @return \Hyperf\Database\Model\Model|OrderInquiry
|
||||
*/
|
||||
public static function addUserDoctor(array $data): \Hyperf\Database\Model\Model|OrderInquiry
|
||||
public static function addOrderInquiry(array $data): \Hyperf\Database\Model\Model|OrderInquiry
|
||||
{
|
||||
return self::create($data);
|
||||
}
|
||||
@@ -102,4 +102,16 @@ class OrderInquiry extends Model
|
||||
{
|
||||
return self::where($params)->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生某天预计收益
|
||||
* @param array $params
|
||||
* @return int|mixed|string
|
||||
*/
|
||||
public static function getDoctorOneDayEstimateIncome(array $params): mixed
|
||||
{
|
||||
return self::where($params)
|
||||
->whereIn('inquiry_status',[4,5,6])
|
||||
->sum("amount_total");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user