Ejemplo n.º 1
0
 /**
  * 结算收入
  *   
  * @param $params
  *    require   u      -- uid
  * @return 
  *    s   -- ok
  */
 public function checkout($params)
 {
     $uid = $params['u'];
     $db = ServerConfig::getdb_by_userid($uid);
     $ug = ModelFactory::UserGood();
     $ua = ModelFactory::UserAccount($db);
     $ret['s'] = 'ok';
     return $ret;
 }
Ejemplo n.º 2
0
 /**
  * 获取所有或部分goods
  * @param $params
  *  require    u      -- userid
  * @return 物品列表,id 为下标
  *   s   OK,others fail
  *   g   goods
  */
 public function get_goods($params)
 {
     $uid = $params['u'];
     $goods = ModelFactory::UserGood();
     $ret['s'] = 'ok';
     $ret['g'] = $goods->get($uid);
     return $ret;
 }
Ejemplo n.º 3
0
 /**
  *  收货物
  * @param $params
  * require  u  -- user_id
  * require  c  -- car be unlold
  * require  g  -- the goods to be unload
  * @return unknown_type
  * s   -- ok
  * c   -- car status
  * t   -- current time
  */
 public function get_goods($params)
 {
     //todo:添加购买验证逻辑
     //购买多个支持
     $uid = $params['u'];
     $car = ModelFactory::UserCar();
     $goods = ModelFactory::UserGood();
     $car->put_super($params['c'], $uid);
     $goods->put_super($params['g'], $uid);
     $ret['s'] = 'ok';
     $ret['t'] = time();
     return $ret;
 }