コード例 #1
0
ファイル: GoodsCommentModel.php プロジェクト: noikiy/php
 public static function getSomeComment($goodsId, $nextId, $size)
 {
     if (empty($goodsId) || $size <= 0) {
         return array();
     }
     $nextId = (int) $nextId;
     if ($nextId > 0) {
         $ret = DB::getDB()->fetchSome('g_goods_comment', '*', array('goods_id', 'state', 'id<'), array($goodsId, self::COMMENT_ST_VALID, $nextId), array('and', 'and'), array('id'), array('desc'), array($size));
     } else {
         $ret = DB::getDB()->fetchSome('g_goods_comment', '*', array('goods_id', 'state'), array($goodsId, self::COMMENT_ST_VALID), array('and'), array('id'), array('desc'), array($size));
     }
     if (empty($ret)) {
         return array();
     }
     foreach ($ret as &$item) {
         $item['nickname'] = Util::emojiDecode($item['nickname']);
         $item['content'] = Util::emojiDecode($item['content']);
         $item['kf_reply'] = Util::emojiDecode($item['kf_reply']);
     }
     return empty($ret) ? array() : $ret;
 }
コード例 #2
0
ファイル: UserModel.php プロジェクト: noikiy/php
 public static function findUserByPhone($phone, $fromDb = 'w')
 {
     if (empty($phone)) {
         return array();
     }
     $ck = Cache::CK_USER_INFO_FOR_PHONE . $phone;
     $ret = Cache::get($ck);
     if ($ret !== false) {
         $ret = json_decode($ret, true);
     } else {
         $ret = DB::getDB($fromDb)->fetchOne('u_user', '*', array('phone'), array($phone));
         if ($ret !== false) {
             Cache::set($ck, json_encode($ret));
         }
     }
     if (empty($ret)) {
         return array();
     }
     $ret['nickname'] = Util::emojiDecode($ret['nickname']);
     return $ret;
 }
コード例 #3
0
ファイル: WxUserModel.php プロジェクト: noikiy/php
 public static function findUserByOpenId($openid, $fromDb = 'w')
 {
     if (empty($openid)) {
         return array();
     }
     $ck = Cache::CK_WX_USER_INFO . $openid;
     $ret = Cache::get($ck);
     if ($ret !== false) {
         $ret = json_decode($ret, true);
     } else {
         $ret = DB::getDB($fromDb)->fetchOne('u_wx_user', '*', array('openid'), array($openid));
         if ($ret !== false) {
             Cache::set($ck, json_encode($ret));
         }
     }
     if (empty($ret)) {
         return array();
     }
     $ret['nickname'] = Util::emojiDecode($ret['nickname']);
     return $ret;
 }