12345678910111213141516171819202122232425262728293031323334353637 |
- <?php
- namespace app\admin\service\coupon;
- use app\model\CouponDetail;
- use app\model\SysSerial;
- use support\exception\BusinessException;
- class CouponDetailService
- {
- /**
- * @Desc 手动发券
- * @Author Gorden
- * @Date 2024/8/27 9:57
- *
- * @param $params
- * @return void
- * @throws BusinessException
- */
- public static function customSendCoupon($params)
- {
- try {
- CouponDetail::insert([
- 'coupon_detail_id' => 'CUDT' . date("ymdH") . random_string(6, 'up'),
- 'join_detail_coupon_id' => $params['coupon_id'],
- 'join_coupon_detail_member_id' => $params['member_id'],
- 'coupon_detail_status' => 'ACTIVED',
- 'coupon_detail_gain_datetime' => $params['coupon_detail_gain_datetime'],
- 'coupon_detail_deadline_datetime' => $params['coupon_detail_deadline_datetime'],
- 'coupon_detail_extend_json'=>json_encode(['gettype'=>'SEND']),
- 'coupon_detail_addtimes' => time(),
- ]);
- } catch (\Exception $e) {
- throw new BusinessException('写入优惠券失败');
- }
- }
- }
|