public function actionUpdatePwd() { $response = array(); $user_phone = $this->request->getParam('user_phone'); $new_pwd = trim($this->request->getParam('new_pwd')); $phone_code = trim($this->request->getParam('phone_code')); $verifyCode = FCookie::get(FConfig::item('config.cookie.phone_key')); $verifyCode = Fn::crypt($verifyCode, FConfig::item('config.cookie.phone_code'), 'decode'); if ($phone_code != $verifyCode) { $response['status'] = 100001; $response['content'] = '短信验证失败!'; } else { $res = $this->user_model->updateAll(array('password' => md5($new_pwd)), 'phone_num=:phone', array(':phone' => $user_phone)); if ($res) { $response['status'] = 100000; $response['content'] = '修改密码成功!'; } else { $response['status'] = 100002; $response['content'] = '修改密码失败!'; } } Yii::app()->end(FHelper::json($response['content'], $response['status'])); }
public function actionToCash() { $user_id = $this->request->getParam('user_id'); $cash_money = $this->request->getParam('cash_money'); $avail_cash = $this->request->getParam('avail_cash'); $create_time = FF_DATE_TIME; $attr_cash = array('user_id' => $user_id, 'cash_money' => $cash_money, 'avail_cash' => $avail_cash, 'create_time' => $create_time); $this->withdrawCash_model->attributes = $attr_cash; $account_val = $this->userInfo['account_val'] - $cash_money; $condition_account_val = array('account_val' => $account_val); $res_userInfo = $this->userInfo_model->updateByPk($this->userInfo['id'], $condition_account_val); $res = $this->withdrawCash_model->save(); if ($res && $res_userInfo) { $response['status'] = 100000; $response['content'] = success; } else { $response['status'] = 100001; $response['content'] = error; } Yii::app()->end(FHelper::json($response['content'], $response['status'])); }