Beispiel #1
0
 public function setIncNewMoney($step)
 {
     $assetMoney = new AssetMoney();
     $assetMoney->user_id = $this->user_id;
     $assetMoney->status = AssetMoney::STATUS_MONEY_UNPAYED;
     $assetMoney->step = $step;
     $assetMoney->type = AssetMoney::TYPE_MONEY;
     $assetMoney->save();
     return $assetMoney;
 }
Beispiel #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();
     }
 }
Beispiel #3
0
 /**
  * 用户名 username input
  * 金额   step     input_int
  * 金额状态 status  radio     选项::增长:20; 减少:30
  *
  * @return string|bool
  */
 public function actionNewEm()
 {
     $request = wanhunet::$app->request;
     $memberModel = Member::findByUsername($request->post('username'));
     $status = [AssetMoney::STATUS_INC, AssetMoney::STATUS_DEC];
     if ($memberModel !== null) {
         $assetMoneyModel = new AssetMoney();
         $assetMoneyModel->action = '';
         $assetMoneyModel->user_id = $memberModel->id;
         $assetMoneyModel->step = $request->post('step');
         $assetMoneyModel->status = in_array($request->post('status'), $status) ? $request->post('status') : 0;
         $assetMoneyModel->type = AssetMoney::TYPE_EXPERIENCE_MONEY;
         $assetMoneyModel->action_uid = $memberModel->id;
         if ($assetMoneyModel->save()) {
             return true;
         } else {
             return current($assetMoneyModel->getFirstErrors());
         }
     } else {
         return '用户不存在';
     }
 }