示例#1
0
文件: mysql.php 项目: uning/mall-back
function test_present(&$db)
{
    $now = time();
    $present = ModelFactory::Present($db);
    $now = time();
    $data = array('user_id' => 1, 'donor_id' => 2, 'message' => 'wahaha', 'item_id' => 3, 'done' => 0, 'created_at' => date(TM_FORMAT, $now));
    $present->insert($data);
}
示例#2
0
 /**
  * 接受礼物赠送
  * @param $params
  *   require  u         -- 受礼人id
  *            f         -- 送礼人id
  *            tag       -- 礼物种类
  * @return 
  *            s         --  OK
  */
 public function accept_gift($params)
 {
     $uid = $params['u'];
     $fid = $params['f'];
     $xid = $params['xid'];
     $msg = $params['msg'];
     if (0) {
         //验证xml中是否存在此物品
     }
     $db = ServerConfig::connect_main_mysql(0);
     $present = ModelFactory::Present($db);
     $gift = $present->findByIDs($uid, $fid, $xid);
     //验证逻辑
     if (!$gift) {
         $ret['s'] = 'notexsit';
         return $ret;
     }
     $tm = new TTMain();
     $gift_obj['tag'] = $gift['item_id'];
     $tm->put($gift_obj, $uid, TT::ITEM_GROUP);
     $ret['s'] = 'OK';
     return $ret;
 }