| 1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- namespace bizHd\promote\services;
- use bizHd\base\services\BaseService;
- use common\components\validate;
- use common\components\util;
- use Yii;
- class CouponRewardService extends BaseService
- {
-
- public static $baseFile = '\bizHd\promote\classes\CouponRewardClass';
-
- //发放奖品 ssh 2019,8.25
- public static function grantReward($data, $sjId)
- {
- validate::easyCheck(['id'], $data);
- $id = $data['id'];
- $reward = self::getById($id, true);
- if (empty($reward)) {
- util::fail('没有找到奖励');
- }
- if ($sjId != $reward['sjId']) {
- util::fail('无法操作');
- }
- if ($reward->status == 2) {
- util::fail('已经发放过了');
- }
- $reward->status = 2;
- $reward->save();
- return true;
- }
-
- }
|