123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <?php
- namespace app\admin\model;
- use support\Model;
- /**
- * 会员智能设备消息推送日志模型
- * Class Users
- * @package app\admin\model
- */
- class IntelligenceLog extends Model
- {
- /**
- * The table associated with the model.
- *
- * @var string
- */
- protected $table = 'user_intelligence_equipment_log';
- public $timestamps = false;
- /**
- * Notes:会员智能设备数据查询
- * @return int
- * User: ZQ
- * Date: 2022/9/19
- */
- public static function equipmentLogList(int $page,int $limit,$log_user_id, $log_equipment_id)
- {
- $list = static::select()
- ->when($log_user_id != '', function ($query) use ($log_user_id){
- $query->where('log_user_id', $log_user_id);
- })
- ->when($log_equipment_id != '', function ($query) use ($log_equipment_id){
- $query->where('log_equipment_id', $log_equipment_id);
- })
- ->forPage($page, $limit)
- ->orderBy('log_create_time','DESC')
- ->get();
- $count = static::select()
- ->when($log_user_id != '', function ($query) use ($log_user_id){
- $query->where('log_user_id', $log_user_id);
- })
- ->when($log_equipment_id != '', function ($query) use ($log_equipment_id){
- $query->where('log_equipment_id', $log_equipment_id);
- })
- ->count();
- return [$list,$count];
- }
- /**
- * Notes:会员智能设备数据详情
- * @return int
- * User: ZQ
- * Date: 2022/9/23
- */
- public static function logInfor(array $where)
- {
- return static::where($where)->first();
- }
- /**
- * Notes:智能设备数据插入
- * @return int
- * User: ZQ
- * Date: 2022/9/19
- */
- public static function logInsert($data)
- {
- $id = static::insertGetId($data);
- return $id;
- }
- }
|