1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?php
- namespace App\Models;
- /**
- * App\Models\PraiseModel
- *
- * @property int $id 主键
- * @property int $partner_id 对象ID
- * @property int $uid 用户ID
- * @property int $create_at 创建时间
- * @property int $created_at
- * @property int $updated_at 更新时间
- * @property int $type 1喜欢/0无感
- * @property int $lock 解锁进度
- * @property int $read 是否已读
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PraiseModel newModelQuery()
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PraiseModel newQuery()
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PraiseModel query()
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PraiseModel whereCreateAt($value)
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PraiseModel whereCreatedAt($value)
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PraiseModel whereId($value)
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PraiseModel whereLock($value)
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PraiseModel wherePartnerId($value)
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PraiseModel whereRead($value)
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PraiseModel whereType($value)
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PraiseModel whereUid($value)
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PraiseModel whereUpdatedAt($value)
- * @mixin \Eloquent
- */
- class PraiseModel extends Model
- {
- protected $table = 'kdgx_partner_charge_praise';
- protected $dateFormat = 'U';
- public $timestamps = false;
- protected $fillable = ['id', 'partner_id', 'uid', 'create_at', 'type', 'created_at', 'updated_at', 'lock', 'read'];
- public function isLike(int $uid, int $partnerId): bool
- {
- $praise = $this->where([
- array('uid', $uid), array('partner_id', $partnerId)
- ])->first();
- if ($praise && 1 == $praise->type) {
- return true;
- } else {
- return false;
- }
- }
- }
|