1
0
mirror of https://github.com/nerzhul/ocsms.git synced 2025-07-23 18:05:33 +00:00

Testing pushing test datas

This commit is contained in:
Loïc Blot (@U-Exp) 2014-09-12 14:38:13 +02:00
parent 07261636e6
commit 129e627cb0
3 changed files with 45 additions and 2 deletions

View File

@ -37,7 +37,10 @@ class SmsController extends Controller {
/**
* @NoAdminRequired
*/
public function push($json_datas) {
public function push($smsCount, $smsDatas) {
if ($smsCount != count($smsDatas)) {
return "ERROR";
}
return array("test" => "test2");
}

40
db/SmsObject.php Normal file
View File

@ -0,0 +1,40 @@
<?php
/**
* ownCloud - ocsms
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Loic Blot <loic.blot@unix-experience.fr>
* @copyright Loic Blot 2014
*/
namespace OCA\OcSms\Db;
use \OCP\IDb;
class Sms {
private $db;
public function __construct(IDb $db) {
$this->db = $db;
}
// @TODO
public function saveAll() {
}
public function find($id) {
$sql = 'SELECT * FROM `*PREFIX*myapp_authors` ' .
'WHERE `id` = ?';
$query = $db->prepareQuery($sql);
$query->bindParam(1, $id, \PDO::PARAM_INT);
$result = $query->execute();
while($row = $result->fetchRow()) {
return $row;
}
}
}
?>

View File

@ -11,7 +11,7 @@
(function ($, OC) {
$(document).ready(function () {
$('#echo').click(function () {
$('#push').click(function () {
var url = OC.generateUrl('/apps/ocsms/push');
var data = {
sms_count: 1,