Example #1
0
 public static function add($value)
 {
     $value = json_encode($value);
     $self = new Debug();
     $self->json = $value;
     $self->save();
     return $self;
 }
Example #2
0
 /**
  * 首次充钱
  * @param $event
  */
 public function setIncFirstMoney($event)
 {
     $rs = $event->rs;
     $assetOne = AssetMoney::find()->where(['user_id' => $rs['user_id']])->andWhere(['type' => AssetMoney::TYPE_MONEY])->andWhere(['status' => AssetMoney::STATUS_INC])->count();
     if ($assetOne == 1) {
         Debug::add('asset' . $assetOne);
         $assm = new AssetMoney();
         $assm->action = wanhunet::$app->controller->getRoute();
         $assm->step = Config::getInstance()->getProperty('setIncEM.firstMoney');
         $assm->user_id = $rs['user_id'];
         $assm->action_uid = $rs['user_id'];
         $assm->status = AssetMoney::STATUS_INC;
         $assm->type = AssetMoney::TYPE_EXPERIENCE_MONEY;
         $assm->save();
         $assmax = new AssetMoney();
         $assmax->action = wanhunet::$app->controller->getRoute();
         $assmax->step = Config::getInstance()->getProperty('setIncEM.firstMoney');
         $assmax->user_id = $rs['user_id'];
         $assmax->action_uid = $rs['user_id'];
         $assmax->status = AssetMoney::STATUS_INC;
         $assmax->type = AssetMoney::TYPE_EXPERIENCE_MONEY_MAX;
         $assmax->save();
     }
 }
Example #3
0
 public function finishPay(Event $event)
 {
     /** @var \wanhunet\components\PayEvent $event */
     $data = $event->rs;
     $notifyResp = $data['notifyResp'];
     Debug::add($notifyResp);
     $this->status = self::STATUS_INC;
     $this->save();
     /** @var Asset $asset */
     $asset = Asset::find()->where(['user_id' => $this->user_id])->one();
     if ($asset !== null) {
         $asset->money = $this->step + $asset->money;
         $asset->saveMoney();
     }
     $event->rs['user_id'] = $this->user_id;
     $this->trigger(self::EVENT_FINISH_PAY, $event);
 }