Example #1
0
 /**
  * 用户解绑定银行卡
  * @param $uid
  * @return array
  */
 public static function unbinding_bank_card($uid)
 {
     $flag = self::getIdentity($uid);
     if (!$flag) {
         $return = array('errorNum' => '1', 'errorMsg' => '用户不存在', 'data' => null);
         return $return;
     }
     //获取付款用户的用户信息
     $SinaBank = SinaBank::find()->where(['uid' => $uid, 'identity_id' => $flag, 'status' => SinaBank::STATUS_BINGING])->one();
     if (!$SinaBank) {
         $return = array('errorNum' => '1', 'errorMsg' => '用户没有绑定银行卡', 'data' => null);
         return $return;
     }
     $identity_id = $flag;
     $card_id = $SinaBank->card_id;
     $sina = new sina();
     $unbinding = $sina->unbinding_bank_card($identity_id, $card_id);
     if ($unbinding) {
         if ($unbinding['response_code'] == 'APPLY_SUCCESS') {
             $SinaBank->status = SinaBank::STATUS_DELETED;
             $SinaBank->msg = '用户解绑定银行卡';
             if ($SinaBank->save()) {
                 //修改网站账户信息---清除账户中的信息
                 Info::updateAll(['bank_card_phone' => '', 'bank_card' => ''], ['member_id' => $uid]);
                 UcenterMember::updateAll(['status' => UcenterMember::STATUS_REAL], ['id' => $uid]);
                 $return = array('errorNum' => '0', 'errorMsg' => 'success', 'data' => null);
                 return $return;
             } else {
                 $return = array('errorNum' => '1', 'errorMsg' => '网站解绑失败', 'data' => null);
                 return $return;
             }
         } else {
             $return = array('errorNum' => '1', 'errorMsg' => $unbinding['response_message'], 'data' => null);
             return $return;
         }
     } else {
         $return = array('errorNum' => '1', 'errorMsg' => '新浪接口错误', 'data' => null);
         return $return;
     }
 }
 /**
  * Deletes an existing UcenterMember model.
  * If deletion is successful, the browser will be redirected to the 'index' page.
  * @param integer $id
  * @return mixed
  */
 public function actionDelete($id)
 {
     // $this->findModel($id)->delete();
     UcenterMember::updateAll(['lock' => UcenterMember::TYPE_DELETE], ['id' => $id]);
     return $this->redirect(['index']);
 }
Example #3
0
 public function actionUnbundling($id)
 {
     $model = $this->findModel($id);
     if ($model->balance) {
         \Yii::$app->getSession()->setFlash('warning', '账户还有余额,请处理完余额再解绑银行卡');
         return $this->render('view', ['model' => $model]);
     }
     $return = sinapay::unbinding_bank_card($model->member_id);
     if ($return['errorNum'] == 0) {
         \Yii::$app->getSession()->setFlash('warning', '解绑成功');
         UcenterMember::updateAll(['status' => UcenterMember::STATUS_REAL], ['id' => $model->member_id]);
         //            SinaBank::updateAll(['status'=>SinaBank::STATUS_DELETED],['id' => $model->member_id,'status'=>SinaBank::STATUS_BINGING]);
         //            Info::updateAll(['bank_card'=>''],['id' => $model->member_id]);
     } else {
         \Yii::$app->getSession()->setFlash('warning', $return['errorMsg']);
     }
     return $this->render('view', ['model' => $model]);
 }