order_id = 441; $task->is_work = 0; $task->source_table = $source_table; if(!$task->save()){ throw new \yii\db\Exception(ScoreExpansionRateTask::getStaticError()); } $order_type = 'StoreOrder'; $res = ScoreExpansionLogic::giveRedpack(441, 1, $order_type); if ($res == false) throw new \yii\db\Exception(ScoreExpansionLogic::getStaticError()); // $res = ScoreExpansionLogic::giveCashierRedpack(10, 2); return $res; } //测试抵扣 public function actionGoodsCeshi() { $item = []; $item['goods'] = Goods::find()->where(['id'=>456])->asArray()->all(); $data = []; foreach ($item['goods'] as $key=>$val){ $data[$val['id']] = $val; } $item['goods'] = $data; $item['mch_order_info']['mall_id'] = $this->mall_id; $item['mch_order_info']['user_id'] = $this->user_id; $marketing = new \addons\ScoreExpansion\common\logic\order\RedpackMarketing(); $item = $marketing::compute($item, $form); return $item; } }