1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?php
- namespace App\Models;
- use Illuminate\Database\Eloquent\Factories\HasFactory;
- use Illuminate\Database\Eloquent\Model;
- class UserShareRecord extends Model
- {
- use HasFactory;
- protected $table = 'user_share_record';
- public $timestamps = false;
- protected static $unguarded = true;
- /**
- * 分享基础信息保存
- * */
- public static function saveInfo($userId, $ids, $type)
- {
- $shareModel = new self;
- $shareModel->user_id = $userId;
- $shareModel->type = $type;
- $shareModel->interest_ids = $ids;
- $result = $shareModel->save();
- return $result ? $shareModel->id : 0;
- }
- /**
- * 获取分享基础信息
- * */
- public static function getShareInfo($userId, $shareId)
- {
- return self::select('id', 'type', 'interest_ids')
- ->where('enable', 1)->where('user_id', $userId)
- ->where('id', $shareId)->first();
- }
- }
|