bug修复

This commit is contained in:
2018-04-05 12:29:02 +08:00
parent 76ccce0d45
commit 009bf0b259
8 changed files with 85 additions and 24 deletions

View File

@@ -122,7 +122,7 @@ class Ad extends Admin {
if ($this->request->isPost()) {
$result = $ad->change();
if ($result) {
return $this->success("添加成功!", url('admin/ad/lists', array('id' => $this->param['place_id'])));
return $this->success("添加成功!", url('admin/ad/lists', array('id' => $this->request->param('place_id')))));
} else {
return $this->error($ad->getError());
}
@@ -143,7 +143,7 @@ class Ad extends Admin {
if ($this->request->isPost()) {
$result = $ad->change();
if ($result) {
return $this->success("修改成功!", url('admin/ad/lists', array('id' => $this->param['place_id'])));
return $this->success("修改成功!", url('admin/ad/lists', array('id' => $this->param('place_id'))));
} else {
return $this->error($ad->getError());
}

View File

@@ -69,7 +69,7 @@ class Attribute extends Admin {
*/
public function add($model_id = '') {
if ($this->request->isPost()) {
$result = $this->model->validate('attribute.add')->save($this->param);
$result = $this->model->validate('attribute.add')->save($this->request->param());
if (false !== $result) {
return $this->success("创建成功!", url('Attribute/index', array('model_id' => $model_id)));
} else {
@@ -92,7 +92,7 @@ class Attribute extends Admin {
*/
public function edit($id = '', $model_id = '') {
if ($this->request->isPost()) {
$result = $this->model->validate('attribute.edit')->save($this->param, array('id'=>$id));
$result = $this->model->validate('attribute.edit')->save($this->request->param(), array('id'=>$id));
if ($result) {
return $this->success("修改成功!", url('Attribute/index', array('model_id' => $model_id)));
} else {

View File

@@ -102,7 +102,7 @@ class Content extends Admin {
*/
public function edit($id) {
if ($this->request->isPost()) {
$result = $this->model->save($this->param, array('id'=> $id));
$result = $this->model->save($this->request->param(), array('id'=> $id));
if ($result !== false) {
//记录行为
action_log('update_content', 'content', $result, session('auth_user.uid'));
@@ -139,7 +139,8 @@ class Content extends Admin {
* @author molong <ycgpp@126.com>
*/
public function del() {
$id = $this->getArrayParam('id');
$param = $this->request->param();
$id = $param['id'];
if (empty($id)) {
return $this->error("非法操作!");
}

View File

@@ -195,8 +195,10 @@ class Form extends Admin {
}
public function editattr(\think\Request $request){
$form_id = isset($this->param['form_id']) ? $this->param['form_id'] : '';
$id = isset($this->param['id']) ? $this->param['id'] : '';
$param = $this->request->param();
$form_id = isset($param['form_id']) ? $param['form_id'] : '';
$id = isset($param['id']) ? $param['id'] : '';
if (!$form_id || !$id) {
return $this->error('非法操作!');
}
@@ -221,7 +223,7 @@ class Form extends Admin {
}
public function delattr(\think\Request $request){
$id = isset($this->param['id']) ? $this->param['id'] : 0;
$id = isset($request->param('id')) ? $request->param('id') : 0;
if (!$id) {
return $this->error('非法操作!');
}

View File

@@ -56,7 +56,7 @@
{volist name="list" id="item"}
<tr>
<td>
{if $item['avatar_url']}
{if isset($item['avatar_url']) && $item['avatar_url']}
<img src="{$item['avatar_url']}" alt="{$item['nickname']}"/>
{else/}
<img src="{:avatar($item['uid'])}" alt="{$item['nickname']}"/>

View File

@@ -1,12 +1,26 @@
<?php
namespace app\api\controller;
class Index extends \app\common\controller\Api {
class Index extends \app\common\controller\Api{
public $mustToken = true;
public $mustToken = false;
public function usercount(){
$this->data['data'] = array('team_num'=>100,'coustomer_num'=>10000);
return $this->data;
}
public function getlive(){
$fp = fopen(ROOT_PATH . DS . 'live.txt', 'r');
$info = fread($fp, filesize(ROOT_PATH . DS . 'live.txt'));
fclose($fp);
$res = explode("\n", $info);
foreach ($res as $value) {
$val = explode(",", $value);
$data[] = array('name'=>$val[0],'src'=>$val[1]);
}
$this->data['data'] = $data;
return $this->data;
}
}

View File

@@ -0,0 +1,39 @@
<?php
namespace app\api\controller;
class Login extends \app\common\controller\Api{
public function index(){
$username = $this->request->param('username', '');
$password = $this->request->param('password', '');
if (!$username || !$password) {
$this->data['code'] = 1;
$this->data['msg'] = "账号密码不能为空!";
return $this->data;
}
$user = db('Member')->where('username', $username)->find();
if ($user && $user['status'] == 1) {
if ($user['password'] == md5($password . $user['salt'])) {
$info['access_token'] = authcode($user['uid'].'|'.$user['username'].'|'.$user['password'], 'ENCODE');
$info['uid'] = $user['uid'];
$info['username'] = $user['username'];
$info['avatar'] = (isset($user['avatar_url']) && $user['avatar_url']) ? $user['avatar_url'] : avatar($user['uid']);
$this->data['data'] = $info;
return $this->data;
}else{
$this->data['code'] = 1;
$this->data['msg'] = "密码错误!";
return $this->data;
}
}else{
$this->data['code'] = 1;
$this->data['msg'] = "无此账户或账户被禁用!";
return $this->data;
}
}
}

View File

@@ -30,19 +30,24 @@ class Wechat extends \app\common\controller\Api{
$info = $app->auth->session($param['jsCode']);
//查询用户是否已添加
$user = db('Member')->where('openid', $info['openid'])->find();
if (!$user) {
$other = array(
'avatar_url' => $param['avatar'],
);
$user = model('Member')->register($param['nickname'], $param['openid'], $param['openid'], $param['openid'].'@wx.com', false, $other);
if (isset($info['openid']) && $info['openid']) {
//查询用户是否已添加
$user = db('Member')->where('openid', $info['openid'])->find();
if (!$user) {
$other = array(
'avatar_url' => $param['avatar'],
);
$user = model('Member')->register($param['nickname'], $param['openid'], $param['openid'], $param['openid'].'@wx.com', false, $other);
}
$info['access_token'] = authcode($user['uid'].'|'.$user['username'].'|'.$user['password'], 'ENCODE');
$info['uid'] = $user['uid'];
$this->data['data'] = $info;
}else{
$this->data['code'] = 1;
$this->data['msg'] = '非法操作!';
}
$info['access_token'] = authcode($user['uid'].'|'.$user['username'].'|'.$user['password'], 'ENCODE');
$info['uid'] = $user['uid'];
$this->data['data'] = $info;
return json($this->data);
}