|
@@ -489,7 +489,28 @@ class ReadRecordService
|
|
|
*/
|
|
|
public static function addReadLog(int $uid, array $data)
|
|
|
{
|
|
|
- $log = ReadLog::model($uid);
|
|
|
- $log->create($data);
|
|
|
+ //$log = ReadLog::model($uid);
|
|
|
+ //$log->create($data);
|
|
|
+ //启用redis 记录阅读记录,不直接插入数据库
|
|
|
+ self::addRecord($uid,$data['bid'],$data['cid'],$data['distribution_channel_id'],$data['send_order_id'],'',$data['sequence']);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 使用redis队列记录阅读记录
|
|
|
+ * @param [type] $uid [用户id]
|
|
|
+ * @param [type] $bid [书籍id]
|
|
|
+ * @param [type] $cid [章节id]
|
|
|
+ * @param [type] $distribution_channel_id [分销用户id]
|
|
|
+ * @param [type] $send_order_id [派单id]
|
|
|
+ * @param [type] $from []
|
|
|
+ * @param [type] $sequence [当前章节]
|
|
|
+ * @return [type] [description]
|
|
|
+ */
|
|
|
+ public static function addRecord($uid,$bid,$cid,$distribution_channel_id,$send_order_id,$from,$sequence){
|
|
|
+ $data = compact('uid', 'bid','cid','distribution_channel_id','send_order_id','from','sequence');
|
|
|
+ $data['created_at'] = $data['updated_at'] = date('Y-m-d H:i:s');
|
|
|
+ $data['attach'] = '';
|
|
|
+ try{
|
|
|
+ Redis::lpush('QappReadRecordPersistence',json_encode($data));
|
|
|
+ }catch (\Exception $e){}
|
|
|
}
|
|
|
}
|