|
@@ -66,103 +66,14 @@ class BookService
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
- public static function getBookStatistics($smart_push_books)
|
|
|
|
- {
|
|
|
|
- // 获取书籍统计数据
|
|
|
|
- if (!empty($smart_push_books)) {
|
|
|
|
- foreach ($smart_push_books as $key => $smart_push_book) {
|
|
|
|
- $book_statistics = WapVisitStatService::smartPushTestBookStats($smart_push_book->bid);
|
|
|
|
- $smart_push_books[$key]->uv = $book_statistics['uv'];
|
|
|
|
- $smart_push_books[$key]->pv = $book_statistics['pv'];
|
|
|
|
- $smart_push_books[$key]->charge_amount = $book_statistics['charge_amount'];
|
|
|
|
- $smart_push_books[$key]->charge_user_num = $book_statistics['charge_user_num'];
|
|
|
|
- $smart_push_books[$key]->book_amount = $book_statistics['book_amount'];
|
|
|
|
- $smart_push_books[$key]->book_user_num = $book_statistics['book_user_num'];
|
|
|
|
- $smart_push_books[$key]->real_push_user_num = $book_statistics['real_push_user_num'];
|
|
|
|
- $smart_push_books[$key]->second_chapter_uv = $book_statistics['second_chapter_uv'];
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return $smart_push_books;
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
|
|
public static function getBookById($bid)
|
|
public static function getBookById($bid)
|
|
{
|
|
{
|
|
return Book::find($bid);
|
|
return Book::find($bid);
|
|
}
|
|
}
|
|
|
|
|
|
- public static function newYunQiBook($bid)
|
|
|
|
- {
|
|
|
|
- $old = DB::table('book_yunqi')->where('yq_bid', $bid)->where('type', 'NEW_YUNQI')->first();
|
|
|
|
- if ($old) {
|
|
|
|
- return -1;
|
|
|
|
- }
|
|
|
|
- $new_yunqi_book = DB::connection('new_yunqi')
|
|
|
|
- ->table('books')
|
|
|
|
- ->join('book_configs', 'books.id', '=', 'book_configs.bid')
|
|
|
|
- ->select(
|
|
|
|
- 'books.id',
|
|
|
|
- 'books.author',
|
|
|
|
- 'books.author',
|
|
|
|
- 'books.intro',
|
|
|
|
- 'books.category_name',
|
|
|
|
- 'books.keyword',
|
|
|
|
- 'books.status',
|
|
|
|
- 'books.chapter_count',
|
|
|
|
- 'books.size',
|
|
|
|
- 'books.last_chapter',
|
|
|
|
- 'book_configs.book_name as name',
|
|
|
|
- 'book_configs.cover',
|
|
|
|
- 'book_configs.force_subscribe_chapter_seq',
|
|
|
|
- 'book_configs.charge_type',
|
|
|
|
- 'book_configs.roles'
|
|
|
|
- )
|
|
|
|
- ->where('books.id', $bid)
|
|
|
|
- ->first();
|
|
|
|
- if (!$new_yunqi_book) {
|
|
|
|
- return -2;
|
|
|
|
- }
|
|
|
|
|
|
|
|
- $book = Book::create(
|
|
|
|
- [
|
|
|
|
- 'ly_bid' => 0, 'name' => $new_yunqi_book->name, 'author' => $new_yunqi_book->author, 'intro' => $new_yunqi_book->intro, 'cover' => $new_yunqi_book->cover,
|
|
|
|
- 'category_name' => $new_yunqi_book->category_name, 'keyword' => $new_yunqi_book->keyword, 'category_id' => 0, 'status' => $new_yunqi_book->status,
|
|
|
|
- 'chapter_count' => $new_yunqi_book->chapter_count, 'first_cid' => 0, 'last_cid' => 0, 'size' => $new_yunqi_book->size, 'last_chapter' => $new_yunqi_book->last_chapter,
|
|
|
|
- 'sequence' => 0, 'yq_bid' => $bid
|
|
|
|
- ]
|
|
|
|
- );
|
|
|
|
- DB::table('book_yunqi')->insert([
|
|
|
|
- 'bid' => $book->id,
|
|
|
|
- 'yq_bid' => $bid,
|
|
|
|
- 'type' => 'NEW_YUNQI',
|
|
|
|
- 'created_at' => date('Y-m-d H:i:s'),
|
|
|
|
- 'updated_at' => date('Y-m-d H:i:s')
|
|
|
|
- ]);
|
|
|
|
- for ($i = 1; $i <= $new_yunqi_book->chapter_count; $i++) {
|
|
|
|
- $temp = DB::connection('new_yunqi')->table('chapters')->where('bid', $bid)->where('sequence', $i)->select('name', 'content', 'is_vip', 'size')->first();
|
|
|
|
- if ($temp) {
|
|
|
|
- Chapter::create([
|
|
|
|
- 'bid' => $book->id,
|
|
|
|
- 'name' => $temp->name,
|
|
|
|
- 'sequence' => $i,
|
|
|
|
- 'is_vip' => $temp->is_vip,
|
|
|
|
- 'size' => $temp->size,
|
|
|
|
- 'prev_cid' => 0,
|
|
|
|
- 'next_cid' => 0,
|
|
|
|
- 'recent_update_at' => date('Y-m-d H:i:s'),
|
|
|
|
- 'content' => $temp->content,
|
|
|
|
- 'ly_chapter_id' => 0
|
|
|
|
- ]);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- \Artisan::call('book:afs', ['bid' => [$book->id]]);
|
|
|
|
- DB::table('book_configs')->where('bid', $book->id)->update([
|
|
|
|
- 'force_subscribe_chapter_seq' => $new_yunqi_book->force_subscribe_chapter_seq,
|
|
|
|
- 'roles' => $new_yunqi_book->roles,
|
|
|
|
- 'charge_type' => $new_yunqi_book->charge_type,
|
|
|
|
- 'cp_source' => 'new_yunqi'
|
|
|
|
- ]);
|
|
|
|
- return 0;
|
|
|
|
- }
|
|
|
|
|
|
|
|
public static function getPrice($book_info,$distribution_channel_id,$size,$account=''){
|
|
public static function getPrice($book_info,$distribution_channel_id,$size,$account=''){
|
|
// 书默认--- 收费类型
|
|
// 书默认--- 收费类型
|