|
@@ -1,14 +1,11 @@
|
|
|
<?php namespace App\Models;
|
|
|
|
|
|
-use App\Facades\Servers\Redis\Redis;
|
|
|
-use App\Facades\Servers\Redis\RedisLock;
|
|
|
-use App\Models\Traits\Coupon\GrantType;
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
use Illuminate\Support\Carbon;
|
|
|
|
|
|
/**
|
|
|
- * 优惠券模型
|
|
|
+ * 内容分享模型
|
|
|
*
|
|
|
*/
|
|
|
class Article extends Model
|
|
@@ -73,38 +70,8 @@ class Article extends Model
|
|
|
return 'klyhq'. str_pad($id, 9, '0', STR_PAD_LEFT);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- /**
|
|
|
- * 优惠券过期时间
|
|
|
- *
|
|
|
- * @param int $expTime 过期时间
|
|
|
- *
|
|
|
- */
|
|
|
- public function getExpTime($expTime){
|
|
|
- // 如果存在过期时间,且小于1000,表示这是一个领取后n天的,按天数返回
|
|
|
- if ( $expTime && $expTime < 1000 ) return Carbon::now()->addDays($expTime)->endOfDay()->getTimestamp();
|
|
|
- // 返回时间戳
|
|
|
- return $expTime;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 过期状态设置
|
|
|
- *
|
|
|
- */
|
|
|
- // public function setStatusByExpire(){
|
|
|
- // // 上锁
|
|
|
- // if(RedisLock::lock('coupon::set::status::by::expire',1,30)){
|
|
|
- // // 修改
|
|
|
- // $result = $this->query()->where([['status','=',0],['end_time','>',0],['end_time','<=',time()]])->update(['status'=>3,'update_time'=>time()]);
|
|
|
- // // 不管成功失败,都解锁
|
|
|
- // RedisLock::unlock('coupon::set::status::by::expire',1);
|
|
|
- // // 返回结果
|
|
|
- // return $result;
|
|
|
- // }
|
|
|
- // }
|
|
|
-
|
|
|
/**
|
|
|
- * 获取优惠券信息
|
|
|
+ * 获取单个信息
|
|
|
*
|
|
|
*/
|
|
|
public function getOne($id,$field=''){
|