新增amqp队列,新增订单创建
This commit is contained in:
@@ -85,4 +85,14 @@ class InquiryCaseProduct extends Model
|
||||
->get($fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param array $data
|
||||
* @return \Hyperf\Database\Model\Model|InquiryCaseProduct
|
||||
*/
|
||||
public static function addInquiryCaseProduct(array $data): \Hyperf\Database\Model\Model|InquiryCaseProduct
|
||||
{
|
||||
return self::create($data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ class OrderInquiryCase extends Model
|
||||
*/
|
||||
protected array $casts = ['inquiry_case_id' => 'integer', 'inquiry_cases_id' => 'integer', 'user_id' => 'integer', 'patient_id' => 'integer', 'order_inquiry_id' => 'integer', 'family_id' => 'integer', 'relation' => 'integer', 'status' => 'integer', 'sex' => 'integer', 'age' => 'integer', 'disease_class_id' => 'integer', 'is_allergy_history' => 'integer', 'is_family_history' => 'integer', 'is_pregnant' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
|
||||
|
||||
protected string $primaryKey = "inquiry_cases_id";
|
||||
protected string $primaryKey = "inquiry_case_id";
|
||||
|
||||
/**
|
||||
* 关联问诊订单表
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Hyperf\Database\Model\Relations\HasOne;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $order_coupon_id 主键id
|
||||
* @property int $order_inquiry_id 订单-问诊id
|
||||
* @property int $user_coupon_id 用户优惠卷表
|
||||
* @property string $coupon_name 优惠卷名称
|
||||
* @property string $coupon_use_price 优惠卷使用金额
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
*/
|
||||
class OrderInquiryCoupon extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'order_inquiry_coupon';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['order_coupon_id', 'order_inquiry_id', 'user_coupon_id', 'coupon_name', 'coupon_use_price', 'created_at', 'updated_at'];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*/
|
||||
protected array $casts = ['order_coupon_id' => 'string', 'order_inquiry_id' => 'string', 'user_coupon_id' => 'string', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
|
||||
|
||||
protected string $primaryKey = "order_coupon_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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param array $data
|
||||
* @return OrderInquiryCoupon|\Hyperf\Database\Model\Model
|
||||
*/
|
||||
public static function addOrderInquiryCoupon(array $data): \Hyperf\Database\Model\Model|OrderInquiryCoupon
|
||||
{
|
||||
return self::create($data);
|
||||
}
|
||||
}
|
||||
@@ -38,4 +38,28 @@ class ProductPlatformAmount extends Model
|
||||
protected array $casts = ['amount_id' => 'integer', 'product_platform_id' => 'integer', 'real_stock' => 'integer', 'stock' => 'integer', 'lock_stock' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
|
||||
|
||||
protected string $primaryKey = "amount_id";
|
||||
|
||||
/**
|
||||
* 自增
|
||||
* @param array $params
|
||||
* @param string $field
|
||||
* @param float $numeral
|
||||
* @return int
|
||||
*/
|
||||
public static function inc(array $params,string $field,float $numeral = 1): int
|
||||
{
|
||||
return self::where($params)->increment($field,$numeral);
|
||||
}
|
||||
|
||||
/**
|
||||
* 自减
|
||||
* @param array $params
|
||||
* @param string $field
|
||||
* @param float $numeral
|
||||
* @return int
|
||||
*/
|
||||
public static function dec(array $params,string $field,float $numeral = 1): int
|
||||
{
|
||||
return self::where($params)->decrement($field,$numeral);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ class UserCoupon extends Model
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*/
|
||||
protected array $casts = ['user_coupon_id' => 'integer', 'user_id' => 'integer', 'patient_id' => 'integer', 'coupon_id' => 'integer', 'user_coupon_status' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
|
||||
protected array $casts = ['user_coupon_id' => 'string', 'user_id' => 'string', 'patient_id' => 'string', 'coupon_id' => 'string', 'user_coupon_status' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
|
||||
|
||||
protected string $primaryKey = "user_coupon_id";
|
||||
|
||||
@@ -70,15 +70,32 @@ class UserCoupon extends Model
|
||||
* @param array $fields
|
||||
* @return Collection|array
|
||||
*/
|
||||
public static function getWithCouponList(array $params,array $coupon_params, array $fields = ['*']): Collection|array
|
||||
public static function getWithCouponList(array $params,array $coupon_params,array $application_scope_params, array $fields = ['*']): Collection|array
|
||||
{
|
||||
return self::with(['Coupon'])
|
||||
->whereHas('Coupon' , function($query) use ($coupon_params){
|
||||
$query->where($coupon_params);
|
||||
->whereHas('Coupon' , function($query) use ($coupon_params,$application_scope_params){
|
||||
$query->where($coupon_params)->whereIn('application_scope',$application_scope_params);
|
||||
})
|
||||
->where($params)->get($fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取优惠卷信息-单条
|
||||
* @param array $params
|
||||
* @param array $coupon_params
|
||||
* @param array $fields
|
||||
* @return object|null
|
||||
*/
|
||||
public static function getWithCouponOne(array $params,array $coupon_params, array $application_scope_params,array $fields = ['*']): object|null
|
||||
{
|
||||
return self::with(['Coupon'])
|
||||
->whereHas('Coupon' , function($query) use ($coupon_params,$application_scope_params){
|
||||
$query->where($coupon_params)->whereIn('application_scope',$application_scope_params);
|
||||
})
|
||||
->where($params)
|
||||
->first($fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户优惠卷
|
||||
* @param array $data
|
||||
|
||||
Reference in New Issue
Block a user