本文整理汇总了PHP中ajax_error函数的典型用法代码示例。如果您正苦于以下问题:PHP ajax_error函数的具体用法?PHP ajax_error怎么用?PHP ajax_error使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ajax_error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct()
{
parent::__construct();
$this->_user = get_user();
$error = null;
if ($this->_user) {
$salesman = M('loan_salesman')->where(['uid' => $this->_user['uid']])->find();
if ($salesman) {
if ($salesman['status'] != 1) {
$error = '此账号已被禁用!';
}
} else {
$error = '此已登录账号' . $this->_user['uname'] . '尚未开通审核权限!';
}
$this->_salesman = $salesman;
} else {
$error = '登录超时,请重新登录!';
}
// 停用
// $error = '审单网页版已停用,请使用指尖审单App。';
if ($error) {
if (IS_POST) {
ajax_error($error);
}
$this->display('login');
exit;
}
}
示例2: apply
/**
* @title 申请兑换
*
* @param int $gift_id 物品编号
*
* @method get
*/
public function apply($gift_id = 0)
{
$user = get_user() or ajax_error('USER_NOT_LOGIN', '登录超时,请重新登录!');
$creditModel = D('Credit');
$creditModel->apply($user['uid'], $gift_id) or ajax_error($creditModel->getError());
ajax_success();
}
示例3: user
/**
* @title 获取"我的"信息
*
* @param string $os 操作系统 android android/ios(弃用,将改为通过http_user_agent自动分析)
* @method get
*/
public function user($os)
{
$user = get_user() or ajax_error('USER_NOT_LOGIN', '登录超时,请重新登录!');
$uid = $user['uid'];
// 判断此学校的信用额度
$limit_range = '3000~8000元';
$university_config = M('loan_config_university')->find($user['university_id']);
if ($university_config) {
$money = M('loan_config_university_money')->where(['education' => $university_config['education']])->field('min(money) min,max(money) max')->find();
$limit_range = $money ? number_format($money['min'], 0, '.', '') . '~' . number_format($money['max'], 0, '.', '') : $limit_range;
}
// 认证状态
$contract_status = M('loan_user_contract')->where(['uid' => $uid])->getField('status');
$auth_status = $contract_status === null ? 0 : $contract_status + 1;
$user_money_limit = $limit_range;
if ($auth_status == 2) {
$user_money_limit = M('loan_user')->where(['uid' => $uid])->getField('money_limit') + 0;
}
$auth_btn_config = ['0' => '立即认证', '1' => '等待审核', '2' => '认证完成', '3' => '认证失败'];
$auth_text_config = ['0' => '立即完成身份认证,即可获得' . $limit_range . '信用额度', '1' => '等待完成身份认证,即可获得' . $limit_range . '信用额度', '2' => '恭喜,已通过身份认证,现已获得' . $user_money_limit . '信用额度', '3' => '等待完成身份认证,即可获得' . $limit_range . '信用额度'];
$loan_max_money = $loan_available_money = 0;
if ($auth_status == 2) {
$loan_user = M('loan_user')->where('uid=' . $uid)->find();
if ($loan_user) {
$loan_max_money = $loan_user['money_limit'];
$loan_available_money = $loan_user['money_limit'] - ($loan_user['total_money_loan'] - $loan_user['total_money_return']);
}
}
// 'loan_max_money' => number_format ( $loan_max_money, 2, '.', '' ),
$userMoneyModel = new \Common\Model\UserMoneyModel();
ajax_success(['user' => ['uname' => $user['uname'], 'realname' => $user['realname']], 'title' => '你好,' . ($user['realname'] ?: $user['uname']), 'sub_title' => isset($auth_text_config[$auth_status]) ? $auth_text_config[$auth_status] : '', 'auth_btn' => ['text' => isset($auth_btn_config[$auth_status]) ? $auth_btn_config[$auth_status] : '', 'title' => '个人认证', 'url' => U('/user/contract@loan') . '?from=' . $os], 'top_menu' => [['title' => '可用额度', 'number' => number_format($loan_available_money, 2, '.', ''), 'url' => U('/user/contract@loan') . '?from=' . $os], ['title' => '我的钱包', 'number' => $userMoneyModel->get($user['uid']), 'url' => U('/wallet/@mobile') . '?from=' . $os], ['title' => '我的积分', 'number' => M('credit')->where('uid=' . $uid)->getField('credit') + 0, 'url' => U('/credit/@mobile') . '?from=' . $os]], 'list_menu' => [['title' => '我的订单', 'icon' => 'http://zjdxdl.qiniudn.com/app_resource_v3_me_order.png', 'tip' => '', 'url' => U('/user/order/@loan') . '?from=' . $os], ['title' => '我的账单', 'icon' => 'http://zjdxdl.qiniudn.com/app_resource_v3_me_bill.png', 'tip' => '', 'url' => U('/user/bill/@loan') . '?from=' . $os], ['title' => '我的兼职', 'icon' => 'http://zjdxdl.qiniudn.com/app_resource_v3_me_job.png', 'tip' => '', 'url' => U('/job/user/@mobile') . '?from=' . $os]], 'feedback' => ['uncheck' => M('feedback_list')->where(['uid' => $uid])->getField('unread_num') ?: 0]]);
}
示例4: vote
public function vote()
{
$id = I('get.id');
$vote = $model = M('common_vote')->find($id) or $this->error('此投票不存在!');
$vote['status'] == 1 or $this->errror('投票已结束!');
if (IS_POST) {
$user = get_user() or $this->error('请先登录!');
$model = M("common_vote_log");
$model->where(['vote_id' => $vote['id'], 'uid' => $user['uid']])->count() && ajax_error('每人仅限投一票!');
$option_id = I('get.option_id');
$option_title = M('common_vote_option')->where(['id' => $option_id, 'status' => 1])->getField('title') or ajax_error('此投票项不存在!');
$model->add(['vote_id' => $vote['id'], 'option_id' => $option_id, 'option_title' => $option_title, 'uid' => $user['uid'], 'uname' => $user['uname'], 'created' => time()]);
M('common_vote_option')->where(['id' => $option_id])->setInc('votes');
ajax_success();
}
$option = M('common_vote_option')->where(['vote_id' => $vote['id'], 'status' => 1])->order('id')->select();
$total_votes = 0;
foreach ($option as $key => $vo) {
$total_votes += $vo['votes'];
}
foreach ($option as $key => $vo) {
$option[$key]['rate'] = $total_votes > 0 ? intval($vo['votes'] / $total_votes * 100) : 0;
}
$this->assign('vote', $vote);
$this->assign('_option', $option);
$this->display();
}
示例5: _error
protected function _error($data)
{
if (IS_AJAX) {
ajax_error($data);
} else {
$this->error($data);
}
}
示例6: olc_output_warning
function olc_output_warning($warning, $force_errorBox = false)
{
if (IS_AJAX_PROCESSING && !$force_errorBox) {
ajax_error($warning, true);
} else {
new errorBox(array(array('text' => HTML_BR . olc_image(DIR_WS_ICONS . 'warning.gif', ICON_WARNING) . BLANK . $warning . '<br/><br/>')));
}
}
示例7: upload
public function upload()
{
$_FILES && isset($_FILES['file']) or ajax_error('FILE_NOT_FOUND', '请选择上传文件!');
$upload = new \Think\Upload(['maxSize' => 0, 'subName' => 'loan_' . date('YmdH'), 'exts' => ['jpg', 'gif', 'png', 'jpeg']]);
$info = $upload->upload() or ajax_error('UPLOAD_ERROR', $upload->getError());
$url = array_shift($info)['url'];
ajax_success(['url' => $url]);
}
示例8: get_resumes
public function get_resumes($job_id)
{
$job_rel = M()->table('__JOB_IMPORT_REL__ jir')->join('__JOB__ j ON j.id = jir.job_id')->where(['j.from_type' => static::TYPE, 'jir.externel_id' => $job_id])->find();
if (!$job_rel) {
ajax_error('not found job');
}
$resumes = $this->_get_resumes_by_job_id($job_rel['job_id']);
ajax_success($resumes);
}
示例9: setClearanceLevel
function setClearanceLevel($level)
{
//cannot currently detect clearance level for basic-auth users
if (isset($_SERVER['PHP_AUTH_USER'])) {
return;
}
if ((int) $_SESSION['clearance'] < $level) {
ajax_error('You do not have sufficient permissions to perform this operation.');
}
}
示例10: input_realname
/**
* 输入用户真实姓名
*/
public function input_realname()
{
if (IS_POST) {
$realname = I('post.realname') or ajax_error('请输入真实姓名');
M('user')->where(['uid' => $this->user->self()['uid'], 'realname' => ''])->save(['realname' => $realname]);
ajax_success();
} else {
$this->display();
}
}
示例11: login
public function login()
{
$account = I('post.account');
$password = I('post.password');
$userModel = D('Common/User');
$user = $userModel->field('uid,uname,password,salt')->where(['mobile' => $account])->find() or ajax_error('ACCOUNT_NOT_FOUND', '此账号不存在!');
$userModel->password($password, $user['salt']) == $user['password'] or ajax_error('PASSWORD_ERROR', '登录密码错误!');
$salesman = M('loan_salesman')->where(['uid' => $user['uid']])->find() or ajax_error('此账号' . $user['uname'] . '尚未开通校园专员权限!');
$salesman['status'] == 1 or ajax_error('此账号已被禁用!');
$userModel->login_success($user['uid'], $user['uname']);
ajax_success($user);
}
示例12: contract_auth
public function contract_auth()
{
$uid = $this->user['uid'];
$auth_id = I('auth_id', 0, 'intval');
$url = I('url') or ajax_error('上传图片异常!');
$url_watermark = \Common\Util\ImageUtil::qiniu_watermark($url);
$auth = M('loan_user_contract_auth')->where(['uid' => $uid, 'auth_id' => $auth_id])->find();
if ($auth) {
M('loan_user_contract_auth')->where(['uid' => $uid, 'auth_id' => $auth_id])->save(['created' => time(), 'url' => $url, 'url_watermark' => $url_watermark]);
} else {
$auth = M('loan_config_auth')->find($auth_id) or $this->error('找不到此认证项资料!');
M('loan_user_contract_auth')->add(['uid' => $uid, 'auth_id' => $auth_id, 'auth_name' => $auth['name'], 'auth_sort' => $auth['sort'], 'created' => time(), 'url' => $url, 'url_watermark' => $url_watermark]);
}
ajax_success();
}
示例13: index
public function index()
{
$key = I('key', false);
$token = I('token', false);
if ($key && $token) {
// $class = '\\Job\\Controller\\OuterService\\' . ucfirst($key) . 'Controller';
// if (class_exists($class) && $class::TOKEN === $token) {
ajax_success(['auth' => password_hash($key . $token, PASSWORD_DEFAULT)]);
// } else {
// ajax_error('Accounts Error');
// }
} else {
ajax_error();
}
}
示例14: PostToHost
function PostToHost($url, $post_data_to_send, $wait_for_response = false)
{
//$url = 'https://www.paypal.com/de/cgi-bin/webscr';
$timeout = 9;
$url_parts = parse_url($url);
$host = $url_parts['host'];
$path = $url_parts['path'];
/*
$query=$url_parts['query'];
$scheme=$url_parts['scheme'];
$port=$url_parts['port'];
$user=$url_parts['user'];
$pass=$url_parts['pass'];
$fragment=$url_parts['fragment'];
*/
if ($_SERVER['HTTP_HOST'] != 'localhost') {
$use_ssl = !(strpos($url, "https") === false);
}
if ($use_ssl) {
$fp = pfsockopen("ssl://" . $host, 443, $errno, $errstr, $timeout);
} else {
$fp = fsockopen($host, 80, $errno, $errstr, $timeout);
}
if ($fp) {
fputs($fp, "POST {$path} HTTP/1.1\r\n");
fputs($fp, "Host: {$host}\r\n");
fputs($fp, "Referer: {$referer}\r\n");
fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
fputs($fp, "Content-length: " . strlen($post_data_to_send) . "\r\n");
fputs($fp, "Connection: close\r\n\r\n");
fputs($fp, $post_data_to_send);
if ($wait_for_response) {
while (!feof($fp)) {
$res .= fgets($fp, 128);
}
return $res;
} else {
echo 'AJAX_NODATA';
}
fclose($fp);
} else {
include_once DIR_FS_INC . "ajax_error.inc.php";
ajax_error(sprintf(PAYMENT_PROBLEM, ${$_SESSION}['payment']->title));
}
}
示例15: edit
public function edit($id = 0)
{
$majorModel = M('university_college_major');
if (IS_POST) {
$university = M('university')->find(I('post.university_id')) or $this->error('找不到此学校信息!');
$_POST['university_name'] = $university['name'];
// 读取学校名称
$college = M('university_college')->where('id=' . I('post.college_id'))->find() or ajax_error();
$_POST['university_name'] = $college['university_name'];
$_POST['college_name'] = $college['name'];
$majorModel->create() or $this->error($majorModel->getError());
$id = $majorModel->id;
$name = $majorModel->name;
$ret = $majorModel->save();
$ret === false and $this->error($majorModel->getError());
if ($ret) {
// 存在更新,则同步更新冗余字段
M('user_info')->where('major_id=' . $id)->setField('major_name', $name);
}
$this->success('编辑成功!', U('index'));
} else {
$info = $majorModel->find($id) or $this->error('找不到此记录信息!');
$university = get_university() or $this->error('请先添加大学信息!');
$college_id = $info['college_id'];
$university_id = $info['university_id'];
$sel_university_id = I('university_id', 0);
if ($sel_university_id && $university_id) {
// 指定了不同的大学
$university_id = $sel_university_id;
}
$college = $this->_getCollege($university_id);
$this->assign('_list_university', $university);
$this->assign('_list_college', $college);
$this->assign('university_id', $university_id);
$this->assign('college_id', $college_id);
$this->assign('info', $info);
$this->meta_title = '编辑学院';
$this->display();
}
}