新增获取商品库存对接、修正实际付款金额返回值

This commit is contained in:
2023-03-15 14:44:39 +08:00
parent 55991b6987
commit cff132c5d4
10 changed files with 582 additions and 95 deletions
+97
View File
@@ -0,0 +1,97 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Database\Model\Collection;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $product_platform_id 主键id
* @property string $product_name 商品名称
* @property string $product_price 商品价格
* @property int $product_type 药品类型(0:未知 1:中成药 2:西药)
* @property string $product_platform_code 处方平台商品编码
* @property string $product_pharmacy_code 第三方药店商品编码
* @property string $product_spec 商品规格
* @property string $license_number 批准文号
* @property string $manufacturer 生产厂家
* @property string $single_unit 单次剂量单位
* @property string $packaging_unit 基本包装单位
* @property string $packaging_count 基本包装数量
* @property string $retail_unit 零售单位
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
*/
class ProductPlatform extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'product_platform';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['product_platform_id', 'product_name', 'product_price', 'product_type', 'product_platform_code', 'product_pharmacy_code', 'product_spec', 'license_number', 'manufacturer', 'single_unit', 'packaging_unit', 'packaging_count', 'retail_unit', 'created_at', 'updated_at'];
protected string $primaryKey = "product_platform_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 Collection|array
*/
public static function getList(array $params = [], array $fields = ['*']): Collection|array
{
return self::where($params)->get($fields);
}
/**
* 修改
* @param array $params
* @param array $data
* @return int
*/
public static function edit(array $params = [], array $data = []): int
{
return self::where($params)->update($data);
}
/**
* 新增
* @param array $data
* @return \Hyperf\Database\Model\Model|ProductPlatform
*/
public static function addProductPlatform(array $data = []): \Hyperf\Database\Model\Model|ProductPlatform
{
return self::create($data);
}
/**
* 获取是否存在
* @param array $params
* @return bool
*/
public static function getExists(array $params): bool
{
return self::where($params)->exists();
}
}