Parcourir la source

Process assets not just items

master
Chris Smith il y a 13 ans
Parent
révision
6b2d1728dd
4 fichiers modifiés avec 34 ajouts et 3 suppressions
  1. 2
    2
      db/evedb.class.php
  2. 14
    0
      model/asset.php
  3. 5
    0
      model/ship.php
  4. 13
    1
      www/test.php

+ 2
- 2
db/evedb.class.php Voir le fichier

1
 <?PHP
1
 <?PHP
2
 
2
 
3
+require_once(dirname(dirname(__FILE__)) . '/model/ship.php');
4
+
3
 class EveDB {
5
 class EveDB {
4
 
6
 
5
  private $pdo;
7
  private $pdo;
52
 
54
 
53
 }
55
 }
54
 
56
 
55
-class Ship {}
56
-
57
 ?>
57
 ?>

+ 14
- 0
model/asset.php Voir le fichier

1
+<?PHP
2
+
3
+ class Asset {
4
+
5
+  public $id;
6
+  public $item;
7
+  public $location;
8
+  public $quantity;
9
+  public $flag;
10
+  public $singleton;
11
+
12
+ }
13
+
14
+?>

+ 5
- 0
model/ship.php Voir le fichier

1
+<?PHP
2
+
3
+ class Ship {}
4
+
5
+?>

+ 13
- 1
www/test.php Voir le fichier

2
 
2
 
3
  require('../api/common.php');
3
  require('../api/common.php');
4
  require('../db/evedb.class.php');
4
  require('../db/evedb.class.php');
5
+ require('../model/asset.php');
5
 
6
 
6
  header('Content-type: text/plain');
7
  header('Content-type: text/plain');
7
 
8
 
11
  function getAsset($asset) {
12
  function getAsset($asset) {
12
   global $db;
13
   global $db;
13
 
14
 
14
-  $res = $db->items->getById($asset->typeID);
15
+  $res = new Asset();
16
+
17
+  $res->id = $asset->itemID;
18
+
19
+  if (isset($asset->locationID)) {
20
+   $res->location = $asset->locationID;
21
+  }
22
+
23
+  $res->quantity = $asset->quantity;
24
+  $res->flag = $asset->flag;
25
+  $res->singleton = $asset->singleton;
26
+  $res->item = $db->items->getById($asset->typeID);
15
   
27
   
16
   if (isset($asset->contents)) {
28
   if (isset($asset->contents)) {
17
    $res->contents = array();
29
    $res->contents = array();

Chargement…
Annuler
Enregistrer