| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- /**
- * Created by PhpStorm.
- * User: Lenovo
- * Date: 2019/1/19
- * Time: 20:24
- */
- namespace App\Models;
- use Illuminate\Support\Facades\Log;
- use DB;
- class SystemRed extends BaseModel
- {
- protected $table = "system_red";
- public $timestamps = false;
- public function addSystemRed($data)
- {
- return $this->insert($data);
- }
- public function updateSystemRed($where,$data)
- {
- return $this->where($where)->update($data);
- }
- public function getSystemRedOne($where)
- {
- return $this->where($where)->first();
- }
- function getAll()
- {
- if(empty($list))
- {
- $list = 10;
- }
- $data = DB::table('system_red AS sr')
- ->select('sr.id','sr.red_num','sr.red_money','sr.status','sr.username','cr.room_name')
- ->leftJoin('chat_rooms AS cr','sr.room_id','=','cr.id')
- ->orderBy('sr.id','desc')
- ->paginate($list);
- if(!$data){
- return -5040000522;//没有数据
- }
- return $data->toArray();
- }
- public function checkRoom($room_id)
- {
- return $this->where("room_id",$room_id)->first();
- }
- }
|