1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- /**
- * @copyright Copyright (c) 2017 https://www.sapixx.com All rights reserved.
- * @license Licensed (http://www.apache.org/licenses/LICENSE-2.0).
- * @author pillar<ltmn@qq.com>
- * 分享记录
- */
- namespace app\ais\model;
- use think\Model;
- use app\common\model\SystemUser;
- use think\helper\Time;
- use filter\Filter;
- class AisInfoShare extends Model{
- protected $pk = 'id';
- /**
- * 判断分享记录如果合规发红包
- * @return void
- */
- public function redRocket(array $param,$ucode = null){
- if(empty($ucode)){
- return;
- }
- if ($param['paid_at'] <= 0 || $param['task_money'] <= 0) {
- return;
- }
- $uid = SystemUser::isInvite(Filter::filter_escape($ucode));
- if(empty($uid)){
- return;
- }
- list($start,$end) = Time::today();
- $condition[] = ['info_id','=',$param['id']];
- $condition[] = ['times','>',$start];
- $condition[] = ['uid','=',$uid];
- $rel = self::where($condition)->find();
- if($rel){
- return self::where(['info_id'=> $param['id']])->setInc('views',1);
- }else{
- $data['uid'] = $uid;
- $data['info_id'] = $param['id'];
- $data['views'] = 1;
- $data['times'] = time();
- return self::insert($data);
- }
- }
-
- /**
- * 发红包
- * @return void
- */
- public function postRedRocket(array $param,$ucode = null){
-
- }
- }
|