46 lines
1.1 KiB
PHP
46 lines
1.1 KiB
PHP
<?php
|
|
namespace app\common\model\system\merchant;
|
|
|
|
|
|
use app\common\model\BaseModel;
|
|
use app\common\model\store\coupon\StoreCoupon;
|
|
use app\common\repositories\store\coupon\StoreCouponRepository;
|
|
|
|
class MerchantShareholderLevel extends BaseModel{
|
|
|
|
public static function tablePk(): string{
|
|
return 'id';
|
|
}
|
|
|
|
public static function tableName(): string{
|
|
return 'merchant_shareholder_level';
|
|
}
|
|
|
|
|
|
/**
|
|
* Common: 获取器 —— 获取相关优惠券列表
|
|
* Author: wu-hui
|
|
* Time: 2024/06/13 14:07
|
|
* @return array
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
* @throws \think\db\exception\DbException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
*/
|
|
public function getCouponListAttr(){
|
|
$couponIds = $this->coupon_ids ?? '';
|
|
$couponIds = explode( ',', $couponIds);
|
|
// 获取所有优惠券信息
|
|
return StoreCoupon::whereIn('coupon_id', $couponIds)
|
|
->where('status', 1)
|
|
->where('is_del', 0)
|
|
->field('coupon_id,title,coupon_price,coupon_time,type')
|
|
->select()
|
|
->toArray();
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|