| xqd
@@ -13,6 +13,8 @@ namespace app\wap\model\special;
|
|
|
|
|
|
use basic\ModelBasic;
|
|
|
use traits\ModelTrait;
|
|
|
+use app\admin\model\study\PlanBuy;
|
|
|
+use app\admin\model\study\PlanItems;
|
|
|
|
|
|
/**专题获得
|
|
|
* Class SpecialBuy
|
| xqd
@@ -114,7 +116,15 @@ class SpecialBuy extends ModelBasic
|
|
|
public static function PaySpecial($special_id, $uid)
|
|
|
{
|
|
|
self::where(['uid' => $uid, 'special_id' => $special_id, 'is_del' => 0])->where('validity_time', ['>', 0], ['<', time()], 'and')->update(['is_del' => 1]);
|
|
|
- return self::where(['uid' => $uid, 'special_id' => $special_id, 'is_del' => 0])->count() ? true : false;
|
|
|
+ $flag = self::where(['uid' => $uid, 'special_id' => $special_id, 'is_del' => 0])->count() ? true : false;
|
|
|
+ if (!$flag) {
|
|
|
+ $join = [
|
|
|
+ ['PlanBuy pb', "pb.planid = pt.pid and pb.uid=" . $uid, 'inner']
|
|
|
+ ];
|
|
|
+ $planItems = PlanItems::alias('pt')->join($join)->where(['pt.cid'=>$special_id])->select();
|
|
|
+ $flag = $planItems ? true : false;
|
|
|
+ }
|
|
|
+ return $flag;
|
|
|
}
|
|
|
|
|
|
/**获取购买专题的有效时间
|