add registerAction
This commit is contained in:
parent
9d94997134
commit
6edf44671e
|
|
@ -36,13 +36,13 @@ exports.model = {
|
|||
},
|
||||
mysql: {
|
||||
handle: mysql,
|
||||
database: '',
|
||||
prefix: 'think_',
|
||||
database: 'mybookmarks',
|
||||
prefix: '',
|
||||
encoding: 'utf8',
|
||||
host: '127.0.0.1',
|
||||
port: '',
|
||||
port: '3306',
|
||||
user: 'root',
|
||||
password: 'root',
|
||||
password: '123456',
|
||||
dateStrings: true
|
||||
}
|
||||
};
|
||||
|
|
@ -55,7 +55,7 @@ exports.session = {
|
|||
type: 'file',
|
||||
common: {
|
||||
cookie: {
|
||||
name: 'thinkjs'
|
||||
name: 'mybookmark'
|
||||
// keys: ['werwer', 'werwer'],
|
||||
// signed: true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
const Base = require('./base.js');
|
||||
|
||||
module.exports = class extends Base {
|
||||
indexAction() {
|
||||
return this.display();
|
||||
}
|
||||
|
||||
async registerAction() {
|
||||
try {
|
||||
let data = this.post();
|
||||
let res = await this.model("users").add(data);
|
||||
this.json({ code: 0, data: res, msg: "注册成功" });
|
||||
} catch (error) {
|
||||
this.json({ code: 1, data: '', msg: error.toString() });
|
||||
}
|
||||
}
|
||||
|
||||
autoLoginAction() {
|
||||
this.json({ "succ": true });
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
module.exports = class extends think.Logic {
|
||||
indexAction() {
|
||||
|
||||
}
|
||||
};
|
||||
|
|
@ -42,9 +42,7 @@ app.factory('bookmarkService', ['$http', '$q', function ($http, $q) {
|
|||
},
|
||||
register: function (params) {
|
||||
var def = $q.defer();
|
||||
$http.post('/api/register/', {
|
||||
params: params
|
||||
})
|
||||
$http.post('/api/register/', params)
|
||||
.success(function (data) {
|
||||
def.resolve(data);
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue