chore: 优化用户查询界面
This commit is contained in:
@@ -20,7 +20,8 @@ class Ajax extends Base
|
||||
/*
|
||||
* 初始化操作
|
||||
*/
|
||||
public function _initialize() {
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
}
|
||||
|
||||
@@ -30,8 +31,8 @@ class Ajax extends Base
|
||||
public function get_region()
|
||||
{
|
||||
if (IS_AJAX) {
|
||||
$pid = input('pid/d', 0);
|
||||
$res = Db::name('region')->where('parent_id',$pid)->select();
|
||||
$pid = input('pid/d', 0);
|
||||
$res = Db::name('region')->where('parent_id', $pid)->select();
|
||||
$this->success('请求成功', null, $res);
|
||||
}
|
||||
}
|
||||
@@ -48,11 +49,11 @@ class Ajax extends Base
|
||||
if ($aid > 0) {
|
||||
$archives_db = Db::name('archives');
|
||||
if ('view' == $type) {
|
||||
$archives_db->where(array('aid'=>$aid))->setInc('click');
|
||||
$archives_db->where(array('aid' => $aid))->setInc('click');
|
||||
}
|
||||
$click = $archives_db->where(array('aid'=>$aid))->getField('click');
|
||||
$click = $archives_db->where(array('aid' => $aid))->getField('click');
|
||||
}
|
||||
echo($click);
|
||||
echo ($click);
|
||||
exit;
|
||||
} else {
|
||||
abort(404);
|
||||
@@ -69,9 +70,9 @@ class Ajax extends Base
|
||||
$downcount = 0;
|
||||
$aid = input('aid/d', 0);
|
||||
if ($aid > 0) {
|
||||
$downcount = Db::name('archives')->where(array('aid'=>$aid))->getField('downcount');
|
||||
$downcount = Db::name('archives')->where(array('aid' => $aid))->getField('downcount');
|
||||
}
|
||||
echo($downcount);
|
||||
echo ($downcount);
|
||||
exit;
|
||||
} else {
|
||||
abort(404);
|
||||
@@ -88,9 +89,9 @@ class Ajax extends Base
|
||||
$collectnum = 0;
|
||||
$aid = input('aid/d', 0);
|
||||
if ($aid > 0) {
|
||||
$collectnum = Db::name('users_collection')->where(array('aid'=>$aid))->count();
|
||||
$collectnum = Db::name('users_collection')->where(array('aid' => $aid))->count();
|
||||
}
|
||||
echo($collectnum);
|
||||
echo ($collectnum);
|
||||
exit;
|
||||
} else {
|
||||
abort(404);
|
||||
@@ -107,9 +108,9 @@ class Ajax extends Base
|
||||
$unread_notice_num = 0;
|
||||
$users_id = session('users_id');
|
||||
if ($users_id > 0) {
|
||||
$unread_notice_num = Db::name('users')->where(array('users_id'=>$users_id))->value('unread_notice_num');
|
||||
$unread_notice_num = Db::name('users')->where(array('users_id' => $users_id))->value('unread_notice_num');
|
||||
}
|
||||
echo($unread_notice_num);
|
||||
echo ($unread_notice_num);
|
||||
exit;
|
||||
} else {
|
||||
abort(404);
|
||||
@@ -129,8 +130,8 @@ class Ajax extends Base
|
||||
$pagesize = input('pagesize/d', 0);
|
||||
$tagid = input('tagid/s', '');
|
||||
$tagidmd5 = input('tagidmd5/s', '');
|
||||
!empty($tagid) && $tagid = preg_replace("/[^a-zA-Z0-9-_]/",'', $tagid);
|
||||
!empty($tagidmd5) && $tagidmd5 = preg_replace("/[^a-zA-Z0-9_]/",'', $tagidmd5);
|
||||
!empty($tagid) && $tagid = preg_replace("/[^a-zA-Z0-9-_]/", '', $tagid);
|
||||
!empty($tagidmd5) && $tagidmd5 = preg_replace("/[^a-zA-Z0-9_]/", '', $tagidmd5);
|
||||
|
||||
if (empty($tagid) || empty($pnum) || empty($tagidmd5)) {
|
||||
$this->error('参数有误');
|
||||
@@ -138,14 +139,13 @@ class Ajax extends Base
|
||||
|
||||
$data = [
|
||||
'code' => 1,
|
||||
'msg' => '',
|
||||
'lastpage' => 0,
|
||||
'msg' => '',
|
||||
'lastpage' => 0,
|
||||
];
|
||||
|
||||
$arcmulti_db = Db::name('arcmulti');
|
||||
$arcmultiRow = $arcmulti_db->where(['tagid'=>$tagidmd5])->find();
|
||||
if(!empty($arcmultiRow) && !empty($arcmultiRow['querysql']))
|
||||
{
|
||||
$arcmultiRow = $arcmulti_db->where(['tagid' => $tagidmd5])->find();
|
||||
if (!empty($arcmultiRow) && !empty($arcmultiRow['querysql'])) {
|
||||
// arcpagelist标签属性pagesize优先级高于arclist标签属性pagesize
|
||||
if (0 < intval($pagesize)) {
|
||||
$arcmultiRow['pagesize'] = $pagesize;
|
||||
@@ -165,7 +165,7 @@ class Ajax extends Base
|
||||
$queryRow = Db::query($querysql);
|
||||
if (!empty($queryRow)) {
|
||||
$tpl_content = '';
|
||||
$filename = './template/'.THEME_STYLE_PATH.'/'.'system/arclist_'.$tagid.'.'.\think\Config::get('template.view_suffix');
|
||||
$filename = './template/' . THEME_STYLE_PATH . '/' . 'system/arclist_' . $tagid . '.' . \think\Config::get('template.view_suffix');
|
||||
if (!file_exists($filename)) {
|
||||
$data['code'] = -1;
|
||||
$data['msg'] = "模板追加文件 arclist_{$tagid}.htm 不存在!";
|
||||
@@ -184,7 +184,7 @@ class Ajax extends Base
|
||||
$row = intval($offset) + intval($arcmultiRow['pagesize']);
|
||||
$innertext = "{eyou:arclist";
|
||||
foreach ($attarray as $key => $val) {
|
||||
if (in_array($key, ['tagid','offset','row'])) {
|
||||
if (in_array($key, ['tagid', 'offset', 'row'])) {
|
||||
continue;
|
||||
}
|
||||
$innertext .= " {$key}='{$val}'";
|
||||
@@ -236,15 +236,15 @@ class Ajax extends Base
|
||||
if ('login' == $type) {
|
||||
if (!empty($users_id)) {
|
||||
$currentstyle = input('param.currentstyle/s');
|
||||
$users = M('users')->field('username,nickname,head_pic')
|
||||
$users = M('users')->field('keyword,nickname,head_pic')
|
||||
->where([
|
||||
'users_id' => $users_id,
|
||||
'lang' => $this->home_lang,
|
||||
'users_id' => $users_id,
|
||||
'lang' => $this->home_lang,
|
||||
])->find();
|
||||
if (!empty($users)) {
|
||||
$nickname = $users['nickname'];
|
||||
if (empty($nickname)) {
|
||||
$nickname = $users['username'];
|
||||
$nickname = $users['keyword'];
|
||||
}
|
||||
$head_pic = get_head_pic(htmlspecialchars_decode($users['head_pic']));
|
||||
$users['head_pic'] = func_preg_replace(['http://thirdqq.qlogo.cn'], ['https://thirdqq.qlogo.cn'], $head_pic);
|
||||
@@ -272,31 +272,25 @@ class Ajax extends Base
|
||||
$this->success('请求成功', null, $users);
|
||||
}
|
||||
}
|
||||
$this->success('请先登录', null, ['ey_is_login'=>0]);
|
||||
}
|
||||
else if ('reg' == $type)
|
||||
{
|
||||
$this->success('请先登录', null, ['ey_is_login' => 0]);
|
||||
} else if ('reg' == $type) {
|
||||
if (!empty($users_id)) {
|
||||
$users['ey_is_login'] = 1;
|
||||
} else {
|
||||
$users['ey_is_login'] = 0;
|
||||
}
|
||||
$this->success('请求成功', null, $users);
|
||||
}
|
||||
else if ('logout' == $type)
|
||||
{
|
||||
} else if ('logout' == $type) {
|
||||
if (!empty($users_id)) {
|
||||
$users['ey_is_login'] = 1;
|
||||
} else {
|
||||
$users['ey_is_login'] = 0;
|
||||
}
|
||||
$this->success('请求成功', null, $users);
|
||||
}
|
||||
else if ('cart' == $type)
|
||||
{
|
||||
} else if ('cart' == $type) {
|
||||
if (!empty($users_id)) {
|
||||
$users['ey_is_login'] = 1;
|
||||
$users['ey_cart_num_20191212'] = Db::name('shop_cart')->where(['users_id'=>$users_id])->sum('product_num');
|
||||
$users['ey_cart_num_20191212'] = Db::name('shop_cart')->where(['users_id' => $users_id])->sum('product_num');
|
||||
} else {
|
||||
$users['ey_is_login'] = 0;
|
||||
$users['ey_cart_num_20191212'] = 0;
|
||||
@@ -328,7 +322,7 @@ class Ajax extends Base
|
||||
->join('__USERS_LEVEL__ b', 'a.level = b.level_id', 'LEFT')
|
||||
->where([
|
||||
'a.users_id' => $users_id,
|
||||
'a.lang' => $this->home_lang,
|
||||
'a.lang' => $this->home_lang,
|
||||
])->find();
|
||||
if (!empty($users)) {
|
||||
$users['reg_time'] = MyDate('Y-m-d H:i:s', $users['reg_time']);
|
||||
@@ -347,7 +341,7 @@ class Ajax extends Base
|
||||
unset($users['paypwd']);
|
||||
$dtypes = [];
|
||||
foreach ($users as $key => $val) {
|
||||
$html_key = md5($key.'-'.$t_uniqid);
|
||||
$html_key = md5($key . '-' . $t_uniqid);
|
||||
$users[$html_key] = $val;
|
||||
|
||||
$dtype = 'txt';
|
||||
@@ -362,13 +356,13 @@ class Ajax extends Base
|
||||
}
|
||||
|
||||
$data = [
|
||||
'ey_is_login' => 1,
|
||||
'users' => $users,
|
||||
'dtypes' => $dtypes,
|
||||
'ey_is_login' => 1,
|
||||
'users' => $users,
|
||||
'dtypes' => $dtypes,
|
||||
];
|
||||
$this->success('请求成功', null, $data);
|
||||
}
|
||||
$this->success('请先登录', null, ['ey_is_login'=>0]);
|
||||
$this->success('请先登录', null, ['ey_is_login' => 0]);
|
||||
}
|
||||
$this->error('访问错误');
|
||||
}
|
||||
@@ -383,7 +377,7 @@ class Ajax extends Base
|
||||
$captchaArr = array_keys($configList);
|
||||
if (in_array($type, $captchaArr)) {
|
||||
/*验证码插件开关*/
|
||||
$admin_login_captcha = config('captcha.'.$type);
|
||||
$admin_login_captcha = config('captcha.' . $type);
|
||||
$config = (!empty($admin_login_captcha['is_on']) && !empty($admin_login_captcha['config'])) ? $admin_login_captcha['config'] : config('captcha.default');
|
||||
/*--end*/
|
||||
} else {
|
||||
@@ -399,7 +393,7 @@ class Ajax extends Base
|
||||
}
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 邮箱发送
|
||||
*/
|
||||
@@ -409,7 +403,7 @@ class Ajax extends Base
|
||||
function_exists('set_time_limit') && set_time_limit(10);
|
||||
|
||||
$type = input('param.type/s');
|
||||
|
||||
|
||||
// 留言发送邮件
|
||||
if (IS_AJAX_POST && 'gbook_submit' == $type) {
|
||||
$tid = input('param.tid/d');
|
||||
@@ -420,13 +414,13 @@ class Ajax extends Base
|
||||
|
||||
$web_name = tpCache('web.web_name');
|
||||
// 判断标题拼接
|
||||
$arctype = M('arctype')->field('typename')->find($tid);
|
||||
$web_name = $arctype['typename'].'-'.$web_name;
|
||||
$arctype = M('arctype')->field('typename')->find($tid);
|
||||
$web_name = $arctype['typename'] . '-' . $web_name;
|
||||
|
||||
// 拼装发送的字符串内容
|
||||
$row = M('guestbook_attribute')->field('a.attr_name, b.attr_value')
|
||||
->alias('a')
|
||||
->join('__GUESTBOOK_ATTR__ b', 'a.attr_id = b.attr_id AND a.typeid = '.$tid, 'LEFT')
|
||||
->join('__GUESTBOOK_ATTR__ b', 'a.attr_id = b.attr_id AND a.typeid = ' . $tid, 'LEFT')
|
||||
->where([
|
||||
'b.aid' => $aid,
|
||||
])
|
||||
@@ -436,13 +430,13 @@ class Ajax extends Base
|
||||
foreach ($row as $key => $val) {
|
||||
if (preg_match('/(\.(jpg|gif|png|bmp|jpeg|ico|webp))$/i', $val['attr_value'])) {
|
||||
if (!stristr($val['attr_value'], '|')) {
|
||||
$val['attr_value'] = $this->request->domain().handle_subdir_pic($val['attr_value']);
|
||||
$val['attr_value'] = "<a href='".$val['attr_value']."' target='_blank'><img src='".$val['attr_value']."' width='150' height='150' /></a>";
|
||||
$val['attr_value'] = $this->request->domain() . handle_subdir_pic($val['attr_value']);
|
||||
$val['attr_value'] = "<a href='" . $val['attr_value'] . "' target='_blank'><img src='" . $val['attr_value'] . "' width='150' height='150' /></a>";
|
||||
}
|
||||
} else {
|
||||
$val['attr_value'] = str_replace(PHP_EOL, ' | ', $val['attr_value']);
|
||||
}
|
||||
$content .= $val['attr_name'] . ':' . $val['attr_value'].'<br/>';
|
||||
$content .= $val['attr_name'] . ':' . $val['attr_value'] . '<br/>';
|
||||
}
|
||||
$html = "<p style='text-align: left;'>{$web_name}</p><p style='text-align: left;'>{$content}</p>";
|
||||
if (isMobile()) {
|
||||
@@ -450,9 +444,9 @@ class Ajax extends Base
|
||||
} else {
|
||||
$html .= "<p style='text-align: left;'>——来源:电脑端</p>";
|
||||
}
|
||||
|
||||
|
||||
// 发送邮件
|
||||
$res = send_email(null,null,$html, $scene);
|
||||
$res = send_email(null, null, $html, $scene);
|
||||
if (intval($res['code']) == 1) {
|
||||
$this->success($res['msg']);
|
||||
} else {
|
||||
@@ -474,14 +468,16 @@ class Ajax extends Base
|
||||
$post = input('post.');
|
||||
$source = !empty($post['source']) ? $post['source'] : 0;
|
||||
if (isset($post['scene']) && in_array($post['scene'], [5, 6])) {
|
||||
if (empty($post['mobile'])) return false;
|
||||
if (empty($post['mobile']))
|
||||
return false;
|
||||
/*发送并返回结果*/
|
||||
$data = $post['data'];
|
||||
//兼容原先消息通知的发送短信的逻辑
|
||||
//查询消息通知模板的内容
|
||||
$sms_type = tpCache('sms.sms_type') ? : 1;
|
||||
$tpl_content = Db::name('sms_template')->where(["send_scene"=> $post['scene'],"sms_type"=> $sms_type])->value('tpl_content');
|
||||
if (!$tpl_content) return false;
|
||||
$sms_type = tpCache('sms.sms_type') ?: 1;
|
||||
$tpl_content = Db::name('sms_template')->where(["send_scene" => $post['scene'], "sms_type" => $sms_type])->value('tpl_content');
|
||||
if (!$tpl_content)
|
||||
return false;
|
||||
$preg_res = preg_match('/订单/', $tpl_content);
|
||||
switch ($data['type']) {
|
||||
case '1':
|
||||
@@ -494,7 +490,7 @@ class Ajax extends Base
|
||||
$content = '';
|
||||
break;
|
||||
}
|
||||
$Result = sendSms($post['scene'], $post['mobile'], array('content'=>$content));
|
||||
$Result = sendSms($post['scene'], $post['mobile'], array('content' => $content));
|
||||
if (intval($Result['status']) == 1) {
|
||||
$this->success('发送成功!');
|
||||
} else {
|
||||
@@ -502,50 +498,59 @@ class Ajax extends Base
|
||||
}
|
||||
/* END */
|
||||
} else {
|
||||
if (isset($post['type']) && in_array($post['type'], ['users_mobile_reg','users_mobile_login'])) {
|
||||
if (isset($post['type']) && in_array($post['type'], ['users_mobile_reg', 'users_mobile_login'])) {
|
||||
$post['is_mobile'] = 'true';
|
||||
}
|
||||
$mobile = !empty($post['mobile']) ? $post['mobile'] : session('mobile');
|
||||
$is_mobile = !empty($post['is_mobile']) ? $post['is_mobile'] : false;
|
||||
if (empty($mobile)) $this->error('请先绑定手机号码');
|
||||
if (empty($mobile))
|
||||
$this->error('请先绑定手机号码');
|
||||
if ('true' === $is_mobile) {
|
||||
/*是否存在手机号码*/
|
||||
$where = [
|
||||
'mobile' => $mobile
|
||||
];
|
||||
$users_id = session('users_id');
|
||||
if (!empty($users_id)) $where['users_id'] = ['NEQ', $users_id];
|
||||
if (!empty($users_id))
|
||||
$where['users_id'] = ['NEQ', $users_id];
|
||||
$Result = Db::name('users')->where($where)->count();
|
||||
/* END */
|
||||
if (0 == $post['source']) {
|
||||
if (!empty($Result)) $this->error('手机号码已注册');
|
||||
if (!empty($Result))
|
||||
$this->error('手机号码已注册');
|
||||
} else if (2 == $post['source']) {
|
||||
if (empty($Result)) $this->error('手机号码未注册');
|
||||
if (empty($Result))
|
||||
$this->error('手机号码未注册');
|
||||
} else if (4 == $post['source']) {
|
||||
if (empty($Result)) $this->error('手机号码不存在');
|
||||
if (empty($Result))
|
||||
$this->error('手机号码不存在');
|
||||
} else {
|
||||
if (!empty($Result)) $this->error('手机号码已存在');
|
||||
if (!empty($Result))
|
||||
$this->error('手机号码已存在');
|
||||
}
|
||||
}
|
||||
|
||||
/*是否允许再次发送*/
|
||||
$where = [
|
||||
'mobile' => $mobile,
|
||||
'source' => $source,
|
||||
'status' => 1,
|
||||
'is_use' => 0,
|
||||
'mobile' => $mobile,
|
||||
'source' => $source,
|
||||
'status' => 1,
|
||||
'is_use' => 0,
|
||||
'add_time' => ['>', getTime() - 120]
|
||||
];
|
||||
$Result = Db::name('sms_log')->where($where)->order('id desc')->count();
|
||||
|
||||
if (!empty($Result) && false == config('sms_debug')) $this->error('120秒内只能发送一次!');
|
||||
if (!empty($Result) && false == config('sms_debug'))
|
||||
$this->error('120秒内只能发送一次!');
|
||||
/* END */
|
||||
|
||||
/*图形验证码判断*/
|
||||
if (!empty($post['IsVertify']) || (isset($post['type']) && in_array($post['type'], ['users_mobile_reg','users_mobile_login']))) {
|
||||
if (empty($post['vertify'])) $this->error('请输入图形验证码!');
|
||||
if (!empty($post['IsVertify']) || (isset($post['type']) && in_array($post['type'], ['users_mobile_reg', 'users_mobile_login']))) {
|
||||
if (empty($post['vertify']))
|
||||
$this->error('请输入图形验证码!');
|
||||
$verify = new \think\Verify();
|
||||
if (!$verify->check($post['vertify'], $post['type'])) $this->error('图形验证码错误!', null, ['code'=>'vertify']);
|
||||
if (!$verify->check($post['vertify'], $post['type']))
|
||||
$this->error('图形验证码错误!', null, ['code' => 'vertify']);
|
||||
}
|
||||
/* END */
|
||||
|
||||
@@ -582,7 +587,7 @@ class Ajax extends Base
|
||||
$UsersDataa = Db::name('users')->alias('a')
|
||||
->field('a.users_id,b.level_value,b.level_name')
|
||||
->join('__USERS_LEVEL__ b', 'a.level = b.level_id', 'LEFT')
|
||||
->where(['a.users_id'=>$users_id])
|
||||
->where(['a.users_id' => $users_id])
|
||||
->find();
|
||||
if (0 == $Arcrank['arcrank']) {
|
||||
if (IS_AJAX) {
|
||||
@@ -590,27 +595,27 @@ class Ajax extends Base
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}else if (-1 == $Arcrank['arcrank']) {
|
||||
} else if (-1 == $Arcrank['arcrank']) {
|
||||
$is_admin = session('?admin_id') ? 1 : 0;
|
||||
$param_admin_id = input('param.admin_id/d');
|
||||
if ($users_id == $Arcrank['users_id']) {
|
||||
if (IS_AJAX) {
|
||||
$this->success('允许查阅!', null, ['is_admin'=>$is_admin, 'msg'=>'待审核稿件,仅限自己查看!']);
|
||||
$this->success('允许查阅!', null, ['is_admin' => $is_admin, 'msg' => '待审核稿件,仅限自己查看!']);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}else if(!empty($is_admin) && !empty($param_admin_id)){
|
||||
} else if (!empty($is_admin) && !empty($param_admin_id)) {
|
||||
if (IS_AJAX) {
|
||||
$this->success('允许查阅!', null, ['is_admin'=>$is_admin, 'msg'=>'待审核稿件,仅限管理员查看!']);
|
||||
$this->success('允许查阅!', null, ['is_admin' => $is_admin, 'msg' => '待审核稿件,仅限管理员查看!']);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
$msg = '待审核稿件,你没有权限阅读!';
|
||||
}
|
||||
}else if ($UsersDataa['level_value'] < $Arcrank['level_value']) {
|
||||
$msg = '内容需要【'.$Arcrank['level_name'].'】才可以查看,您为【'.$UsersDataa['level_name'].'】,请先升级!';
|
||||
}else{
|
||||
} else if ($UsersDataa['level_value'] < $Arcrank['level_value']) {
|
||||
$msg = '内容需要【' . $Arcrank['level_name'] . '】才可以查看,您为【' . $UsersDataa['level_name'] . '】,请先升级!';
|
||||
} else {
|
||||
if (IS_AJAX) {
|
||||
$this->success('允许查阅!');
|
||||
} else {
|
||||
@@ -622,24 +627,24 @@ class Ajax extends Base
|
||||
} else {
|
||||
return $msg;
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
if (0 == $Arcrank['arcrank']) {
|
||||
if (IS_AJAX) {
|
||||
$this->success('允许查阅!');
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}else if (-1 == $Arcrank['arcrank']) {
|
||||
} else if (-1 == $Arcrank['arcrank']) {
|
||||
$is_admin = session('?admin_id') ? 1 : 0;
|
||||
$param_admin_id = input('param.admin_id/d');
|
||||
if (!empty($is_admin) && !empty($param_admin_id)) {
|
||||
$this->success('允许查阅!', null, ['is_admin'=>$is_admin, 'msg'=>'待审核稿件,仅限管理员查看!']);
|
||||
$this->success('允许查阅!', null, ['is_admin' => $is_admin, 'msg' => '待审核稿件,仅限管理员查看!']);
|
||||
} else {
|
||||
$msg = '待审核稿件,你没有权限阅读!';
|
||||
}
|
||||
}else if (!empty($Arcrank['level_name'])) {
|
||||
$msg = '文章需要【'.$Arcrank['level_name'].'】才可以查看,游客不可查看,请登录!';
|
||||
}else{
|
||||
} else if (!empty($Arcrank['level_name'])) {
|
||||
$msg = '文章需要【' . $Arcrank['level_name'] . '】才可以查看,游客不可查看,请登录!';
|
||||
} else {
|
||||
$msg = '游客不可查看,请登录!';
|
||||
}
|
||||
if (IS_AJAX) {
|
||||
@@ -677,7 +682,7 @@ class Ajax extends Base
|
||||
$eyou = new \think\template\taglib\Eyou('');
|
||||
$tagsList = $eyou->getTags();
|
||||
$tagsAttr = $tagsList['memberlist'];
|
||||
|
||||
|
||||
$innertext = "{eyou:memberlist";
|
||||
foreach ($attarray as $key => $val) {
|
||||
if (!in_array($key, $tagsAttr) || in_array($key, ['js'])) {
|
||||
@@ -709,24 +714,24 @@ class Ajax extends Base
|
||||
// 获取token的值:http://ziyuan.baidu.com/linksubmit/index?site=http://www.eyoucms.com/
|
||||
$sitemap_zzbaidutoken = config('tpcache.sitemap_zzbaidutoken');
|
||||
if (empty($sitemap_zzbaidutoken)) {
|
||||
$this->error('尚未配置实时推送Url的token!', null, ['code'=>0]);
|
||||
$this->error('尚未配置实时推送Url的token!', null, ['code' => 0]);
|
||||
} else if (!function_exists('curl_init')) {
|
||||
$this->error('请开启php扩展curl_init', null, ['code'=>1]);
|
||||
$this->error('请开启php扩展curl_init', null, ['code' => 1]);
|
||||
}
|
||||
|
||||
$urlsArr[] = $url;
|
||||
$type = ('edit' == $type) ? 'update' : 'urls';
|
||||
|
||||
if (is_http_url($sitemap_zzbaidutoken)) {
|
||||
$searchs = ["/urls?","/update?"];
|
||||
$searchs = ["/urls?", "/update?"];
|
||||
$replaces = ["/{$type}?", "/{$type}?"];
|
||||
$api = str_replace($searchs, $replaces, $sitemap_zzbaidutoken);
|
||||
} else {
|
||||
$api = 'http://data.zz.baidu.com/'.$type.'?site='.$this->request->host(true).'&token='.trim($sitemap_zzbaidutoken);
|
||||
$api = 'http://data.zz.baidu.com/' . $type . '?site=' . $this->request->host(true) . '&token=' . trim($sitemap_zzbaidutoken);
|
||||
}
|
||||
|
||||
$ch = curl_init();
|
||||
$options = array(
|
||||
$options = array(
|
||||
CURLOPT_URL => $api,
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
@@ -780,13 +785,13 @@ class Ajax extends Base
|
||||
|
||||
/*是否需要付费*/
|
||||
if (0 < $archivesInfo['users_price'] && empty($archivesInfo['users_free'])) {
|
||||
if (empty($archivesInfo['arc_level_id'])){
|
||||
if (empty($archivesInfo['arc_level_id'])) {
|
||||
//不限会员 付费
|
||||
$result['status_value'] = 1;
|
||||
}else{
|
||||
} else {
|
||||
//3-限制会员 付费
|
||||
$result['status_value'] = 3;
|
||||
if ($archivesInfo['level_value'] <= $UsersData['level_value']){
|
||||
if ($archivesInfo['level_value'] <= $UsersData['level_value']) {
|
||||
$result['vip_status'] = 1;//已升级会员未购买
|
||||
}
|
||||
}
|
||||
@@ -802,20 +807,20 @@ class Ajax extends Base
|
||||
//已购买
|
||||
if (!empty($Paid)) {
|
||||
if (3 == $result['status_value']) {
|
||||
if (1 == $result['vip_status']){
|
||||
if (1 == $result['vip_status']) {
|
||||
$result['play_auth'] = 1;
|
||||
$result['vip_status'] = 3;//已升级会员已经购买
|
||||
}else{
|
||||
} else {
|
||||
$result['play_auth'] = 0;
|
||||
$result['vip_status'] = 2;//未升级会员已经购买
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
$result['play_auth'] = 1;
|
||||
$result['vip_status'] = 4;//不限会员已经购买
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
if (0 < intval($archivesInfo['arc_level_id'])) { // 会员免费
|
||||
$result['status_value'] = 2;
|
||||
if (!empty($UsersID) && $archivesInfo['level_value'] <= $UsersData['level_value']) {
|
||||
@@ -841,48 +846,48 @@ class Ajax extends Base
|
||||
/*END*/
|
||||
|
||||
$is_pay = 0;
|
||||
if (in_array($result['status_value'], [1,3])){ // 所有人、会员付费
|
||||
if (in_array($result['status_value'], [1, 3])) { // 所有人、会员付费
|
||||
$is_pay = Db::name('media_order')->where($where)->count();
|
||||
}
|
||||
$result['is_pay'] = $is_pay;
|
||||
|
||||
if (in_array($result['status_value'], [2,3])){ // 已满足会员级别要求
|
||||
if (in_array($result['status_value'], [2, 3])) { // 已满足会员级别要求
|
||||
$result['status_name'] = Db::name('users_level')->where('level_id', intval($archivesInfo['arc_level_id']))->value('level_name');
|
||||
}
|
||||
|
||||
/*
|
||||
if (in_array($result['status_value'], [2,3])){ // 会员免费与会员付费
|
||||
$result['status_name'] = Db::name('users_level')->where('level_id', $archivesInfo['arc_level_id'])->value('level_name');
|
||||
$vip_status = 0;
|
||||
if ($archivesInfo['level_value'] <= $UsersData['level_value']) {
|
||||
$vip_status = 1; // 已满足会员级别要求
|
||||
}
|
||||
}*/
|
||||
/*
|
||||
if (in_array($result['status_value'], [2,3])){ // 会员免费与会员付费
|
||||
$result['status_name'] = Db::name('users_level')->where('level_id', $archivesInfo['arc_level_id'])->value('level_name');
|
||||
$vip_status = 0;
|
||||
if ($archivesInfo['level_value'] <= $UsersData['level_value']) {
|
||||
$vip_status = 1; // 已满足会员级别要求
|
||||
}
|
||||
}*/
|
||||
|
||||
if ($result['status_value'] == 0){
|
||||
if ($result['status_value'] == 0) {
|
||||
$result['button'] = '免费';
|
||||
$result['status_name'] = '免费';
|
||||
}else if ($result['status_value'] == 1){ // 所有人付费
|
||||
} else if ($result['status_value'] == 1) { // 所有人付费
|
||||
$result['button'] = '付费';
|
||||
if (!empty($is_pay)){
|
||||
if (!empty($is_pay)) {
|
||||
$result['button'] = '观看';
|
||||
}
|
||||
}else if ($result['status_value'] == 2){
|
||||
} else if ($result['status_value'] == 2) {
|
||||
$result['button'] = 'VIP';
|
||||
if (!empty($result['play_auth'])){
|
||||
if (!empty($result['play_auth'])) {
|
||||
$result['button'] = '观看';
|
||||
}
|
||||
}else if ($result['status_value'] == 3){
|
||||
} else if ($result['status_value'] == 3) {
|
||||
// if(1 == $result['vip_status']){
|
||||
// $result['button'] = '立即购买';
|
||||
// $result['button_url'] = 'MediaOrderBuy_1592878548();';
|
||||
// }else
|
||||
if (2 == $result['vip_status']){
|
||||
if (2 == $result['vip_status']) {
|
||||
$result['button'] = 'VIP';
|
||||
$result['button_url'] = "window.location.href = '" . url('user/Level/level_centre') . "'";
|
||||
} else if (3 == $result['vip_status']) {
|
||||
$result['button'] = '观看';
|
||||
}else{
|
||||
} else {
|
||||
$result['button'] = 'VIP付费';
|
||||
$result['button_url'] = "window.location.href = '" . url('user/Level/level_centre') . "'";
|
||||
}
|
||||
@@ -890,7 +895,7 @@ class Ajax extends Base
|
||||
// $result['button'] = '观看';
|
||||
// }
|
||||
}
|
||||
if ('观看' == $result['button']){
|
||||
if ('观看' == $result['button']) {
|
||||
$result['button_url'] = arcurl('home/Media/view', $archivesInfo);
|
||||
}
|
||||
|
||||
@@ -913,16 +918,17 @@ class Ajax extends Base
|
||||
$count = Db::name('users_notice_read')
|
||||
->where(['id' => $id])
|
||||
->value("id");
|
||||
if (empty($count)) $this->error('未知错误!');
|
||||
if (empty($count))
|
||||
$this->error('未知错误!');
|
||||
|
||||
//未读消息数-1
|
||||
$unread_num = Db::name('users')->where(['users_id' => $users_id])->value("unread_notice_num");
|
||||
if ($unread_num>0){
|
||||
$unread_num = $unread_num-1;
|
||||
Db::name('users')->where(['users_id' => $users_id])->update(['unread_notice_num'=>$unread_num]);
|
||||
if ($unread_num > 0) {
|
||||
$unread_num = $unread_num - 1;
|
||||
Db::name('users')->where(['users_id' => $users_id])->update(['unread_notice_num' => $unread_num]);
|
||||
}
|
||||
Db::name('users_notice_read')->where(['id'=>$id])->update(['is_read'=>1]);
|
||||
$this->success('保存成功',null,['unread_num'=>$unread_num]);
|
||||
Db::name('users_notice_read')->where(['id' => $id])->update(['is_read' => 1]);
|
||||
$this->success('保存成功', null, ['unread_num' => $unread_num]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -941,33 +947,33 @@ class Ajax extends Base
|
||||
}
|
||||
|
||||
$row = Db::name('users_collection')->where([
|
||||
'users_id' => $users_id,
|
||||
'aid' => $aid,
|
||||
'users_id' => $users_id,
|
||||
'aid' => $aid,
|
||||
])->find();
|
||||
if (empty($row)) {
|
||||
$archivesInfo = Db::name('archives')->field('aid,title,litpic,channel,typeid')->find($aid);
|
||||
if (!empty($archivesInfo)) {
|
||||
$r = Db::name('users_collection')->add([
|
||||
'users_id' => $users_id,
|
||||
'users_id' => $users_id,
|
||||
'title' => $archivesInfo['title'],
|
||||
'aid' => $aid,
|
||||
'litpic' => $archivesInfo['litpic'],
|
||||
'channel' => $archivesInfo['channel'],
|
||||
'typeid' => $archivesInfo['typeid'],
|
||||
'lang' => $this->home_lang,
|
||||
'add_time' => getTime(),
|
||||
'lang' => $this->home_lang,
|
||||
'add_time' => getTime(),
|
||||
'update_time' => getTime(),
|
||||
]);
|
||||
if (!empty($r)) {
|
||||
$this->success('收藏成功', null, ['opt'=>'add']);
|
||||
$this->success('收藏成功', null, ['opt' => 'add']);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$r = Db::name('users_collection')->where([
|
||||
'users_id' => $users_id,
|
||||
'users_id' => $users_id,
|
||||
'aid' => $aid,
|
||||
])->delete();
|
||||
$this->success('取消成功', null, ['opt'=>'cancel']);
|
||||
$this->success('取消成功', null, ['opt' => 'cancel']);
|
||||
}
|
||||
$this->error('收藏失败', null);
|
||||
}
|
||||
@@ -985,18 +991,18 @@ class Ajax extends Base
|
||||
$aid = input('param.aid/d');
|
||||
$users_id = session('users_id');
|
||||
$total = Db::name('users_collection')->where([
|
||||
'aid' => $aid,
|
||||
'aid' => $aid,
|
||||
])->count();
|
||||
if (!empty($users_id)) {
|
||||
$count = Db::name('users_collection')->where([
|
||||
'aid' => $aid,
|
||||
'users_id' => $users_id,
|
||||
'aid' => $aid,
|
||||
'users_id' => $users_id,
|
||||
])->count();
|
||||
if (!empty($count)) {
|
||||
$this->success('已收藏', null, ['total'=>$total]);
|
||||
$this->success('已收藏', null, ['total' => $total]);
|
||||
}
|
||||
}
|
||||
$this->error('未收藏', null, ['total'=>$total]);
|
||||
$this->error('未收藏', null, ['total' => $total]);
|
||||
}
|
||||
abort(404);
|
||||
}
|
||||
@@ -1017,7 +1023,7 @@ class Ajax extends Base
|
||||
if (!empty($arc)) {
|
||||
$count = Db::name('users_footprint')->where([
|
||||
'users_id' => $users_id,
|
||||
'aid' => $aid,
|
||||
'aid' => $aid,
|
||||
])->count();
|
||||
|
||||
if (empty($count)) {
|
||||
@@ -1025,30 +1031,30 @@ class Ajax extends Base
|
||||
$user_footprint_limit = config('global.user_footprint_limit');
|
||||
if (!$user_footprint_limit) {
|
||||
$user_footprint_limit = 20;
|
||||
config('global.user_footprint_limit',$user_footprint_limit);
|
||||
config('global.user_footprint_limit', $user_footprint_limit);
|
||||
}
|
||||
$user_footprint_record = Db::name('users_footprint')->where(['users_id'=>$users_id])->count("id");
|
||||
$user_footprint_record = Db::name('users_footprint')->where(['users_id' => $users_id])->count("id");
|
||||
if ($user_footprint_record == $user_footprint_limit) {
|
||||
Db::name('users_footprint')->where(['users_id' => $users_id])->order("update_time ASC")->limit(1)->delete();
|
||||
}elseif ($user_footprint_record > $user_footprint_limit) {
|
||||
$del_count = $user_footprint_record-$user_footprint_limit+1;
|
||||
} elseif ($user_footprint_record > $user_footprint_limit) {
|
||||
$del_count = $user_footprint_record - $user_footprint_limit + 1;
|
||||
$del_ids = Db::name('users_footprint')->field("id")->where(['users_id' => $this->users_id])->order("update_time ASC")->limit($del_count)->select();
|
||||
$del_ids = get_arr_column($del_ids,'id');
|
||||
Db::name('users_footprint')->where(['id' => ['IN',$del_ids]])->delete();
|
||||
$del_ids = get_arr_column($del_ids, 'id');
|
||||
Db::name('users_footprint')->where(['id' => ['IN', $del_ids]])->delete();
|
||||
}
|
||||
|
||||
$arc['users_id'] = $users_id;
|
||||
$arc['lang'] = $this->home_lang;
|
||||
$arc['add_time'] = getTime();
|
||||
$arc['users_id'] = $users_id;
|
||||
$arc['lang'] = $this->home_lang;
|
||||
$arc['add_time'] = getTime();
|
||||
$arc['update_time'] = getTime();
|
||||
Db::name('users_footprint')->add($arc);
|
||||
} else {
|
||||
Db::name('users_footprint')->where([
|
||||
'users_id' => $users_id,
|
||||
'aid' => $aid
|
||||
'aid' => $aid
|
||||
])->update([
|
||||
'update_time' => getTime(),
|
||||
]);
|
||||
'update_time' => getTime(),
|
||||
]);
|
||||
}
|
||||
$this->success('保存成功');
|
||||
}
|
||||
@@ -1076,35 +1082,35 @@ class Ajax extends Base
|
||||
|
||||
//今日签到信息
|
||||
$now_time = time();
|
||||
$today_start = mktime(0,0,0,date("m",$now_time),date("d",$now_time),date("Y",$now_time));
|
||||
$today_end = mktime(23,59,59,date("m",$now_time),date("d",$now_time),date("Y",$now_time));
|
||||
$row = Db::name('users_signin')->where(['users_id'=>$users_id,'add_time'=>['BETWEEN',[$today_start,$today_end]]])->value("id");
|
||||
$today_start = mktime(0, 0, 0, date("m", $now_time), date("d", $now_time), date("Y", $now_time));
|
||||
$today_end = mktime(23, 59, 59, date("m", $now_time), date("d", $now_time), date("Y", $now_time));
|
||||
$row = Db::name('users_signin')->where(['users_id' => $users_id, 'add_time' => ['BETWEEN', [$today_start, $today_end]]])->value("id");
|
||||
|
||||
if (!$row) {
|
||||
$r = Db::name('users_signin')->add([
|
||||
'users_id' => $users_id,
|
||||
'lang' => $this->home_lang,
|
||||
'add_time' => getTime(),
|
||||
'users_id' => $users_id,
|
||||
'lang' => $this->home_lang,
|
||||
'add_time' => getTime(),
|
||||
]);
|
||||
if (!empty($r)) {
|
||||
$scores_step = $signin_conf['score_signin_score'] ?:0;
|
||||
Db::name('users')->where(['users_id'=>$users_id])->setInc('scores',$scores_step);
|
||||
$users_scores = Db::name('users')->where(['users_id'=>$users_id])->value("scores");
|
||||
$scores_step = $signin_conf['score_signin_score'] ?: 0;
|
||||
Db::name('users')->where(['users_id' => $users_id])->setInc('scores', $scores_step);
|
||||
$users_scores = Db::name('users')->where(['users_id' => $users_id])->value("scores");
|
||||
|
||||
Db::name('users_score')->add([
|
||||
'type' => 5,//每日签到
|
||||
'users_id' => $users_id,
|
||||
'ask_id' => 0,
|
||||
'reply_id' => 0,
|
||||
'score' => $scores_step,
|
||||
'devote' => $scores_step,
|
||||
'money' => 0.00,
|
||||
'info' => '每日签到',
|
||||
'lang' => $this->home_lang,
|
||||
'add_time' => getTime(),
|
||||
'update_time' => getTime(),
|
||||
'type' => 5,//每日签到
|
||||
'users_id' => $users_id,
|
||||
'ask_id' => 0,
|
||||
'reply_id' => 0,
|
||||
'score' => $scores_step,
|
||||
'devote' => $scores_step,
|
||||
'money' => 0.00,
|
||||
'info' => '每日签到',
|
||||
'lang' => $this->home_lang,
|
||||
'add_time' => getTime(),
|
||||
'update_time' => getTime(),
|
||||
]);
|
||||
$this->success('签到成功', null,['scores'=>$users_scores]);
|
||||
$this->success('签到成功', null, ['scores' => $users_scores]);
|
||||
}
|
||||
$this->error('未知错误', null);
|
||||
}
|
||||
@@ -1126,28 +1132,101 @@ class Ajax extends Base
|
||||
abort(404);
|
||||
}
|
||||
}
|
||||
//add lucky 查询项目
|
||||
public function projectsearch(){
|
||||
|
||||
|
||||
//add lucky 查询项目/应用/服务商
|
||||
public function projectsearch()
|
||||
{
|
||||
$type = intval(input('type'));
|
||||
if($type == 1){//服务商
|
||||
$item = Db::name('service')->where(['name'=>input('realname')])->find();
|
||||
}else{
|
||||
$item = Db::name('project')->where(['name'=>input('username')])->find();
|
||||
if($item){
|
||||
if(input('password') != "123123"){
|
||||
echo json_encode(array('code'=>-1,'msg'=>'项目存在,密码错误'));exit;
|
||||
}
|
||||
}else{
|
||||
echo json_encode(array('code'=>0,'msg'=>'项目不存在','name'=>input('username')));exit;
|
||||
if ($type == 1) {//服务商
|
||||
$item = Db::name('service')->where(['name' => input('realname')])->find();
|
||||
|
||||
if ($item) {
|
||||
echo json_encode(array('code' => 1, 'msg' => '操作成功', 'img' => $item['qrcode']));
|
||||
} else {
|
||||
echo json_encode(array('code' => 0, 'msg' => '不存在'));
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
// ------------------------------------------
|
||||
// ---------------- 项目/应用查询 ----------------
|
||||
// ------------------------------------------
|
||||
$keyword = input('keyword'); // 关键字
|
||||
$password = input('password'); // 获取密码
|
||||
$matchType = input('match_type', 1); // 匹配类型,默认为完全匹配
|
||||
|
||||
// 检查密码是否在数据库中
|
||||
$password_check = Db::name('project_query_password')->where(['password' => $password])->find();
|
||||
if (!$password_check) {
|
||||
echo json_encode(array('code' => -1, 'msg' => '密码无效或无权限'));
|
||||
exit;
|
||||
} else {
|
||||
// 检查关键字与应用名称是否存在匹配
|
||||
// 应用名称与关键字有几种匹配情况
|
||||
// 1. 完全匹配
|
||||
// 2. 包含匹配
|
||||
// 3. 前缀匹配
|
||||
// 4. 后缀匹配
|
||||
|
||||
// 根据匹配类型构建查询条件
|
||||
$where = [];
|
||||
switch ($matchType) {
|
||||
case 1: // 完全匹配
|
||||
$where['name'] = $keyword;
|
||||
break;
|
||||
case 2: // 包含匹配
|
||||
$where['name'] = ['like', '%' . $keyword . '%'];
|
||||
break;
|
||||
case 3: // 前缀匹配
|
||||
$where['name'] = ['like', $keyword . '%'];
|
||||
break;
|
||||
case 4: // 后缀匹配
|
||||
$where['name'] = ['like', '%' . $keyword];
|
||||
break;
|
||||
default: // 默认完全匹配
|
||||
$where['name'] = $keyword;
|
||||
}
|
||||
}
|
||||
|
||||
if($item){//用户存在
|
||||
echo json_encode(array('code'=>1,'msg'=>'操作成功','img'=>$item['qrcode']));exit;
|
||||
}else{
|
||||
echo json_encode(array('code'=>0,'msg'=>'不存在'));exit;
|
||||
}
|
||||
|
||||
// 查询匹配的应用列表
|
||||
// $item_list = Db::name('project')->where($where)->select();
|
||||
$item_list = Db::name('project')->where($where)->select();
|
||||
$count = count($item_list);
|
||||
|
||||
$infoArray = array('name' => $keyword, 'match_type' => $matchType, 'count' => $count);
|
||||
|
||||
// 如果匹配的应用列表为空
|
||||
if (empty($item_list)) {
|
||||
echo json_encode(array_merge(array('code' => -2, 'msg' => '项目/应用不存在,可以申请'), $infoArray));
|
||||
exit;
|
||||
}
|
||||
|
||||
// 从查询密码中获得允许的关键字和禁止的关键字, 都转换成数组
|
||||
// 处理空字符串情况,将其转换为空数组
|
||||
$allow_keywords = trim($password_check['allow_keywords']) === '' ? [] : explode(',', $password_check['allow_keywords']);
|
||||
$deny_keywords = trim($password_check['deny_keywords']) === '' ? [] : explode(',', $password_check['deny_keywords']);
|
||||
|
||||
// 检查关键字是否在允许列表中,或者是否在禁止列表中
|
||||
$find = true;
|
||||
if (!empty($allow_keywords) && !in_array($keyword, $allow_keywords)) {
|
||||
// echo json_encode(array('code'=>-1,'msg'=>'关键字不在允许列表中'));exit;
|
||||
$find = false;
|
||||
} elseif (!empty($deny_keywords) && in_array($keyword, $deny_keywords)) {
|
||||
// echo json_encode(array('code'=>-1,'msg'=>'关键字在禁止列表中'));exit;
|
||||
$find = false;
|
||||
}
|
||||
|
||||
// 如果找到匹配的应用
|
||||
if ($find) {
|
||||
$item = $item_list[0];
|
||||
echo json_encode(array_merge(array('code' => 1, 'msg' => '项目/应用存在', 'img' => $item['qrcode']), $infoArray));
|
||||
exit;
|
||||
} else {
|
||||
echo json_encode(array_merge(array('code' => -2, 'msg' => '项目/应用不存在,可以申请'), $infoArray));
|
||||
exit;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user